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
package/README.md CHANGED
@@ -25,8 +25,7 @@ operational knobs to memorise.
25
25
  changes across multiple harnesses and languages.
26
26
  - Staff engineers and tech leads who want **enforceable discipline**:
27
27
  locked-in decisions, no placeholders, mandatory TDD, traceable plans.
28
- - Maintainers of AI agents/skills who want **measurable prompt engineering**
29
- via the built-in eval harness.
28
+ - Maintainers who want a compact, file-backed flow their harness agents can actually follow.
30
29
 
31
30
  ---
32
31
 
@@ -76,7 +75,7 @@ You ──► /cc <idea>
76
75
  cclaw reads state + knowledge, guides execution
77
76
 
78
77
 
79
- artifacts written, checkpoint saved
78
+ artifacts written, handoff captured
80
79
 
81
80
 
82
81
  next stage is explicit in flow-state.json
@@ -86,7 +85,14 @@ You ──► /cc <idea>
86
85
 
87
86
  ## 30-second install
88
87
 
88
+ Requirements:
89
+
90
+ - Node.js **20+** (matches the package `engines` field).
91
+ - Run from the **git project root** you want cclaw to manage, not from `~`
92
+ or a nested package directory.
93
+
89
94
  ```bash
95
+ cd /path/to/your/repo
90
96
  npx cclaw-cli
91
97
  ```
92
98
 
@@ -102,26 +108,23 @@ Everything day-to-day happens inside your harness (Claude Code, Cursor,
102
108
  OpenCode, or Codex); optional maintenance commands are listed in the
103
109
  CLI reference.
104
110
 
111
+ If cclaw says it is not installed, either run `npx cclaw-cli init` in the
112
+ repo root or `cd` to the project that already contains `.cclaw/`.
113
+
105
114
  ### What gets generated
106
115
 
107
116
  ```text
108
117
  .cclaw/
109
- ├── commands/ # stage + utility command contracts (markdown)
110
- ├── skills/ # stage + utility skills loaded by the harness
111
- ├── contexts/ # cross-cutting context modes (research, debugging, …)
118
+ ├── commands/ # four entrypoints: /cc, /cc-next, /cc-ideate, /cc-view
119
+ ├── skills/ # flow-critical skills loaded by the harness
112
120
  ├── templates/ # artifact skeletons for each stage
113
- ├── rules/ # lint-style rules surfaced to the agent
114
- ├── adapters/ # per-harness translation notes
115
- ├── agents/ # subagent definitions (planner, reviewer, …)
116
- ├── hooks/ # harness-agnostic hook scripts
117
- ├── worktrees/ # isolated feature worktrees (power-user, via /cc-ops)
118
- ├── artifacts/ # active feature artifacts (00-idea.md → 09-retro.md)
119
- ├── runs/ # archived feature snapshots: YYYY-MM-DD-slug/
120
- ├── references/ # (optional) pinned copies of reference frameworks
121
- ├── evals/ # eval corpus, rubrics, baselines, reports
122
- ├── custom-skills/ # user-authored skills (never overwritten)
123
- ├── state/ # flow-state.json + delegation-log.json + activity
124
- └── knowledge.jsonl # append-only, strict-schema lessons + patterns
121
+ ├── rules/ # opt-in language rule packs
122
+ ├── agents/ # subagent definitions
123
+ ├── hooks/ # harness-agnostic hook runtime
124
+ ├── artifacts/ # active run artifacts (00-idea.md -> 09-retro.md)
125
+ ├── runs/ # archived run snapshots: YYYY-MM-DD-slug/
126
+ ├── state/ # flow-state.json + stage activity log
127
+ └── knowledge.jsonl # append-only lessons + patterns
125
128
  ```
126
129
 
127
130
  Plus harness-specific shims:
@@ -133,9 +136,10 @@ Plus harness-specific shims:
133
136
  activated via `/use cc` or description-based auto-matching. Hooks
134
137
  require Codex CLI ≥ v0.114 and `[features] codex_hooks = true` in
135
138
  `~/.codex/config.toml`; `cclaw init --codex` offers to patch that flag
136
- for you. `.codex/commands/` and the legacy `.agents/skills/cclaw-cc*/`
137
- folders are auto-cleaned on sync.)
139
+ for you. `cclaw doctor` reports stale legacy Codex layouts.)
138
140
  - `AGENTS.md` with a managed routing block (includes a Codex-specific note)
141
+ — see [`docs/agents-block.example.md`](./docs/agents-block.example.md)
142
+ for a static example of what the harness reads.
139
143
 
140
144
  ### `.cclaw/config.yaml` — the minimal surface
141
145
 
@@ -172,21 +176,22 @@ Full key-by-key reference: [`docs/config.md`](./docs/config.md).
172
176
  ## The four commands you actually use
173
177
 
174
178
  All four appear as slash commands in every supported harness. This is the
175
- top-level user surface everything else is either automatic or happens
176
- inside `/cc-ops` subcommands.
179
+ top-level user surface: `/cc`, `/cc-next`, `/cc-ideate`, and `/cc-view status`
180
+ cover the happy path. Operator/support tools stay separate so the harness
181
+ does not feel like a command framework.
177
182
 
178
183
  | Command | What it does |
179
184
  |---|---|
180
185
  | **`/cc <idea>`** | Classify the task, discover origin docs (`docs/prd/**`, ADRs, root `PRD.md`, …), sniff the stack, recommend a track, then start the first stage of that track. `/cc` without arguments resumes the current flow. |
181
186
  | **`/cc-next`** | The one progression primitive. Reads `flow-state.json`, checks gates + mandatory subagent delegations, and either resumes the current stage or advances to the next. `/cc-next` in a new session is how you **resume**. |
182
187
  | **`/cc-ideate`** | Repository improvement ideate mode. Scans for TODOs, flaky tests, oversized modules, docs drift, and recurring knowledge-store lessons, **persists the ranked backlog** to `.cclaw/artifacts/ideate-<date>-<slug>.md`, and ends with a concrete handoff: launch `/cc` on the selected candidate in the same session, save-and-close, or discard. Resume check on next run reuses any ideate artifact younger than 30 days. Never mutates `flow-state.json`. |
183
- | **`/cc-view`** | Read-only flow visibility. `/cc-view status` (default) shows stage progress, mandatory delegations with their fulfillment mode (isolated / generic-dispatch / role-switch), the ship closeout substate (retro → compound → archive), and the active harness parity row. `/cc-view tree` renders the same picture as a tree with a closeout sub-branch under ship and a per-harness playbook summary. `/cc-view diff` shows stage/gate/closeout/delegation deltas since the last run. Never mutates state (except diff's snapshot baseline). |
188
+ | **`/cc-view`** | Read-only flow visibility. `/cc-view status` (default) shows stage progress, mandatory delegations with their fulfillment mode (isolated / generic-dispatch / role-switch), the ship closeout substate (retro → compound → archive), and the active harness parity row. `/cc-view tree` renders the same picture as a tree with a closeout sub-branch under ship and harness capability status from `cclaw doctor --explain`. `/cc-view diff` shows stage/gate/closeout/delegation changes from visible state and git evidence. Never mutates state. |
184
189
 
185
- > Power-user surface: `/cc-ops` is an operational router for manual
186
- > overrides (rewind a stale stage, manage parallel features, re-run a
187
- > compound pass). `/cc-learn` is the strict-schema knowledge writer —
188
- > agents call it automatically from completion protocols; you rarely
189
- > invoke it by hand.
190
+ Operational extras stay off the main surface: `/cc-next` handles progression
191
+ and closeout, `cclaw archive` handles explicit archival/reset, and
192
+ `cclaw doctor` verifies install/runtime wiring. Doctor is not a replacement
193
+ for a real harness smoke test; it catches broken files, stale hooks, and
194
+ schema drift before the user loses a run.
190
195
 
191
196
  ### Example first-run
192
197
 
@@ -260,7 +265,7 @@ Each critical-path stage produces a dated artifact under
260
265
  `02a-research.md` (design research fleet synthesis), `03-design.md` through
261
266
  `08-ship.md`. Closeout adds `09-retro.md`; archive then rolls the whole
262
267
  bundle into `.cclaw/runs/<YYYY-MM-DD-slug>/` and resets the active flow for
263
- the next feature.
268
+ the next run.
264
269
 
265
270
  ### Track heuristics are configurable (advisory)
266
271
 
@@ -312,9 +317,7 @@ it into ceremony:
312
317
  - **Mandatory subagent delegation** at TDD, with per-harness waivers.
313
318
  - **Turn Announce Discipline.** Every stage entry/exit emits a visible
314
319
  line so users can see what the agent is doing, not just what it says.
315
- - **Extracted protocols.** Decision, Completion, and Ethos protocols live
316
- in a single place (`.cclaw/contexts/`), so every skill speaks the same
317
- dialect.
320
+ - **Inline protocols.** Decision, Completion, and Ethos discipline is embedded in the active stage skill so users do not need to chase generated reference files.
318
321
  - **Knowledge capture throughout the flow.** Every stage completion
319
322
  protocol emits typed entries (`rule` / `pattern` / `lesson`) to
320
323
  `.cclaw/knowledge.jsonl` as the flow progresses — not only at retro.
@@ -334,7 +337,7 @@ it into ceremony:
334
337
 
335
338
  The `tdd` stage is not prose guidance. It requires:
336
339
 
337
- - an explicit **RED** test run (logged to `.cclaw/state/stage-activity.jsonl`)
340
+ - an explicit **RED** test run (captured in `.cclaw/artifacts/06-tdd.md`)
338
341
  - a mandatory **`test-author`** subagent dispatch (logged to
339
342
  `.cclaw/state/delegation-log.json`)
340
343
  - a **GREEN** full-suite run before exit
@@ -349,7 +352,7 @@ subagent as `completed` (or, on Codex / OpenCode, role-switched with
349
352
  ## Ship and closeout — automatic, resumable
350
353
 
351
354
  Shipping writes `08-ship.md`. `/cc-next` then automatically walks the
352
- feature through a deterministic three-step closeout without extra
355
+ run through a deterministic three-step closeout without extra
353
356
  commands from you:
354
357
 
355
358
  1. **Retro (`09-retro.md`).** cclaw drafts a retrospective from your
@@ -375,9 +378,7 @@ If your session dies mid-closeout, a new `/cc-next` resumes at the
375
378
  exact step — retro drafts are not regenerated and no structured ask is
376
379
  repeated silently.
377
380
 
378
- You can still invoke each step manually (`/cc-ops retro`, `/cc-ops
379
- compound`, `/cc-ops archive`), but for the default path you do not need
380
- to: `/cc-next` is the only command.
381
+ For the default path, `/cc-next` is the only command; explicit archival/reset remains available through `cclaw archive`.
381
382
 
382
383
  ---
383
384
 
@@ -386,12 +387,12 @@ to: `/cc-next` is the only command.
386
387
  cclaw is honest about what each harness can and cannot do, and it
387
388
  closes every real gap with a documented fallback — not a silent waiver.
388
389
 
389
- | Harness | Dispatch | Fallback | Hook surface | Structured ask | Playbook |
390
- |---|---|---|---|---|---|
391
- | Claude Code | full (named subagents) | `native` | full | `AskUserQuestion` | [`claude-playbook.md`](./src/content/harness-playbooks.ts) |
392
- | Cursor | generic Task dispatcher | `generic-dispatch` | full | `AskQuestion` | `cursor-playbook.md` |
393
- | OpenCode | plugin / in-session | `role-switch` | plugin | `question` (permission-gated; `permission.question: "allow"`) | `opencode-playbook.md` |
394
- | OpenAI Codex | in-session only | `role-switch` (evidenceRefs required) | limited (Bash-only `PreToolUse`/`PostToolUse`; requires `codex_hooks` feature flag) | `request_user_input` (experimental; Plan / Collaboration mode) | `codex-playbook.md` |
390
+ | Harness | Dispatch | Fallback | Hook surface | Structured ask |
391
+ |---|---|---|---|---|
392
+ | Claude Code | full (named subagents) | `native` | full | `AskUserQuestion` |
393
+ | Cursor | generic Task dispatcher | `generic-dispatch` | full | `AskQuestion` |
394
+ | OpenCode | plugin / in-session | `role-switch` | plugin | `question` (permission-gated; `permission.question: "allow"`) |
395
+ | OpenAI Codex | in-session only | `role-switch` (evidenceRefs required) | limited (Bash-only `PreToolUse`/`PostToolUse`; requires `codex_hooks` feature flag) | `request_user_input` (experimental; Plan / Collaboration mode) |
395
396
 
396
397
  What the fallbacks mean:
397
398
 
@@ -401,8 +402,7 @@ What the fallbacks mean:
401
402
  vocabulary of `subagent_type`s (`explore`, `generalPurpose`, …).
402
403
  cclaw maps each named agent (planner / reviewer / test-author /
403
404
  security-reviewer / doc-updater) onto the generic dispatcher with a
404
- structured role prompt. Per-agent mapping lives in the Cursor
405
- playbook.
405
+ structured role prompt.
406
406
  - `role-switch` — OpenCode and Codex lack an isolated worker primitive.
407
407
  The agent announces the role in-session, performs the work, and
408
408
  records a delegation row with `fulfillmentMode: "role-switch"` and at
@@ -418,10 +418,10 @@ What the fallbacks mean:
418
418
  > (Jan 2026), but Codex ≥ v0.114 (Mar 2026) grew an experimental
419
419
  > lifecycle hooks API. cclaw installs Codex entry points as native
420
420
  > **skills** under `.agents/skills/cc*/SKILL.md` (invoke with `/use cc`,
421
- > `/use cc-next`, `/use cc-view`, `/use cc-ops`, `/use cc-ideate`, or
421
+ > `/use cc-next`, `/use cc-view`, `/use cc-ideate`, or
422
422
  > by typing `/cc …` in plain text — Codex auto-matches from the skill
423
423
  > description) **and** writes `.codex/hooks.json` so session-start
424
- > rehydration, stop-checkpoint, prompt-guard, workflow-guard, and
424
+ > rehydration, stop-handoff, prompt-guard, workflow-guard, and
425
425
  > context-monitor fire automatically — as long as you enable the
426
426
  > `codex_hooks` feature flag in `~/.codex/config.toml`. `cclaw init
427
427
  > --codex` asks for consent before patching that file. Codex's
@@ -431,59 +431,32 @@ What the fallbacks mean:
431
431
  > and any legacy layout to clean up.
432
432
 
433
433
  The full capability matrix lives in
434
- [`docs/harnesses.md`](./docs/harnesses.md). Per-harness playbooks are
435
- generated into `.cclaw/references/harnesses/` on every install and
436
- upgrade; stage skills cite them by path.
437
-
438
- Runtime state:
439
-
440
- - `.cclaw/state/harness-gaps.json` (schema v2) — per-harness list of
441
- missing capabilities, missing hook events, the declared fallback, the
442
- playbook path, and a `remediation[]` list you can act on.
443
- - `cclaw doctor` — asserts every installed harness has its playbook on
444
- disk and surfaces the expected fulfillment mode inside the
445
- `delegation:mandatory:current_stage` check.
446
-
447
- ---
434
+ [`docs/harnesses.md`](./docs/harnesses.md). Harness capability gaps are
435
+ reported by `cclaw doctor` instead of generating reference files into the
436
+ user project.
448
437
 
449
- ## Eval-driven prompt engineering
450
-
451
- cclaw ships with `cclaw-cli eval` a three-tier regression harness for
452
- the skills and contracts the runtime generates. Use it when you change a
453
- stage skill, tweak a prompt, or swap a model.
454
-
455
- Works with any OpenAI-compatible endpoint — Zhipu AI GLM, OpenAI, Together,
456
- self-hosted vLLM — via three environment variables:
457
-
458
- ```bash
459
- CCLAW_EVAL_API_KEY=...
460
- CCLAW_EVAL_BASE_URL=https://api.z.ai/api/coding/paas/v4 # default
461
- CCLAW_EVAL_MODEL=glm-5.1 # default
462
- ```
463
-
464
- Full details, corpus format, and the eval contract live in
465
- [`docs/evals.md`](./docs/evals.md).
466
- Mutation-testing setup lives in `stryker.config.mjs` and
467
- `.github/workflows/mutation.yml` (manual + weekly run).
438
+ Runtime state stays small: `flow-state.json` is the source of truth, while
439
+ stage activity is an append-only trace for what happened during the run.
440
+ Derived diagnostics are produced on demand by `cclaw doctor`.
468
441
 
469
442
  ---
470
443
 
471
444
  ## CLI reference
472
445
 
473
- The CLI is deliberately small. Everything operational happens inside
474
- your harness.
446
+ `cclaw-cli` is deliberately small: it installs, syncs, upgrades, diagnoses, and removes the generated harness runtime. Day-to-day flow work happens inside your harness via `/cc*` commands and Node hooks.
475
447
 
476
448
  ```bash
477
449
  npx cclaw-cli # launches interactive setup (or prints
478
450
  # a one-line status hint if already installed)
479
451
  npx cclaw-cli sync # re-materialize generated runtime from config.yaml
480
452
  npx cclaw-cli upgrade # refresh generated files; preserves .cclaw/config.yaml
481
- npx cclaw-cli archive # archive current run and reset flow-state
453
+ npx cclaw-cli archive # explicit/manual archive; normal post-ship closeout uses /cc-next
482
454
  npx cclaw-cli uninstall # remove .cclaw + generated harness shims
483
- npx cclaw-cli eval … # maintainer surface (see docs/evals.md)
484
455
  npx cclaw-cli --version
485
456
  ```
486
457
 
458
+ The generated `node .cclaw/hooks/stage-complete.mjs <stage>` helper is the canonical stage-closeout path and must not require a runtime `cclaw` binary in `PATH`.
459
+
487
460
  For CI or scripted installs, `cclaw-cli init --harnesses=<list>
488
461
  --no-interactive` is the non-interactive form. All other tunables
489
462
  (prompt-guard strictness, TDD enforcement, language rule packs, track
@@ -28,6 +28,8 @@ export interface LearningSeedEntry {
28
28
  domain?: string | null;
29
29
  stage?: FlowStage | null;
30
30
  origin_stage?: FlowStage | null;
31
+ origin_run?: string | null;
32
+ /** @deprecated Use `origin_run`. Accepted only for legacy learning bullets. */
31
33
  origin_feature?: string | null;
32
34
  frequency?: number;
33
35
  universality?: LearningUniversality;
@@ -37,6 +39,8 @@ export interface LearningSeedEntry {
37
39
  last_seen_ts?: string;
38
40
  project?: string | null;
39
41
  source?: LearningSource | null;
42
+ supersedes?: string[];
43
+ superseded_by?: string;
40
44
  }
41
45
  export interface LearningsParseResult {
42
46
  ok: boolean;
@@ -780,6 +780,7 @@ const LEARNING_ALLOWED_KEYS = new Set([
780
780
  "domain",
781
781
  "stage",
782
782
  "origin_stage",
783
+ "origin_run",
783
784
  "origin_feature",
784
785
  "frequency",
785
786
  "universality",
@@ -788,7 +789,9 @@ const LEARNING_ALLOWED_KEYS = new Set([
788
789
  "first_seen_ts",
789
790
  "last_seen_ts",
790
791
  "project",
791
- "source"
792
+ "source",
793
+ "supersedes",
794
+ "superseded_by"
792
795
  ]);
793
796
  function isIsoUtcTimestamp(value) {
794
797
  return /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z$/u.test(value);
@@ -862,6 +865,9 @@ function parseLearningSeedEntry(raw, index) {
862
865
  error: `Learnings bullet #${index} field "origin_stage" must be one of ${FLOW_STAGES.join(", ")} or null.`
863
866
  };
864
867
  }
868
+ if (obj.origin_run !== undefined && !isNullableString(obj.origin_run)) {
869
+ return { ok: false, error: `Learnings bullet #${index} field "origin_run" must be string or null.` };
870
+ }
865
871
  if (obj.origin_feature !== undefined && !isNullableString(obj.origin_feature)) {
866
872
  return { ok: false, error: `Learnings bullet #${index} field "origin_feature" must be string or null.` };
867
873
  }
@@ -906,6 +912,17 @@ function parseLearningSeedEntry(raw, index) {
906
912
  };
907
913
  }
908
914
  }
915
+ if (obj.supersedes !== undefined) {
916
+ if (!Array.isArray(obj.supersedes) ||
917
+ obj.supersedes.length === 0 ||
918
+ obj.supersedes.some((value) => typeof value !== "string" || value.trim().length === 0)) {
919
+ return { ok: false, error: `Learnings bullet #${index} field "supersedes" must be a non-empty array of strings.` };
920
+ }
921
+ }
922
+ if (obj.superseded_by !== undefined &&
923
+ (typeof obj.superseded_by !== "string" || obj.superseded_by.trim().length === 0)) {
924
+ return { ok: false, error: `Learnings bullet #${index} field "superseded_by" must be a non-empty string.` };
925
+ }
909
926
  return {
910
927
  ok: true,
911
928
  entry: {
@@ -1002,7 +1019,6 @@ const FRONTMATTER_REQUIRED_KEYS = [
1002
1019
  "stage",
1003
1020
  "schema_version",
1004
1021
  "version",
1005
- "feature",
1006
1022
  "locked_decisions",
1007
1023
  "inputs_hash"
1008
1024
  ];
@@ -1271,6 +1287,11 @@ export async function lintArtifact(projectRoot, stage, track = "standard") {
1271
1287
  const value = parsedFrontmatter.values[key];
1272
1288
  return typeof value !== "string" || value.trim().length === 0;
1273
1289
  });
1290
+ if (parsedFrontmatter.hasFrontmatter &&
1291
+ typeof parsedFrontmatter.values.run !== "string" &&
1292
+ typeof parsedFrontmatter.values.feature !== "string") {
1293
+ frontmatterMissingKeys.push("run");
1294
+ }
1274
1295
  const frontmatterStage = parsedFrontmatter.values.stage?.replace(/^['"]|['"]$/gu, "");
1275
1296
  const frontmatterSchemaVersion = parsedFrontmatter.values.schema_version?.replace(/^['"]|['"]$/gu, "");
1276
1297
  const frontmatterInputsHash = parsedFrontmatter.values.inputs_hash?.replace(/^['"]|['"]$/gu, "");
@@ -1283,7 +1304,7 @@ export async function lintArtifact(projectRoot, stage, track = "standard") {
1283
1304
  findings.push({
1284
1305
  section: "Frontmatter",
1285
1306
  required: requireFrontmatter,
1286
- rule: "Artifact must include frontmatter keys (stage, schema_version=1, version, feature, locked_decisions, inputs_hash=sha256:pending|sha256:<64hex>).",
1307
+ rule: "Artifact must include frontmatter keys (stage, schema_version=1, version, run, locked_decisions, inputs_hash=sha256:pending|sha256:<64hex>). Legacy feature is accepted during migration.",
1287
1308
  found: parsedFrontmatter.hasFrontmatter ? frontmatterValid : true,
1288
1309
  details: !parsedFrontmatter.hasFrontmatter
1289
1310
  ? "Legacy artifact without YAML frontmatter (allowed for backward compatibility)."
package/dist/cli.d.ts CHANGED
@@ -1,7 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import type { FlowTrack, HarnessId } from "./types.js";
3
- import type { EvalMode } from "./eval/types.js";
4
- type CommandName = "init" | "sync" | "doctor" | "upgrade" | "uninstall" | "archive" | "eval" | "internal";
3
+ type CommandName = "init" | "sync" | "doctor" | "upgrade" | "uninstall" | "archive" | "internal";
5
4
  interface ParsedArgs {
6
5
  command?: CommandName;
7
6
  harnesses?: HarnessId[];
@@ -16,23 +15,6 @@ interface ParsedArgs {
16
15
  archiveName?: string;
17
16
  archiveSkipRetro?: boolean;
18
17
  archiveSkipRetroReason?: string;
19
- evalStage?: string;
20
- evalMode?: EvalMode;
21
- evalSchemaOnly?: boolean;
22
- evalRules?: boolean;
23
- evalJudge?: boolean;
24
- evalJson?: boolean;
25
- evalNoWrite?: boolean;
26
- evalUpdateBaseline?: boolean;
27
- evalConfirm?: boolean;
28
- evalQuiet?: boolean;
29
- evalMaxCostUsd?: number;
30
- /** Optional subcommand after `eval`. */
31
- evalSubcommand?: "diff" | "runs";
32
- /** Positional arguments for eval subcommands (e.g. `diff <old> <new>`). */
33
- evalArgs?: string[];
34
- evalBackground?: boolean;
35
- evalCompareModel?: string;
36
18
  /** Hidden plumbing command (`cclaw internal ...`) arguments. */
37
19
  internalArgs?: string[];
38
20
  showHelp?: boolean;