cairn-ai 0.1.7 → 0.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.agents/workflows/cairn-memory.md +1 -1
- package/.agents/workflows/cairn-plan.md +9 -8
- package/.agents/workflows/cairn-review.md +2 -2
- package/.agents/workflows/cairn-work.md +6 -5
- package/.claude/commands/cairn-review.md +1 -1
- package/.claude/commands/cairn-work.md +3 -1
- package/.codex-plugin/plugin.json +6 -3
- package/README.de.md +7 -7
- package/README.es.md +7 -7
- package/README.fr.md +7 -7
- package/README.ja.md +7 -7
- package/README.ko.md +7 -7
- package/README.md +7 -7
- package/README.pt.md +7 -7
- package/README.zh.md +7 -7
- package/agents/explorer.md +3 -2
- package/agents/worker.md +3 -2
- package/commands/cairn-memory.md +1 -1
- package/commands/cairn-plan.md +10 -8
- package/commands/cairn-review.md +2 -2
- package/commands/cairn-work.md +10 -8
- package/docs/model-guidance/README.md +2 -2
- package/docs/model-guidance/claude.md +2 -2
- package/docs/model-guidance/codex.md +8 -8
- package/package.json +1 -1
- package/scripts/cairn-state.mjs +20 -8
- package/scripts/cairn-state.sh +4 -4
- package/scripts/cairn.mjs +4 -4
- package/skills/cairn-memory/SKILL.md +3 -0
- package/skills/cairn-plan/SKILL.md +21 -14
- package/skills/cairn-review/SKILL.md +7 -4
- package/skills/cairn-work/SKILL.md +29 -21
- package/templates/PLAN.md +1 -0
- package/templates/work-plan.md +14 -5
package/commands/cairn-review.md
CHANGED
|
@@ -8,9 +8,9 @@ Goal: review completed work against plan, memory, policy, and evidence.
|
|
|
8
8
|
|
|
9
9
|
Procedure:
|
|
10
10
|
|
|
11
|
-
1. Every agent must read the project-root `MEMORY.md` for domain knowledge and repository policy before review work, then read the plan
|
|
11
|
+
1. Every agent must read the project-root `MEMORY.md` for domain knowledge and repository policy before review work, then read the plan task and memory inputs.
|
|
12
12
|
2. Check changed files, tool readiness evidence, and verification evidence.
|
|
13
|
-
3. Delegate independent read-only review to `explorer` when it materially improves speed or quality; use `worker` only for scoped verification reruns or QA artifacts. Tell every delegated agent to read the project-root `MEMORY.md` before work.
|
|
13
|
+
3. Delegate independent read-only review to `explorer` when it materially improves speed or quality; use `worker` only for scoped verification reruns or QA artifacts. When subagent tools are available, each agent may recursively delegate bounded sub-tasks to subagents. Tell every delegated agent and child subagent to read the project-root `MEMORY.md` before work, keep scope, and preserve others' edits.
|
|
14
14
|
4. Report findings first, ordered by severity, with file and line references. If no issues are found, say so clearly and mention remaining test gaps or residual risk.
|
|
15
15
|
5. Record review evidence in `docs/plan/<topic>.md`.
|
|
16
16
|
6. Use the OS locale for user-visible output unless the user asks for another language.
|
package/commands/cairn-work.md
CHANGED
|
@@ -4,20 +4,22 @@ Use the `cairn-work` skill.
|
|
|
4
4
|
|
|
5
5
|
Prerequisite: if `node scripts/cairn.mjs doctor` fails, restore installation with `node scripts/cairn.mjs install` or `node scripts/cairn.mjs upgrade`.
|
|
6
6
|
|
|
7
|
-
Goal: execute the next incomplete module
|
|
7
|
+
Goal: execute the next incomplete module task in `PLAN.md` without bypassing the recorded complexity triage.
|
|
8
8
|
|
|
9
9
|
Procedure:
|
|
10
10
|
|
|
11
|
-
1. Every agent must read the project-root `MEMORY.md` for domain knowledge and repository policy before selecting or executing a
|
|
11
|
+
1. Every agent must read the project-root `MEMORY.md` for domain knowledge and repository policy before selecting or executing a task.
|
|
12
12
|
2. Read `PLAN.md`, the detailed plan, and relevant memory notes.
|
|
13
13
|
3. Read the Codex or Claude model guidance recorded in the plan.
|
|
14
|
-
4. Select one small module
|
|
14
|
+
4. Select one small module task.
|
|
15
15
|
5. Confirm required tool readiness. If a required LSP/check tool is missing, run `node scripts/cairn.mjs toolcheck --install` or a repository-native install command before accepting a fallback.
|
|
16
16
|
6. Confirm the complexity triage and selected Light/Heavy Path recorded in the plan. If missing, update the plan before mutating files.
|
|
17
17
|
7. For Light Path, implement directly or use one bounded `worker`, then run focused verification.
|
|
18
18
|
8. For Heavy Path, follow the plan's staged implementation and review gates without role-mapping shortcuts.
|
|
19
|
-
9. When delegating implementation to `worker`, state the file ownership clearly,
|
|
20
|
-
10.
|
|
21
|
-
11. Re-run
|
|
22
|
-
12.
|
|
23
|
-
13.
|
|
19
|
+
9. When delegating implementation to `worker`, state the file ownership clearly. When subagent tools are available, each agent may recursively delegate bounded sub-tasks to subagents. Tell every delegated agent and child subagent to read the project-root `MEMORY.md` before work, keep scope, and preserve others' edits.
|
|
20
|
+
10. For Heavy Path, run the recorded automated test command and record explicit `Tests:` evidence before any completion claim.
|
|
21
|
+
11. Re-run module acceptance verification.
|
|
22
|
+
12. Re-run surface integration verification.
|
|
23
|
+
13. Record tool readiness and verification evidence in `docs/plan/<topic>.md` and update `PLAN.md`.
|
|
24
|
+
14. If the user asks a side question, status question, or narrow clarification while this task is still active, answer it briefly and then resume the previous active work unless the user explicitly asks to pause, stop, or switch tasks.
|
|
25
|
+
15. Use the OS locale for user-visible output unless the user asks for another language.
|
|
@@ -19,9 +19,9 @@ The goal is not to make prompts long by model. The goal is to stabilize the same
|
|
|
19
19
|
- Select Light Path or Heavy Path before implementation.
|
|
20
20
|
- Detect required LSP, typecheck, lint, dry-run, and verification tools before implementation.
|
|
21
21
|
- Missing required tools must trigger a project-local, repository-native, or ephemeral install attempt before they can be treated as unavailable.
|
|
22
|
-
- Every implementation
|
|
22
|
+
- Every implementation task must pass module acceptance verification and surface integration verification.
|
|
23
23
|
- Before mutating external state, run the closest available dry-run, check, plan, diff, validate, or equivalent command.
|
|
24
|
-
- Limit each
|
|
24
|
+
- Limit each task to two verification passes by default. After two failed passes, record the blocker or split it into sub-tasks instead of continuing a repeated loop.
|
|
25
25
|
- User-visible output must follow the OS locale unless the user asks for another language.
|
|
26
26
|
|
|
27
27
|
## Delegation Defaults
|
|
@@ -17,7 +17,7 @@ Claude-family models are strong at long-context retention, policy interpretation
|
|
|
17
17
|
- Do not accept "tool missing" as a reason to skip precise codebase exploration until install or bootstrap has been attempted.
|
|
18
18
|
- Do not skip the two verification gates even on Light Path.
|
|
19
19
|
- Do not approve a plan that lacks dry-run or check evidence for external-state-changing work.
|
|
20
|
-
- Do not allow open-ended verification loops. Require a blocker or
|
|
20
|
+
- Do not allow open-ended verification loops. Require a blocker or sub-task split after two failed passes.
|
|
21
21
|
- On Heavy Path, check plan gaps before implementation.
|
|
22
22
|
- Before asking the user, use repository evidence and available `explorer`/`worker` delegation when it materially improves speed or quality.
|
|
23
23
|
- Write user-visible output in the OS locale unless the user asks for another language.
|
|
@@ -35,7 +35,7 @@ Claude-family models are strong at long-context retention, policy interpretation
|
|
|
35
35
|
- Keep the plan short and executable.
|
|
36
36
|
- Always record complexity triage and the selected Light/Heavy Path.
|
|
37
37
|
- Always record tool readiness and blockers.
|
|
38
|
-
- Each module
|
|
38
|
+
- Each module task must include files, contract, dry-run or check command when applicable, module acceptance verification, and surface integration verification.
|
|
39
39
|
|
|
40
40
|
### Review
|
|
41
41
|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
# Codex Model Guidance
|
|
2
2
|
|
|
3
|
-
Codex-family models are strong at small implementation
|
|
3
|
+
Codex-family models are strong at small implementation tasks, explicit tool use, and repeatable verification. In Cairn, prefer them for bounded `worker` tasks and structurally clear planning.
|
|
4
4
|
|
|
5
5
|
## Use Strengths
|
|
6
6
|
|
|
7
|
-
- Quickly handle implementation
|
|
7
|
+
- Quickly handle implementation tasks with clear file scope.
|
|
8
8
|
- Read existing patterns and make minimal changes in the same style.
|
|
9
9
|
- Run repository tool readiness checks and bootstrap missing command-line tools.
|
|
10
10
|
- Capture module acceptance verification and surface integration verification from command results.
|
|
@@ -14,23 +14,23 @@ Codex-family models are strong at small implementation slices, explicit tool use
|
|
|
14
14
|
## Adjustment Rules
|
|
15
15
|
|
|
16
16
|
- Do not start implementation without a plan.
|
|
17
|
-
- Keep work units small. Split large changes into smaller plan
|
|
17
|
+
- Keep work units small. Split large changes into smaller plan tasks.
|
|
18
18
|
- If `apply_patch` is unstable in the environment, use an editing tool or a clear file update path.
|
|
19
19
|
- Do not duplicate the same exploration. Wait for already delegated searches.
|
|
20
20
|
- Do not trust success-looking output alone. Confirm real files, commands, and surface evidence.
|
|
21
21
|
- Do not skip LSP, typecheck, lint, dry-run, or verification because a tool is missing. Try repository-local installation or record the failed install attempt as a blocker.
|
|
22
|
-
- Do not continue an open-ended verification loop. Use at most two verification passes per
|
|
22
|
+
- Do not continue an open-ended verification loop. Use at most two verification passes per task unless the plan records a risk-based exception.
|
|
23
23
|
- Write user-visible output in the OS locale unless the user asks for another language.
|
|
24
24
|
|
|
25
25
|
## Path Guidance
|
|
26
26
|
|
|
27
27
|
### Planning
|
|
28
28
|
|
|
29
|
-
- On Light Path, write explicit
|
|
29
|
+
- On Light Path, write explicit task contracts when a plan artifact exists.
|
|
30
30
|
- Record detected stack, required tools, install commands, and tool blockers.
|
|
31
31
|
- Specify file scope and verification commands so implementation does not need to rediscover them.
|
|
32
|
-
- Specify the dry-run or check command for
|
|
33
|
-
- On failure, prefer
|
|
32
|
+
- Specify the dry-run or check command for tasks that can mutate external state, or record why none exists.
|
|
33
|
+
- On failure, prefer sub-task splitting over a repeated loop.
|
|
34
34
|
|
|
35
35
|
### Implementation
|
|
36
36
|
|
|
@@ -38,7 +38,7 @@ Codex-family models are strong at small implementation slices, explicit tool use
|
|
|
38
38
|
- Confirm required tools are available. Install or bootstrap missing required tools before implementation.
|
|
39
39
|
- Run the recorded dry-run or check command before external-state mutation when applicable.
|
|
40
40
|
- After changes, run both module acceptance verification and surface integration verification.
|
|
41
|
-
- If a gate fails, diagnose once, shrink or split
|
|
41
|
+
- If a gate fails, diagnose once, shrink the task or split it into sub-tasks, and rerun both gates. Stop after the second failed pass and record the blocker.
|
|
42
42
|
- Return evidence in a form that can be recorded in `docs/plan/<topic>.md`.
|
|
43
43
|
|
|
44
44
|
### Delegation
|
package/package.json
CHANGED
package/scripts/cairn-state.mjs
CHANGED
|
@@ -44,15 +44,15 @@ This file is a short index of active and completed work plans.
|
|
|
44
44
|
- Plans must be decision-complete before implementation.
|
|
45
45
|
- Run complexity triage before applying agent, plugin, or delegated workflow guidance.
|
|
46
46
|
- Record the selected Light Path or Heavy Path and the checked Heavy Path signals in \`docs/plan/<topic>.md\`.
|
|
47
|
-
- Split implementation into small module
|
|
47
|
+
- Split implementation into small module tasks.
|
|
48
48
|
- Detect repository stack and required LSP/check tools before implementation.
|
|
49
49
|
- Install or bootstrap missing required tools before declaring them unavailable.
|
|
50
|
-
- Each
|
|
50
|
+
- Each task normally passes exactly two gates.
|
|
51
51
|
- Module acceptance verification.
|
|
52
52
|
- Surface integration verification.
|
|
53
53
|
- Run dry-run or check mode before external-state mutation when available.
|
|
54
|
-
- Use at most two verification passes per
|
|
55
|
-
- If a gate fails, diagnose once, shrink or split
|
|
54
|
+
- Use at most two verification passes per task by default.
|
|
55
|
+
- If a gate fails, diagnose once, shrink the task or split it into sub-tasks, and rerun both gates.
|
|
56
56
|
- After two failed passes, record the blocker in \`docs/plan/<topic>.md\`.
|
|
57
57
|
`;
|
|
58
58
|
|
|
@@ -136,8 +136,9 @@ async function pendingActivePlanItems(root) {
|
|
|
136
136
|
}
|
|
137
137
|
const unchecked = [...text.matchAll(/^\s*-\s+\[\s\]\s+(.+)$/gm)].map((match) => match[1].trim());
|
|
138
138
|
const emptyEvidence = emptyEvidenceItems(text);
|
|
139
|
-
|
|
140
|
-
|
|
139
|
+
const missingHeavyPathTests = heavyPathMissingTests(text);
|
|
140
|
+
if (unchecked.length > 0 || emptyEvidence.length > 0 || missingHeavyPathTests.length > 0) {
|
|
141
|
+
pending.push({ path: relativePath, unchecked, emptyEvidence, missingHeavyPathTests });
|
|
141
142
|
}
|
|
142
143
|
}
|
|
143
144
|
|
|
@@ -177,6 +178,16 @@ function emptyEvidenceItems(text) {
|
|
|
177
178
|
return empty;
|
|
178
179
|
}
|
|
179
180
|
|
|
181
|
+
function heavyPathMissingTests(text) {
|
|
182
|
+
if (!/^\s*-\s+Selected path:\s*Heavy Path\.?\s*$/im.test(text)) return [];
|
|
183
|
+
const evidence = section(text, "Evidence");
|
|
184
|
+
const hasExplicitTestEvidence = [
|
|
185
|
+
/^\s*-\s+(Tests?|Test execution|Automated tests):\s*\S.+$/im,
|
|
186
|
+
/^\s*-\s+Module acceptance:\s+.*\b(npm test|node --test|pytest|phpunit|go test|cargo test|mvn test|gradle test|swift test|xcodebuild test)\b/im,
|
|
187
|
+
].some((pattern) => pattern.test(evidence));
|
|
188
|
+
return hasExplicitTestEvidence ? [] : ["Heavy Path test evidence is missing"];
|
|
189
|
+
}
|
|
190
|
+
|
|
180
191
|
function section(text, title) {
|
|
181
192
|
const pattern = new RegExp(`^##\\s+${escapeRegExp(title)}\\s*$([\\s\\S]*?)(?=^##\\s+|(?![\\s\\S]))`, "m");
|
|
182
193
|
return text.match(pattern)?.[1]?.trim() ?? "";
|
|
@@ -187,16 +198,17 @@ function stopBlockedMessage({ event, ko, pending }) {
|
|
|
187
198
|
const suffix = pending.length > 3 ? `; +${pending.length - 3} more` : "";
|
|
188
199
|
if (ko) {
|
|
189
200
|
const subject = event === "subagent-stop" ? "서브에이전트 완료 신호" : "완료 신호";
|
|
190
|
-
return `Cairn 종료 게이트: ${subject}를 차단했습니다. 미완료 작업이 남아 있습니다. PLAN.md의 Active Plans를 다시 읽고 다음 미완료
|
|
201
|
+
return `Cairn 종료 게이트: ${subject}를 차단했습니다. 미완료 작업이 남아 있습니다. PLAN.md의 Active Plans를 다시 읽고 다음 미완료 task를 계속 진행하세요: ${itemText}${suffix}`;
|
|
191
202
|
}
|
|
192
203
|
const subject = event === "subagent-stop" ? "subagent completion signal" : "completion signal";
|
|
193
|
-
return `Cairn stop gate: blocked ${subject}. Incomplete work remains. Re-read PLAN.md Active Plans and continue the next incomplete
|
|
204
|
+
return `Cairn stop gate: blocked ${subject}. Incomplete work remains. Re-read PLAN.md Active Plans and continue the next incomplete task: ${itemText}${suffix}`;
|
|
194
205
|
}
|
|
195
206
|
|
|
196
207
|
function formatPendingItem(item) {
|
|
197
208
|
const reasons = [
|
|
198
209
|
...item.unchecked.map((label) => `unchecked: ${label}`),
|
|
199
210
|
...item.emptyEvidence.map((label) => `empty evidence: ${label}`),
|
|
211
|
+
...(item.missingHeavyPathTests ?? []).map((label) => `missing tests: ${label}`),
|
|
200
212
|
];
|
|
201
213
|
return `${item.path} (${reasons.slice(0, 3).join(", ")})`;
|
|
202
214
|
}
|
package/scripts/cairn-state.sh
CHANGED
|
@@ -53,15 +53,15 @@ This file is a short index of active and completed work plans.
|
|
|
53
53
|
|
|
54
54
|
- Every agent must start assigned work by reading the project-root `MEMORY.md` for domain knowledge and repository policy.
|
|
55
55
|
- Plans must be decision-complete before implementation.
|
|
56
|
-
- Split implementation into small module
|
|
56
|
+
- Split implementation into small module tasks.
|
|
57
57
|
- Detect repository stack and required LSP/check tools before implementation.
|
|
58
58
|
- Install or bootstrap missing required tools before declaring them unavailable.
|
|
59
|
-
- Each
|
|
59
|
+
- Each task normally passes exactly two gates.
|
|
60
60
|
- Module acceptance verification.
|
|
61
61
|
- Surface integration verification.
|
|
62
62
|
- Run dry-run or check mode before external-state mutation when available.
|
|
63
|
-
- Use at most two verification passes per
|
|
64
|
-
- If a gate fails, diagnose once, shrink or split
|
|
63
|
+
- Use at most two verification passes per task by default.
|
|
64
|
+
- If a gate fails, diagnose once, shrink the task or split it into sub-tasks, and rerun both gates.
|
|
65
65
|
- After two failed passes, record the blocker in `docs/plan/<topic>.md`.
|
|
66
66
|
EOF
|
|
67
67
|
fi
|
package/scripts/cairn.mjs
CHANGED
|
@@ -59,15 +59,15 @@ function isCliEntry() {
|
|
|
59
59
|
const messages = {
|
|
60
60
|
en: {
|
|
61
61
|
memory: "Use the cairn-memory skill. Keep MEMORY.md as a short index and write details to docs/memory/<domain>.md.",
|
|
62
|
-
plan: "Use the cairn-plan skill before non-trivial implementation. Every agent must first read the project-root MEMORY.md for domain knowledge and repository policy. Keep PLAN.md as an index, write detailed plans to docs/plan/<topic>.md, and record Light/Heavy Path triage before any mutation.",
|
|
63
|
-
work: "Use the cairn-work skill only after a plan exists. Every agent must first read the project-root MEMORY.md for domain knowledge and repository policy. Execute one module
|
|
62
|
+
plan: "Use the cairn-plan skill before non-trivial implementation. Every agent must first read the project-root MEMORY.md for domain knowledge and repository policy. Understand the whole work first, then classify it into executable tasks and sub-tasks. Keep PLAN.md as an index, write detailed plans to docs/plan/<topic>.md, and record Light/Heavy Path triage before any mutation.",
|
|
63
|
+
work: "Use the cairn-work skill only after a plan exists. Every agent must first read the project-root MEMORY.md for domain knowledge and repository policy. Execute one module task using the recorded Light/Heavy Path route, and capture dry-run/check, module, and surface evidence. If the user asks a side question while work is active, answer briefly and then resume unless they explicitly ask to pause, stop, or switch tasks.",
|
|
64
64
|
review: "Use the cairn-review skill. Compare evidence against PLAN.md and MEMORY.md.",
|
|
65
65
|
usage: "Usage: cairn install|upgrade|doctor|uninstall|init|memory|plan|work|review|toolcheck",
|
|
66
66
|
},
|
|
67
67
|
ko: {
|
|
68
68
|
memory: "cairn-memory 스킬을 사용하세요. MEMORY.md는 짧은 색인으로, 상세 내용은 docs/memory/<domain>.md에 기록합니다.",
|
|
69
|
-
plan: "중요 구현 전에는 cairn-plan 스킬을 사용하세요. 모든 에이전트는 도메인 지식과 저장소 정책을 위해 프로젝트 루트 MEMORY.md를 먼저 읽어야 합니다. PLAN.md는 색인으로, 상세 계획은 docs/plan/<topic>.md에 기록하며 파일 변경 전 Light/Heavy Path 트리아지를 남깁니다.",
|
|
70
|
-
work: "계획이 있을 때만 cairn-work 스킬을 사용하세요. 모든 에이전트는 도메인 지식과 저장소 정책을 위해 프로젝트 루트 MEMORY.md를 먼저 읽어야 합니다. 기록된 Light/Heavy Path 경로로 하나의 모듈
|
|
69
|
+
plan: "중요 구현 전에는 cairn-plan 스킬을 사용하세요. 모든 에이전트는 도메인 지식과 저장소 정책을 위해 프로젝트 루트 MEMORY.md를 먼저 읽어야 합니다. 먼저 전체 작업을 파악한 뒤 실행 가능한 task와 필요한 sub-task로 분류합니다. PLAN.md는 색인으로, 상세 계획은 docs/plan/<topic>.md에 기록하며 파일 변경 전 Light/Heavy Path 트리아지를 남깁니다.",
|
|
70
|
+
work: "계획이 있을 때만 cairn-work 스킬을 사용하세요. 모든 에이전트는 도메인 지식과 저장소 정책을 위해 프로젝트 루트 MEMORY.md를 먼저 읽어야 합니다. 기록된 Light/Heavy Path 경로로 하나의 모듈 작업을 실행하며 dry-run/check, 모듈, 표면 증거를 확보합니다. 작업 중 사용자가 곁가지 질문을 하면 짧게 답한 뒤, 명시적으로 일시중지/중단/작업 전환을 요청한 경우가 아니면 이전 active work를 계속합니다.",
|
|
71
71
|
review: "cairn-review 스킬을 사용하세요. PLAN.md와 MEMORY.md 기준으로 증거를 비교합니다.",
|
|
72
72
|
usage: "사용법: cairn install|upgrade|doctor|uninstall|init|memory|plan|work|review|toolcheck",
|
|
73
73
|
},
|
|
@@ -13,6 +13,8 @@ The root `MEMORY.md` is an index, not detailed knowledge. Record details in `doc
|
|
|
13
13
|
|
|
14
14
|
Every delegated agent must read the project-root `MEMORY.md` before doing its assigned discovery, evidence, or update task.
|
|
15
15
|
|
|
16
|
+
When subagent tools are available, each agent may recursively delegate bounded sub-tasks to subagents. Every child subagent must read the project-root `MEMORY.md`, keep the assigned scope, and preserve others' edits.
|
|
17
|
+
|
|
16
18
|
## Procedure
|
|
17
19
|
|
|
18
20
|
1. Run `node scripts/cairn-state.mjs manual` if it exists. Otherwise ensure `MEMORY.md`, `PLAN.md`, `docs/memory`, and `docs/plan` directly.
|
|
@@ -20,6 +22,7 @@ Every delegated agent must read the project-root `MEMORY.md` before doing its as
|
|
|
20
22
|
3. Delegate when it materially improves speed or quality instead of asking the user.
|
|
21
23
|
- `explorer`: read-only domain discovery, boundaries, invariants, policies, contradictions, and stale facts when available.
|
|
22
24
|
- `worker`: exact file paths, commands, schemas, references, and bounded evidence capture.
|
|
25
|
+
- Recursive subagent delegation is allowed only for bounded sub-tasks when the current surface supports it.
|
|
23
26
|
4. Write detailed facts to `docs/memory/<domain>.md`.
|
|
24
27
|
5. Keep only one-line links and summaries in `MEMORY.md`.
|
|
25
28
|
6. Write user-visible output in the OS locale unless the user asks for another language.
|
|
@@ -15,6 +15,8 @@ Every planning run starts by reading the project-root `MEMORY.md`. Treat it as t
|
|
|
15
15
|
|
|
16
16
|
Do not treat planning as optional for implementation work that is more than a narrow single-file fix. If the current request can change behavior, architecture, data, external state, or multiple files, produce or update a plan artifact before mutation.
|
|
17
17
|
|
|
18
|
+
Plan from the whole work down. First understand the full requested outcome and affected surfaces, then classify the work into small executable tasks. If one task is still too broad to verify cleanly, split that task into sub-tasks.
|
|
19
|
+
|
|
18
20
|
## Procedure
|
|
19
21
|
|
|
20
22
|
1. Run `node scripts/cairn-state.mjs manual` if it exists. Otherwise ensure `MEMORY.md`, `PLAN.md`, `docs/memory`, and `docs/plan` directly.
|
|
@@ -24,16 +26,18 @@ Do not treat planning as optional for implementation work that is more than a na
|
|
|
24
26
|
5. Run `node scripts/cairn.mjs toolcheck` when available, or `scripts/cairn-toolcheck.mjs` directly, to identify repository stacks and required tools.
|
|
25
27
|
6. If LSP, typecheck, lint, dry-run, or verification tools are missing, run `node scripts/cairn.mjs toolcheck --install` or the closest repository-native install command before treating the tool as unavailable.
|
|
26
28
|
7. Explore the repository with focused search and LSP/symbol tools after tool readiness is confirmed.
|
|
27
|
-
8.
|
|
28
|
-
9.
|
|
29
|
-
10.
|
|
29
|
+
8. Summarize the whole work and affected surfaces, then classify the plan into small executable tasks. Use sub-tasks only when a task needs further breakdown to be verifiable.
|
|
30
|
+
9. Identify the closest available dry-run or check mode for every task that can mutate external state.
|
|
31
|
+
10. Run complexity triage before applying workflow guidance from agents, plugins, or delegated roles. Record the route before any implementation task.
|
|
32
|
+
11. Delegate according to the selected path and model guidance instead of asking the user.
|
|
30
33
|
- Use `explorer` for independent read-only codebase discovery, impact analysis, pattern searches, and read-only verification that can run in parallel when the current tool list supports it.
|
|
31
|
-
- Use `worker` for bounded implementation
|
|
34
|
+
- Use `worker` for bounded implementation tasks with clear file ownership, disjoint write scope, or verification tasks that can run while the main session continues.
|
|
35
|
+
- When subagent tools are available, each agent may recursively delegate bounded sub-tasks to subagents, subject to the current surface's depth and concurrency limits.
|
|
32
36
|
- Keep urgent blocking work local when the next step depends immediately on the result.
|
|
33
|
-
- Tell every delegated agent to read the project-root `MEMORY.md` before work, and tell workers they are not alone in the codebase and must not revert others' edits.
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
+
- Tell every delegated agent and child subagent to read the project-root `MEMORY.md` before work, keep scope, and tell workers they are not alone in the codebase and must not revert others' edits.
|
|
38
|
+
12. Create `docs/plan/<topic>.md` from `templates/work-plan.md`.
|
|
39
|
+
13. Add a short index entry to `PLAN.md`.
|
|
40
|
+
14. Write user-visible output in the OS locale unless the user asks for another language.
|
|
37
41
|
|
|
38
42
|
## Complexity Triage
|
|
39
43
|
|
|
@@ -93,15 +97,18 @@ Heavy Path flow: plan -> pre-implementation review -> bounded `worker` implement
|
|
|
93
97
|
## Planning Rules
|
|
94
98
|
|
|
95
99
|
- Every plan must be decision-complete.
|
|
100
|
+
- Every plan must describe the whole work first, then classify it into executable tasks and any needed sub-tasks.
|
|
101
|
+
- Every plan must allow recursive subagent delegation for bounded sub-tasks when the current agent surface supports it.
|
|
96
102
|
- Every plan must include complexity triage and the selected path.
|
|
97
103
|
- Every plan must explicitly list Heavy Path signals checked, even when Light Path is selected.
|
|
98
104
|
- Every plan must include applied model guidance and rationale.
|
|
99
105
|
- Every plan must include tool readiness results: detected stack, required LSP/check tools, installed tools, and blockers.
|
|
100
|
-
- Every implementation
|
|
106
|
+
- Every implementation task must be small enough to verify with two checks.
|
|
107
|
+
- Heavy Path tasks must include an explicit automated test command and a `Tests:` evidence line; Heavy Path completion cannot rely on generic verification wording without test evidence.
|
|
101
108
|
- The default checks are module acceptance verification and surface integration verification.
|
|
102
|
-
- Every risky or external-state-changing
|
|
109
|
+
- Every risky or external-state-changing task must include the closest available dry-run or check command before the write/apply command.
|
|
103
110
|
- Verification can expand for risk, but the reason must be recorded.
|
|
104
|
-
- The default loop budget is two verification passes per
|
|
111
|
+
- The default loop budget is two verification passes per task. If a gate fails, diagnose once, shrink the task or split it into sub-tasks, and rerun both gates. After two failed passes, record the blocker in `docs/plan/<topic>.md` instead of continuing an open-ended loop.
|
|
105
112
|
- Ask the user only when agents, repository evidence, or local verification cannot answer the decision.
|
|
106
113
|
- User-visible text must follow the OS locale unless the user asks for another language.
|
|
107
114
|
|
|
@@ -132,13 +139,13 @@ Prefer repository-native dry-run and check modes before mutating external state.
|
|
|
132
139
|
TASK: Produce <role> input needed for the <topic> plan.
|
|
133
140
|
EXPECTED OUTCOME: Return concrete decisions, file paths, dependencies, risks, and evidence requirements.
|
|
134
141
|
REQUIRED TOOLS: Read-only repository exploration, tool readiness checks, LSP/symbol tools, local command checks.
|
|
135
|
-
MUST DO: Read the project-root `MEMORY.md` before doing assigned work. Preserve proper nouns exactly. Prefer repository evidence. Install or bootstrap missing required tools before declaring them unavailable. Identify assumptions. Use `explorer` for read-only discovery and `worker` for bounded implementation or verification when available and useful. Tell every delegated agent to read the project-root `MEMORY.md` before work. Tell workers they are not alone in the codebase and must not revert others' edits. Use the OS locale for user-visible text.
|
|
136
|
-
MUST NOT DO: Edit production code. Ask the user. Expand scope.
|
|
142
|
+
MUST DO: Read the project-root `MEMORY.md` before doing assigned work. Preserve proper nouns exactly. Prefer repository evidence. Install or bootstrap missing required tools before declaring them unavailable. Identify assumptions. Use `explorer` for read-only discovery and `worker` for bounded implementation or verification when available and useful. When subagent tools are available, allow recursive delegation of bounded sub-tasks. Tell every delegated agent and child subagent to read the project-root `MEMORY.md` before work. Tell workers they are not alone in the codebase and must not revert others' edits. Use the OS locale for user-visible text.
|
|
143
|
+
MUST NOT DO: Edit production code. Ask the user. Expand scope. Delegate vague or unbounded work.
|
|
137
144
|
CONTEXT: User request, MEMORY.md, relevant docs/memory notes, applied model guidance, repository root.
|
|
138
145
|
```
|
|
139
146
|
|
|
140
147
|
## Completion Criteria
|
|
141
148
|
|
|
142
149
|
- `PLAN.md` references the plan topic.
|
|
143
|
-
- `docs/plan/<topic>.md` includes goal, memory inputs, model guidance, tool readiness, complexity triage, selected path, agent assignments, module
|
|
150
|
+
- `docs/plan/<topic>.md` includes goal, memory inputs, model guidance, tool readiness, complexity triage, selected path, agent assignments, module tasks, and two checks per task.
|
|
144
151
|
- The next implementation task can run without making planning decisions.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: cairn-review
|
|
3
|
-
description: Review completed Cairn
|
|
3
|
+
description: Review completed Cairn tasks against MEMORY.md, PLAN.md, domain policy, and two-gate evidence.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Cairn Review
|
|
@@ -9,18 +9,21 @@ Use this after meaningful implementation with Cairn.
|
|
|
9
9
|
|
|
10
10
|
## Purpose
|
|
11
11
|
|
|
12
|
-
Review is not another implementation loop. Confirm that the completed
|
|
12
|
+
Review is not another implementation loop. Confirm that the completed task satisfies the plan and that memory and plan artifacts are useful to the next agent.
|
|
13
13
|
|
|
14
14
|
Every review run and every delegated review agent must read the project-root `MEMORY.md` before doing assigned work.
|
|
15
15
|
|
|
16
|
+
When subagent tools are available, each agent may recursively delegate bounded review sub-tasks to subagents. Every child subagent must read the project-root `MEMORY.md`, keep the assigned scope, and preserve others' edits.
|
|
17
|
+
|
|
16
18
|
## Procedure
|
|
17
19
|
|
|
18
|
-
1. Read the completed
|
|
20
|
+
1. Read the completed task in `docs/plan/<topic>.md`.
|
|
19
21
|
2. Read `MEMORY.md` and relevant `docs/memory/*.md`.
|
|
20
22
|
3. Check changed files, tool readiness evidence, and evidence paths.
|
|
21
23
|
4. Delegate independent review when it materially improves speed or quality and the current tool policy allows it.
|
|
22
24
|
- Use `explorer` for read-only impact analysis, pattern checks, and independent diff inspection.
|
|
23
25
|
- Use `worker` for scoped verification command re-runs or QA artifact capture.
|
|
26
|
+
- Recursive subagent delegation is allowed only for bounded sub-tasks when the current surface supports it.
|
|
24
27
|
- Keep blocking review work local when the next step depends immediately on the result.
|
|
25
28
|
5. Report findings first, ordered by severity, with file and line references. If there are no issues, say so clearly and record remaining test gaps or residual risk.
|
|
26
29
|
6. Write user-visible output in the OS locale unless the user asks for another language.
|
|
@@ -28,7 +31,7 @@ Every review run and every delegated review agent must read the project-root `ME
|
|
|
28
31
|
## Reviewer Prompt Format
|
|
29
32
|
|
|
30
33
|
```text
|
|
31
|
-
TASK: Review correctness, scope, and evidence for
|
|
34
|
+
TASK: Review correctness, scope, and evidence for task <task-id>.
|
|
32
35
|
EXPECTED OUTCOME: Findings ordered by severity with file and line references, or an explicit no-issue result with residual risk.
|
|
33
36
|
REQUIRED TOOLS: Read-only diff inspection, tool readiness checks, verification command execution, plan/memory reading.
|
|
34
37
|
MUST DO: Read the project-root `MEMORY.md` before doing assigned work. Check tool readiness and install-attempt evidence. Check dry-run or check evidence when external state could change. Check both module evidence and surface evidence. Preserve proper nouns exactly. Use the OS locale for user-visible text.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: cairn-work
|
|
3
|
-
description: Use after cairn-plan to execute the next incomplete docs/plan module
|
|
3
|
+
description: Use after cairn-plan to execute the next incomplete docs/plan module task with the recorded Light/Heavy Path route, bounded worker delegation, dry-run/check evidence, and two verification gates.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Cairn Work
|
|
@@ -9,38 +9,44 @@ Use this to implement a plan created by `cairn-plan`. Do not use this as a short
|
|
|
9
9
|
|
|
10
10
|
## Purpose
|
|
11
11
|
|
|
12
|
-
Execute only one module
|
|
12
|
+
Execute only one module task at a time. Instead of a repeated red-green loop, prove a small task with two strong verification gates.
|
|
13
13
|
|
|
14
|
-
Every work run starts by reading the project-root `MEMORY.md` before choosing or executing a
|
|
14
|
+
Every work run starts by reading the project-root `MEMORY.md` before choosing or executing a task. Every delegated agent must also read the project-root `MEMORY.md` before doing its assigned task.
|
|
15
|
+
|
|
16
|
+
If the user asks a side question, status question, or narrow clarification while the selected task is still active, answer it briefly and then resume the previous active work unless the user explicitly asks to pause, stop, or switch tasks.
|
|
17
|
+
|
|
18
|
+
When subagent tools are available, each agent may recursively delegate bounded sub-tasks to subagents. Every child subagent must read the project-root `MEMORY.md`, keep the assigned scope, and preserve others' edits.
|
|
15
19
|
|
|
16
20
|
## Procedure
|
|
17
21
|
|
|
18
22
|
1. Read the project-root `MEMORY.md` first.
|
|
19
23
|
2. Read `PLAN.md`, the selected `docs/plan/<topic>.md`, and relevant memory notes.
|
|
20
24
|
3. Read the `docs/model-guidance/*.md` inputs recorded in the plan.
|
|
21
|
-
4. Select the first incomplete module
|
|
25
|
+
4. Select the first incomplete module task.
|
|
22
26
|
5. Confirm that required LSP, typecheck, lint, dry-run, and verification tools are available from the plan's tool readiness section.
|
|
23
27
|
6. If a required tool is missing, run `node scripts/cairn.mjs toolcheck --install` or the closest repository-native install command, then rerun the tool before continuing.
|
|
24
28
|
7. Confirm the selected Light Path or Heavy Path in the plan. If the plan lacks complexity triage, stop and update the plan before mutating files.
|
|
25
29
|
8. For Light Path, implement directly or delegate to one bounded `worker`; keep the verification gate.
|
|
26
30
|
9. For Heavy Path, follow the full planning and review pipeline recorded in the plan. Run pre-implementation review before mutation and read-only review after evidence exists.
|
|
27
|
-
10. Delegate implementation to `worker` with exact files, ownership, constraints, and model-specific adjustment rules. Tell every delegated agent to read the project-root `MEMORY.md` before work. Use `explorer` for parallel read-only discovery or verification when available and useful.
|
|
28
|
-
11. Before mutating external state, run the
|
|
29
|
-
12.
|
|
30
|
-
13.
|
|
31
|
-
14.
|
|
32
|
-
15.
|
|
33
|
-
16.
|
|
31
|
+
10. Delegate implementation to `worker` with exact files, ownership, constraints, and model-specific adjustment rules. Tell every delegated agent and child subagent to read the project-root `MEMORY.md` before work, keep scope, and preserve others' edits. Use `explorer` for parallel read-only discovery or verification when available and useful. Allow recursive delegation only for bounded sub-tasks when the current surface supports it.
|
|
32
|
+
11. Before mutating external state, run the task dry-run or check command when one is recorded. If none exists, record the absence and continue with the smallest reversible command available.
|
|
33
|
+
12. For Heavy Path, run the recorded automated test command and record explicit `Tests:` evidence before claiming completion.
|
|
34
|
+
13. `worker` must return changed files, tool readiness result, dry-run or check result when applicable, automated test result for Heavy Path, module acceptance command and result, surface integration command or QA artifact, and cleanup notes.
|
|
35
|
+
14. Re-run both verification gates directly.
|
|
36
|
+
15. Apply the bounded loop policy when a gate fails.
|
|
37
|
+
16. Record evidence in the plan file before marking the task complete.
|
|
38
|
+
17. If the user asks a side question, status question, or narrow clarification while this task is still active, answer it briefly and then resume the previous active work unless the user explicitly asks to pause, stop, or switch tasks.
|
|
39
|
+
18. Write user-visible output in the OS locale unless the user asks for another language.
|
|
34
40
|
|
|
35
41
|
## Builder Prompt Format
|
|
36
42
|
|
|
37
43
|
```text
|
|
38
|
-
TASK: Implement
|
|
39
|
-
EXPECTED OUTCOME: Minimal code or documentation change satisfying the
|
|
44
|
+
TASK: Implement task <task-id> for <topic>.
|
|
45
|
+
EXPECTED OUTCOME: Minimal code or documentation change satisfying the task contract.
|
|
40
46
|
REQUIRED TOOLS: Scoped file editing, tool readiness checks, existing test/build commands, surface QA commands.
|
|
41
|
-
MUST DO: Read the project-root `MEMORY.md` before doing assigned work and follow its policy. Stay within the listed file scope and ownership. Assume you are not alone in the codebase; do not revert others' edits. Install or bootstrap missing required tools before declaring them unavailable. Run dry-run or check mode before external-state mutation when available. Provide module evidence and surface evidence. Use the OS locale for user-visible text.
|
|
42
|
-
MUST NOT DO: Ask the user. Skip LSP/typecheck/lint because a tool is missing without attempting installation. Refactor unrelated code. Continue an open-ended verification loop. Claim completion without evidence. Modify files outside the assigned ownership.
|
|
43
|
-
CONTEXT: docs/plan/<topic>.md
|
|
47
|
+
MUST DO: Read the project-root `MEMORY.md` before doing assigned work and follow its policy. Stay within the listed file scope and ownership. Assume you are not alone in the codebase; do not revert others' edits. When subagent tools are available, recursively delegate only bounded sub-tasks and pass these same constraints to every child subagent. Install or bootstrap missing required tools before declaring them unavailable. Run dry-run or check mode before external-state mutation when available. Provide module evidence and surface evidence. Use the OS locale for user-visible text.
|
|
48
|
+
MUST NOT DO: Ask the user. Skip LSP/typecheck/lint because a tool is missing without attempting installation. Refactor unrelated code. Continue an open-ended verification loop. Treat a side question as permission to abandon the active task. Delegate vague or unbounded work. Claim completion without evidence. Modify files outside the assigned ownership.
|
|
49
|
+
CONTEXT: docs/plan/<topic>.md task, relevant docs/memory notes, applied model guidance, exact files, verification commands.
|
|
44
50
|
```
|
|
45
51
|
|
|
46
52
|
## Tool Readiness Policy
|
|
@@ -49,12 +55,13 @@ CONTEXT: docs/plan/<topic>.md slice, relevant docs/memory notes, applied model g
|
|
|
49
55
|
- If no command is recorded, run `node scripts/cairn.mjs toolcheck` when available.
|
|
50
56
|
- Missing LSP, typecheck, lint, dry-run, or verification tools must trigger a project-local or repository-native install attempt.
|
|
51
57
|
- After installation, rerun the exact tool command and record evidence.
|
|
52
|
-
- If installation fails, stop the
|
|
58
|
+
- If installation fails, stop the task and record the blocker rather than silently falling back to less precise exploration.
|
|
53
59
|
|
|
54
60
|
## Two Verification Gates
|
|
55
61
|
|
|
56
62
|
- Module acceptance: targeted unit, typecheck, lint, parser, schema, or command that proves the module contract.
|
|
57
63
|
- Surface integration: HTTP, browser, CLI, tmux, desktop, or parsed artifact evidence proving behavior through the real surface.
|
|
64
|
+
- Heavy Path test gate: run an explicit automated test command and record it as `Tests:` evidence in the plan. This is required even when module acceptance uses a broader check command.
|
|
58
65
|
|
|
59
66
|
## Dry-Run Policy
|
|
60
67
|
|
|
@@ -68,16 +75,17 @@ Run the closest available dry-run or check mode before commands that mutate exte
|
|
|
68
75
|
|
|
69
76
|
## Bounded Loop Policy
|
|
70
77
|
|
|
71
|
-
- Run at most two verification passes per
|
|
72
|
-
- If a gate fails, diagnose the cause once, shrink or split
|
|
73
|
-
- After two failed passes, stop implementation for the
|
|
78
|
+
- Run at most two verification passes per task by default.
|
|
79
|
+
- If a gate fails, diagnose the cause once, shrink the task or split it into sub-tasks, then rerun both gates.
|
|
80
|
+
- After two failed passes, stop implementation for the task and record the blocker in `docs/plan/<topic>.md`.
|
|
74
81
|
- Do not imitate repeated red-green loops unless the plan explicitly records a risk-based reason.
|
|
75
82
|
|
|
76
83
|
## Completion Criteria
|
|
77
84
|
|
|
78
85
|
- Both verification gates passed in the current turn.
|
|
86
|
+
- Heavy Path work has explicit automated test evidence in the current plan.
|
|
79
87
|
- Required LSP/check/verification tools were available, installed, or recorded as blockers with attempted commands.
|
|
80
|
-
- Dry-run or check evidence exists when the
|
|
88
|
+
- Dry-run or check evidence exists when the task could mutate external state, or the plan records why no dry-run exists.
|
|
81
89
|
- The required Light Path or Heavy Path flow was followed.
|
|
82
90
|
- The model guidance recorded in the plan was applied.
|
|
83
91
|
- Evidence was recorded in `docs/plan/<topic>.md`.
|
package/templates/PLAN.md
CHANGED
|
@@ -6,6 +6,7 @@ Short index of work plans. Link detailed plans under `docs/plan/`.
|
|
|
6
6
|
|
|
7
7
|
- Detect repository stack and required LSP/check tools before implementation.
|
|
8
8
|
- Install or bootstrap missing required tools before declaring them unavailable.
|
|
9
|
+
- Heavy Path completion requires explicit automated test evidence.
|
|
9
10
|
- Record tool readiness, dry-run/check evidence, module acceptance evidence, and surface integration evidence in detailed plans.
|
|
10
11
|
|
|
11
12
|
## Active Plans
|
package/templates/work-plan.md
CHANGED
|
@@ -4,6 +4,13 @@
|
|
|
4
4
|
|
|
5
5
|
Describe the observable result.
|
|
6
6
|
|
|
7
|
+
## Whole Work
|
|
8
|
+
|
|
9
|
+
- Outcome:
|
|
10
|
+
- Affected surfaces:
|
|
11
|
+
- Task classification:
|
|
12
|
+
- Sub-tasks, if needed:
|
|
13
|
+
|
|
7
14
|
## Memory Inputs
|
|
8
15
|
|
|
9
16
|
- `MEMORY.md`
|
|
@@ -44,7 +51,7 @@ Describe the observable result.
|
|
|
44
51
|
## Agent Assignments
|
|
45
52
|
|
|
46
53
|
- `explorer`: read-only discovery, impact analysis, pattern search, and read-only verification when available.
|
|
47
|
-
- `worker`: bounded implementation
|
|
54
|
+
- `worker`: bounded implementation tasks with clear file ownership, or scoped verification work.
|
|
48
55
|
- Local main session: urgent blocking work when the next step depends immediately on the result.
|
|
49
56
|
|
|
50
57
|
## Tool Readiness
|
|
@@ -61,14 +68,15 @@ Describe the observable result.
|
|
|
61
68
|
|
|
62
69
|
- Dry-run or check mode before external-state mutation:
|
|
63
70
|
- No dry-run available, if applicable:
|
|
64
|
-
- Verification loop budget: two passes per
|
|
65
|
-
- Failure handling: diagnose once, shrink or split
|
|
71
|
+
- Verification loop budget: two passes per task by default.
|
|
72
|
+
- Failure handling: diagnose once, shrink the task or split it into sub-tasks, rerun both gates, then record a blocker after the second failed pass.
|
|
66
73
|
|
|
67
|
-
## Module
|
|
74
|
+
## Module Tasks
|
|
68
75
|
|
|
69
|
-
###
|
|
76
|
+
### Task 1: <module>
|
|
70
77
|
|
|
71
78
|
- Contract:
|
|
79
|
+
- Sub-tasks, if needed:
|
|
72
80
|
- Files:
|
|
73
81
|
- Dependencies:
|
|
74
82
|
- Tool readiness requirement:
|
|
@@ -80,6 +88,7 @@ Describe the observable result.
|
|
|
80
88
|
|
|
81
89
|
- Dry-run or check:
|
|
82
90
|
- Tool readiness:
|
|
91
|
+
- Tests:
|
|
83
92
|
- Module acceptance:
|
|
84
93
|
- Surface integration:
|
|
85
94
|
- Verification pass count:
|