cairn-ai 0.1.9 → 0.1.11

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.
@@ -12,4 +12,4 @@ Procedure:
12
12
  4. Use `explorer` for read-only domain discovery and contradiction checks when available; use `worker` for exact references, command checks, and bounded evidence capture. 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.
13
13
  5. Write details to `docs/memory/<domain>.md`.
14
14
  6. Keep `MEMORY.md` as a short index.
15
- 7. Use the OS locale for user-visible output unless the user asks for another language.
15
+ 7. Use the OS locale for user-visible responses and generated or updated documentation, plans, and memory artifacts unless the user asks for another language.
@@ -16,8 +16,8 @@ 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 bounded implementation or verification tasks with clear file ownership. 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. Keep urgent blocking work local.
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.
23
- 15. Use the OS locale for user-visible output unless the user asks for another language.
23
+ 15. Use the OS locale for user-visible responses and generated or updated documentation, plans, and memory artifacts unless the user asks for another language.
@@ -11,4 +11,4 @@ Procedure:
11
11
  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.
12
12
  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.
13
13
  5. Record review evidence in `docs/plan/<topic>.md`.
14
- 6. Use the OS locale for user-visible output unless the user asks for another language.
14
+ 6. Use the OS locale for user-visible responses and generated or updated documentation, plans, and memory artifacts unless the user asks for another language.
@@ -12,11 +12,11 @@ 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, implement directly or use one bounded `worker`, then run focused verification.
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. 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.
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`.
21
21
  13. 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.
22
- 14. Use the OS locale for user-visible output unless the user asks for another language.
22
+ 14. Use the OS locale for user-visible responses and generated or updated documentation, plans, and memory artifacts unless the user asks for another language.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cairn",
3
- "version": "0.1.9",
3
+ "version": "0.1.11",
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.de.md CHANGED
@@ -119,7 +119,7 @@ Codex-only hooks werden nicht nach Antigravity portiert. Stattdessen laufen dies
119
119
 
120
120
  ## Locale Policy
121
121
 
122
- Cairns reusable instructions sind für global use auf Englisch geschrieben. User-visible output folgt der konfigurierten OS locale, sofern der user nicht ausdrücklich eine andere Sprache verlangt. Die CLI lokalisiert common messages für `en`, `ko`, `ja`, `zh`, `es`, `fr`, `de` und `pt` und fällt bei unsupported locales auf English zurück. Codex hook `statusMessage` text bleibt static English, während hook command output English oder Korean ist.
122
+ Cairns reusable instructions sind für global use auf Englisch geschrieben. User-visible output sowie erstellte oder aktualisierte documentation, plans und memory artifacts folgen der konfigurierten OS locale, sofern der user nicht ausdrücklich eine andere Sprache verlangt. Das umfasst Inhalte in `MEMORY.md`, `PLAN.md`, `docs/memory` und `docs/plan`. Die CLI lokalisiert common messages für `en`, `ko`, `ja`, `zh`, `es`, `fr`, `de` und `pt` und fällt bei unsupported locales auf English zurück. Codex hook `statusMessage` text bleibt static English, während hook command output English oder Korean ist.
123
123
 
124
124
  ## Delegation
125
125
 
package/README.es.md CHANGED
@@ -119,7 +119,7 @@ Los hooks exclusivos de Codex no se portan a Antigravity. En su lugar, los mismo
119
119
 
120
120
  ## Locale Policy
121
121
 
122
- Las instrucciones reutilizables de Cairn están escritas en inglés para uso global. El output visible para el usuario debe seguir el OS locale configurado, salvo que el usuario pida otro idioma explícitamente. La CLI localiza mensajes comunes para `en`, `ko`, `ja`, `zh`, `es`, `fr`, `de` y `pt`, y vuelve a English para locales no soportados. El texto `statusMessage` de Codex hooks permanece en inglés estático, mientras que hook command output es English o Korean.
122
+ Las instrucciones reutilizables de Cairn están escritas en inglés para uso global. El output visible para el usuario y la documentation, los plans y los memory artifacts generados o actualizados deben seguir el OS locale configurado, salvo que el usuario pida otro idioma explícitamente. Esto incluye el contenido de `MEMORY.md`, `PLAN.md`, `docs/memory` y `docs/plan`. La CLI localiza mensajes comunes para `en`, `ko`, `ja`, `zh`, `es`, `fr`, `de` y `pt`, y vuelve a English para locales no soportados. El texto `statusMessage` de Codex hooks permanece en inglés estático, mientras que hook command output es English o Korean.
123
123
 
124
124
  ## Delegation
125
125
 
package/README.fr.md CHANGED
@@ -119,7 +119,7 @@ Les hooks propres à Codex ne sont pas portés vers Antigravity. À la place, le
119
119
 
120
120
  ## Locale Policy
121
121
 
122
- Les instructions réutilisables de Cairn sont écrites en anglais pour un usage global. La sortie visible par l'utilisateur doit suivre l'OS locale configurée, sauf si l'utilisateur demande explicitement une autre langue. La CLI localise les messages communs pour `en`, `ko`, `ja`, `zh`, `es`, `fr`, `de` et `pt`, puis revient à English pour les locales non prises en charge. Le texte `statusMessage` des Codex hooks reste en anglais statique, tandis que hook command output est English ou Korean.
122
+ Les instructions réutilisables de Cairn sont écrites en anglais pour un usage global. La sortie visible par l'utilisateur ainsi que la documentation, les plans et les artifacts mémoire générés ou mis à jour doivent suivre l'OS locale configurée, sauf si l'utilisateur demande explicitement une autre langue. Cela inclut le contenu de `MEMORY.md`, `PLAN.md`, `docs/memory` et `docs/plan`. La CLI localise les messages communs pour `en`, `ko`, `ja`, `zh`, `es`, `fr`, `de` et `pt`, puis revient à English pour les locales non prises en charge. Le texte `statusMessage` des Codex hooks reste en anglais statique, tandis que hook command output est English ou Korean.
123
123
 
124
124
  ## Delegation
125
125
 
package/README.ja.md CHANGED
@@ -119,7 +119,7 @@ Codex-only hooks は Antigravity へ port されません。代わりに同じ p
119
119
 
120
120
  ## Locale Policy
121
121
 
122
- Cairn の reusable instructions は global use のため英語で書かれています。user-visible output は user が別の language を指定しない限り configured OS locale に従います。CLI は `en`、`ko`、`ja`、`zh`、`es`、`fr`、`de`、`pt` の common messages を localize し、unsupported locales は English に fallback します。Codex hook `statusMessage` text は static English のまま、hook command output は English または Korean です。
122
+ Cairn の reusable instructions は global use のため英語で書かれています。user-visible output と生成または更新される documentation、plans、memory artifacts は、user が別の language を指定しない限り configured OS locale に従います。これには `MEMORY.md`、`PLAN.md`、`docs/memory`、`docs/plan` の内容が含まれます。CLI は `en`、`ko`、`ja`、`zh`、`es`、`fr`、`de`、`pt` の common messages を localize し、unsupported locales は English に fallback します。Codex hook `statusMessage` text は static English のまま、hook command output は English または Korean です。
123
123
 
124
124
  ## Delegation
125
125
 
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: 기존 아키텍처 레이어 안의 좁은 변경입니다. 기본값이며, 직접 구현하거나 하나의 제한된 `worker`를 사용한 뒤 검증 게이트를 유지합니다.
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
 
@@ -119,12 +123,12 @@ Codex 전용 hooks는 Antigravity로 포팅하지 않습니다. 대신 같은 pl
119
123
 
120
124
  ## Locale Policy
121
125
 
122
- Cairn의 재사용 지침은 전역 사용을 위해 영어로 작성됩니다. 사용자에게 보이는 출력은 사용자가 다른 언어를 명시하지 않는 한 설정된 OS locale을 따릅니다. CLI는 `en`, `ko`, `ja`, `zh`, `es`, `fr`, `de`, `pt`의 일반 메시지를 현지화하고, 지원하지 않는 locale은 영어로 fallback합니다. Codex hook `statusMessage` 텍스트는 정적 영어로 유지하고, hook command output은 영어 또는 한국어입니다.
126
+ Cairn의 재사용 지침은 전역 사용을 위해 영어로 작성됩니다. 사용자에게 보이는 출력과 생성 또는 갱신되는 문서, 계획, 메모리 산출물은 사용자가 다른 언어를 명시하지 않는 한 설정된 OS locale을 따릅니다. 여기에는 `MEMORY.md`, `PLAN.md`, `docs/memory`, `docs/plan` 내용이 포함됩니다. CLI는 `en`, `ko`, `ja`, `zh`, `es`, `fr`, `de`, `pt`의 일반 메시지를 현지화하고, 지원하지 않는 locale은 영어로 fallback합니다. Codex hook `statusMessage` 텍스트는 정적 영어로 유지하고, hook command output은 영어 또는 한국어입니다.
123
127
 
124
128
  ## Delegation
125
129
 
126
130
  - `explorer`: 가능한 경우 read-only codebase discovery, impact analysis, pattern search, read-only verification을 처리합니다.
127
- - `worker`: 명확한 file ownership이 있는 제한된 implementation 또는 verification task를 처리합니다.
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. Implement directly or use one bounded `worker`, then keep the verification gate.
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
 
@@ -127,12 +131,12 @@ Codex-only hooks are not ported to Antigravity. Instead, the same planning, memo
127
131
 
128
132
  ## Locale Policy
129
133
 
130
- Cairn's reusable instructions are written in English for global use. User-visible output should follow the configured OS locale unless the user explicitly asks for another language. The CLI localizes common messages for `en`, `ko`, `ja`, `zh`, `es`, `fr`, `de`, and `pt`, and falls back to English for unsupported locales. Codex hook `statusMessage` text remains static English, while hook command output is English or Korean.
134
+ Cairn's reusable instructions are written in English for global use. User-visible output and generated or updated documentation, plans, and memory artifacts should follow the configured OS locale unless the user explicitly asks for another language. This includes `MEMORY.md`, `PLAN.md`, `docs/memory`, and `docs/plan` content. The CLI localizes common messages for `en`, `ko`, `ja`, `zh`, `es`, `fr`, `de`, and `pt`, and falls back to English for unsupported locales. Codex hook `statusMessage` text remains static English, while hook command output is English or Korean.
131
135
 
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 bounded implementation or verification tasks with clear file ownership.
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/README.pt.md CHANGED
@@ -119,7 +119,7 @@ Codex-only hooks nao sao portados para Antigravity. Em vez disso, os mesmos proc
119
119
 
120
120
  ## Locale Policy
121
121
 
122
- As instrucoes reutilizaveis do Cairn sao escritas em English para global use. User-visible output deve seguir o OS locale configurado, a menos que o usuario peca explicitamente outro idioma. A CLI localiza mensagens comuns para `en`, `ko`, `ja`, `zh`, `es`, `fr`, `de` e `pt`, e volta para English em unsupported locales. O texto `statusMessage` dos Codex hooks permanece static English, enquanto hook command output e English ou Korean.
122
+ As instrucoes reutilizaveis do Cairn sao escritas em English para global use. User-visible output e documentation, plans e memory artifacts gerados ou atualizados devem seguir o OS locale configurado, a menos que o usuario peca explicitamente outro idioma. Isso inclui conteudo em `MEMORY.md`, `PLAN.md`, `docs/memory` e `docs/plan`. A CLI localiza mensagens comuns para `en`, `ko`, `ja`, `zh`, `es`, `fr`, `de` e `pt`, e volta para English em unsupported locales. O texto `statusMessage` dos Codex hooks permanece static English, enquanto hook command output e English ou Korean.
123
123
 
124
124
  ## Delegation
125
125
 
package/README.zh.md CHANGED
@@ -119,7 +119,7 @@ Codex-only hooks 不会移植到 Antigravity。相同的 planning、memory、com
119
119
 
120
120
  ## Locale Policy
121
121
 
122
- Cairn 的 reusable instructions 为了 global use 使用英文编写。除非用户明确要求其他语言,user-visible output 应遵循 configured OS locale。CLI 会本地化 `en`、`ko`、`ja`、`zh`、`es`、`fr`、`de` 和 `pt` 的 common messages,不支持的 locales fallback 到 English。Codex hook `statusMessage` text 保持 static English,而 hook command output 为 English 或 Korean。
122
+ Cairn 的 reusable instructions 为了 global use 使用英文编写。除非用户明确要求其他语言,user-visible output 以及生成或更新的 documentation、plans、memory artifacts 应遵循 configured OS locale。这包括 `MEMORY.md`、`PLAN.md`、`docs/memory` 和 `docs/plan` 内容。CLI 会本地化 `en`、`ko`、`ja`、`zh`、`es`、`fr`、`de` 和 `pt` 的 common messages,不支持的 locales fallback 到 English。Codex hook `statusMessage` text 保持 static English,而 hook command output 为 English 或 Korean。
123
123
 
124
124
  ## Delegation
125
125
 
@@ -14,4 +14,4 @@ Procedure:
14
14
  4. Use `explorer` for read-only domain discovery and contradiction checks when available; use `worker` for exact references, command checks, and bounded evidence capture. 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.
15
15
  5. Write details to `docs/memory/<domain>.md`.
16
16
  6. Keep `MEMORY.md` as a short index.
17
- 7. Use the OS locale for user-visible output unless the user asks for another language.
17
+ 7. Use the OS locale for user-visible responses and generated or updated documentation, plans, and memory artifacts unless the user asks for another language.
@@ -18,9 +18,9 @@ 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 bounded implementation or verification tasks with clear file ownership. 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. Keep urgent blocking work local.
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.
25
25
  15. For Heavy Path, include an explicit automated test command and `Tests:` evidence line; Heavy Path completion must not rely on generic verification wording alone.
26
- 16. Use the OS locale for user-visible output unless the user asks for another language.
26
+ 16. Use the OS locale for user-visible responses and generated or updated documentation, plans, and memory artifacts unless the user asks for another language.
@@ -13,4 +13,4 @@ Procedure:
13
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
- 6. Use the OS locale for user-visible output unless the user asks for another language.
16
+ 6. Use the OS locale for user-visible responses and generated or updated documentation, plans, and memory artifacts unless the user asks for another language.
@@ -14,12 +14,12 @@ 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, implement directly or use one bounded `worker`, then run focused verification.
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. 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.
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.
23
23
  13. Record tool readiness and verification evidence in `docs/plan/<topic>.md` and update `PLAN.md`.
24
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.
25
+ 15. Use the OS locale for user-visible responses and generated or updated documentation, plans, and memory artifacts unless the user asks for another language.
@@ -17,15 +17,20 @@ 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.
23
28
  - Before mutating external state, run the closest available dry-run, check, plan, diff, validate, or equivalent command.
24
29
  - 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
- - User-visible output must follow the OS locale unless the user asks for another language.
30
+ - User-visible responses and generated or updated documentation, plans, and memory artifacts must follow the OS locale unless the user asks for another language.
26
31
 
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 bounded implementation or verification tasks with clear file ownership.
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.
@@ -20,7 +20,7 @@ Claude-family models are strong at long-context retention, policy interpretation
20
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
- - Write user-visible output in the OS locale unless the user asks for another language.
23
+ - Write user-visible responses and generated or updated documentation, plans, and memory artifacts in the OS locale unless the user asks for another language.
24
24
 
25
25
  ## Path Guidance
26
26
 
@@ -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,13 +18,14 @@ 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.
20
25
  - Do not trust success-looking output alone. Confirm real files, commands, and surface evidence.
21
26
  - 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
27
  - 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
- - Write user-visible output in the OS locale unless the user asks for another language.
28
+ - Write user-visible responses and generated or updated documentation, plans, and memory artifacts in the OS locale unless the user asks for another language.
24
29
 
25
30
  ## Path Guidance
26
31
 
@@ -34,7 +39,10 @@ Codex-family models are strong at small implementation tasks, explicit tool use,
34
39
 
35
40
  ### Implementation
36
41
 
37
- - Edit only within the file scope listed in the plan.
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cairn-ai",
3
- "version": "0.1.9",
3
+ "version": "0.1.11",
4
4
  "description": "Token-efficient agent harness with tool readiness for Codex, Claude Code, and Antigravity",
5
5
  "license": "MIT",
6
6
  "author": {
@@ -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
 
@@ -17,7 +17,7 @@ This file is a short index of persistent repository knowledge.
17
17
  - Prefer precise repository exploration before implementation.
18
18
  - Preserve proper nouns, file names, variable names, service names, alert names, MCP tool names, and agent names exactly as written.
19
19
  - Read only the detailed memory files needed for the current task.
20
- - Write user-visible responses and artifacts in the OS locale unless the user asks for another language.
20
+ - Write user-visible responses and generated or updated documentation, plans, and memory artifacts in the OS locale unless the user asks for another language.
21
21
 
22
22
  ## Update Rules
23
23
 
@@ -26,6 +26,28 @@ This file is a short index of persistent repository knowledge.
26
26
  - Record facts with source paths, commands, and observed behavior.
27
27
  `;
28
28
 
29
+ const memoryTemplateKo = `# MEMORY
30
+
31
+ 이 파일은 지속적으로 필요한 저장소 지식의 짧은 색인입니다.
32
+
33
+ ## Domain Knowledge
34
+
35
+ - 자세한 기록은 \`docs/memory/\` 아래에 연결합니다.
36
+
37
+ ## Policy
38
+
39
+ - 구현 전에는 저장소를 정확히 탐색합니다.
40
+ - 고유명사, 파일 이름, 변수 이름, 서비스 이름, 알림 이름, MCP 도구 이름, 에이전트 이름은 쓰인 그대로 보존합니다.
41
+ - 현재 작업에 필요한 상세 메모리 파일만 읽습니다.
42
+ - 사용자가 다른 언어를 요청하지 않는 한, 사용자에게 보이는 응답과 생성 또는 갱신하는 문서, 계획, 메모리 산출물은 OS locale 언어로 작성합니다.
43
+
44
+ ## Update Rules
45
+
46
+ - 루트 파일은 짧게 유지합니다.
47
+ - 자세한 도메인 지식은 \`docs/memory/<domain>.md\`로 옮깁니다.
48
+ - 사실은 출처 경로, 명령, 관찰된 동작과 함께 기록합니다.
49
+ `;
50
+
29
51
  const planTemplate = `# PLAN
30
52
 
31
53
  This file is a short index of active and completed work plans.
@@ -51,11 +73,43 @@ This file is a short index of active and completed work plans.
51
73
  - Module acceptance verification.
52
74
  - Surface integration verification.
53
75
  - Run dry-run or check mode before external-state mutation when available.
76
+ - Write user-visible responses and generated or updated documentation, plans, and memory artifacts in the OS locale unless the user asks for another language.
54
77
  - Use at most two verification passes per task by default.
55
78
  - If a gate fails, diagnose once, shrink the task or split it into sub-tasks, and rerun both gates.
56
79
  - After two failed passes, record the blocker in \`docs/plan/<topic>.md\`.
57
80
  `;
58
81
 
82
+ const planTemplateKo = `# PLAN
83
+
84
+ 이 파일은 진행 중이거나 완료된 작업 계획의 짧은 색인입니다.
85
+
86
+ ## Active Plans
87
+
88
+ - 상세 계획은 \`docs/plan/\` 아래에 연결합니다.
89
+
90
+ ## Completed Plans
91
+
92
+ - 완료된 주제는 증거 링크와 함께 이곳으로 옮깁니다.
93
+
94
+ ## Planning Rules
95
+
96
+ - 모든 에이전트는 배정된 작업을 시작할 때 도메인 지식과 저장소 정책을 위해 프로젝트 루트 \`MEMORY.md\`를 먼저 읽어야 합니다.
97
+ - 계획은 구현 전에 의사결정이 완료된 상태여야 합니다.
98
+ - 에이전트, 플러그인, 위임 워크플로 지침을 적용하기 전에 복잡도 트리아지를 실행합니다.
99
+ - 선택한 Light Path 또는 Heavy Path와 확인한 Heavy Path 신호를 \`docs/plan/<topic>.md\`에 기록합니다.
100
+ - 구현은 작은 모듈 작업으로 나눕니다.
101
+ - 구현 전에 저장소 스택과 필요한 LSP/check 도구를 감지합니다.
102
+ - 필요한 도구가 없으면 사용할 수 없다고 판단하기 전에 설치 또는 부트스트랩을 시도합니다.
103
+ - 각 작업은 보통 정확히 두 게이트를 통과합니다.
104
+ - 모듈 수용 검증.
105
+ - 표면 통합 검증.
106
+ - 외부 상태 변경 전에는 가능한 경우 dry-run 또는 check mode를 실행합니다.
107
+ - 사용자가 다른 언어를 요청하지 않는 한, 사용자에게 보이는 응답과 생성 또는 갱신하는 문서, 계획, 메모리 산출물은 OS locale 언어로 작성합니다.
108
+ - 기본적으로 작업당 검증은 최대 두 번만 수행합니다.
109
+ - 게이트가 실패하면 한 번 진단하고, 작업을 줄이거나 sub-task로 나눈 뒤 두 게이트를 다시 실행합니다.
110
+ - 두 번 실패한 뒤에는 blocker를 \`docs/plan/<topic>.md\`에 기록합니다.
111
+ `;
112
+
59
113
  if (isCliEntry()) {
60
114
  const event = process.argv[2] ?? "manual";
61
115
  const result = await runStateResult(event);
@@ -69,12 +123,12 @@ export async function runState(event = "manual", { root = process.env.HARNESS_RE
69
123
 
70
124
  export async function runStateResult(event = "manual", { root = process.env.HARNESS_REPO_ROOT ?? process.cwd(), locale = localeValue() } = {}) {
71
125
  const resolvedRoot = resolve(root);
126
+ const ko = locale.toLowerCase().startsWith("ko");
72
127
  await mkdir(join(resolvedRoot, "docs", "memory"), { recursive: true });
73
128
  await mkdir(join(resolvedRoot, "docs", "plan"), { recursive: true });
74
- await writeIfMissing(join(resolvedRoot, "MEMORY.md"), memoryTemplate);
75
- await writeIfMissing(join(resolvedRoot, "PLAN.md"), planTemplate);
129
+ await writeIfMissing(join(resolvedRoot, "MEMORY.md"), ko ? memoryTemplateKo : memoryTemplate);
130
+ await writeIfMissing(join(resolvedRoot, "PLAN.md"), ko ? planTemplateKo : planTemplate);
76
131
 
77
- const ko = locale.toLowerCase().startsWith("ko");
78
132
  if (event === "session-start" || event === "user-prompt-submit") {
79
133
  return {
80
134
  status: 0,
@@ -92,7 +146,7 @@ export async function runStateResult(event = "manual", { root = process.env.HARN
92
146
  };
93
147
  }
94
148
  if (event === "stop" || event === "subagent-stop") {
95
- const pending = await pendingActivePlanItems(resolvedRoot);
149
+ const pending = await pendingPlanItems(resolvedRoot);
96
150
  if (pending.length > 0) {
97
151
  return {
98
152
  status: 1,
@@ -119,32 +173,50 @@ async function writeIfMissing(path, content) {
119
173
  }
120
174
  }
121
175
 
122
- async function pendingActivePlanItems(root) {
176
+ async function pendingPlanItems(root) {
123
177
  const planPath = join(root, "PLAN.md");
124
178
  const plan = await readFile(planPath, "utf8");
125
179
  const activePlans = markdownLinksToPlanFiles(section(plan, "Active Plans"));
180
+ const completedPlans = markdownLinksToPlanFiles(section(plan, "Completed Plans"));
181
+ const indexedPlans = new Map();
182
+ for (const relativePath of activePlans) indexedPlans.set(relativePath, "active");
183
+ for (const relativePath of completedPlans) {
184
+ if (!indexedPlans.has(relativePath)) indexedPlans.set(relativePath, "completed");
185
+ }
186
+ for (const relativePath of await docsPlanFiles(root)) {
187
+ if (!indexedPlans.has(relativePath)) indexedPlans.set(relativePath, "unindexed");
188
+ }
126
189
  const pending = [];
127
190
 
128
- for (const relativePath of activePlans) {
191
+ for (const [relativePath, indexState] of indexedPlans) {
129
192
  const path = resolve(root, relativePath);
130
193
  const pathFromRoot = relative(root, path);
131
194
  if (pathFromRoot.startsWith("..") || isAbsolute(pathFromRoot)) continue;
132
195
  const text = await readPlanFile(path);
133
196
  if (text === null) {
134
- pending.push({ path: relativePath, unchecked: ["active plan file is missing"], emptyEvidence: [] });
197
+ pending.push({ path: relativePath, indexIssues: [`${indexState} plan file is missing`], unchecked: [], emptyEvidence: [] });
135
198
  continue;
136
199
  }
200
+ const indexIssues = indexState === "unindexed" ? ["not linked in PLAN.md Active Plans or Completed Plans"] : [];
137
201
  const unchecked = [...text.matchAll(/^\s*-\s+\[\s\]\s+(.+)$/gm)].map((match) => match[1].trim());
138
202
  const emptyEvidence = emptyEvidenceItems(text);
139
203
  const missingHeavyPathTests = heavyPathMissingTests(text);
140
- if (unchecked.length > 0 || emptyEvidence.length > 0 || missingHeavyPathTests.length > 0) {
141
- pending.push({ path: relativePath, unchecked, emptyEvidence, missingHeavyPathTests });
204
+ if (indexIssues.length > 0 || unchecked.length > 0 || emptyEvidence.length > 0 || missingHeavyPathTests.length > 0) {
205
+ pending.push({ path: relativePath, indexIssues, unchecked, emptyEvidence, missingHeavyPathTests });
142
206
  }
143
207
  }
144
208
 
145
209
  return pending;
146
210
  }
147
211
 
212
+ async function docsPlanFiles(root) {
213
+ const entries = await readdir(join(root, "docs", "plan"), { withFileTypes: true });
214
+ return entries
215
+ .filter((entry) => entry.isFile() && entry.name.endsWith(".md"))
216
+ .map((entry) => `docs/plan/${entry.name}`)
217
+ .sort();
218
+ }
219
+
148
220
  async function readPlanFile(path) {
149
221
  try {
150
222
  return await readFile(path, "utf8");
@@ -206,6 +278,7 @@ function stopBlockedMessage({ event, ko, pending }) {
206
278
 
207
279
  function formatPendingItem(item) {
208
280
  const reasons = [
281
+ ...(item.indexIssues ?? []).map((label) => `index: ${label}`),
209
282
  ...item.unchecked.map((label) => `unchecked: ${label}`),
210
283
  ...item.emptyEvidence.map((label) => `empty evidence: ${label}`),
211
284
  ...(item.missingHeavyPathTests ?? []).map((label) => `missing tests: ${label}`),
@@ -10,7 +10,38 @@ mkdir -p "$root/docs/memory" "$root/docs/plan"
10
10
  memory="$root/MEMORY.md"
11
11
  plan="$root/PLAN.md"
12
12
 
13
+ is_ko() {
14
+ case "$locale" in
15
+ ko*|KO*) return 0 ;;
16
+ *) return 1 ;;
17
+ esac
18
+ }
19
+
13
20
  if [ ! -f "$memory" ]; then
21
+ if is_ko; then
22
+ cat > "$memory" <<'EOF'
23
+ # MEMORY
24
+
25
+ 이 파일은 지속적으로 필요한 저장소 지식의 짧은 색인입니다.
26
+
27
+ ## Domain Knowledge
28
+
29
+ - 자세한 기록은 `docs/memory/` 아래에 연결합니다.
30
+
31
+ ## Policy
32
+
33
+ - 구현 전에는 저장소를 정확히 탐색합니다.
34
+ - 고유명사, 파일 이름, 변수 이름, 서비스 이름, 알림 이름, MCP 도구 이름, 에이전트 이름은 쓰인 그대로 보존합니다.
35
+ - 현재 작업에 필요한 상세 메모리 파일만 읽습니다.
36
+ - 사용자가 다른 언어를 요청하지 않는 한, 사용자에게 보이는 응답과 생성 또는 갱신하는 문서, 계획, 메모리 산출물은 OS locale 언어로 작성합니다.
37
+
38
+ ## Update Rules
39
+
40
+ - 루트 파일은 짧게 유지합니다.
41
+ - 자세한 도메인 지식은 `docs/memory/<domain>.md`로 옮깁니다.
42
+ - 사실은 출처 경로, 명령, 관찰된 동작과 함께 기록합니다.
43
+ EOF
44
+ else
14
45
  cat > "$memory" <<'EOF'
15
46
  # MEMORY
16
47
 
@@ -25,7 +56,7 @@ This file is a short index of persistent repository knowledge.
25
56
  - Prefer precise repository exploration before implementation.
26
57
  - Preserve proper nouns, file names, variable names, service names, alert names, MCP tool names, and agent names exactly as written.
27
58
  - Read only the detailed memory files needed for the current task.
28
- - Write user-visible responses and artifacts in the OS locale unless the user asks for another language.
59
+ - Write user-visible responses and generated or updated documentation, plans, and memory artifacts in the OS locale unless the user asks for another language.
29
60
 
30
61
  ## Update Rules
31
62
 
@@ -33,9 +64,43 @@ This file is a short index of persistent repository knowledge.
33
64
  - Move detailed domain knowledge to `docs/memory/<domain>.md`.
34
65
  - Record facts with source paths, commands, and observed behavior.
35
66
  EOF
67
+ fi
36
68
  fi
37
69
 
38
70
  if [ ! -f "$plan" ]; then
71
+ if is_ko; then
72
+ cat > "$plan" <<'EOF'
73
+ # PLAN
74
+
75
+ 이 파일은 진행 중이거나 완료된 작업 계획의 짧은 색인입니다.
76
+
77
+ ## Active Plans
78
+
79
+ - 상세 계획은 `docs/plan/` 아래에 연결합니다.
80
+
81
+ ## Completed Plans
82
+
83
+ - 완료된 주제는 증거 링크와 함께 이곳으로 옮깁니다.
84
+
85
+ ## Planning Rules
86
+
87
+ - 모든 에이전트는 배정된 작업을 시작할 때 도메인 지식과 저장소 정책을 위해 프로젝트 루트 `MEMORY.md`를 먼저 읽어야 합니다.
88
+ - 계획은 구현 전에 의사결정이 완료된 상태여야 합니다.
89
+ - 에이전트, 플러그인, 위임 워크플로 지침을 적용하기 전에 복잡도 트리아지를 실행합니다.
90
+ - 선택한 Light Path 또는 Heavy Path와 확인한 Heavy Path 신호를 `docs/plan/<topic>.md`에 기록합니다.
91
+ - 구현은 작은 모듈 작업으로 나눕니다.
92
+ - 구현 전에 저장소 스택과 필요한 LSP/check 도구를 감지합니다.
93
+ - 필요한 도구가 없으면 사용할 수 없다고 판단하기 전에 설치 또는 부트스트랩을 시도합니다.
94
+ - 각 작업은 보통 정확히 두 게이트를 통과합니다.
95
+ - 모듈 수용 검증.
96
+ - 표면 통합 검증.
97
+ - 외부 상태 변경 전에는 가능한 경우 dry-run 또는 check mode를 실행합니다.
98
+ - 사용자가 다른 언어를 요청하지 않는 한, 사용자에게 보이는 응답과 생성 또는 갱신하는 문서, 계획, 메모리 산출물은 OS locale 언어로 작성합니다.
99
+ - 기본적으로 작업당 검증은 최대 두 번만 수행합니다.
100
+ - 게이트가 실패하면 한 번 진단하고, 작업을 줄이거나 sub-task로 나눈 뒤 두 게이트를 다시 실행합니다.
101
+ - 두 번 실패한 뒤에는 blocker를 `docs/plan/<topic>.md`에 기록합니다.
102
+ EOF
103
+ else
39
104
  cat > "$plan" <<'EOF'
40
105
  # PLAN
41
106
 
@@ -60,19 +125,14 @@ This file is a short index of active and completed work plans.
60
125
  - Module acceptance verification.
61
126
  - Surface integration verification.
62
127
  - Run dry-run or check mode before external-state mutation when available.
128
+ - Write user-visible responses and generated or updated documentation, plans, and memory artifacts in the OS locale unless the user asks for another language.
63
129
  - Use at most two verification passes per task by default.
64
130
  - If a gate fails, diagnose once, shrink the task or split it into sub-tasks, and rerun both gates.
65
131
  - After two failed passes, record the blocker in `docs/plan/<topic>.md`.
66
132
  EOF
133
+ fi
67
134
  fi
68
135
 
69
- is_ko() {
70
- case "$locale" in
71
- ko*|KO*) return 0 ;;
72
- *) return 1 ;;
73
- esac
74
- }
75
-
76
136
  case "$event" in
77
137
  session-start|user-prompt-submit)
78
138
  if is_ko; then
package/scripts/cairn.mjs CHANGED
@@ -56,61 +56,66 @@ 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
+ const artifactLocalePolicy = "Write user-visible responses and generated or updated documentation, plans, and memory artifacts in the OS locale unless the user asks for another language.";
62
+ const artifactLocalePolicyKo = "사용자가 다른 언어를 요청하지 않는 한, 사용자에게 보이는 응답과 생성 또는 갱신하는 문서, 계획, 메모리 산출물은 OS locale 언어로 작성합니다.";
63
+
59
64
  const messages = {
60
65
  en: {
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. 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
- review: "Use the cairn-review skill. Compare evidence against PLAN.md and MEMORY.md.",
66
+ memory: `Use the cairn-memory skill. Keep MEMORY.md as a short index and write details to docs/memory/<domain>.md. ${artifactLocalePolicy}`,
67
+ 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. ${artifactLocalePolicy} ${planExecutionPolicy}`,
68
+ 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. ${artifactLocalePolicy} 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.`,
69
+ review: `Use the cairn-review skill. Compare evidence against PLAN.md and MEMORY.md. ${artifactLocalePolicy}`,
65
70
  usage: "Usage: cairn install|upgrade|doctor|uninstall|init|memory|plan|work|review|toolcheck",
66
71
  },
67
72
  ko: {
68
- memory: "cairn-memory 스킬을 사용하세요. MEMORY.md는 짧은 색인으로, 상세 내용은 docs/memory/<domain>.md에 기록합니다.",
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
- review: "cairn-review 스킬을 사용하세요. PLAN.md와 MEMORY.md 기준으로 증거를 비교합니다.",
73
+ memory: `cairn-memory 스킬을 사용하세요. MEMORY.md는 짧은 색인으로, 상세 내용은 docs/memory/<domain>.md에 기록합니다. ${artifactLocalePolicyKo}`,
74
+ plan: `중요 구현 전에는 cairn-plan 스킬을 사용하세요. 모든 에이전트는 도메인 지식과 저장소 정책을 위해 프로젝트 루트 MEMORY.md를 먼저 읽어야 합니다. 먼저 전체 작업을 파악한 뒤 실행 가능한 task와 필요한 sub-task로 분류합니다. PLAN.md는 색인으로, 상세 계획은 docs/plan/<topic>.md에 기록하며 파일 변경 전 Light/Heavy Path 트리아지를 남깁니다. ${artifactLocalePolicyKo} ${planExecutionPolicy}`,
75
+ work: `계획이 있을 때만 cairn-work 스킬을 사용하세요. 모든 에이전트는 도메인 지식과 저장소 정책을 위해 프로젝트 루트 MEMORY.md를 먼저 읽어야 합니다. 기록된 Light/Heavy Path 경로로 하나의 모듈 작업을 실행합니다. ${workExecutionPolicy} dry-run/check, 모듈, 표면 증거를 확보합니다. ${artifactLocalePolicyKo} 작업 중 사용자가 곁가지 질문을 하면 짧게 답한 뒤, 명시적으로 일시중지/중단/작업 전환을 요청한 경우가 아니면 이전 active work를 계속합니다.`,
76
+ review: `cairn-review 스킬을 사용하세요. PLAN.md와 MEMORY.md 기준으로 증거를 비교합니다. ${artifactLocalePolicyKo}`,
72
77
  usage: "사용법: cairn install|upgrade|doctor|uninstall|init|memory|plan|work|review|toolcheck",
73
78
  },
74
79
  ja: {
75
- memory: "cairn-memory スキルを使用してください。MEMORY.md は短い索引にし、詳細は docs/memory/<domain>.md に記録します。",
76
- plan: "cairn-plan スキルを使用してください。PLAN.md は索引にし、詳細計画は docs/plan/<topic>.md に記録します。",
77
- work: "cairn-work スキルを使用してください。1つのモジュールスライスを実行し、モジュール証拠と表面証拠を取得します。",
78
- review: "cairn-review スキルを使用してください。PLAN.md と MEMORY.md に照らして証拠を比較します。",
80
+ memory: `cairn-memory スキルを使用してください。MEMORY.md は短い索引にし、詳細は docs/memory/<domain>.md に記録します。${artifactLocalePolicy}`,
81
+ plan: `cairn-plan スキルを使用してください。PLAN.md は索引にし、詳細計画は docs/plan/<topic>.md に記録します。${artifactLocalePolicy} ${planExecutionPolicy}`,
82
+ work: `cairn-work スキルを使用してください。1つのモジュールスライスを実行し、モジュール証拠と表面証拠を取得します。${workExecutionPolicy} ${artifactLocalePolicy}`,
83
+ review: `cairn-review スキルを使用してください。PLAN.md と MEMORY.md に照らして証拠を比較します。${artifactLocalePolicy}`,
79
84
  usage: "使い方: cairn install|upgrade|doctor|uninstall|init|memory|plan|work|review|toolcheck",
80
85
  },
81
86
  zh: {
82
- memory: "使用 cairn-memory skill。将 MEMORY.md 保持为简短索引,并将详细内容写入 docs/memory/<domain>.md。",
83
- plan: "使用 cairn-plan skill。将 PLAN.md 保持为索引,并将详细计划写入 docs/plan/<topic>.md。",
84
- work: "使用 cairn-work skill。执行一个模块切片,并收集模块证据。",
85
- review: "使用 cairn-review skill。根据 PLAN.md 和 MEMORY.md 对比证据。",
87
+ memory: `使用 cairn-memory skill。将 MEMORY.md 保持为简短索引,并将详细内容写入 docs/memory/<domain>.md。${artifactLocalePolicy}`,
88
+ plan: `使用 cairn-plan skill。将 PLAN.md 保持为索引,并将详细计划写入 docs/plan/<topic>.md。${artifactLocalePolicy} ${planExecutionPolicy}`,
89
+ work: `使用 cairn-work skill。执行一个模块切片,并收集模块证据。${workExecutionPolicy} ${artifactLocalePolicy}`,
90
+ review: `使用 cairn-review skill。根据 PLAN.md 和 MEMORY.md 对比证据。${artifactLocalePolicy}`,
86
91
  usage: "用法: cairn install|upgrade|doctor|uninstall|init|memory|plan|work|review|toolcheck",
87
92
  },
88
93
  es: {
89
- 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: "Usa la skill cairn-plan. Mantén PLAN.md como índice y escribe los planes detallados en docs/plan/<topic>.md.",
91
- work: "Usa la skill cairn-work. Ejecuta un solo segmento de módulo y captura evidencia de módulo y de superficie.",
92
- review: "Usa la skill cairn-review. Compara la evidencia con PLAN.md y MEMORY.md.",
94
+ memory: `Usa la skill cairn-memory. Mantén MEMORY.md como un índice breve y escribe los detalles en docs/memory/<domain>.md. ${artifactLocalePolicy}`,
95
+ plan: `Usa la skill cairn-plan. Mantén PLAN.md como índice y escribe los planes detallados en docs/plan/<topic>.md. ${artifactLocalePolicy} ${planExecutionPolicy}`,
96
+ work: `Usa la skill cairn-work. Ejecuta un solo segmento de módulo y captura evidencia de módulo y de superficie. ${workExecutionPolicy} ${artifactLocalePolicy}`,
97
+ review: `Usa la skill cairn-review. Compara la evidencia con PLAN.md y MEMORY.md. ${artifactLocalePolicy}`,
93
98
  usage: "Uso: cairn install|upgrade|doctor|uninstall|init|memory|plan|work|review|toolcheck",
94
99
  },
95
100
  fr: {
96
- memory: "Utilisez la skill cairn-memory. Gardez MEMORY.md comme index court et écrivez les détails dans docs/memory/<domain>.md.",
97
- plan: "Utilisez la skill cairn-plan. Gardez MEMORY.md comme index et écrivez les plans détaillés dans docs/plan/<topic>.md.",
98
- work: "Utilisez la skill cairn-work. Exécutez une tranche de module et capturez les preuves de module et de surface.",
99
- review: "Utilisez la skill cairn-review. Comparez les preuves avec PLAN.md et MEMORY.md.",
101
+ memory: `Utilisez la skill cairn-memory. Gardez MEMORY.md comme index court et écrivez les détails dans docs/memory/<domain>.md. ${artifactLocalePolicy}`,
102
+ plan: `Utilisez la skill cairn-plan. Gardez MEMORY.md comme index et écrivez les plans détaillés dans docs/plan/<topic>.md. ${artifactLocalePolicy} ${planExecutionPolicy}`,
103
+ work: `Utilisez la skill cairn-work. Exécutez une tranche de module et capturez les preuves de module et de surface. ${workExecutionPolicy} ${artifactLocalePolicy}`,
104
+ review: `Utilisez la skill cairn-review. Comparez les preuves avec PLAN.md et MEMORY.md. ${artifactLocalePolicy}`,
100
105
  usage: "Utilisation: cairn install|upgrade|doctor|uninstall|init|memory|plan|work|review|toolcheck",
101
106
  },
102
107
  de: {
103
- 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: "Verwenden Sie die Skill cairn-plan. Halten Sie MEMORY.md als Index und schreiben Sie Detailpläne nach docs/plan/<topic>.md.",
105
- work: "Verwenden Sie die Skill cairn-work. Führen Sie einen Modulabschnitt aus und erfassen Sie Modul- und Oberflächenbelege.",
106
- review: "Verwenden Sie die Skill cairn-review. Vergleichen Sie Belege mit PLAN.md und MEMORY.md.",
108
+ memory: `Verwenden Sie die Skill cairn-memory. Halten Sie MEMORY.md als kurzen Index und schreiben Sie Details nach docs/memory/<domain>.md. ${artifactLocalePolicy}`,
109
+ plan: `Verwenden Sie die Skill cairn-plan. Halten Sie MEMORY.md als Index und schreiben Sie Detailpläne nach docs/plan/<topic>.md. ${artifactLocalePolicy} ${planExecutionPolicy}`,
110
+ work: `Verwenden Sie die Skill cairn-work. Führen Sie einen Modulabschnitt aus und erfassen Sie Modul- und Oberflächenbelege. ${workExecutionPolicy} ${artifactLocalePolicy}`,
111
+ review: `Verwenden Sie die Skill cairn-review. Vergleichen Sie Belege mit PLAN.md und MEMORY.md. ${artifactLocalePolicy}`,
107
112
  usage: "Verwendung: cairn install|upgrade|doctor|uninstall|init|memory|plan|work|review|toolcheck",
108
113
  },
109
114
  pt: {
110
- memory: "Use a skill cairn-memory. Mantenha MEMORY.md como um índice curto e escreva detalhes em docs/memory/<domain>.md.",
111
- plan: "Use a skill cairn-plan. Mantenha MEMORY.md como índice e escreva planos detalhados em docs/plan/<topic>.md.",
112
- work: "Use a skill cairn-work. Execute uma fatia de módulo e capture evidências de módulo e de superfície.",
113
- review: "Use a skill cairn-review. Compare evidências com PLAN.md e MEMORY.md.",
115
+ memory: `Use a skill cairn-memory. Mantenha MEMORY.md como um índice curto e escreva detalhes em docs/memory/<domain>.md. ${artifactLocalePolicy}`,
116
+ plan: `Use a skill cairn-plan. Mantenha MEMORY.md como índice e escreva planos detalhados em docs/plan/<topic>.md. ${artifactLocalePolicy} ${planExecutionPolicy}`,
117
+ work: `Use a skill cairn-work. Execute uma fatia de módulo e capture evidências de módulo e de superfície. ${workExecutionPolicy} ${artifactLocalePolicy}`,
118
+ review: `Use a skill cairn-review. Compare evidências com PLAN.md e MEMORY.md. ${artifactLocalePolicy}`,
114
119
  usage: "Uso: cairn install|upgrade|doctor|uninstall|init|memory|plan|work|review|toolcheck",
115
120
  },
116
121
  };
@@ -25,7 +25,7 @@ When subagent tools are available, each agent may recursively delegate bounded s
25
25
  - Recursive subagent delegation is allowed only for bounded sub-tasks when the current surface supports it.
26
26
  4. Write detailed facts to `docs/memory/<domain>.md`.
27
27
  5. Keep only one-line links and summaries in `MEMORY.md`.
28
- 6. Write user-visible output in the OS locale unless the user asks for another language.
28
+ 6. Write user-visible responses and generated or updated documentation, plans, and memory artifacts in the OS locale unless the user asks for another language.
29
29
 
30
30
  ## Delegation Prompt Format
31
31
 
@@ -33,7 +33,7 @@ When subagent tools are available, each agent may recursively delegate bounded s
33
33
  TASK: Explore persistent domain knowledge for <domain>.
34
34
  EXPECTED OUTCOME: Return facts, source paths, and proof commands concisely.
35
35
  REQUIRED TOOLS: Read-only file search, LSP/symbol tools, command checks.
36
- MUST DO: Read the project-root `MEMORY.md` before doing assigned work. Preserve proper nouns exactly. Cite local paths. Separate facts from inference. Use the OS locale for user-visible text.
36
+ MUST DO: Read the project-root `MEMORY.md` before doing assigned work. Preserve proper nouns exactly. Cite local paths. Separate facts from inference. Use the OS locale for user-visible responses and generated or updated documentation, plans, and memory artifacts.
37
37
  MUST NOT DO: Edit files. Ask the user. Guess missing names.
38
38
  CONTEXT: Current task, repository root, existing MEMORY.md entries.
39
39
  ```
@@ -31,13 +31,17 @@ 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
- - Use `worker` for bounded implementation tasks with clear file ownership, disjoint write scope, or verification tasks that can run while the main session continues.
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
- - Keep urgent blocking work local when the next step depends immediately on the result.
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`.
40
- 14. Write user-visible output in the OS locale unless the user asks for another language.
44
+ 14. Write user-visible responses and generated or updated documentation, plans, and memory artifacts in the OS locale unless the user asks for another language.
41
45
 
42
46
  ## Complexity Triage
43
47
 
@@ -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 and implement directly or with one `worker`, but keep the verification gate.
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: direct edit or single `worker` -> 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.
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.
@@ -110,7 +118,7 @@ Heavy Path flow: plan -> pre-implementation review -> bounded `worker` implement
110
118
  - Verification can expand for risk, but the reason must be recorded.
111
119
  - 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.
112
120
  - Ask the user only when agents, repository evidence, or local verification cannot answer the decision.
113
- - User-visible text must follow the OS locale unless the user asks for another language.
121
+ - User-visible responses and generated or updated documentation, plans, and memory artifacts must follow the OS locale unless the user asks for another language.
114
122
 
115
123
  ## Tool Readiness Policy
116
124
 
@@ -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 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.
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 responses and generated or updated documentation, plans, and memory artifacts.
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
  ```
@@ -26,7 +26,7 @@ When subagent tools are available, each agent may recursively delegate bounded r
26
26
  - Recursive subagent delegation is allowed only for bounded sub-tasks when the current surface supports it.
27
27
  - Keep blocking review work local when the next step depends immediately on the result.
28
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.
29
- 6. Write user-visible output in the OS locale unless the user asks for another language.
29
+ 6. Write user-visible responses and generated or updated documentation, plans, and memory artifacts in the OS locale unless the user asks for another language.
30
30
 
31
31
  ## Reviewer Prompt Format
32
32
 
@@ -34,7 +34,7 @@ When subagent tools are available, each agent may recursively delegate bounded r
34
34
  TASK: Review correctness, scope, and evidence for task <task-id>.
35
35
  EXPECTED OUTCOME: Findings ordered by severity with file and line references, or an explicit no-issue result with residual risk.
36
36
  REQUIRED TOOLS: Read-only diff inspection, tool readiness checks, verification command execution, plan/memory reading.
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.
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 responses and generated or updated documentation, plans, and memory artifacts.
38
38
  MUST NOT DO: Edit files. Ask the user. Approve skipped LSP/typecheck/lint without install evidence. Approve missing evidence or open-ended verification loops.
39
39
  CONTEXT: docs/plan/<topic>.md, MEMORY.md, relevant docs/memory notes, changed files.
40
40
  ```
@@ -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, implement directly or delegate to one bounded `worker`; keep the verification gate.
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, 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.
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.
@@ -36,7 +42,7 @@ When subagent tools are available, each agent may recursively delegate bounded s
36
42
  15. Apply the bounded loop policy when a gate fails.
37
43
  16. Record evidence in the plan file before marking the task complete.
38
44
  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.
45
+ 18. Write user-visible responses and generated or updated documentation, plans, and memory artifacts in the OS locale unless the user asks for another language.
40
46
 
41
47
  ## Builder Prompt Format
42
48
 
@@ -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 responses and generated or updated documentation, plans, and memory artifacts.
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.
@@ -11,4 +11,4 @@ Short index of persistent repository knowledge. Link detailed notes under `docs/
11
11
  - Preserve proper nouns exactly as written.
12
12
  - Prefer repository evidence over assumptions.
13
13
  - Read only the detailed memory needed for the current task.
14
- - Write user-visible output in the OS locale unless the user asks for another language.
14
+ - Write user-visible responses and generated or updated documentation, plans, and memory artifacts in the OS locale unless the user asks for another language.
package/templates/PLAN.md CHANGED
@@ -8,6 +8,7 @@ Short index of work plans. Link detailed plans under `docs/plan/`.
8
8
  - Install or bootstrap missing required tools before declaring them unavailable.
9
9
  - Heavy Path completion requires explicit automated test evidence.
10
10
  - Record tool readiness, dry-run/check evidence, module acceptance evidence, and surface integration evidence in detailed plans.
11
+ - Write user-visible responses and generated or updated documentation, plans, and memory artifacts in the OS locale unless the user asks for another language.
11
12
 
12
13
  ## Active Plans
13
14
 
@@ -24,7 +24,7 @@ Describe the observable result.
24
24
  - `docs/model-guidance/<claude-or-codex>.md`
25
25
  - Rationale:
26
26
  - Role-specific adjustment:
27
- - User-visible output locale: OS locale unless the user asks for another language.
27
+ - User-visible response and artifact locale: OS locale unless the user asks for another language.
28
28
 
29
29
  ## Complexity Triage
30
30