cclaw-cli 0.48.35 → 0.51.0

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.
Files changed (181) hide show
  1. package/README.md +54 -82
  2. package/dist/artifact-linter.d.ts +4 -0
  3. package/dist/artifact-linter.js +24 -3
  4. package/dist/cli.d.ts +1 -19
  5. package/dist/cli.js +49 -495
  6. package/dist/constants.d.ts +2 -13
  7. package/dist/constants.js +1 -46
  8. package/dist/content/closeout-guidance.d.ts +14 -0
  9. package/dist/content/closeout-guidance.js +42 -0
  10. package/dist/content/core-agents.js +51 -9
  11. package/dist/content/decision-protocol.d.ts +12 -0
  12. package/dist/content/decision-protocol.js +20 -0
  13. package/dist/content/diff-command.d.ts +1 -2
  14. package/dist/content/diff-command.js +8 -94
  15. package/dist/content/examples.d.ts +4 -10
  16. package/dist/content/examples.js +10 -20
  17. package/dist/content/hook-events.js +2 -2
  18. package/dist/content/hook-inline-snippets.d.ts +5 -2
  19. package/dist/content/hook-inline-snippets.js +33 -1
  20. package/dist/content/hook-manifest.d.ts +3 -4
  21. package/dist/content/hook-manifest.js +11 -12
  22. package/dist/content/hooks.js +2 -0
  23. package/dist/content/ideate-command.d.ts +2 -0
  24. package/dist/content/ideate-command.js +31 -25
  25. package/dist/content/iron-laws.d.ts +5 -5
  26. package/dist/content/iron-laws.js +5 -5
  27. package/dist/content/learnings.d.ts +3 -4
  28. package/dist/content/learnings.js +24 -50
  29. package/dist/content/meta-skill.js +31 -24
  30. package/dist/content/next-command.js +38 -38
  31. package/dist/content/node-hooks.js +17 -343
  32. package/dist/content/opencode-plugin.js +2 -100
  33. package/dist/content/research-playbooks.js +14 -14
  34. package/dist/content/review-loop.d.ts +2 -0
  35. package/dist/content/review-loop.js +8 -0
  36. package/dist/content/session-hooks.js +14 -46
  37. package/dist/content/skills.d.ts +0 -5
  38. package/dist/content/skills.js +53 -128
  39. package/dist/content/stage-common-guidance.d.ts +0 -1
  40. package/dist/content/stage-common-guidance.js +15 -14
  41. package/dist/content/stage-schema.d.ts +26 -1
  42. package/dist/content/stage-schema.js +121 -40
  43. package/dist/content/stages/_lint-metadata/index.js +9 -15
  44. package/dist/content/stages/brainstorm.js +22 -43
  45. package/dist/content/stages/design.js +37 -57
  46. package/dist/content/stages/plan.js +22 -13
  47. package/dist/content/stages/review.js +24 -27
  48. package/dist/content/stages/scope.js +34 -46
  49. package/dist/content/stages/ship.js +7 -4
  50. package/dist/content/stages/spec.js +20 -9
  51. package/dist/content/stages/tdd.js +64 -44
  52. package/dist/content/start-command.js +10 -12
  53. package/dist/content/status-command.d.ts +2 -7
  54. package/dist/content/status-command.js +19 -146
  55. package/dist/content/subagents.d.ts +0 -5
  56. package/dist/content/subagents.js +47 -28
  57. package/dist/content/templates.d.ts +1 -1
  58. package/dist/content/templates.js +126 -135
  59. package/dist/content/track-render-context.d.ts +17 -0
  60. package/dist/content/track-render-context.js +44 -0
  61. package/dist/content/tree-command.d.ts +1 -2
  62. package/dist/content/tree-command.js +4 -87
  63. package/dist/content/utility-skills.d.ts +2 -29
  64. package/dist/content/utility-skills.js +2 -1533
  65. package/dist/content/view-command.js +29 -11
  66. package/dist/delegation.d.ts +1 -1
  67. package/dist/delegation.js +5 -15
  68. package/dist/doctor-registry.js +20 -21
  69. package/dist/doctor.js +88 -408
  70. package/dist/flow-state.d.ts +3 -0
  71. package/dist/flow-state.js +2 -0
  72. package/dist/harness-adapters.d.ts +1 -1
  73. package/dist/harness-adapters.js +48 -57
  74. package/dist/install.js +128 -520
  75. package/dist/internal/advance-stage.js +3 -9
  76. package/dist/internal/compound-readiness.d.ts +1 -1
  77. package/dist/internal/compound-readiness.js +1 -1
  78. package/dist/internal/tdd-loop-status.d.ts +1 -1
  79. package/dist/internal/tdd-loop-status.js +1 -1
  80. package/dist/knowledge-store.d.ts +16 -10
  81. package/dist/knowledge-store.js +51 -15
  82. package/dist/policy.js +16 -109
  83. package/dist/run-archive.d.ts +4 -6
  84. package/dist/run-archive.js +15 -20
  85. package/dist/run-persistence.d.ts +2 -2
  86. package/dist/run-persistence.js +3 -9
  87. package/package.json +1 -2
  88. package/dist/content/archive-command.d.ts +0 -2
  89. package/dist/content/archive-command.js +0 -124
  90. package/dist/content/compound-command.d.ts +0 -5
  91. package/dist/content/compound-command.js +0 -193
  92. package/dist/content/contexts.d.ts +0 -9
  93. package/dist/content/contexts.js +0 -65
  94. package/dist/content/contracts.d.ts +0 -2
  95. package/dist/content/contracts.js +0 -51
  96. package/dist/content/doctor-references.d.ts +0 -2
  97. package/dist/content/doctor-references.js +0 -150
  98. package/dist/content/eval-scaffold.d.ts +0 -15
  99. package/dist/content/eval-scaffold.js +0 -370
  100. package/dist/content/feature-command.d.ts +0 -2
  101. package/dist/content/feature-command.js +0 -123
  102. package/dist/content/flow-map.d.ts +0 -23
  103. package/dist/content/flow-map.js +0 -134
  104. package/dist/content/harness-doc.d.ts +0 -2
  105. package/dist/content/harness-doc.js +0 -202
  106. package/dist/content/harness-playbooks.d.ts +0 -24
  107. package/dist/content/harness-playbooks.js +0 -393
  108. package/dist/content/harness-tool-refs.d.ts +0 -20
  109. package/dist/content/harness-tool-refs.js +0 -268
  110. package/dist/content/ops-command.d.ts +0 -2
  111. package/dist/content/ops-command.js +0 -71
  112. package/dist/content/protocols.d.ts +0 -7
  113. package/dist/content/protocols.js +0 -215
  114. package/dist/content/retro-command.d.ts +0 -2
  115. package/dist/content/retro-command.js +0 -165
  116. package/dist/content/rewind-command.d.ts +0 -2
  117. package/dist/content/rewind-command.js +0 -106
  118. package/dist/content/tdd-log-command.d.ts +0 -2
  119. package/dist/content/tdd-log-command.js +0 -85
  120. package/dist/eval/agents/single-shot.d.ts +0 -27
  121. package/dist/eval/agents/single-shot.js +0 -79
  122. package/dist/eval/agents/with-tools.d.ts +0 -44
  123. package/dist/eval/agents/with-tools.js +0 -261
  124. package/dist/eval/agents/workflow.d.ts +0 -31
  125. package/dist/eval/agents/workflow.js +0 -155
  126. package/dist/eval/baseline.d.ts +0 -38
  127. package/dist/eval/baseline.js +0 -282
  128. package/dist/eval/config-loader.d.ts +0 -14
  129. package/dist/eval/config-loader.js +0 -395
  130. package/dist/eval/corpus.d.ts +0 -30
  131. package/dist/eval/corpus.js +0 -330
  132. package/dist/eval/cost-guard.d.ts +0 -102
  133. package/dist/eval/cost-guard.js +0 -190
  134. package/dist/eval/diff.d.ts +0 -64
  135. package/dist/eval/diff.js +0 -323
  136. package/dist/eval/llm-client.d.ts +0 -176
  137. package/dist/eval/llm-client.js +0 -267
  138. package/dist/eval/mode.d.ts +0 -28
  139. package/dist/eval/mode.js +0 -61
  140. package/dist/eval/progress.d.ts +0 -83
  141. package/dist/eval/progress.js +0 -59
  142. package/dist/eval/report.d.ts +0 -11
  143. package/dist/eval/report.js +0 -181
  144. package/dist/eval/rubric-loader.d.ts +0 -20
  145. package/dist/eval/rubric-loader.js +0 -143
  146. package/dist/eval/runner.d.ts +0 -81
  147. package/dist/eval/runner.js +0 -746
  148. package/dist/eval/runs.d.ts +0 -41
  149. package/dist/eval/runs.js +0 -114
  150. package/dist/eval/sandbox.d.ts +0 -38
  151. package/dist/eval/sandbox.js +0 -137
  152. package/dist/eval/tools/glob.d.ts +0 -2
  153. package/dist/eval/tools/glob.js +0 -163
  154. package/dist/eval/tools/grep.d.ts +0 -2
  155. package/dist/eval/tools/grep.js +0 -152
  156. package/dist/eval/tools/index.d.ts +0 -7
  157. package/dist/eval/tools/index.js +0 -35
  158. package/dist/eval/tools/read.d.ts +0 -2
  159. package/dist/eval/tools/read.js +0 -122
  160. package/dist/eval/tools/types.d.ts +0 -49
  161. package/dist/eval/tools/types.js +0 -41
  162. package/dist/eval/tools/write.d.ts +0 -2
  163. package/dist/eval/tools/write.js +0 -92
  164. package/dist/eval/types.d.ts +0 -561
  165. package/dist/eval/types.js +0 -47
  166. package/dist/eval/verifiers/judge.d.ts +0 -40
  167. package/dist/eval/verifiers/judge.js +0 -256
  168. package/dist/eval/verifiers/rules.d.ts +0 -24
  169. package/dist/eval/verifiers/rules.js +0 -218
  170. package/dist/eval/verifiers/structural.d.ts +0 -14
  171. package/dist/eval/verifiers/structural.js +0 -171
  172. package/dist/eval/verifiers/traceability.d.ts +0 -23
  173. package/dist/eval/verifiers/traceability.js +0 -84
  174. package/dist/eval/verifiers/workflow-consistency.d.ts +0 -21
  175. package/dist/eval/verifiers/workflow-consistency.js +0 -225
  176. package/dist/eval/workflow-corpus.d.ts +0 -7
  177. package/dist/eval/workflow-corpus.js +0 -207
  178. package/dist/feature-system.d.ts +0 -42
  179. package/dist/feature-system.js +0 -432
  180. package/dist/internal/knowledge-digest.d.ts +0 -7
  181. package/dist/internal/knowledge-digest.js +0 -93
@@ -1,393 +0,0 @@
1
- /**
2
- * Per-harness parity playbooks.
3
- *
4
- * cclaw's subagent contracts (planner / reviewer / security-reviewer /
5
- * test-author / doc-updater) assume Claude-style isolated workers. On
6
- * harnesses without that primitive, the agent has to fulfil the role via a
7
- * documented fallback (generic Task dispatch, role-switch in-session, …).
8
- *
9
- * Each playbook is:
10
- * 1. short (≤ ~150 lines markdown),
11
- * 2. executable — reproducible by an agent without reading the whole repo,
12
- * 3. evidence-first — always records a delegation-log entry with
13
- * `fulfillmentMode` and `evidenceRefs` so `cclaw doctor` can tell the
14
- * role was actually performed.
15
- *
16
- * Playbooks are materialised at
17
- * `.cclaw/references/harnesses/<harness>-playbook.md` by install/sync/upgrade.
18
- */
19
- import { HARNESS_ADAPTERS } from "../harness-adapters.js";
20
- export const HARNESS_PLAYBOOKS_DIR = "references/harnesses";
21
- export function harnessPlaybookRelativePath(harness) {
22
- return `${HARNESS_PLAYBOOKS_DIR}/${harness}-playbook.md`;
23
- }
24
- export function harnessPlaybookFileName(harness) {
25
- return `${harness}-playbook.md`;
26
- }
27
- const CLAUDE_PLAYBOOK = `---
28
- harness: claude
29
- fallback: native
30
- description: "Claude Code has real isolated subagent workers with user-defined named types. No fallback required — this playbook is reference-only."
31
- ---
32
-
33
- # Claude Code — Parity Playbook
34
-
35
- **Status: native.** Claude Code supports isolated subagent workers via the
36
- \`Task\` tool with user-defined \`subagent_type\` (\`planner\`, \`reviewer\`,
37
- \`security-reviewer\`, \`test-author\`, \`doc-updater\`). Each dispatch runs in
38
- its own context and produces a return message visible only to the parent
39
- agent.
40
-
41
- This playbook exists so the harness matrix has one reference shape; Claude
42
- itself has no parity gap to close.
43
-
44
- ## Dispatch pattern
45
-
46
- 1. Pick the \`subagent_type\` matching the cclaw agent (e.g. \`reviewer\`).
47
- 2. Provide a specific, self-contained \`prompt\` — the subagent cannot see
48
- prior assistant turns.
49
- 3. Record a delegation entry before dispatch:
50
-
51
- \`\`\`json
52
- {
53
- "stage": "review",
54
- "agent": "reviewer",
55
- "mode": "mandatory",
56
- "status": "scheduled",
57
- "fulfillmentMode": "isolated",
58
- "spanId": "dspan-..."
59
- }
60
- \`\`\`
61
-
62
- 4. After the subagent returns, update the entry to \`status: "completed"\`
63
- and attach \`evidenceRefs\` pointing at the artifact section that
64
- captures the subagent's output.
65
-
66
- ## Verification
67
-
68
- \`cclaw doctor\` will pass the \`delegation:mandatory:current_stage\` check
69
- when each mandatory agent has a \`completed\` row for the active run.
70
- `;
71
- const CURSOR_PLAYBOOK = `---
72
- harness: cursor
73
- fallback: generic-dispatch
74
- description: "Cursor has a generic Task dispatcher with subagent_type (generalPurpose, explore, shell, …) but no user-defined named subagents. cclaw maps planner/reviewer/test-author/… onto generic dispatch with a structured role prompt."
75
- ---
76
-
77
- # Cursor — Parity Playbook
78
-
79
- **Fallback: generic-dispatch.** Cursor's \`Task\` tool supports
80
- \`subagent_type\` from a fixed vocabulary (\`generalPurpose\`, \`explore\`,
81
- \`shell\`, \`browser-use\`, …). Real isolation, but no user-defined agent
82
- names. cclaw closes the gap by mapping each named cclaw agent onto the
83
- generic dispatcher with a strict role prompt.
84
-
85
- ## Named-agent → Cursor subagent_type map
86
-
87
- | cclaw agent | Cursor \`subagent_type\` | Readonly? | Rationale |
88
- |----------------------|-------------------------|-----------|-----------|
89
- | \`planner\` | \`explore\` | yes | Pure research, no writes. |
90
- | \`reviewer\` | \`explore\` | yes | Reads diff + context, emits findings. |
91
- | \`security-reviewer\`| \`explore\` | yes | Reads code, produces report; no fixes. |
92
- | \`test-author\` | \`generalPurpose\` | no | Writes tests, runs them, iterates. |
93
- | \`doc-updater\` | \`generalPurpose\` | no | Edits docs, re-runs build. |
94
-
95
- ## Dispatch pattern
96
-
97
- 1. Pick the mapped \`subagent_type\` from the table above.
98
- 2. Build the \`prompt\` from the cclaw agent role brief in
99
- \`.cclaw/agents/<agent>.md\`, prefaced with a single line naming the
100
- cclaw role (\`You are the cclaw <agent>. Follow the role brief below.\`).
101
- 3. Set \`readonly: true\` when the table says yes — Cursor enforces it.
102
- 4. Before dispatch, append a delegation row:
103
-
104
- \`\`\`json
105
- {
106
- "stage": "tdd",
107
- "agent": "test-author",
108
- "mode": "mandatory",
109
- "status": "scheduled",
110
- "fulfillmentMode": "generic-dispatch",
111
- "spanId": "dspan-..."
112
- }
113
- \`\`\`
114
-
115
- 5. After dispatch returns, transition the row to \`completed\` with
116
- \`evidenceRefs\` citing the artifact anchor where the result landed.
117
-
118
- ## Why not upgrade Cursor to a full tier-1?
119
-
120
- Cursor has dispatch + hooks + \`AskQuestion\`. The missing piece is
121
- **user-defined named subagents**. Semantically this is the difference
122
- between Claude's \`test-author\` (a distinct runtime worker registered by
123
- cclaw) and Cursor's \`generalPurpose\` worker that cclaw *asks* to act as a
124
- test-author. Good enough for parity; different enough to keep the labels
125
- honest.
126
-
127
- ## Verification
128
-
129
- \`cclaw doctor\` passes when the delegation row exists with
130
- \`fulfillmentMode: "generic-dispatch"\` (or \`completed\` rows for the
131
- mandatory agents in general). No evidenceRef requirement applies here —
132
- Cursor dispatch is real isolation.
133
- `;
134
- const OPENCODE_PLAYBOOK = `---
135
- harness: opencode
136
- fallback: role-switch
137
- description: "OpenCode has plugin-based dispatch hooks and a native structured-ask tool (question) but no isolated subagent worker primitive. cclaw uses an in-session role-switch with a delegation-log entry + evidenceRefs, and emits Decision Protocol calls through the question tool when it is permitted."
138
- ---
139
-
140
- # OpenCode — Parity Playbook
141
-
142
- **Fallback: role-switch.** OpenCode exposes tool/session event hooks via a
143
- plugin but does not provide an isolated subagent worker. cclaw closes the
144
- delegation gate by role-switching inside the same session: the agent
145
- announces the role, performs the work against the role brief, and records
146
- evidence.
147
-
148
- **Structured ask: native \`question\` tool.** OpenCode ships a first-class
149
- \`question\` primitive (header + question text + options, plus a
150
- "type custom" fallback; supports multi-question navigation). It is
151
- permission-gated:
152
-
153
- - \`opencode.json\` must grant \`permission.question: "allow"\` (or be
154
- covered by a \`"*": "allow"\` default).
155
- - ACP clients additionally need \`OPENCODE_ENABLE_QUESTION_TOOL=1\` set
156
- on the \`opencode acp\` process.
157
-
158
- When the tool is permitted, every Decision Protocol call maps to a single
159
- \`question\` invocation. When it is denied or the host doesn't expose it,
160
- fall back to the shared plain-text lettered list — same skeleton, same
161
- artifact decision log. Full mapping:
162
- \`.cclaw/references/harness-tools/opencode.md\`.
163
-
164
- ## Role-switch protocol
165
-
166
- 1. Announce the role explicitly in a single message:
167
-
168
- > Acting as cclaw **<agent>** per \`.cclaw/agents/<agent>.md\`. No other
169
- > role may be assumed until the delegation row is closed.
170
-
171
- 2. Execute the role's brief. Do NOT interleave other roles' work.
172
- 3. Write the result into the stage artifact (e.g. TDD work lands in
173
- \`.cclaw/artifacts/06-tdd.md\`).
174
- 4. Append a delegation row:
175
-
176
- \`\`\`json
177
- {
178
- "stage": "tdd",
179
- "agent": "test-author",
180
- "mode": "mandatory",
181
- "status": "completed",
182
- "fulfillmentMode": "role-switch",
183
- "evidenceRefs": [
184
- ".cclaw/artifacts/06-tdd.md#red-run",
185
- ".cclaw/artifacts/06-tdd.md#green-run"
186
- ],
187
- "spanId": "dspan-..."
188
- }
189
- \`\`\`
190
-
191
- 5. \`evidenceRefs\` **must** point at concrete artifact anchors — not
192
- placeholder text. \`cclaw doctor\` will report \`missingEvidence\` if
193
- the array is empty under a role-switch fallback.
194
-
195
- ## Exception: OpenCode plugin dispatch
196
-
197
- If the project configures a plugin-based dispatch path (e.g. a tool that
198
- spawns a worker process), set \`fulfillmentMode: "generic-dispatch"\`
199
- instead of \`role-switch\` and omit the role-announce step. evidenceRefs
200
- remain optional but recommended.
201
-
202
- ## Verification
203
-
204
- \`cclaw doctor\` passes when every mandatory agent for the active stage
205
- has either a \`completed\` row with evidenceRefs (role-switch) or a
206
- \`completed\` row under plugin dispatch.
207
- `;
208
- const CODEX_PLAYBOOK = `---
209
- harness: codex
210
- fallback: role-switch
211
- description: "OpenAI Codex exposes lifecycle hooks (v0.114+, gated by the codex_hooks feature flag) but no subagent dispatch and no custom slash commands. cclaw ships entry points as skills under .agents/skills/cc*/ and wires .codex/hooks.json; mandatory delegations fall back to role-switch with evidenceRefs."
212
- ---
213
-
214
- # OpenAI Codex — Parity Playbook
215
-
216
- Codex CLI has a different shape from Claude/Cursor:
217
-
218
- - **Entry points are skills.** \`/cc\`, \`/cc-next\`, \`/cc-ideate\`,
219
- \`/cc-view\`, \`/cc-ops\` are generated as skills at
220
- \`.agents/skills/cc/SKILL.md\` (and \`cc-next/\`, \`cc-view/\`,
221
- \`cc-ideate/\`, \`cc-ops/\`). They activate via Codex's native
222
- \`/use <skillName>\` command or automatically when the user's prompt
223
- mentions any of the \`/cc\`-style tokens (skill descriptions include
224
- them verbatim). Codex CLI removed custom prompts in v0.89 (Jan 2026);
225
- there is no way to register a true custom slash command.
226
- - **Lifecycle hooks.** Codex CLI ≥ v0.114 (Mar 2026) exposes lifecycle
227
- hooks at \`.codex/hooks.json\`, gated behind the experimental
228
- \`[features] codex_hooks = true\` flag in \`~/.codex/config.toml\`.
229
- cclaw writes \`.codex/hooks.json\` on sync; if the flag is off, the
230
- file is simply inert and \`cclaw doctor\` emits a warning. \`cclaw init\`
231
- offers to patch the flag with explicit user consent.
232
- - **Tool interception is Bash-only.** Codex's \`PreToolUse\` and
233
- \`PostToolUse\` events only fire for the \`Bash\` tool. \`Write\`,
234
- \`Edit\`, \`WebSearch\`, and MCP tool calls are **not** gated by hooks.
235
- cclaw partially compensates by wiring \`UserPromptSubmit\` to both
236
- \`prompt-guard\` and a non-blocking
237
- \`cclaw internal verify-current-state --quiet\` nudge that emits
238
- unmet-delegation / missing-evidence warnings before the turn executes.
239
- This is still a nudge, not a hard block: workflow-guard (TDD red-first,
240
- artifact presence) only fires on Bash turns. See the hook coverage matrix below.
241
- - **Legacy paths.** \`.codex/commands/*\` was never consumed by Codex and
242
- is removed on every \`cclaw sync\`. The v0.39.x \`.agents/skills/cclaw-cc*/\`
243
- layout is replaced by \`.agents/skills/cc*/\` and the old folders are
244
- auto-removed on sync. Do not restore either by hand.
245
-
246
- ## Structured ask: native \`request_user_input\` tool
247
-
248
- Codex exposes \`request_user_input\` — an experimental tool that accepts
249
- 1-3 short questions and returns the user's answers in the same order.
250
- It is the primitive the built-in Plan / Collaboration mode templates use
251
- (see \`codex-rs/collaboration-mode-templates/templates/plan.md\`), and
252
- agents running inside Codex can call it directly. Answers come back as
253
- free-form strings, not option IDs — keep lettered options inline in the
254
- question text so the user's reply maps cleanly to the artifact
255
- decision log.
256
-
257
- cclaw stage skills invoke \`request_user_input\` for every Decision
258
- Protocol call when the tool is available, and fall back to the shared
259
- plain-text lettered list when Codex returns a schema error or when the
260
- current host hides the tool (older builds, non-collaboration mode). Full
261
- mapping: \`.cclaw/references/harness-tools/codex.md\`.
262
-
263
- ## Fallback: role-switch
264
-
265
- Codex has no subagent dispatch — neither named nor generic. Mandatory
266
- delegations must be role-switched in-session. Silent auto-waiver was
267
- disabled in v0.33 and remains off.
268
-
269
- 1. **Explicit announce.** Before performing the role, emit a single
270
- message naming the role and citing \`.cclaw/agents/<agent>.md\`.
271
- 2. **No role interleaving.** Close one delegation before opening
272
- another; never mix, for example, reviewer and test-author work in
273
- the same turn.
274
- 3. **EvidenceRefs are mandatory.** A \`completed\` row without
275
- \`evidenceRefs\` is treated as \`missingEvidence\` by \`cclaw doctor\`
276
- and blocks the stage gate.
277
-
278
- ## Stage-specific role maps
279
-
280
- | Stage | Mandatory roles | Artifact to cite in evidenceRefs |
281
- |------------|----------------------------------|--------------------------------------|
282
- | scope | \`planner\` | \`.cclaw/artifacts/02-scope.md\` |
283
- | design | \`planner\` | \`.cclaw/artifacts/03-design.md\` |
284
- | plan | \`planner\` | \`.cclaw/artifacts/05-plan.md\` |
285
- | tdd | \`test-author\` | \`.cclaw/artifacts/06-tdd.md\` |
286
- | review | \`reviewer\`, \`security-reviewer\` | \`.cclaw/artifacts/07-review.md\` |
287
- | ship | \`doc-updater\` | \`.cclaw/artifacts/08-ship.md\` |
288
-
289
- ## Invocation cheatsheet
290
-
291
- - \`/use cc\` — open the \`/cc\` skill and pick a track.
292
- - \`/use cc-next\` — advance the flow one stage.
293
- - \`/use cc-ops\` — compound / archive / rewind.
294
- - \`node .cclaw/hooks/stage-complete.mjs <stage>\` — canonical stage closeout helper;
295
- validates delegations + gate evidence before mutating \`flow-state.json\`.
296
- - Typing \`/cc …\` or \`/cc-next …\` in plain text also works: Codex
297
- matches the skill descriptions (which spell out these tokens) and
298
- auto-loads the right skill body.
299
- - Use Codex's built-in \`/skill\` UI to enable or disable
300
- cclaw skills per session.
301
-
302
- ## Feature flag — how to enable hooks
303
-
304
- Codex CLI ignores \`.codex/hooks.json\` unless \`codex_hooks = true\`
305
- appears under \`[features]\` in \`~/.codex/config.toml\`:
306
-
307
- \`\`\`toml
308
- [features]
309
- codex_hooks = true
310
- \`\`\`
311
-
312
- \`cclaw init --codex\` prompts to write this automatically (one-line
313
- diff, preserving the rest of \`config.toml\` untouched). Decline the
314
- prompt to leave the file alone; the skill-level \`/use cc\` entry points
315
- continue to work regardless.
316
-
317
- ## Hook coverage matrix
318
-
319
- | Hook intent | Codex mapping | Coverage |
320
- |-------------|---------------|----------|
321
- | SessionStart rehydration | \`SessionStart\` matcher \`startup|resume\` → \`session-start\` | Full. |
322
- | PreToolUse prompt-guard | \`PreToolUse\` matcher \`Bash\` + \`UserPromptSubmit\` → \`prompt-guard\` | Bash tool calls are gated inline; \`UserPromptSubmit\` catches prompts before any tool fires, so non-Bash writes (\`Write\`/\`Edit\`) are still prompt-guarded at the turn boundary. |
323
- | UserPromptSubmit state nudge | \`UserPromptSubmit\` → \`cclaw internal verify-current-state --quiet\` | Non-blocking warning only. Prints unmet mandatory delegation / gate-evidence counts before the turn; cannot block non-Bash \`Write\`/\`Edit\`. |
324
- | PreToolUse workflow-guard | \`PreToolUse\` matcher \`Bash\` → \`workflow-guard\` | Bash-only. For \`Write\`/\`Edit\` calls the agent performs the TDD-order / artifact check in-turn (see the stage skill). |
325
- | PostToolUse context-monitor | \`PostToolUse\` matcher \`Bash\` → \`context-monitor\` | Bash-only. Other tool calls get context-monitored at end-of-turn via \`.cclaw/references/protocols/ethos.md\`. |
326
- | Stop checkpoint | \`Stop\` → \`stop-checkpoint\` | Full. |
327
- | PreCompact digest | Not supported — Codex has no \`PreCompact\` event. | Covered by \`/cc-ops retro\` and the user running \`/cc-view status\` before Codex's \`/compact\` command. |
328
-
329
- ## Verification
330
-
331
- \`cclaw doctor\` on a codex-enabled install checks:
332
-
333
- - \`shim:codex:cc:present\` and \`frontmatter\` (plus the four utility
334
- skills \`cc-next\`, \`cc-view\`, \`cc-ops\`, \`cc-ideate\`).
335
- - \`hook:schema:codex\` validates \`.codex/hooks.json\` shape.
336
- - \`hook:wiring:codex\` verifies the generated hooks reference every
337
- runtime script cclaw needs (session-start, prompt-guard, workflow-guard,
338
- context-monitor, stop-checkpoint).
339
- - \`warning:codex:feature_flag\` is emitted as a warning (not an error)
340
- when \`~/.codex/config.toml\` is missing the \`codex_hooks\` feature
341
- flag — hooks silently do nothing in that state.
342
- - \`warning:codex:legacy_commands_dir\` and
343
- \`warning:codex:legacy_cclaw_cc_skills\` catch leftovers from older
344
- cclaw versions.
345
- - Every mandatory agent for the active stage has a \`completed\` row
346
- with \`fulfillmentMode: "role-switch"\` and at least one \`evidenceRef\`.
347
- `;
348
- const PLAYBOOK_BY_HARNESS = {
349
- claude: CLAUDE_PLAYBOOK,
350
- cursor: CURSOR_PLAYBOOK,
351
- opencode: OPENCODE_PLAYBOOK,
352
- codex: CODEX_PLAYBOOK
353
- };
354
- export function harnessPlaybookMarkdown(harness) {
355
- const body = PLAYBOOK_BY_HARNESS[harness];
356
- if (!body) {
357
- throw new Error(`No playbook defined for harness "${harness}".`);
358
- }
359
- return body;
360
- }
361
- export function harnessPlaybooksIndexMarkdown() {
362
- const rows = Object.keys(HARNESS_ADAPTERS)
363
- .map((h) => {
364
- const fallback = HARNESS_ADAPTERS[h].capabilities.subagentFallback;
365
- return `| \`${h}\` | ${fallback} | [\`${harnessPlaybookFileName(h)}\`](./${harnessPlaybookFileName(h)}) |`;
366
- })
367
- .join("\n");
368
- return `# Harness parity playbooks
369
-
370
- Each playbook describes the concrete pattern cclaw expects when the
371
- harness does not natively satisfy a mandatory delegation contract.
372
-
373
- | Harness | Fallback | Playbook |
374
- |---|---|---|
375
- ${rows}
376
-
377
- ## How cclaw uses these files
378
-
379
- - \`cclaw doctor\` verifies that every installed harness has its playbook
380
- present under \`.cclaw/references/harnesses/\`.
381
- - Stage skills (TDD, review, ship) cite the active harness's playbook
382
- instead of inlining the fallback pattern.
383
- - The \`delegation:mandatory:current_stage\` check expects
384
- \`fulfillmentMode\` to match the harness's declared \`subagentFallback\`
385
- (\`isolated\`, \`generic-dispatch\`, or \`role-switch\`).
386
-
387
- ## When to edit
388
-
389
- Playbooks are generated by \`cclaw upgrade\`. Local edits are overwritten.
390
- To customise the parity pattern for a specific repository, override the
391
- skill that cites the playbook, not the playbook itself.
392
- `;
393
- }
@@ -1,20 +0,0 @@
1
- /**
2
- * Per-harness tool-mapping reference files.
3
- *
4
- * Addresses A.1#4: the four supported harnesses (claude, cursor, opencode, codex)
5
- * expose different primitive names for the same capabilities (ask-user,
6
- * delegate/Task, web fetch, file edit, code execution, ...). cclaw's stage skills
7
- * need to pick the right name at runtime without bloating every stage with per-harness
8
- * if/else ladders.
9
- *
10
- * Each file below is short (one table per capability), authoritative, and materialised
11
- * at `.cclaw/references/harness-tools/<harness>.md`. Stage skills and the meta-skill
12
- * cite the folder instead of duplicating the mappings inline.
13
- *
14
- * When a new harness is added (or an existing one renames a tool), update the
15
- * corresponding entry here — do NOT scatter tool names across skill text.
16
- */
17
- import type { HarnessId } from "../types.js";
18
- export declare const HARNESS_TOOL_REFS_DIR = "references/harness-tools";
19
- export declare function harnessToolRefMarkdown(harness: HarnessId): string;
20
- export declare const HARNESS_TOOL_REFS_INDEX_MD = "---\nname: Harness tool maps\ndescription: \"Index file. One reference per supported harness \u2014 cite the per-harness file instead of hardcoding tool names in stage skills.\"\n---\n\n# Harness Tool Maps\n\ncclaw supports four harnesses; each exposes different primitive names for the same capabilities. Stage skills and utility skills cite the file matching the currently active harness and fall back to plain-text equivalents for capabilities that the harness lacks.\n\n| Harness | File | Notes |\n|---|---|---|\n| Claude Code | `.cclaw/references/harness-tools/claude.md` | Richest tool surface (AskUserQuestion, Task, WebFetch, WebSearch, MCP, \u2026). |\n| Cursor | `.cclaw/references/harness-tools/cursor.md` | Near-parity with Claude; uses `AskQuestion` instead of `AskUserQuestion`. |\n| OpenCode | `.cclaw/references/harness-tools/opencode.md` | Native `question` tool (permission-gated) for structured asks; no isolated subagent dispatch. |\n| Codex | `.cclaw/references/harness-tools/codex.md` | Native `request_user_input` tool (experimental, Plan / Collaboration mode) for structured asks; no subagent dispatch. |\n\nWhen a new harness is added or an existing one renames a tool, update the corresponding file (and this index) \u2014 do NOT scatter tool names across skill text.\n";