cclaw-cli 0.49.0 → 0.51.1

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 (183) hide show
  1. package/README.md +57 -84
  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 -491
  6. package/dist/constants.d.ts +2 -13
  7. package/dist/constants.js +1 -43
  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 +55 -17
  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 +44 -21
  23. package/dist/content/ideate-command.d.ts +2 -0
  24. package/dist/content/ideate-command.js +34 -25
  25. package/dist/content/iron-laws.d.ts +5 -5
  26. package/dist/content/iron-laws.js +5 -5
  27. package/dist/content/language-policy.d.ts +2 -0
  28. package/dist/content/language-policy.js +13 -0
  29. package/dist/content/learnings.d.ts +3 -4
  30. package/dist/content/learnings.js +26 -50
  31. package/dist/content/meta-skill.js +33 -22
  32. package/dist/content/next-command.js +41 -38
  33. package/dist/content/node-hooks.js +17 -345
  34. package/dist/content/opencode-plugin.js +5 -103
  35. package/dist/content/research-playbooks.js +14 -14
  36. package/dist/content/review-loop.d.ts +2 -0
  37. package/dist/content/review-loop.js +8 -0
  38. package/dist/content/session-hooks.js +15 -47
  39. package/dist/content/skills.d.ts +0 -5
  40. package/dist/content/skills.js +55 -128
  41. package/dist/content/stage-common-guidance.d.ts +0 -1
  42. package/dist/content/stage-common-guidance.js +17 -14
  43. package/dist/content/stage-schema.d.ts +26 -1
  44. package/dist/content/stage-schema.js +121 -40
  45. package/dist/content/stages/_lint-metadata/index.js +9 -15
  46. package/dist/content/stages/brainstorm.js +22 -43
  47. package/dist/content/stages/design.js +37 -57
  48. package/dist/content/stages/plan.js +22 -13
  49. package/dist/content/stages/review.js +24 -27
  50. package/dist/content/stages/scope.js +34 -46
  51. package/dist/content/stages/ship.js +7 -4
  52. package/dist/content/stages/spec.js +20 -9
  53. package/dist/content/stages/tdd.js +64 -44
  54. package/dist/content/start-command.js +13 -12
  55. package/dist/content/status-command.d.ts +2 -7
  56. package/dist/content/status-command.js +19 -146
  57. package/dist/content/subagents.d.ts +0 -5
  58. package/dist/content/subagents.js +51 -28
  59. package/dist/content/templates.d.ts +1 -1
  60. package/dist/content/templates.js +126 -135
  61. package/dist/content/track-render-context.d.ts +17 -0
  62. package/dist/content/track-render-context.js +44 -0
  63. package/dist/content/tree-command.d.ts +1 -2
  64. package/dist/content/tree-command.js +4 -87
  65. package/dist/content/utility-skills.d.ts +2 -29
  66. package/dist/content/utility-skills.js +2 -1534
  67. package/dist/content/view-command.js +31 -11
  68. package/dist/delegation.d.ts +1 -1
  69. package/dist/delegation.js +5 -15
  70. package/dist/doctor-registry.js +20 -21
  71. package/dist/doctor.js +88 -344
  72. package/dist/flow-state.d.ts +3 -0
  73. package/dist/flow-state.js +2 -0
  74. package/dist/harness-adapters.d.ts +1 -1
  75. package/dist/harness-adapters.js +51 -58
  76. package/dist/install.js +128 -358
  77. package/dist/internal/advance-stage.js +3 -9
  78. package/dist/internal/compound-readiness.d.ts +1 -1
  79. package/dist/internal/compound-readiness.js +1 -1
  80. package/dist/internal/tdd-loop-status.d.ts +1 -1
  81. package/dist/internal/tdd-loop-status.js +1 -1
  82. package/dist/knowledge-store.d.ts +16 -10
  83. package/dist/knowledge-store.js +51 -15
  84. package/dist/policy.js +16 -105
  85. package/dist/run-archive.d.ts +4 -6
  86. package/dist/run-archive.js +15 -20
  87. package/dist/run-persistence.d.ts +2 -2
  88. package/dist/run-persistence.js +3 -9
  89. package/package.json +1 -2
  90. package/dist/content/archive-command.d.ts +0 -2
  91. package/dist/content/archive-command.js +0 -124
  92. package/dist/content/compound-command.d.ts +0 -5
  93. package/dist/content/compound-command.js +0 -193
  94. package/dist/content/contexts.d.ts +0 -18
  95. package/dist/content/contexts.js +0 -24
  96. package/dist/content/contracts.d.ts +0 -2
  97. package/dist/content/contracts.js +0 -51
  98. package/dist/content/doctor-references.d.ts +0 -2
  99. package/dist/content/doctor-references.js +0 -150
  100. package/dist/content/eval-scaffold.d.ts +0 -15
  101. package/dist/content/eval-scaffold.js +0 -370
  102. package/dist/content/feature-command.d.ts +0 -2
  103. package/dist/content/feature-command.js +0 -123
  104. package/dist/content/flow-map.d.ts +0 -23
  105. package/dist/content/flow-map.js +0 -134
  106. package/dist/content/harness-doc.d.ts +0 -2
  107. package/dist/content/harness-doc.js +0 -202
  108. package/dist/content/harness-playbooks.d.ts +0 -24
  109. package/dist/content/harness-playbooks.js +0 -393
  110. package/dist/content/harness-tool-refs.d.ts +0 -20
  111. package/dist/content/harness-tool-refs.js +0 -268
  112. package/dist/content/ops-command.d.ts +0 -2
  113. package/dist/content/ops-command.js +0 -71
  114. package/dist/content/protocols.d.ts +0 -7
  115. package/dist/content/protocols.js +0 -215
  116. package/dist/content/retro-command.d.ts +0 -2
  117. package/dist/content/retro-command.js +0 -165
  118. package/dist/content/rewind-command.d.ts +0 -2
  119. package/dist/content/rewind-command.js +0 -106
  120. package/dist/content/tdd-log-command.d.ts +0 -2
  121. package/dist/content/tdd-log-command.js +0 -85
  122. package/dist/eval/agents/single-shot.d.ts +0 -27
  123. package/dist/eval/agents/single-shot.js +0 -79
  124. package/dist/eval/agents/with-tools.d.ts +0 -44
  125. package/dist/eval/agents/with-tools.js +0 -261
  126. package/dist/eval/agents/workflow.d.ts +0 -31
  127. package/dist/eval/agents/workflow.js +0 -155
  128. package/dist/eval/baseline.d.ts +0 -38
  129. package/dist/eval/baseline.js +0 -282
  130. package/dist/eval/config-loader.d.ts +0 -14
  131. package/dist/eval/config-loader.js +0 -395
  132. package/dist/eval/corpus.d.ts +0 -30
  133. package/dist/eval/corpus.js +0 -330
  134. package/dist/eval/cost-guard.d.ts +0 -102
  135. package/dist/eval/cost-guard.js +0 -190
  136. package/dist/eval/diff.d.ts +0 -64
  137. package/dist/eval/diff.js +0 -323
  138. package/dist/eval/llm-client.d.ts +0 -176
  139. package/dist/eval/llm-client.js +0 -267
  140. package/dist/eval/mode.d.ts +0 -28
  141. package/dist/eval/mode.js +0 -61
  142. package/dist/eval/progress.d.ts +0 -83
  143. package/dist/eval/progress.js +0 -59
  144. package/dist/eval/report.d.ts +0 -11
  145. package/dist/eval/report.js +0 -181
  146. package/dist/eval/rubric-loader.d.ts +0 -20
  147. package/dist/eval/rubric-loader.js +0 -143
  148. package/dist/eval/runner.d.ts +0 -81
  149. package/dist/eval/runner.js +0 -746
  150. package/dist/eval/runs.d.ts +0 -41
  151. package/dist/eval/runs.js +0 -114
  152. package/dist/eval/sandbox.d.ts +0 -38
  153. package/dist/eval/sandbox.js +0 -137
  154. package/dist/eval/tools/glob.d.ts +0 -2
  155. package/dist/eval/tools/glob.js +0 -163
  156. package/dist/eval/tools/grep.d.ts +0 -2
  157. package/dist/eval/tools/grep.js +0 -152
  158. package/dist/eval/tools/index.d.ts +0 -7
  159. package/dist/eval/tools/index.js +0 -35
  160. package/dist/eval/tools/read.d.ts +0 -2
  161. package/dist/eval/tools/read.js +0 -122
  162. package/dist/eval/tools/types.d.ts +0 -49
  163. package/dist/eval/tools/types.js +0 -41
  164. package/dist/eval/tools/write.d.ts +0 -2
  165. package/dist/eval/tools/write.js +0 -92
  166. package/dist/eval/types.d.ts +0 -561
  167. package/dist/eval/types.js +0 -47
  168. package/dist/eval/verifiers/judge.d.ts +0 -40
  169. package/dist/eval/verifiers/judge.js +0 -256
  170. package/dist/eval/verifiers/rules.d.ts +0 -24
  171. package/dist/eval/verifiers/rules.js +0 -218
  172. package/dist/eval/verifiers/structural.d.ts +0 -14
  173. package/dist/eval/verifiers/structural.js +0 -171
  174. package/dist/eval/verifiers/traceability.d.ts +0 -23
  175. package/dist/eval/verifiers/traceability.js +0 -84
  176. package/dist/eval/verifiers/workflow-consistency.d.ts +0 -21
  177. package/dist/eval/verifiers/workflow-consistency.js +0 -225
  178. package/dist/eval/workflow-corpus.d.ts +0 -7
  179. package/dist/eval/workflow-corpus.js +0 -207
  180. package/dist/feature-system.d.ts +0 -42
  181. package/dist/feature-system.js +0 -432
  182. package/dist/internal/knowledge-digest.d.ts +0 -7
  183. package/dist/internal/knowledge-digest.js +0 -93
@@ -1,5 +1,6 @@
1
1
  import type { FlowStage, FlowTrack, TransitionRule } from "./types.js";
2
2
  export declare const TRANSITION_RULES: TransitionRule[];
3
+ export declare const FLOW_STATE_SCHEMA_VERSION = 1;
3
4
  export interface StageGateState {
4
5
  required: string[];
5
6
  recommended: string[];
@@ -66,6 +67,8 @@ export interface CloseoutState {
66
67
  }
67
68
  export declare function createInitialCloseoutState(): CloseoutState;
68
69
  export interface FlowState {
70
+ /** Backward-compatible schema marker for future migrations. */
71
+ schemaVersion: typeof FLOW_STATE_SCHEMA_VERSION;
69
72
  activeRunId: string;
70
73
  currentStage: FlowStage;
71
74
  completedStages: FlowStage[];
@@ -1,6 +1,7 @@
1
1
  import { buildTransitionRules, orderedStageSchemas, stageGateIds, stageRecommendedGateIds } from "./content/stage-schema.js";
2
2
  import { FLOW_STAGES, FLOW_TRACKS, TRACK_STAGES } from "./types.js";
3
3
  export const TRANSITION_RULES = buildTransitionRules();
4
+ export const FLOW_STATE_SCHEMA_VERSION = 1;
4
5
  /**
5
6
  * Ship closeout substate machine.
6
7
  *
@@ -80,6 +81,7 @@ export function createInitialFlowState(activeRunIdOrOptions = {}, maybeTrack) {
80
81
  };
81
82
  }
82
83
  return {
84
+ schemaVersion: FLOW_STATE_SCHEMA_VERSION,
83
85
  activeRunId,
84
86
  currentStage: firstStageForTrack(track),
85
87
  completedStages: [],
@@ -78,7 +78,7 @@ export interface HarnessAdapter {
78
78
  /**
79
79
  * Declared fallback pattern used when the harness cannot satisfy a
80
80
  * mandatory delegation natively. Drives `checkMandatoryDelegations`
81
- * and the generated playbook per harness.
81
+ * and generated harness guidance.
82
82
  */
83
83
  subagentFallback: SubagentFallback;
84
84
  };
@@ -1,6 +1,7 @@
1
1
  import fs from "node:fs/promises";
2
2
  import path from "node:path";
3
3
  import { RUNTIME_ROOT } from "./constants.js";
4
+ import { conversationLanguagePolicyMarkdown } from "./content/language-policy.js";
4
5
  import { CCLAW_AGENTS, agentMarkdown } from "./content/core-agents.js";
5
6
  import { ironLawsAgentsMdBlock } from "./content/iron-laws.js";
6
7
  import { ensureDir, exists, writeFileSafe } from "./fs-utils.js";
@@ -33,35 +34,11 @@ const UTILITY_SHIMS = [
33
34
  command: "view",
34
35
  skillFolder: "flow-view",
35
36
  commandFile: "view.md"
36
- },
37
- {
38
- fileName: "cc-ops.md",
39
- skillName: "cc-ops",
40
- command: "ops",
41
- skillFolder: "flow-ops",
42
- commandFile: "ops.md"
43
37
  }
44
38
  ];
45
39
  /** Skill-kind shim name for the root `/cc` entry point. */
46
40
  const ENTRY_SHIM_SKILL_NAME = "cc";
47
- /**
48
- * Skill directory names that v0.39.0 / v0.39.1 installed under
49
- * `.agents/skills/` before the rename. We delete these on every sync so
50
- * upgrades from those versions do not leave orphaned `cclaw-cc*`
51
- * folders that would double-register in Codex's skill listing.
52
- */
53
- const LEGACY_CODEX_SKILL_NAMES = [
54
- "cclaw-cc",
55
- "cclaw-cc-next",
56
- "cclaw-cc-view",
57
- "cclaw-cc-ops",
58
- "cclaw-cc-ideate",
59
- // Pre-v0.40 installed `/cc-learn` as a top-level skill before it was
60
- // folded into `/cc-ops`. Without this entry the orphan stays behind
61
- // after upgrade and Codex lists both the new in-thread workflow and
62
- // the legacy slash command.
63
- "cclaw-cc-learn"
64
- ];
41
+ const LEGACY_CODEX_SKILL_PREFIX = "cclaw-cc";
65
42
  /**
66
43
  * Shims that older cclaw versions installed as top-level slash commands but
67
44
  * which we now treat as internal (skill-only, invoked by the agent, never
@@ -96,7 +73,7 @@ export const HARNESS_ADAPTERS = {
96
73
  // Cursor has a real Task tool with subagent_type (generalPurpose,
97
74
  // explore, shell, browser-use, …) but no user-defined named
98
75
  // subagents. cclaw maps each named agent (planner/reviewer/…) onto
99
- // generic dispatch with a role prompt — see the cursor playbook.
76
+ // generic dispatch with a role prompt.
100
77
  nativeSubagentDispatch: "generic",
101
78
  hookSurface: "full",
102
79
  structuredAsk: "AskQuestion",
@@ -115,9 +92,8 @@ export const HARNESS_ADAPTERS = {
115
92
  // permission-gated — `opencode.json` must set
116
93
  // `permission.question: "allow"` and ACP clients must export
117
94
  // `OPENCODE_ENABLE_QUESTION_TOOL=1`. cclaw surfaces the tool name
118
- // in the Decision Protocol and in the OpenCode playbook; skills
119
- // fall back to the shared plain-text lettered list when the tool
120
- // is denied or unavailable.
95
+ // in generated harness guidance; skills fall back to the shared
96
+ // plain-text lettered list when the tool is denied or unavailable.
121
97
  structuredAsk: "question",
122
98
  subagentFallback: "role-switch"
123
99
  }
@@ -144,9 +120,8 @@ export const HARNESS_ADAPTERS = {
144
120
  // It is the primitive the built-in Plan / Collaboration mode
145
121
  // templates use (see `codex-rs/collaboration-mode-templates`).
146
122
  // Agents running inside Codex can call it directly; cclaw wires
147
- // it into the Decision Protocol and the Codex playbook. The
148
- // shared plain-text lettered list is the documented fallback
149
- // when the tool is unavailable.
123
+ // it into generated harness guidance. The shared plain-text
124
+ // lettered list is the documented fallback when the tool is unavailable.
150
125
  structuredAsk: "request_user_input",
151
126
  subagentFallback: "role-switch"
152
127
  }
@@ -185,6 +160,7 @@ function agentsMdBlock() {
185
160
  > Auto-generated by \`cclaw sync\`. Do not edit this managed block manually.
186
161
  > Existing project rules in this repository take precedence over cclaw defaults.
187
162
 
163
+ ${conversationLanguagePolicyMarkdown()}
188
164
  ## Anti-Slop Guard
189
165
 
190
166
  Treat quality as a hard requirement, not style preference:
@@ -218,11 +194,10 @@ When in doubt, prefer **non-trivial** — the quick track is opt-in and only saf
218
194
  ### Instruction Priority (top wins)
219
195
 
220
196
  1. User message in the current turn.
221
- 2. Active stage skill HARD-GATE (\`.cclaw/skills/<stage>/SKILL.md\`).
222
- 3. Command contract gates (\`.cclaw/commands/<stage>.md\`).
223
- 4. The \`using-cclaw\` meta-skill.
224
- 5. Contextual utility skills.
225
- 6. Training priors.
197
+ 2. Active stage skill and command contract.
198
+ 3. The \`using-cclaw\` meta-skill.
199
+ 4. Contextual utility skills.
200
+ 5. Training priors.
226
201
 
227
202
  ### Commands
228
203
 
@@ -232,13 +207,12 @@ When in doubt, prefer **non-trivial** — the quick track is opt-in and only saf
232
207
  | \`/cc-next\` | **Progression.** Advances to the next stage when current is complete. |
233
208
  | \`/cc-ideate\` | **Ideate mode.** Generates a ranked repo-improvement backlog before implementation. |
234
209
  | \`/cc-view\` | **Read-only router.** Unified entry for status/tree/diff views. |
235
- | \`/cc-ops\` | **Operations router.** Unified entry for feature/tdd-log/retro/compound/archive/rewind actions. |
236
210
 
237
211
  Knowledge capture and curation run automatically as part of stage completion
238
212
  protocols via the internal \`learnings\` skill — no user-facing command.
239
213
 
240
- **Stage order:** brainstorm > scope > design > spec > plan > tdd > review > ship.
241
- \`/cc-next\` loads the right stage skill automatically. Gates must pass before handoff.
214
+ **Stage order:** brainstorm > scope > design > spec > plan > tdd > review > ship, then closeout: retro > compound > archive.
215
+ \`/cc-next\` loads the right stage skill automatically and also drives post-ship closeout. Gates must pass before handoff.
242
216
 
243
217
  ### Verification Discipline
244
218
 
@@ -253,14 +227,14 @@ If the same approach fails three times in a row (same command, same finding, sam
253
227
  - This managed AGENTS block is intentionally minimal for cross-project use.
254
228
  - Harness coverage is tiered: Tier1 (claude), Tier2 (cursor/opencode/codex — codex has Bash-only tool hooks), Tier3 (fallback/manual-only).
255
229
  - Detailed operating procedures live in \`.cclaw/skills/using-cclaw/SKILL.md\`.
256
- - Preamble budget and cooldown rules live in \`.cclaw/references/protocols/ethos.md\`.
230
+ - Keep preambles brief; re-announce role/stage only when either changes.
257
231
  - Subagent orchestration patterns: \`.cclaw/skills/subagent-dev/SKILL.md\` and \`.cclaw/skills/parallel-dispatch/SKILL.md\`.
258
232
 
259
233
  ### Codex users
260
234
 
261
235
  OpenAI Codex CLI has **no native \`/cc\` slash command** (custom prompts
262
236
  were deprecated in v0.89, Jan 2026). The \`/cc\`, \`/cc-next\`,
263
- \`/cc-ideate\`, \`/cc-view\`, \`/cc-ops\` tokens above describe intent — in
237
+ \`/cc-ideate\`, \`/cc-view\` tokens above describe intent — in
264
238
  Codex they map onto skills cclaw installs at
265
239
  \`.agents/skills/cc*/SKILL.md\`. Activate one of two ways:
266
240
 
@@ -275,9 +249,8 @@ in \`~/.codex/config.toml\`. cclaw generates \`.codex/hooks.json\` on
275
249
  sync; if the feature flag is off, hooks are inert and cclaw's
276
250
  session-start rehydration simply does not fire. Run \`cclaw doctor\` to
277
251
  see if the flag is missing. \`.codex/commands/*\` is still unused by
278
- Codex CLI and is removed on every sync. See
279
- \`.cclaw/references/harnesses/codex-playbook.md\` for the hook coverage
280
- matrix (Bash-only \`PreToolUse\`/\`PostToolUse\`; other events are full).
252
+ Codex CLI and is removed on every sync. Run \`cclaw doctor --explain\` for
253
+ hook coverage details (Bash-only \`PreToolUse\`/\`PostToolUse\`; other events are full).
281
254
  ${CCLAW_MARKER_END}`;
282
255
  }
283
256
  /** Removes the cclaw AGENTS.md block. */
@@ -334,6 +307,20 @@ export async function removeCclawFromAgentsMd(projectRoot) {
334
307
  await removeCclawFromRoutingFile(path.join(projectRoot, "AGENTS.md"));
335
308
  await removeCclawFromRoutingFile(path.join(projectRoot, "CLAUDE.md"));
336
309
  }
310
+ function utilityShimBehavior(command) {
311
+ switch (command) {
312
+ case "cc":
313
+ return "This is the entry command, not a flow stage. It may initialize or resume flow state after confirmation.";
314
+ case "next":
315
+ return "This is the progression command, not a flow stage. It may advance stages and post-ship closeout through managed helpers.";
316
+ case "ideate":
317
+ return "This is an ideation command, not a flow stage. It may write ideation artifacts/seeds but does not advance flow state.";
318
+ case "view":
319
+ return "This is a read-only view command, not a flow stage. It never mutates flow state.";
320
+ default:
321
+ return "This is a utility command, not a flow stage.";
322
+ }
323
+ }
337
324
  function utilityShimContent(harness, command, skillFolder, commandFile) {
338
325
  const shimName = command === "cc" ? "cc" : `cc-${command}`;
339
326
  return `---
@@ -348,7 +335,7 @@ Load and execute:
348
335
  1. \`.cclaw/skills/${skillFolder}/SKILL.md\`
349
336
  2. \`.cclaw/commands/${commandFile}\`
350
337
 
351
- This is a utility command (not a flow stage). It does not advance flow state.
338
+ ${utilityShimBehavior(command)}
352
339
  `;
353
340
  }
354
341
  /**
@@ -360,15 +347,13 @@ This is a utility command (not a flow stage). It does not advance flow state.
360
347
  function codexSkillDescription(command) {
361
348
  switch (command) {
362
349
  case "cc":
363
- return `Entry point for the cclaw 8-stage workflow (brainstorm scope design spec plantdd → review → ship). Use whenever the user types \`/cc\`, \`/cclaw\`, or asks to "start the flow", "begin cclaw", "kick off the workflow", "classify this task", or wants to start/resume a non-trivial software change. No args = resume the active stage from \`.cclaw/state/flow-state.json\`. With a prompt = classify and pick a track (quick/medium/standard).`;
350
+ return `Entry point for the cclaw track-aware workflow ending in ship plus auto-closeout (retrocompoundarchive). Use whenever the user types \`/cc\`, \`/cclaw\`, or asks to "start the flow", "begin cclaw", "kick off the workflow", "classify this task", or wants to start/resume a non-trivial software change. No args = resume the active stage from \`.cclaw/state/flow-state.json\`. With a prompt = classify and pick a track (quick/medium/standard).`;
364
351
  case "next":
365
- return `Advance the cclaw flow to the next stage. Use when the user types \`/cc-next\` or asks to "move to the next stage", "continue the flow", "advance cclaw", "progress the workflow", or when the current stage skill reports completion and gates have passed.`;
352
+ return `Advance the cclaw flow to the next stage or post-ship closeout substate. Use when the user types \`/cc-next\` or asks to "move to the next stage", "continue the flow", "advance cclaw", "progress the workflow", or when the current stage skill reports completion and gates have passed.`;
366
353
  case "ideate":
367
354
  return `Read-only repo-improvement ideate mode for cclaw. Use when the user types \`/cc-ideate\` or asks to "ideate", "scan the repo for TODOs/tech debt", "generate a backlog", or wants a ranked list of candidate ideas before committing to a single flow. Does not mutate \`.cclaw/state/flow-state.json\`.`;
368
355
  case "view":
369
356
  return `Read-only router for cclaw flow views. Use when the user types \`/cc-view\`, \`/cc-view status\`, \`/cc-view tree\`, \`/cc-view diff\`, or asks to "show cclaw status", "show the flow tree", "diff flow state", or wants a snapshot without mutation.`;
370
- case "ops":
371
- return `Operations router for cclaw post-flow actions. Use when the user types \`/cc-ops\`, \`/cc-ops feature\`, \`/cc-ops tdd-log\`, \`/cc-ops retro\`, \`/cc-ops compound\`, \`/cc-ops archive\`, \`/cc-ops rewind\`, or asks to "archive the run", "run the retro", "compound knowledge", "rewind to an earlier stage", or manage feature worktrees.`;
372
357
  default:
373
358
  return `Generated cclaw skill for ${command}.`;
374
359
  }
@@ -394,13 +379,13 @@ Codex CLI v0.89 (Jan 2026). cclaw ships its entry points as skills
394
379
  under \`.agents/skills/${skillSlug}/\` so the user can either:
395
380
 
396
381
  - Type \`/use ${skillSlug}\` at the Codex prompt, or
397
- - Type \`${slashToken} …\` (or describe the intent in English) — Codex's
382
+ - Type \`${slashToken} …\` (or describe the intent in natural language) — Codex's
398
383
  skill matcher picks this skill up via the description frontmatter.
399
384
 
400
385
  Lifecycle hooks **are** available in Codex CLI v0.114+ (behind the
401
386
  \`[features] codex_hooks = true\` flag in \`~/.codex/config.toml\`) and
402
- cclaw installs a matching \`.codex/hooks.json\` see the playbook for
403
- what the hook surface does and does not cover.
387
+ cclaw installs a matching \`.codex/hooks.json\`; run \`cclaw doctor --explain\`
388
+ for the current hook surface and limitations.
404
389
 
405
390
  ## Protocol
406
391
 
@@ -422,8 +407,7 @@ what the hook surface does and does not cover.
422
407
  (v0.33+).
423
408
  - Codex's \`PreToolUse\` / \`PostToolUse\` hooks currently only intercept
424
409
  the \`Bash\` tool. \`Write\`, \`Edit\`, \`WebSearch\`, and MCP tool calls
425
- are **not** gated by hooks — read
426
- \`.cclaw/references/harnesses/codex-playbook.md\` for what cclaw
410
+ are **not** gated by hooks — use \`cclaw doctor --explain\` for what cclaw
427
411
  substitutes with in-turn agent steps for those call classes.
428
412
  - Codex's \`SessionStart\` matcher only supports \`startup|resume\`. Claude
429
413
  and Cursor also fire on \`clear\` and \`compact\`, so mid-session
@@ -488,10 +472,19 @@ async function cleanupLegacyCodexSurfaces(projectRoot) {
488
472
  catch {
489
473
  // best-effort cleanup
490
474
  }
491
- // Remove the old `cclaw-cc*` skill folders if they exist from a
492
- // previous cclaw install. Idempotent; best-effort.
475
+ // Remove old `cclaw-cc*` skill folders if they exist from a previous
476
+ // cclaw install. Idempotent; best-effort.
493
477
  const legacySkillsRoot = path.join(projectRoot, ".agents/skills");
494
- for (const name of LEGACY_CODEX_SKILL_NAMES) {
478
+ let legacySkillNames = [];
479
+ try {
480
+ legacySkillNames = (await fs.readdir(legacySkillsRoot, { withFileTypes: true }))
481
+ .filter((entry) => entry.isDirectory() && entry.name.startsWith(LEGACY_CODEX_SKILL_PREFIX))
482
+ .map((entry) => entry.name);
483
+ }
484
+ catch {
485
+ legacySkillNames = [];
486
+ }
487
+ for (const name of legacySkillNames) {
495
488
  const folder = path.join(legacySkillsRoot, name);
496
489
  try {
497
490
  await fs.rm(folder, { recursive: true, force: true });