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,6 +1,6 @@
1
1
  import { RUNTIME_ROOT } from "../constants.js";
2
- import { FLOW_MAP_REL_PATH } from "./flow-map.js";
3
2
  import { stageSchema } from "./stage-schema.js";
3
+ import { closeoutChainInline, closeoutNextCommandGuidance, closeoutSubstateInline, closeoutSubstateProtocolBullets } from "./closeout-guidance.js";
4
4
  import { stageSkillFolder } from "./skills.js";
5
5
  const NEXT_SKILL_FOLDER = "flow-next-step";
6
6
  const NEXT_SKILL_NAME = "flow-next-step";
@@ -58,7 +58,8 @@ export function nextCommandContract() {
58
58
 
59
59
  - **Current stage not started / in progress** → load its skill and execute it.
60
60
  - **Current stage complete (all gates passed)** → advance \`currentStage\` and load the next skill.
61
- - **Flow complete** → report done.
61
+ - **Ship complete** → continue the resumable ${closeoutChainInline()} closeout via \`/cc-next\`.
62
+ - **Flow complete** → report done after closeout has archived the run.
62
63
 
63
64
  This is the only progression command the user needs to drive the entire flow. Stage command contracts are internal implementation details loaded by \`/cc-next\`.
64
65
 
@@ -66,13 +67,13 @@ This is the only progression command the user needs to drive the entire flow. St
66
67
 
67
68
  - **Do not** invent gate completion: use only \`${flowPath}\` plus observable evidence in repo artifacts.
68
69
  - **Do not** skip stages: advance only from \`currentStage\` to its configured successor.
69
- - After ship completes, the closeout chain **retro -> compound -> archive** runs automatically, driven by \`closeout.shipSubstate\`. Do not ask the user to type those commands manually — follow the substate switch in Path B below.
70
+ - ${closeoutNextCommandGuidance()}
70
71
 
71
72
  ## Algorithm (mandatory)
72
73
 
73
74
  1. Read **\`${flowPath}\`**. If missing → **BLOCKED** (state missing).
74
75
  2. Parse JSON. Capture \`currentStage\` and \`stageGateCatalog[currentStage]\`.
75
- 3. If \`staleStages[currentStage]\` exists, do not advance automatically. Re-run the stage artifact work, then clear the marker with \`/cc-ops rewind --ack <currentStage>\`.
76
+ 3. If \`staleStages[currentStage]\` exists, do not advance automatically. Re-run the stage artifact work, then clear the marker with \`cclaw internal rewind --ack <currentStage>\`.
76
77
  4. Read **\`${reconciliationNoticesPath}\`** when present. If it contains entries for \`activeRunId + currentStage\` and the listed gate is still blocked in \`stageGateCatalog[currentStage].blocked\`, emit a structured warning before any stage-advance decision.
77
78
  5. Let \`G\` = \`requiredGates\` for **\`currentStage\`** from the stage schema.
78
79
  6. Let \`catalog\` = \`stageGateCatalog[currentStage]\` from flow state.
@@ -81,11 +82,11 @@ This is the only progression command the user needs to drive the entire flow. St
81
82
  9. If \`M\` is non-empty, inspect **\`${delegationPath}\`**. Treat as satisfied only if each mandatory agent is **completed** or **waived**.
82
83
  10. For each satisfied mandatory delegation row, verify \`evidenceRefs\` is a non-empty array (unless status is \`waived\` with rationale). Missing evidenceRefs means delegation is unresolved.
83
84
  11. If any mandatory delegation is missing and no waiver exists: **STOP** and ask the user whether to dispatch now or waive with rationale. Do not mark gates passed while delegation is unresolved.
84
- 12. If \`currentStage === "review"\` and \`catalog.blocked\` includes \`review_criticals_resolved\`, treat this as a hard remediation branch: recommend \`/cc-ops rewind tdd "review_blocked_by_critical"\` with the blocking finding IDs, and do not attempt to advance toward ship.
85
+ 12. If \`currentStage === "review"\` and \`catalog.blocked\` includes \`review_criticals_resolved\`, treat this as a hard remediation branch: recommend \`cclaw internal rewind tdd "review_blocked_by_critical"\` with the blocking finding IDs, and do not attempt to advance toward ship.
85
86
 
86
87
  ### Path A: Current stage is NOT complete (any gate unmet or delegation missing)
87
88
 
88
- → Load **\`${RUNTIME_ROOT}/skills/<skillFolder>/SKILL.md\`** and **\`${RUNTIME_ROOT}/commands/<currentStage>.md\`** for the current stage.
89
+ → Load **\`${RUNTIME_ROOT}/skills/<skillFolder>/SKILL.md\`** for the current stage.
89
90
  → Execute that stage's protocol. The stage skill handles the full interaction including STOP points and gate tracking.
90
91
  → Stage completion must use \`node .cclaw/hooks/stage-complete.mjs <currentStage>\` (canonical), which validates delegations + gate evidence before mutating \`flow-state.json\`.
91
92
 
@@ -95,24 +96,11 @@ ${ralphLoopContractSnippet()}
95
96
 
96
97
  → If current stage's \`next\` is **\`done\`**:
97
98
 
98
- When \`currentStage === "ship"\`, route by **\`closeout.shipSubstate\`**:
99
- - \`"idle"\` or missing -> set \`closeout.shipSubstate = "retro_review"\`, then
100
- load \`${RUNTIME_ROOT}/commands/retro.md\` + \`${RUNTIME_ROOT}/skills/flow-retro/SKILL.md\`
101
- and execute the retro protocol (draft + one structured accept/edit/skip ask).
102
- - \`"retro_review"\` -> continue the retro protocol (re-ask the structured
103
- question; the draft already exists — do not regenerate it).
104
- - \`"compound_review"\` -> load \`${RUNTIME_ROOT}/commands/compound.md\` +
105
- \`${RUNTIME_ROOT}/skills/flow-compound/SKILL.md\`, execute the compound
106
- scan, ask user **one** structured question (apply / skip) per candidate
107
- cluster or a single accept-all / skip choice, and advance substate on
108
- completion or skip.
109
- - \`"ready_to_archive"\` -> load \`${RUNTIME_ROOT}/commands/archive.md\` +
110
- \`${RUNTIME_ROOT}/skills/flow-archive/SKILL.md\`, run archive, reset state.
111
- - \`"archived"\` (transient) -> report "run archived" and stop.
99
+ ${closeoutSubstateProtocolBullets()}
112
100
 
113
101
  Otherwise report **"Flow complete. All stages finished."** and stop.
114
102
 
115
- → Otherwise: load **\`${RUNTIME_ROOT}/skills/<skillFolder>/SKILL.md\`** and **\`${RUNTIME_ROOT}/commands/<nextStage>.md\`** for the successor stage. Execute that stage's protocol.
103
+ → Otherwise: load **\`${RUNTIME_ROOT}/skills/<skillFolder>/SKILL.md\`** for the successor stage. Execute that stage's protocol.
116
104
 
117
105
  ### Track-aware successor resolution
118
106
 
@@ -128,7 +116,7 @@ ${ralphLoopContractSnippet()}
128
116
  \`/cc-next\` in a **new session** = resume from where you left off:
129
117
  - Flow-state records \`currentStage\` and which gates have passed.
130
118
  - The stage skill reads upstream artifacts and picks up context.
131
- - \`closeout.shipSubstate\` carries the post-ship substate, so a crashed
119
+ - ${closeoutSubstateInline()} carries the post-ship substate, so a crashed
132
120
  session during retro/compound/archive resumes at the exact step without
133
121
  regenerating the retro draft.
134
122
  - No special resume command needed — \`/cc-next\` IS the resume command.
@@ -151,9 +139,7 @@ Validate envelopes with:
151
139
 
152
140
  ## Surface reference
153
141
 
154
- When you need the full shape of cclaw (stages, routers, Ralph Loop,
155
- state files) load \`${FLOW_MAP_REL_PATH}\`. It is the single-page
156
- overview and is safe to read at any time.
142
+ Use the flow-start skill plus \`.cclaw/state/flow-state.json\` for orientation when needed.
157
143
  `;
158
144
  }
159
145
  /**
@@ -182,6 +168,21 @@ description: "The primary progression command. Reads flow state, starts/resumes
182
168
 
183
169
  \`/cc-next\` is **the only command you need** to drive the entire cclaw flow.
184
170
 
171
+ ## Operator Output Contract
172
+
173
+ Default output should be compact, like OMC/OMX operator surfaces:
174
+
175
+ \`\`\`
176
+ Stage: <currentStage> (<track>)
177
+ Gates: <passed>/<required> passed, <blocked> blocked
178
+ Delegations: <done>/<mandatory> done
179
+ Blockers: <none | gate/delegation/reconciliation ids>
180
+ Next: <exact next action, usually /cc-next or one named remediation>
181
+ \`\`\`
182
+
183
+ Only expand beyond this when blocked, when asking a structured question, or when
184
+ the user explicitly requests detail. Do not dump full artifacts in progression output.
185
+
185
186
  **How it works:**
186
187
  1. Reads \`flow-state.json\` to find \`currentStage\`
187
188
  2. Checks if all gates for that stage are satisfied
@@ -200,7 +201,7 @@ Do **not** mark gates satisfied from memory alone. Cite **artifact evidence** (p
200
201
 
201
202
  1. Open **\`${flowPath}\`**.
202
203
  2. Record \`currentStage\` and \`stageGateCatalog[currentStage]\`.
203
- 3. If \`staleStages[currentStage]\` exists, re-run the stage and clear marker via \`/cc-ops rewind --ack <currentStage>\` before advancing.
204
+ 3. If \`staleStages[currentStage]\` exists, re-run the stage and clear marker via \`cclaw internal rewind --ack <currentStage>\` before advancing.
204
205
  4. If the file is missing or invalid JSON → **BLOCKED** (report and stop).
205
206
  5. Read \`${reconciliationNoticesPath}\` when present. For entries matching \`activeRunId + currentStage\` whose gate is still in \`stageGateCatalog[currentStage].blocked\`, show a warning with gate id + reason before proceeding.
206
207
 
@@ -221,42 +222,41 @@ If reconciliation warnings were emitted in Step 1, treat them as a pre-advance s
221
222
 
222
223
  **Path A — stage NOT complete (any gate unmet):**
223
224
 
224
- Load the current stage's skill and command contract:
225
+ Load the current stage skill:
225
226
  - \`${RUNTIME_ROOT}/skills/<skillFolder>/SKILL.md\`
226
- - \`${RUNTIME_ROOT}/commands/<currentStage>.md\`
227
227
 
228
228
  Execute the stage protocol. The stage skill handles interaction, STOP points, gate tracking, and stage completion via \`node .cclaw/hooks/stage-complete.mjs <stage>\` (canonical flow-state mutation path).
229
229
 
230
230
  ${ralphLoopContractSnippet()}
231
231
 
232
- Special-case for review: if \`review_criticals_resolved\` is in \`blocked\`, route to rework instead of looping review forever — recommend \`/cc-ops rewind tdd "review_blocked_by_critical"\`.
232
+ Special-case for review: if \`review_criticals_resolved\` is in \`blocked\`, route to rework instead of looping review forever — recommend \`cclaw internal rewind tdd "review_blocked_by_critical"\`.
233
233
 
234
234
  **Path B — stage IS complete (all gates met, all delegations done):**
235
235
 
236
236
  If \`next\` is \`done\`:
237
237
 
238
238
  When \`currentStage\` is \`ship\`, automatically drive the **closeout chain**
239
- by inspecting \`closeout.shipSubstate\`:
239
+ by inspecting ${closeoutSubstateInline()}:
240
240
 
241
241
  | shipSubstate | Action |
242
242
  |-----------------------|-----------------------------------------------------|
243
243
  | \`idle\` / missing | Flip to \`retro_review\` and start retro protocol |
244
- | \`retro_review\` | Continue retro protocol (re-ask accept/edit/skip) |
245
- | \`compound_review\` | Run compound scan with a single approve/skip ask |
246
- | \`ready_to_archive\` | Run archive skill; reset flow-state on success |
244
+ | \`retro_review\` | Draft/update \`09-retro.md\`, ask accept/edit/skip |
245
+ | \`compound_review\` | Compound closeout: overlap scan, refresh/supersede, ask approve/skip |
246
+ | \`ready_to_archive\` | Run \`cclaw archive\`; reset flow-state on success |
247
247
  | \`archived\` | Report "run archived"; stop |
248
248
 
249
- Each step owns its own state transition. \`/cc-next\` never shells out to
250
- \`cclaw doctor\` or \`cclaw archive\` automatically it loads the matching
251
- skill and command contract and executes the protocol in-session.
249
+ Each step owns its own state transition. \`/cc-next\` keeps retro and compound
250
+ in-session, then uses the archive runtime only at \`ready_to_archive\`.
252
251
 
253
252
  Otherwise report **"Flow complete. All stages finished."** and stop.
254
253
 
255
- Otherwise (non-terminal \`next\`): load the next stage's skill and command
256
- contract, begin execution.
254
+ Otherwise (non-terminal \`next\`): load the next stage skill and begin execution.
257
255
 
258
256
  ## Stage order
259
257
 
258
+ This table is the critical path. After \`ship\`, \`/cc-next\` continues closeout via ${closeoutSubstateInline()}: ${closeoutChainInline()}.
259
+
260
260
  | Stage | Next | Skill path |
261
261
  |---|---|---|
262
262
  ${stageRows}