Skip to content

/cairn-direction

Spec-tightener + subagent dispatcher. Engage on code-change asks — verbs, bug reports, observations. Pivot-aware on active tasks.

shell
$ npx -y skills add isaacriehm/cairn --skill cairn-direction --agent claude-code

How it fires

How this skill gets triggered: by you, by Claude, or both.

  • Fires itselfAuto-invocation. Claude auto-loads it when your prompt matches the work.
  • You can call itInvoke it directly when you want it.
  • Slash command/cairn-direction
How auto-invocation works

Context preview

The summary Claude sees to decide when to auto-load this skill.

Spec-tightener + subagent dispatcher. Engage on code-change asks — verbs, bug reports, observations. Pivot-aware on active tasks.

SKILL.md

cairn-direction.SKILL.md
name: cairn-direction
description: Spec-tightener + subagent dispatcher. Engage on code-change asks — verbs, bug reports, observations. Pivot-aware on active tasks.
when_to_use: |
  Engage when operator's message implies code change. Triggers:
    - Task verbs (build, add, fix, refactor, implement, remove, …)
    - Bug reports + symptom observations
    - Modal-verb requests (should, must)
    - Mission continuation tokens ("continue", "go", "next") +
      autonomy phrases ("autonomously", "until ctx", "don't pause")
  Bug reports + observations ARE tasks.

  Skip ONLY:
    - Pure info question with no active mission to continue
    - Operator opted out ("skip cairn", "just do it")
    - Trivial fully-specified edit ("rename foo to bar at f.ts:42")

  Active-task case → Step 0.5 (pivot detection), not skip.

Skill: cairn-direction

Host portability

This skill is shared by Claude Code, Cursor, and Codex. Resolve Cairn MCP tools with the host's native discovery mechanism. `AskUserQuestion` means the host's structured question UI; if unavailable, ask the same concise A/B/C question in chat and pause. Dispatch plans use the host's native subagent tool. When a named Cairn role is required, read its brief under `../../agents/` and pass that brief to the native subagent; execute inline only when the host has no subagent capability.

Convert loose operator prompts into tightened specs + dispatched work. Long-form playbooks live in `docs/PLUGIN_ARCHITECTURE.md` §11 (rejection capture, pivot, mission scope, dispatch block, autonomous continuation) and §14 (question quality). This file is the entry-point summary.

Step 0 — preload deferred tools (REQUIRED FIRST)

Preload only the WRITE + judgment tools. The read-only context tools (`cairn_in_scope`, `cairn_canonical_for_topic`, `cairn_components_in_scope`, `cairn_component_get`, `cairn_mission_get`, `cairn_search`) are no longer preloaded — the server now injects your frame for you:

  • **SessionStart / UserPromptSubmit** inject the working-context header:

active task, mission + phase, and the in-scope DEC/INV id index.

  • **PostToolUse(Read)** injects the DEC/INV bodies + the component slice

bound to files as you open them (each once per session).

Load any of those read tools on demand only — when you need a body the header didn't carry, or a mission field the header omitted.

ToolSearch(select:mcp__plugin_cairn_cairn__cairn_task_create,mcp__plugin_cairn_cairn__cairn_task_complete,mcp__plugin_cairn_cairn__cairn_task_journal_append,mcp__plugin_cairn_cairn__cairn_record_decision,mcp__plugin_cairn_cairn__cairn_component_annotate,mcp__plugin_cairn_cairn__cairn_mission_start,mcp__plugin_cairn_cairn__cairn_mission_accept_draft,mcp__plugin_cairn_cairn__cairn_mission_plan_phase,mcp__plugin_cairn_cairn__cairn_mission_advance,mcp__plugin_cairn_cairn__cairn_mission_set_exit_gate,AskUserQuestion)

`cairn_task_journal_append` is preloaded because you call it every turn (see Hard rules) — without preloading it the first call fails with an input-schema error and you waste a turn re-discovering it.

`AskUserQuestion` is deferred — without preload you fall back to inline prose and break the structured-answer contract.

Step 0.4 — operator-rejection capture

Operator rejects prior work ("bad", "don't like", "stop using", "wrong") → capture as a DEC BEFORE the local fix. Extract regex

  • globs + rationale →

`cairn_record_decision({..., assertions: [{kind: "text_must_not_match", pattern, in_globs}]})` — omit `target`; it auto-accepts into the ledger by default (verify-then-accept; the built-in dedup gate routes a near-duplicate to an `_inbox/` draft). Read the result's `auto_accepted`: if true surface ``Captured rejection → `DEC-<id>` accepted.``; else ``Captured rejection → draft `DEC-<id>` queued for review.`` Full playbook: `docs/PLUGIN_ARCHITECTURE.md` §11.

Step 0.5 — pivot detection (active-task path)

`ls .cairn/tasks/active/` empty → Step 0.7.

**Cold-resume.** Continuation token AND `journal.jsonl` has entries from a different `session_id` → `cairn_resume({task_id})`, read `files_touched` (cap 8, most-recent-first, parallel), read `spec.tightened.md`, resume from `next_step`.

Otherwise compare prompt to active title + goal:

  • **Same subject** → continue inline, no `cairn_task_create`.
  • **Diverging** → `AskUserQuestion`: `[a]` complete first,

`[b]` abort + pivot, `[c]` fold as sub-task. Detail: `docs/PLUGIN_ARCHITECTURE.md` §11.

Step 0.7 — mission scope detection (no active mission)

`cairn_mission_get({})`. `active: true` → skip (Step 2.5 anchors).

`active: false` → **always run the complexity check** — this is not opt-in. Cairn proposes a mission whenever the work is too big for one task; the operator never has to ask for it.

**Strong triggers (ANY one fires the prompt):**

  • Enumerated phases / steps ("first … then …", a numbered list of

deliverables).

  • Scope phrasing — "build the whole / entire X", "redesign Y

end-to-end", "rewrite Z", "from scratch".

  • The prompt points at a spec/planning doc (a `.md` path, a pasted

PRD, >300 words with 2+ H2/H3 sections).

**Weak signals (2+ together fire the prompt):** 3+ distinct task verbs; 3+ feature nouns from different areas/modules; cross-cutting work spanning 3+ modules; an estimate the work needs multiple sittings.

When nothing fires, proceed as a single task — but if you are about to create a task whose `goal` spans 3+ modules or whose acceptance has 4+ independent bullets, stop and run this check first.

Trigger → `AskUserQuestion`: `[a]` mission (recommended for the listed scope), `[b]` single task. On `[a]`: write prompt to `.cairn/missions/_drafts/<slug>.md` → `cairn_mission_start({spec_path, exit_gate: "prompt"})` → surface phases via second `AskUserQuestion` → `cairn_mission_accept_draft`. The first phase lands brief-pending → Step 2.55 tightens it before any task. Full flow: `docs/PLUGIN_ARCHITECTURE.md` §11.

Hard contract — spec MUST exist befo

Read more
Read it on GitHub ↗

Showing the first part of this file.

Ships withcairn

Persistent ground truth for AI coding agents. First-class support for Claude Code, Cursor, and Codex. Stop agents from drifting.

Get the whole plugin, auto-invoked
Stats
6
Stars
0
Views
1
Forks
Active
Maintenance
TypeScript
Language
MIT
License
4d ago
Last commit
3mo ago
Created

Repo: isaacriehm/cairn