cairn-ai 0.1.9 → 0.1.10
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-plan.md +1 -1
- package/.agents/workflows/cairn-work.md +2 -2
- package/.codex-plugin/plugin.json +5 -1
- package/README.ko.md +9 -5
- package/README.md +9 -5
- package/commands/cairn-plan.md +1 -1
- package/commands/cairn-work.md +2 -2
- package/docs/model-guidance/README.md +7 -2
- package/docs/model-guidance/codex.md +13 -2
- package/package.json +1 -1
- package/scripts/cairn-state.mjs +26 -7
- package/scripts/cairn.mjs +19 -16
- package/skills/cairn-plan/SKILL.md +13 -5
- package/skills/cairn-work/SKILL.md +10 -3
|
@@ -16,7 +16,7 @@ Procedure:
|
|
|
16
16
|
8. Run complexity triage before applying agent, plugin, or delegated workflow guidance, and record it before mutating files.
|
|
17
17
|
9. Use Light Path by default unless a Heavy Path condition clearly applies.
|
|
18
18
|
10. Use `explorer` for independent read-only discovery, impact analysis, pattern search, and read-only verification when available.
|
|
19
|
-
11. Use `worker` for
|
|
19
|
+
11. Treat the user-called/main agent as the orchestrator: it plans, assigns, verifies, relays received subagent status events or observable lifecycle events to the user, and records evidence. Use `worker` for actual implementation edits with clear file ownership whenever subagent tools are available, on both Light Path and Heavy Path. When the subagent tool provides a progress-reporting channel, require subagents to report status when starting work, when deciding or confirming direction, during periodic progress, and when finishing; immediately relay received status events to the user. If no mid-run reporting channel exists, relay observable events such as assignment, waiting, and final completion. Require delegated subagents to provide a final report before leaving; after capturing the final report and evidence, close or release the completed subagent, then review the final report and evidence before marking the work complete. 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. If subagent tools are unavailable, the main agent takes over implementation directly and records that takeover in evidence.
|
|
20
20
|
12. Write `docs/plan/<topic>.md`.
|
|
21
21
|
13. Add the topic link and status to `PLAN.md`.
|
|
22
22
|
14. Put the selected Light/Heavy Path, checked Heavy Path signals, tool readiness, module acceptance verification, and surface integration verification on every module task.
|
|
@@ -12,9 +12,9 @@ Procedure:
|
|
|
12
12
|
4. Select one small module task.
|
|
13
13
|
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.
|
|
14
14
|
6. Confirm the complexity triage and selected Light/Heavy Path recorded in the plan. If missing, update the plan before mutating files.
|
|
15
|
-
7. For Light Path,
|
|
15
|
+
7. For Light Path, keep the user-called/main agent in the orchestrator role and delegate implementation edits to one bounded `worker` whenever subagent tools are available, then run focused verification.
|
|
16
16
|
8. For Heavy Path, follow the plan's staged implementation and review gates without role-mapping shortcuts.
|
|
17
|
-
9.
|
|
17
|
+
9. Delegate actual implementation edits to `worker` with clear file ownership on both Light Path and Heavy Path whenever subagent tools are available. When the subagent tool provides a progress-reporting channel, require subagents to report status to the orchestrator when starting work, when deciding or confirming direction, during periodic progress, and when finishing; immediately relay received status events to the user. If no mid-run reporting channel exists, relay observable events such as assignment, waiting, and final completion. Require delegated subagents to provide a final report before leaving; after capturing the final report and evidence, close or release the completed subagent, then review the final report and evidence before marking the work complete. 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. If subagent tools are unavailable, the main agent takes over implementation directly and records that takeover in evidence.
|
|
18
18
|
10. Re-run module acceptance verification.
|
|
19
19
|
11. Re-run surface integration verification.
|
|
20
20
|
12. Record tool readiness and verification evidence in `docs/plan/<topic>.md` and update `PLAN.md`.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cairn",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.10",
|
|
4
4
|
"description": "Token-efficient agent harness with tool readiness for Codex, Claude Code, and Antigravity.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "WkNam"
|
|
@@ -26,7 +26,11 @@
|
|
|
26
26
|
"Run cairn-toolcheck before planning implementation work.",
|
|
27
27
|
"Before non-trivial implementation, run cairn-plan for this task without asking me for discoverable facts.",
|
|
28
28
|
"When planning, first understand the whole work, then classify it into small executable tasks; if a task needs further breakdown, split it into sub-tasks.",
|
|
29
|
+
"The user-called/main agent is the orchestrator: plan, assign, verify, and record evidence; actual implementation edits must be delegated to worker subagents whenever subagent tools are available, on both Light Path and Heavy Path.",
|
|
30
|
+
"When the subagent tool provides a progress-reporting channel, subagents report status to the orchestrator when starting work, when deciding or confirming direction, during periodic progress, and when finishing; the orchestrator must immediately relay received status events to the user. If no mid-run reporting channel exists, the orchestrator relays observable events such as assignment, waiting, and final completion.",
|
|
31
|
+
"When a delegated subagent finishes, it must provide its final report before leaving; after the orchestrator captures the final report and evidence, the orchestrator must close or release the completed subagent, then review the final report and evidence before marking the work complete.",
|
|
29
32
|
"When subagent tools are available, each agent may recursively delegate bounded sub-tasks to subagents; every child subagent must read MEMORY.md, keep scope, and preserve others' edits.",
|
|
33
|
+
"If subagent tools are unavailable, the main agent takes over implementation directly and records that takeover in evidence; do not stop before local implementation solely because subagent tools are unavailable.",
|
|
30
34
|
"Record Light Path or Heavy Path complexity triage in docs/plan/<topic>.md before mutating files.",
|
|
31
35
|
"Run cairn-work from the current PLAN.md and pass dry-run/check, module acceptance, and surface integration gates.",
|
|
32
36
|
"If I ask a side question, status question, or narrow clarification while a plan or task is still active, answer it briefly and then resume the previous active work unless I explicitly ask you to pause, stop, or switch tasks."
|
package/README.ko.md
CHANGED
|
@@ -17,16 +17,20 @@ Cairn은 도구 준비 상태도 작업의 일부로 다룹니다. LSP, typechec
|
|
|
17
17
|
|
|
18
18
|
Cairn은 LazyCodex(`https://github.com/code-yeongyu/lazycodex`)의 영향을 받았습니다. 영향을 받은 부분은 설치 가능한 에이전트 하네스 구조, Codex hook trust/setup 처리, project memory, planning skills, 실행 가능한 workflow commands, diagnostics, 그리고 local agent surfaces 전반의 skill/agent packaging입니다.
|
|
19
19
|
|
|
20
|
-
Cairn은 실행 정책에서는 LazyCodex와 다릅니다. LazyCodex의 role-chain execution model이나 open-ended completion loop는 채택하지 않습니다. 대신 Light/Heavy Path triage, 제한된 `explorer`/`worker` 위임, 두 검증 게이트, 명시적 stop condition을 사용합니다.
|
|
20
|
+
Cairn은 실행 정책에서는 LazyCodex와 다릅니다. LazyCodex의 role-chain execution model이나 open-ended completion loop는 채택하지 않습니다. 대신 Light/Heavy Path triage, main-agent orchestration, 제한된 `explorer`/`worker` 위임, 두 검증 게이트, 명시적 stop condition을 사용합니다.
|
|
21
21
|
|
|
22
22
|
## Complexity Triage
|
|
23
23
|
|
|
24
24
|
모든 구현 작업은 agent, plugin, delegated workflow 지침을 적용하기 전에 먼저 complexity triage를 거칩니다. triage는 사용자에게 묻지 않고 저장소 탐색, 예상 변경 범위, 위험 신호를 기준으로 결정합니다.
|
|
25
25
|
|
|
26
|
-
- Light Path: 기존 아키텍처 레이어 안의 좁은 변경입니다.
|
|
26
|
+
- Light Path: 기존 아키텍처 레이어 안의 좁은 변경입니다. 기본값이지만, 사용자가 호출한 main agent는 여전히 orchestration을 맡고 subagent 도구가 있으면 구현 편집을 하나의 제한된 `worker`에 위임한 뒤 검증 게이트를 유지합니다.
|
|
27
27
|
- Heavy Path: 새 디렉터리/모듈/레이어, 새 도메인 모델/서비스/추상화, 보안/세션/인증, 외부 API/message queue/payment, DB schema/migration, concurrency/transaction/cache 변경, 여러 도메인 리팩터링, 또는 사용자의 extra-care 요청입니다.
|
|
28
28
|
|
|
29
|
-
선택된 path와 근거는 계획 산출물이 있을 때 `docs/plan/<topic>.md`에 기록합니다. Light Path에서도 두 검증 게이트는 유지됩니다.
|
|
29
|
+
선택된 path와 근거는 계획 산출물이 있을 때 `docs/plan/<topic>.md`에 기록합니다. Light Path에서도 두 검증 게이트는 유지됩니다. subagent 도구가 없으면 main agent가 implementation을 직접 인계하고, 그 takeover를 evidence에 기록합니다.
|
|
30
|
+
|
|
31
|
+
subagent 도구가 progress-reporting channel을 제공하면 subagent는 작업 시작, 방향 결정/확인, 주기적 진행, 완료 시점에 orchestrator에게 상태를 보고합니다. orchestrator는 받은 status event를 즉시 사용자에게 전달합니다. mid-run reporting channel이 없으면 orchestrator는 할당, 대기, 최종 완료처럼 관측 가능한 event를 사용자에게 전달합니다.
|
|
32
|
+
|
|
33
|
+
위임받은 subagent는 작업을 마치면 퇴근 전에 final report를 남깁니다. orchestrator가 final report와 evidence를 회수한 뒤 완료된 subagent를 close/release합니다. 그 다음 orchestrator가 final report와 evidence를 검토한 뒤 작업 완료 여부를 판단합니다.
|
|
30
34
|
|
|
31
35
|
## Tool Readiness
|
|
32
36
|
|
|
@@ -124,7 +128,7 @@ Cairn의 재사용 지침은 전역 사용을 위해 영어로 작성됩니다.
|
|
|
124
128
|
## Delegation
|
|
125
129
|
|
|
126
130
|
- `explorer`: 가능한 경우 read-only codebase discovery, impact analysis, pattern search, read-only verification을 처리합니다.
|
|
127
|
-
- `worker`: 명확한 file ownership이 있는
|
|
128
|
-
- Main session: 다음 단계가 즉시 결과에 의존하는 urgent blocking work
|
|
131
|
+
- `worker`: 명확한 file ownership이 있는 실제 implementation edit 또는 verification task를 처리합니다.
|
|
132
|
+
- Main session: orchestrate, verify, evidence 기록을 맡으며, 다음 단계가 즉시 결과에 의존하는 urgent non-implementation blocking work만 로컬에서 처리합니다. 다만 subagent 도구가 없으면 main agent가 implementation을 직접 인계합니다.
|
|
129
133
|
|
|
130
134
|
모든 delegation prompt는 TASK, EXPECTED OUTCOME, REQUIRED TOOLS, MUST DO, MUST NOT DO, CONTEXT 여섯 섹션을 사용합니다.
|
package/README.md
CHANGED
|
@@ -25,16 +25,20 @@ Cairn also treats tool readiness as part of the work. LSP, typecheck, lint, dry-
|
|
|
25
25
|
|
|
26
26
|
Cairn is influenced by LazyCodex (`https://github.com/code-yeongyu/lazycodex`). The borrowed ideas are the installable agent-harness shape, Codex hook trust/setup handling, project memory, planning skills, executable workflow commands, diagnostics, and skill/agent packaging across local agent surfaces.
|
|
27
27
|
|
|
28
|
-
Cairn intentionally diverges from LazyCodex in the execution policy. It does not adopt LazyCodex's role-chain execution model or open-ended completion loops. Cairn uses Light/Heavy Path triage, bounded `explorer`/`worker` delegation, two verification gates, and explicit stop conditions instead.
|
|
28
|
+
Cairn intentionally diverges from LazyCodex in the execution policy. It does not adopt LazyCodex's role-chain execution model or open-ended completion loops. Cairn uses Light/Heavy Path triage, main-agent orchestration, bounded `explorer`/`worker` delegation, two verification gates, and explicit stop conditions instead.
|
|
29
29
|
|
|
30
30
|
## Complexity Triage
|
|
31
31
|
|
|
32
32
|
Every implementation task passes complexity triage first, before agent, plugin, or delegated workflow guidance. Triage is decided from repository exploration, expected change scope, and risk signals without asking the user.
|
|
33
33
|
|
|
34
|
-
- Light Path: narrow changes inside existing architecture layers. This is the default.
|
|
34
|
+
- Light Path: narrow changes inside existing architecture layers. This is the default. The user-called/main agent still orchestrates and delegates implementation edits to one bounded `worker` whenever subagent tools are available, then keeps the verification gate.
|
|
35
35
|
- Heavy Path: new directory/module/layer, new domain model/service/abstraction, security/session/auth, external API/message queue/payment, DB schema/migration, concurrency/transaction/cache changes, cross-domain refactor, or explicit extra-care request.
|
|
36
36
|
|
|
37
|
-
The selected path and rationale are recorded in `docs/plan/<topic>.md` when a plan artifact exists. Even on Light Path, the two verification gates remain.
|
|
37
|
+
The selected path and rationale are recorded in `docs/plan/<topic>.md` when a plan artifact exists. Even on Light Path, the two verification gates remain. If subagent tools are unavailable, the main agent takes over implementation directly and records that takeover in evidence.
|
|
38
|
+
|
|
39
|
+
When the subagent tool provides a progress-reporting channel, subagents report status to the orchestrator when starting work, when deciding or confirming direction, during periodic progress, and when finishing. The orchestrator immediately relays received status events to the user. If no mid-run reporting channel exists, the orchestrator relays observable events such as assignment, waiting, and final completion.
|
|
40
|
+
|
|
41
|
+
When a delegated subagent finishes, it provides a final report before leaving. After the orchestrator captures that final report and evidence, the completed subagent is closed or released. The orchestrator then reviews the final report and evidence before marking the work complete.
|
|
38
42
|
|
|
39
43
|
## Tool Readiness
|
|
40
44
|
|
|
@@ -132,7 +136,7 @@ Cairn's reusable instructions are written in English for global use. User-visibl
|
|
|
132
136
|
## Delegation
|
|
133
137
|
|
|
134
138
|
- `explorer`: handles read-only codebase discovery, impact analysis, pattern searches, and read-only verification when available.
|
|
135
|
-
- `worker`: handles
|
|
136
|
-
- Main session: keeps urgent blocking work local when the next step depends immediately on the result.
|
|
139
|
+
- `worker`: handles actual implementation edits or verification tasks with clear file ownership.
|
|
140
|
+
- Main session: orchestrates, verifies, and records evidence; it keeps only urgent non-implementation blocking work local when the next step depends immediately on the result, except that unavailable subagent tools make the main agent take over implementation directly.
|
|
137
141
|
|
|
138
142
|
Every delegation prompt uses six sections: TASK, EXPECTED OUTCOME, REQUIRED TOOLS, MUST DO, MUST NOT DO, CONTEXT.
|
package/commands/cairn-plan.md
CHANGED
|
@@ -18,7 +18,7 @@ Procedure:
|
|
|
18
18
|
8. Run complexity triage before applying agent, plugin, or delegated workflow guidance, and record it before mutating files.
|
|
19
19
|
9. Use Light Path by default unless a Heavy Path condition clearly applies.
|
|
20
20
|
10. Use `explorer` for independent read-only discovery, impact analysis, pattern search, and read-only verification when available.
|
|
21
|
-
11. Use `worker` for
|
|
21
|
+
11. Treat the user-called/main agent as the orchestrator: it plans, assigns, verifies, relays received subagent status events or observable lifecycle events to the user, and records evidence. Use `worker` for actual implementation edits with clear file ownership whenever subagent tools are available, on both Light Path and Heavy Path. When the subagent tool provides a progress-reporting channel, require subagents to report status when starting work, when deciding or confirming direction, during periodic progress, and when finishing; immediately relay received status events to the user. If no mid-run reporting channel exists, relay observable events such as assignment, waiting, and final completion. Require delegated subagents to provide a final report before leaving; after capturing the final report and evidence, close or release the completed subagent, then review the final report and evidence before marking the work complete. 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. If subagent tools are unavailable, the main agent takes over implementation directly and records that takeover in evidence.
|
|
22
22
|
12. Write `docs/plan/<topic>.md`.
|
|
23
23
|
13. Add the topic link and status to `PLAN.md`.
|
|
24
24
|
14. Put the selected Light/Heavy Path, checked Heavy Path signals, tool readiness, module acceptance verification, and surface integration verification on every module task.
|
package/commands/cairn-work.md
CHANGED
|
@@ -14,9 +14,9 @@ Procedure:
|
|
|
14
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
|
-
7. For Light Path,
|
|
17
|
+
7. For Light Path, keep the user-called/main agent in the orchestrator role and delegate implementation edits to one bounded `worker` whenever subagent tools are available, 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.
|
|
19
|
+
9. Delegate actual implementation edits to `worker` with clear file ownership on both Light Path and Heavy Path whenever subagent tools are available. When the subagent tool provides a progress-reporting channel, require subagents to report status to the orchestrator when starting work, when deciding or confirming direction, during periodic progress, and when finishing; immediately relay received status events to the user. If no mid-run reporting channel exists, relay observable events such as assignment, waiting, and final completion. Require delegated subagents to provide a final report before leaving; after capturing the final report and evidence, close or release the completed subagent, then review the final report and evidence before marking the work complete. 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. If subagent tools are unavailable, the main agent takes over implementation directly and records that takeover in evidence.
|
|
20
20
|
10. For Heavy Path, run the recorded automated test command and record explicit `Tests:` evidence before any completion claim.
|
|
21
21
|
11. Re-run module acceptance verification.
|
|
22
22
|
12. Re-run surface integration verification.
|
|
@@ -17,6 +17,11 @@ The goal is not to make prompts long by model. The goal is to stabilize the same
|
|
|
17
17
|
- Keep detailed judgment in `docs/memory/`, `docs/plan/`, and `docs/model-guidance/`.
|
|
18
18
|
- Preserve proper nouns, file names, variable names, service names, alert names, MCP tool names, and agent names exactly as written.
|
|
19
19
|
- Select Light Path or Heavy Path before implementation.
|
|
20
|
+
- Treat the user-called/main agent as the orchestrator: it plans, assigns, verifies, and records evidence.
|
|
21
|
+
- Delegate actual implementation edits to `worker` subagents whenever subagent tools are available, regardless of Light Path or Heavy Path.
|
|
22
|
+
- When the subagent tool provides a progress-reporting channel, require subagents to report status to the orchestrator when starting work, when deciding or confirming direction, during periodic progress, and when finishing; the orchestrator must immediately relay received status events to the user. If no mid-run reporting channel exists, the orchestrator relays observable events such as assignment, waiting, and final completion.
|
|
23
|
+
- When a delegated subagent finishes, require a final report before it leaves; after capturing the final report and evidence, the orchestrator closes or releases the completed subagent, then reviews the final report and evidence before marking the work complete.
|
|
24
|
+
- If subagent tools are unavailable, the main agent takes over implementation directly and records that takeover in evidence.
|
|
20
25
|
- Detect required LSP, typecheck, lint, dry-run, and verification tools before implementation.
|
|
21
26
|
- Missing required tools must trigger a project-local, repository-native, or ephemeral install attempt before they can be treated as unavailable.
|
|
22
27
|
- Every implementation task must pass module acceptance verification and surface integration verification.
|
|
@@ -27,5 +32,5 @@ The goal is not to make prompts long by model. The goal is to stabilize the same
|
|
|
27
32
|
## Delegation Defaults
|
|
28
33
|
|
|
29
34
|
- `explorer`: use for read-only codebase discovery, impact analysis, pattern searches, and read-only verification when available.
|
|
30
|
-
- `worker`: use for
|
|
31
|
-
- Main session: keep urgent blocking work local when the next step depends immediately on the result.
|
|
35
|
+
- `worker`: use for actual implementation edits or verification tasks with clear file ownership.
|
|
36
|
+
- Main session: orchestrate, immediately relay received subagent status events or observable subagent lifecycle events to the user, verify, and record evidence; keep only urgent non-implementation blocking work local when the next step depends immediately on the result, except that unavailable subagent tools make the main agent take over implementation directly.
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
# Codex Model Guidance
|
|
2
2
|
|
|
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.
|
|
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. When Codex is the user-called/main agent, it orchestrates instead of making implementation edits directly whenever subagent tools are available.
|
|
4
4
|
|
|
5
5
|
## Use Strengths
|
|
6
6
|
|
|
7
7
|
- Quickly handle implementation tasks with clear file scope.
|
|
8
|
+
- As `worker`, make actual implementation edits within the assigned file scope.
|
|
9
|
+
- As the user-called/main agent, delegate implementation edits to `worker` whenever subagent tools are available.
|
|
10
|
+
- As a subagent, report status to the orchestrator when the current subagent tool provides a progress-reporting channel, including when starting work, when deciding or confirming direction, during periodic progress, and when finishing.
|
|
11
|
+
- As a subagent, provide a final report before leaving when assigned work is complete.
|
|
8
12
|
- Read existing patterns and make minimal changes in the same style.
|
|
9
13
|
- Run repository tool readiness checks and bootstrap missing command-line tools.
|
|
10
14
|
- Capture module acceptance verification and surface integration verification from command results.
|
|
@@ -14,6 +18,7 @@ Codex-family models are strong at small implementation tasks, explicit tool use,
|
|
|
14
18
|
## Adjustment Rules
|
|
15
19
|
|
|
16
20
|
- Do not start implementation without a plan.
|
|
21
|
+
- Do not stop before local implementation solely because subagent tools are unavailable; the main agent takes over implementation directly and records that takeover in evidence.
|
|
17
22
|
- Keep work units small. Split large changes into smaller plan tasks.
|
|
18
23
|
- If `apply_patch` is unstable in the environment, use an editing tool or a clear file update path.
|
|
19
24
|
- Do not duplicate the same exploration. Wait for already delegated searches.
|
|
@@ -34,7 +39,10 @@ Codex-family models are strong at small implementation tasks, explicit tool use,
|
|
|
34
39
|
|
|
35
40
|
### Implementation
|
|
36
41
|
|
|
37
|
-
-
|
|
42
|
+
- If acting as the user-called/main agent, orchestrate the work and delegate actual implementation edits to `worker` whenever subagent tools are available, regardless of Light Path or Heavy Path.
|
|
43
|
+
- If acting as the user-called/main agent, immediately relay received subagent status events to the user. If no mid-run reporting channel exists, relay observable events such as assignment, waiting, and final completion.
|
|
44
|
+
- If acting as the user-called/main agent, close or release completed subagents after capturing their final report and evidence, then review the final report and evidence before marking the work complete.
|
|
45
|
+
- If acting as `worker`, edit only within the file scope listed in the plan.
|
|
38
46
|
- Confirm required tools are available. Install or bootstrap missing required tools before implementation.
|
|
39
47
|
- Run the recorded dry-run or check command before external-state mutation when applicable.
|
|
40
48
|
- After changes, run both module acceptance verification and surface integration verification.
|
|
@@ -46,3 +54,6 @@ Codex-family models are strong at small implementation tasks, explicit tool use,
|
|
|
46
54
|
- Handle search, file listing, command checks, and QA artifact capture.
|
|
47
55
|
- Use `explorer` for independent read-only discovery or read-only verification when available.
|
|
48
56
|
- When using `worker`, state clear file ownership and tell the worker not to revert others' edits.
|
|
57
|
+
- Tell subagents to report status when the tool provides a progress-reporting channel: starting work, deciding or confirming direction, periodic progress, and finishing.
|
|
58
|
+
- Tell subagents to provide a final report before leaving, then close or release them after evidence is captured. Review the final report and evidence before marking the work complete.
|
|
59
|
+
- If subagent tools are unavailable, the main agent takes over implementation directly and records that takeover in evidence.
|
package/package.json
CHANGED
package/scripts/cairn-state.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { realpathSync } from "node:fs";
|
|
3
|
-
import { mkdir, readFile, writeFile } from "node:fs/promises";
|
|
3
|
+
import { mkdir, readFile, readdir, writeFile } from "node:fs/promises";
|
|
4
4
|
import { isAbsolute, join, relative, resolve } from "node:path";
|
|
5
5
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
6
6
|
|
|
@@ -92,7 +92,7 @@ export async function runStateResult(event = "manual", { root = process.env.HARN
|
|
|
92
92
|
};
|
|
93
93
|
}
|
|
94
94
|
if (event === "stop" || event === "subagent-stop") {
|
|
95
|
-
const pending = await
|
|
95
|
+
const pending = await pendingPlanItems(resolvedRoot);
|
|
96
96
|
if (pending.length > 0) {
|
|
97
97
|
return {
|
|
98
98
|
status: 1,
|
|
@@ -119,32 +119,50 @@ async function writeIfMissing(path, content) {
|
|
|
119
119
|
}
|
|
120
120
|
}
|
|
121
121
|
|
|
122
|
-
async function
|
|
122
|
+
async function pendingPlanItems(root) {
|
|
123
123
|
const planPath = join(root, "PLAN.md");
|
|
124
124
|
const plan = await readFile(planPath, "utf8");
|
|
125
125
|
const activePlans = markdownLinksToPlanFiles(section(plan, "Active Plans"));
|
|
126
|
+
const completedPlans = markdownLinksToPlanFiles(section(plan, "Completed Plans"));
|
|
127
|
+
const indexedPlans = new Map();
|
|
128
|
+
for (const relativePath of activePlans) indexedPlans.set(relativePath, "active");
|
|
129
|
+
for (const relativePath of completedPlans) {
|
|
130
|
+
if (!indexedPlans.has(relativePath)) indexedPlans.set(relativePath, "completed");
|
|
131
|
+
}
|
|
132
|
+
for (const relativePath of await docsPlanFiles(root)) {
|
|
133
|
+
if (!indexedPlans.has(relativePath)) indexedPlans.set(relativePath, "unindexed");
|
|
134
|
+
}
|
|
126
135
|
const pending = [];
|
|
127
136
|
|
|
128
|
-
for (const relativePath of
|
|
137
|
+
for (const [relativePath, indexState] of indexedPlans) {
|
|
129
138
|
const path = resolve(root, relativePath);
|
|
130
139
|
const pathFromRoot = relative(root, path);
|
|
131
140
|
if (pathFromRoot.startsWith("..") || isAbsolute(pathFromRoot)) continue;
|
|
132
141
|
const text = await readPlanFile(path);
|
|
133
142
|
if (text === null) {
|
|
134
|
-
pending.push({ path: relativePath,
|
|
143
|
+
pending.push({ path: relativePath, indexIssues: [`${indexState} plan file is missing`], unchecked: [], emptyEvidence: [] });
|
|
135
144
|
continue;
|
|
136
145
|
}
|
|
146
|
+
const indexIssues = indexState === "unindexed" ? ["not linked in PLAN.md Active Plans or Completed Plans"] : [];
|
|
137
147
|
const unchecked = [...text.matchAll(/^\s*-\s+\[\s\]\s+(.+)$/gm)].map((match) => match[1].trim());
|
|
138
148
|
const emptyEvidence = emptyEvidenceItems(text);
|
|
139
149
|
const missingHeavyPathTests = heavyPathMissingTests(text);
|
|
140
|
-
if (unchecked.length > 0 || emptyEvidence.length > 0 || missingHeavyPathTests.length > 0) {
|
|
141
|
-
pending.push({ path: relativePath, unchecked, emptyEvidence, missingHeavyPathTests });
|
|
150
|
+
if (indexIssues.length > 0 || unchecked.length > 0 || emptyEvidence.length > 0 || missingHeavyPathTests.length > 0) {
|
|
151
|
+
pending.push({ path: relativePath, indexIssues, unchecked, emptyEvidence, missingHeavyPathTests });
|
|
142
152
|
}
|
|
143
153
|
}
|
|
144
154
|
|
|
145
155
|
return pending;
|
|
146
156
|
}
|
|
147
157
|
|
|
158
|
+
async function docsPlanFiles(root) {
|
|
159
|
+
const entries = await readdir(join(root, "docs", "plan"), { withFileTypes: true });
|
|
160
|
+
return entries
|
|
161
|
+
.filter((entry) => entry.isFile() && entry.name.endsWith(".md"))
|
|
162
|
+
.map((entry) => `docs/plan/${entry.name}`)
|
|
163
|
+
.sort();
|
|
164
|
+
}
|
|
165
|
+
|
|
148
166
|
async function readPlanFile(path) {
|
|
149
167
|
try {
|
|
150
168
|
return await readFile(path, "utf8");
|
|
@@ -206,6 +224,7 @@ function stopBlockedMessage({ event, ko, pending }) {
|
|
|
206
224
|
|
|
207
225
|
function formatPendingItem(item) {
|
|
208
226
|
const reasons = [
|
|
227
|
+
...(item.indexIssues ?? []).map((label) => `index: ${label}`),
|
|
209
228
|
...item.unchecked.map((label) => `unchecked: ${label}`),
|
|
210
229
|
...item.emptyEvidence.map((label) => `empty evidence: ${label}`),
|
|
211
230
|
...(item.missingHeavyPathTests ?? []).map((label) => `missing tests: ${label}`),
|
package/scripts/cairn.mjs
CHANGED
|
@@ -56,60 +56,63 @@ function isCliEntry() {
|
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
+
const planExecutionPolicy = "The user-called/main agent is the orchestrator; implementation edits go to worker subagents whenever subagent tools are available. When the subagent tool provides a progress-reporting channel, subagents report status to the orchestrator when starting work, when deciding or confirming direction, during periodic progress, and when finishing; the orchestrator must immediately relay received status events to the user. If no mid-run reporting channel exists, the orchestrator relays observable events such as assignment, waiting, and final completion. When a delegated subagent finishes, it must provide its final report before leaving; after the orchestrator captures the final report and evidence, the orchestrator must close or release the completed subagent, then review the final report and evidence before marking the work complete. If subagent tools are unavailable, the main agent takes over implementation directly and records that takeover in evidence.";
|
|
60
|
+
const workExecutionPolicy = "The user-called/main agent orchestrates, while worker subagents perform implementation edits whenever subagent tools are available. When the subagent tool provides a progress-reporting channel, subagents report status to the orchestrator when starting work, when deciding or confirming direction, during periodic progress, and when finishing; the orchestrator must immediately relay received status events to the user. If no mid-run reporting channel exists, the orchestrator relays observable events such as assignment, waiting, and final completion. When a delegated subagent finishes, it must provide its final report before leaving; after the orchestrator captures the final report and evidence, the orchestrator must close or release the completed subagent, then review the final report and evidence before marking the work complete. If subagent tools are unavailable, the main agent takes over implementation directly and records that takeover in evidence.";
|
|
61
|
+
|
|
59
62
|
const messages = {
|
|
60
63
|
en: {
|
|
61
64
|
memory: "Use the cairn-memory skill. Keep MEMORY.md as a short index and write details to docs/memory/<domain>.md.",
|
|
62
|
-
plan:
|
|
63
|
-
work:
|
|
65
|
+
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. ${planExecutionPolicy}`,
|
|
66
|
+
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: ${workExecutionPolicy} 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
67
|
review: "Use the cairn-review skill. Compare evidence against PLAN.md and MEMORY.md.",
|
|
65
68
|
usage: "Usage: cairn install|upgrade|doctor|uninstall|init|memory|plan|work|review|toolcheck",
|
|
66
69
|
},
|
|
67
70
|
ko: {
|
|
68
71
|
memory: "cairn-memory 스킬을 사용하세요. MEMORY.md는 짧은 색인으로, 상세 내용은 docs/memory/<domain>.md에 기록합니다.",
|
|
69
|
-
plan:
|
|
70
|
-
work:
|
|
72
|
+
plan: `중요 구현 전에는 cairn-plan 스킬을 사용하세요. 모든 에이전트는 도메인 지식과 저장소 정책을 위해 프로젝트 루트 MEMORY.md를 먼저 읽어야 합니다. 먼저 전체 작업을 파악한 뒤 실행 가능한 task와 필요한 sub-task로 분류합니다. PLAN.md는 색인으로, 상세 계획은 docs/plan/<topic>.md에 기록하며 파일 변경 전 Light/Heavy Path 트리아지를 남깁니다. ${planExecutionPolicy}`,
|
|
73
|
+
work: `계획이 있을 때만 cairn-work 스킬을 사용하세요. 모든 에이전트는 도메인 지식과 저장소 정책을 위해 프로젝트 루트 MEMORY.md를 먼저 읽어야 합니다. 기록된 Light/Heavy Path 경로로 하나의 모듈 작업을 실행합니다. ${workExecutionPolicy} dry-run/check, 모듈, 표면 증거를 확보합니다. 작업 중 사용자가 곁가지 질문을 하면 짧게 답한 뒤, 명시적으로 일시중지/중단/작업 전환을 요청한 경우가 아니면 이전 active work를 계속합니다.`,
|
|
71
74
|
review: "cairn-review 스킬을 사용하세요. PLAN.md와 MEMORY.md 기준으로 증거를 비교합니다.",
|
|
72
75
|
usage: "사용법: cairn install|upgrade|doctor|uninstall|init|memory|plan|work|review|toolcheck",
|
|
73
76
|
},
|
|
74
77
|
ja: {
|
|
75
78
|
memory: "cairn-memory スキルを使用してください。MEMORY.md は短い索引にし、詳細は docs/memory/<domain>.md に記録します。",
|
|
76
|
-
plan:
|
|
77
|
-
work:
|
|
79
|
+
plan: `cairn-plan スキルを使用してください。PLAN.md は索引にし、詳細計画は docs/plan/<topic>.md に記録します。${planExecutionPolicy}`,
|
|
80
|
+
work: `cairn-work スキルを使用してください。1つのモジュールスライスを実行し、モジュール証拠と表面証拠を取得します。${workExecutionPolicy}`,
|
|
78
81
|
review: "cairn-review スキルを使用してください。PLAN.md と MEMORY.md に照らして証拠を比較します。",
|
|
79
82
|
usage: "使い方: cairn install|upgrade|doctor|uninstall|init|memory|plan|work|review|toolcheck",
|
|
80
83
|
},
|
|
81
84
|
zh: {
|
|
82
85
|
memory: "使用 cairn-memory skill。将 MEMORY.md 保持为简短索引,并将详细内容写入 docs/memory/<domain>.md。",
|
|
83
|
-
plan:
|
|
84
|
-
work:
|
|
86
|
+
plan: `使用 cairn-plan skill。将 PLAN.md 保持为索引,并将详细计划写入 docs/plan/<topic>.md。${planExecutionPolicy}`,
|
|
87
|
+
work: `使用 cairn-work skill。执行一个模块切片,并收集模块证据。${workExecutionPolicy}`,
|
|
85
88
|
review: "使用 cairn-review skill。根据 PLAN.md 和 MEMORY.md 对比证据。",
|
|
86
89
|
usage: "用法: cairn install|upgrade|doctor|uninstall|init|memory|plan|work|review|toolcheck",
|
|
87
90
|
},
|
|
88
91
|
es: {
|
|
89
92
|
memory: "Usa la skill cairn-memory. Mantén MEMORY.md como un índice breve y escribe los detalles en docs/memory/<domain>.md.",
|
|
90
|
-
plan:
|
|
91
|
-
work:
|
|
93
|
+
plan: `Usa la skill cairn-plan. Mantén PLAN.md como índice y escribe los planes detallados en docs/plan/<topic>.md. ${planExecutionPolicy}`,
|
|
94
|
+
work: `Usa la skill cairn-work. Ejecuta un solo segmento de módulo y captura evidencia de módulo y de superficie. ${workExecutionPolicy}`,
|
|
92
95
|
review: "Usa la skill cairn-review. Compara la evidencia con PLAN.md y MEMORY.md.",
|
|
93
96
|
usage: "Uso: cairn install|upgrade|doctor|uninstall|init|memory|plan|work|review|toolcheck",
|
|
94
97
|
},
|
|
95
98
|
fr: {
|
|
96
99
|
memory: "Utilisez la skill cairn-memory. Gardez MEMORY.md comme index court et écrivez les détails dans docs/memory/<domain>.md.",
|
|
97
|
-
plan:
|
|
98
|
-
work:
|
|
100
|
+
plan: `Utilisez la skill cairn-plan. Gardez MEMORY.md comme index et écrivez les plans détaillés dans docs/plan/<topic>.md. ${planExecutionPolicy}`,
|
|
101
|
+
work: `Utilisez la skill cairn-work. Exécutez une tranche de module et capturez les preuves de module et de surface. ${workExecutionPolicy}`,
|
|
99
102
|
review: "Utilisez la skill cairn-review. Comparez les preuves avec PLAN.md et MEMORY.md.",
|
|
100
103
|
usage: "Utilisation: cairn install|upgrade|doctor|uninstall|init|memory|plan|work|review|toolcheck",
|
|
101
104
|
},
|
|
102
105
|
de: {
|
|
103
106
|
memory: "Verwenden Sie die Skill cairn-memory. Halten Sie MEMORY.md als kurzen Index und schreiben Sie Details nach docs/memory/<domain>.md.",
|
|
104
|
-
plan:
|
|
105
|
-
work:
|
|
107
|
+
plan: `Verwenden Sie die Skill cairn-plan. Halten Sie MEMORY.md als Index und schreiben Sie Detailpläne nach docs/plan/<topic>.md. ${planExecutionPolicy}`,
|
|
108
|
+
work: `Verwenden Sie die Skill cairn-work. Führen Sie einen Modulabschnitt aus und erfassen Sie Modul- und Oberflächenbelege. ${workExecutionPolicy}`,
|
|
106
109
|
review: "Verwenden Sie die Skill cairn-review. Vergleichen Sie Belege mit PLAN.md und MEMORY.md.",
|
|
107
110
|
usage: "Verwendung: cairn install|upgrade|doctor|uninstall|init|memory|plan|work|review|toolcheck",
|
|
108
111
|
},
|
|
109
112
|
pt: {
|
|
110
113
|
memory: "Use a skill cairn-memory. Mantenha MEMORY.md como um índice curto e escreva detalhes em docs/memory/<domain>.md.",
|
|
111
|
-
plan:
|
|
112
|
-
work:
|
|
114
|
+
plan: `Use a skill cairn-plan. Mantenha MEMORY.md como índice e escreva planos detalhados em docs/plan/<topic>.md. ${planExecutionPolicy}`,
|
|
115
|
+
work: `Use a skill cairn-work. Execute uma fatia de módulo e capture evidências de módulo e de superfície. ${workExecutionPolicy}`,
|
|
113
116
|
review: "Use a skill cairn-review. Compare evidências com PLAN.md e MEMORY.md.",
|
|
114
117
|
usage: "Uso: cairn install|upgrade|doctor|uninstall|init|memory|plan|work|review|toolcheck",
|
|
115
118
|
},
|
|
@@ -31,9 +31,13 @@ Plan from the whole work down. First understand the full requested outcome and a
|
|
|
31
31
|
10. Run complexity triage before applying workflow guidance from agents, plugins, or delegated roles. Record the route before any implementation task.
|
|
32
32
|
11. Delegate according to the selected path and model guidance instead of asking the user.
|
|
33
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.
|
|
34
|
-
-
|
|
34
|
+
- Treat the user-called/main agent as the orchestrator: it plans, assigns, verifies, and records evidence.
|
|
35
|
+
- Use `worker` for actual implementation edits with clear file ownership whenever subagent tools are available, on both Light Path and Heavy Path.
|
|
36
|
+
- When the subagent tool provides a progress-reporting channel, require subagents to report status to the orchestrator when starting work, when deciding or confirming direction, during periodic progress, and when finishing; the orchestrator must immediately relay received status events to the user. If no mid-run reporting channel exists, relay observable events such as assignment, waiting, and final completion.
|
|
37
|
+
- Require delegated subagents to provide a final report before leaving; after capturing the final report and evidence, close or release the completed subagent, then review the final report and evidence before marking the work complete.
|
|
35
38
|
- 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.
|
|
36
|
-
-
|
|
39
|
+
- If subagent tools are unavailable, the main agent takes over implementation directly and records that takeover in evidence; do not stop before local implementation solely because subagent tools are unavailable.
|
|
40
|
+
- Keep urgent non-implementation blocking work local when the next step depends immediately on the result.
|
|
37
41
|
- 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
42
|
12. Create `docs/plan/<topic>.md` from `templates/work-plan.md`.
|
|
39
43
|
13. Add a short index entry to `PLAN.md`.
|
|
@@ -47,7 +51,7 @@ This decision takes priority over plugin, agent, or delegated workflow guidance
|
|
|
47
51
|
|
|
48
52
|
### Light Path
|
|
49
53
|
|
|
50
|
-
Use Light Path for narrow changes inside existing architecture layers. Skip planning/review agents
|
|
54
|
+
Use Light Path for narrow changes inside existing architecture layers. Skip planning/review agents when appropriate, but actual implementation edits still go to `worker` whenever subagent tools are available. Keep the verification gate.
|
|
51
55
|
|
|
52
56
|
Light Path conditions:
|
|
53
57
|
|
|
@@ -64,7 +68,7 @@ Light Path examples:
|
|
|
64
68
|
- Change copy text or constants.
|
|
65
69
|
- Fix one clearly scoped bug.
|
|
66
70
|
|
|
67
|
-
Light Path flow:
|
|
71
|
+
Light Path flow: main-agent orchestration -> bounded `worker` implementation when subagent tools are available -> main-agent takeover when subagent tools are unavailable -> focused verification by the main agent or a scoped verification `worker` -> report. If there is no plan artifact, use the original user request and the diff as the verification baseline.
|
|
68
72
|
|
|
69
73
|
### Heavy Path
|
|
70
74
|
|
|
@@ -92,12 +96,16 @@ Heavy Path flow: plan -> pre-implementation review -> bounded `worker` implement
|
|
|
92
96
|
- Heavy Path conditions found, if any.
|
|
93
97
|
- Heavy Path conditions checked and not found.
|
|
94
98
|
- Roles or delegation omitted in Light Path and why.
|
|
99
|
+
- Any unavailable subagent tool main-agent takeover and its evidence record.
|
|
95
100
|
- Pre-implementation decisions that review must resolve in Heavy Path.
|
|
96
101
|
|
|
97
102
|
## Planning Rules
|
|
98
103
|
|
|
99
104
|
- Every plan must be decision-complete.
|
|
100
105
|
- Every plan must describe the whole work first, then classify it into executable tasks and any needed sub-tasks.
|
|
106
|
+
- Every plan must treat the user-called/main agent as the orchestrator and assign actual implementation edits to `worker` whenever subagent tools are available, regardless of Light Path or Heavy Path.
|
|
107
|
+
- Every plan must require subagents to report status when the subagent tool provides a progress-reporting channel. If no mid-run reporting channel exists, the orchestrator must relay observable events such as assignment, waiting, and final completion.
|
|
108
|
+
- Every plan must require delegated subagents to provide a final report before leaving, require the orchestrator to close or release completed subagents after capturing final report and evidence, and require the orchestrator to review the final report and evidence before marking work complete.
|
|
101
109
|
- Every plan must allow recursive subagent delegation for bounded sub-tasks when the current agent surface supports it.
|
|
102
110
|
- Every plan must include complexity triage and the selected path.
|
|
103
111
|
- Every plan must explicitly list Heavy Path signals checked, even when Light Path is selected.
|
|
@@ -139,7 +147,7 @@ Prefer repository-native dry-run and check modes before mutating external state.
|
|
|
139
147
|
TASK: Produce <role> input needed for the <topic> plan.
|
|
140
148
|
EXPECTED OUTCOME: Return concrete decisions, file paths, dependencies, risks, and evidence requirements.
|
|
141
149
|
REQUIRED TOOLS: Read-only repository exploration, tool readiness checks, LSP/symbol tools, local command checks.
|
|
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
|
|
150
|
+
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. Treat the user-called/main agent as the orchestrator. Use `explorer` for read-only discovery and `worker` for actual implementation edits or verification when subagent tools are available, regardless of Light Path or Heavy Path. When the subagent tool provides a progress-reporting channel, require subagents to report status to the orchestrator when starting work, when deciding or confirming direction, during periodic progress, and when finishing; the orchestrator must immediately relay received status events to the user. If no mid-run reporting channel exists, relay observable events such as assignment, waiting, and final completion. Require delegated subagents to provide a final report before leaving; after capturing the final report and evidence, close or release the completed subagent, then review the final report and evidence before marking the work complete. If subagent tools are unavailable, the main agent takes over implementation directly and records that takeover in evidence. 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
151
|
MUST NOT DO: Edit production code. Ask the user. Expand scope. Delegate vague or unbounded work.
|
|
144
152
|
CONTEXT: User request, MEMORY.md, relevant docs/memory notes, applied model guidance, repository root.
|
|
145
153
|
```
|
|
@@ -13,6 +13,12 @@ Execute only one module task at a time. Instead of a repeated red-green loop, pr
|
|
|
13
13
|
|
|
14
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
15
|
|
|
16
|
+
The user-called/main agent is the orchestrator for work execution: it selects the task, assigns implementation, verifies results, and records evidence. Actual implementation edits belong to `worker` subagents whenever subagent tools are available, regardless of Light Path or Heavy Path.
|
|
17
|
+
|
|
18
|
+
When the subagent tool provides a progress-reporting channel, subagents report status to the orchestrator when starting work, when deciding or confirming direction, during periodic progress, and when finishing. The orchestrator must immediately relay received status events to the user. If no mid-run reporting channel exists, the orchestrator relays observable events such as assignment, waiting, and final completion.
|
|
19
|
+
|
|
20
|
+
Delegated subagents must provide a final report before leaving. After the orchestrator captures the final report and evidence, it must close or release the completed subagent, then review the final report and evidence before marking the work complete.
|
|
21
|
+
|
|
16
22
|
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
23
|
|
|
18
24
|
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.
|
|
@@ -26,9 +32,9 @@ When subagent tools are available, each agent may recursively delegate bounded s
|
|
|
26
32
|
5. Confirm that required LSP, typecheck, lint, dry-run, and verification tools are available from the plan's tool readiness section.
|
|
27
33
|
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.
|
|
28
34
|
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.
|
|
29
|
-
8. For Light Path,
|
|
35
|
+
8. For Light Path, keep the main agent in the orchestrator role and delegate implementation edits to one bounded `worker` whenever subagent tools are available; keep the verification gate.
|
|
30
36
|
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.
|
|
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,
|
|
37
|
+
10. Delegate implementation to `worker` with exact files, ownership, constraints, and model-specific adjustment rules on both Light Path and Heavy Path whenever subagent tools are available. Tell every delegated agent and child subagent to read the project-root `MEMORY.md` before work, keep scope, preserve others' edits, and report status when the subagent tool provides a progress-reporting channel. Immediately relay received status events to the user. If no mid-run reporting channel exists, relay observable events such as assignment, waiting, and final completion. Require delegated subagents to provide a final report before leaving; after capturing final report and evidence, close or release the completed subagent, then review the final report and evidence before marking the work complete. 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. If subagent tools are unavailable, the main agent takes over implementation directly and records that takeover in evidence.
|
|
32
38
|
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
39
|
12. For Heavy Path, run the recorded automated test command and record explicit `Tests:` evidence before claiming completion.
|
|
34
40
|
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.
|
|
@@ -44,7 +50,7 @@ When subagent tools are available, each agent may recursively delegate bounded s
|
|
|
44
50
|
TASK: Implement task <task-id> for <topic>.
|
|
45
51
|
EXPECTED OUTCOME: Minimal code or documentation change satisfying the task contract.
|
|
46
52
|
REQUIRED TOOLS: Scoped file editing, tool readiness checks, existing test/build commands, surface QA commands.
|
|
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.
|
|
53
|
+
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. Treat the user-called/main agent as the orchestrator; delegate actual implementation edits to `worker` whenever subagent tools are available, regardless of Light Path or Heavy Path. When the subagent tool provides a progress-reporting channel, require subagents to report status to the orchestrator when starting work, when deciding or confirming direction, during periodic progress, and when finishing; the orchestrator must immediately relay received status events to the user. If no mid-run reporting channel exists, relay observable events such as assignment, waiting, and final completion. Require delegated subagents to provide a final report before leaving; after capturing final report and evidence, close or release the completed subagent, then review the final report and evidence before marking the work complete. If subagent tools are unavailable, the main agent takes over implementation directly and records that takeover in evidence. 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
54
|
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
55
|
CONTEXT: docs/plan/<topic>.md task, relevant docs/memory notes, applied model guidance, exact files, verification commands.
|
|
50
56
|
```
|
|
@@ -84,6 +90,7 @@ Run the closest available dry-run or check mode before commands that mutate exte
|
|
|
84
90
|
|
|
85
91
|
- Both verification gates passed in the current turn.
|
|
86
92
|
- Heavy Path work has explicit automated test evidence in the current plan.
|
|
93
|
+
- Implementation edits were delegated to `worker` when subagent tools were available, or the main agent took over implementation directly and recorded that takeover in evidence when subagent tools were unavailable.
|
|
87
94
|
- Required LSP/check/verification tools were available, installed, or recorded as blockers with attempted commands.
|
|
88
95
|
- Dry-run or check evidence exists when the task could mutate external state, or the plan records why no dry-run exists.
|
|
89
96
|
- The required Light Path or Heavy Path flow was followed.
|