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
@@ -38,10 +38,11 @@ Reuse prior project knowledge before choosing a direction.
38
38
 
39
39
  ## Steps
40
40
 
41
- 1. Read \`.cclaw/knowledge.jsonl\`.
42
- 2. Match by stage/domain keywords from the current task.
43
- 3. Rank matches by confidence and recency.
44
- 4. Return the top entries verbatim.
41
+ 1. Use the session-injected knowledge digest first.
42
+ 2. Read \`.cclaw/knowledge.jsonl\` only if the digest is missing or too thin.
43
+ 3. Match by stage/domain keywords from the current task.
44
+ 4. Rank matches by confidence and recency.
45
+ 5. Return the top entries verbatim.
45
46
 
46
47
  ## Output Contract
47
48
 
@@ -107,18 +108,17 @@ Summarize citable domain practices for a narrow design decision.
107
108
 
108
109
  ## Purpose
109
110
 
110
- Run a four-lens investigation before design lock so architecture choices are grounded
111
+ Run a tiered investigation before design lock so architecture choices are grounded
111
112
  in current ecosystem data, not intuition.
112
113
 
113
- ## Dispatch Lenses (fan-out)
114
+ ## Dispatch Lenses (tiered)
114
115
 
115
- Launch four independent investigation threads in parallel when the harness supports it
116
- (or sequentially with explicit role-switch logs when it does not):
116
+ Choose the smallest tier that matches the change; use parallel threads only when the
117
+ harness supports it and the lenses are independent:
117
118
 
118
- 1. **stack-researcher**dependency compatibility, alternatives, deprecations.
119
- 2. **features-researcher** domain conventions and product/UX patterns.
120
- 3. **architecture-researcher** architecture options and trade-off matrix.
121
- 4. **pitfalls-researcher** — known failure modes, CVEs, and operational traps.
119
+ - **Lightweight:** pitfalls-researcher only known failure modes, CVEs, and operational traps.
120
+ - **Standard:** architecture-researcher + pitfalls-researcher.
121
+ - **Deep:** stack-researcher + features-researcher + architecture-researcher + pitfalls-researcher.
122
122
 
123
123
  ## Output Contract
124
124
 
@@ -130,8 +130,8 @@ Write findings to \`.cclaw/artifacts/02a-research.md\` with these sections:
130
130
  - \`## Pitfalls & Risks\`
131
131
  - \`## Synthesis\`
132
132
 
133
- Each section must contain concrete notes and at least one evidence reference
134
- (source URL, file path, or command output anchor).
133
+ Each section that was run must contain concrete notes and at least one evidence reference
134
+ (source URL, file path, or command output anchor). Sections skipped by tier should say \`Not run for this tier\`.
135
135
 
136
136
  ## Guardrails
137
137
 
@@ -100,6 +100,8 @@ export interface RunReviewLoopOptions {
100
100
  shouldOptOut?: () => boolean;
101
101
  emitEnvelope?: (envelope: ReviewLoopEnvelope) => void;
102
102
  }
103
+ export declare function reviewLoopPolicySummary(stage: ReviewLoopStage): string;
104
+ export declare function reviewLoopSecondOpinionSummary(stage: ReviewLoopStage): string;
103
105
  export declare const REVIEW_LOOP_CHECKLISTS: {
104
106
  readonly scope: readonly [{
105
107
  readonly id: "premise_fit";
@@ -22,6 +22,14 @@ const REVIEW_LOOP_RESPONSE_SCHEMA = `{
22
22
  }
23
23
  ]
24
24
  }`;
25
+ export function reviewLoopPolicySummary(stage) {
26
+ const checklist = REVIEW_LOOP_CHECKLISTS[stage];
27
+ const ids = checklist.map((dimension) => `\`${dimension.id}\``).join(", ");
28
+ return `outside-voice review loop policy: use checklist dimensions ${ids}; stop at quality score >= ${REVIEW_LOOP_DEFAULT_TARGET_SCORE} or max ${REVIEW_LOOP_DEFAULT_MAX_ITERATIONS} iterations.`;
29
+ }
30
+ export function reviewLoopSecondOpinionSummary(stage) {
31
+ return `when \`.cclaw/config.yaml::reviewLoop.externalSecondOpinion.enabled\` is true, run an extra external-model pass for ${stage} and explicitly reconcile score/finding disagreements.`;
32
+ }
25
33
  export const REVIEW_LOOP_CHECKLISTS = {
26
34
  scope: [
27
35
  {
@@ -19,25 +19,24 @@ These are prompt-discipline guidelines that complement the real hooks cclaw gene
19
19
 
20
20
  ## HARD-GATE
21
21
 
22
- **Never end a session with uncommitted or untested changes.** If you must stop, create a checkpoint first.
22
+ **Never end a session with uncommitted or untested changes.** If you must stop, leave a short handoff in the current artifact or commit message.
23
23
 
24
24
  ## Session Start Protocol
25
25
 
26
26
  When a new session begins in any harness:
27
27
 
28
28
  1. **Read flow state:** Load \`.cclaw/state/flow-state.json\` to find the current stage and completed stages.
29
- 2. **Load knowledge:** Stream the tail of \`.cclaw/knowledge.jsonl\` (strict JSONL store) and surface the most relevant rules/patterns.
29
+ 2. **Load knowledge:** Use the session-injected knowledge digest first; stream \`.cclaw/knowledge.jsonl\` only when the digest is missing or insufficient.
30
30
  3. **Check for in-progress work:** If the last stage is incomplete, remind the user and offer to resume.
31
- 4. **Load suggestion memory:** Read \`.cclaw/state/suggestion-memory.json\` and honor \`enabled=false\` opt-out.
32
- 5. **Load iron laws:** Read \`.cclaw/state/iron-laws.json\` to know which laws are strict in this repo.
33
- 6. **Read AGENTS.md:** The cclaw block contains routing and rules — follow them.
31
+ 4. **Load iron laws:** Read \`.cclaw/state/iron-laws.json\` to know which laws are strict in this repo.
32
+ 5. **Read AGENTS.md:** The cclaw block contains routing and rules follow them.
34
33
 
35
34
  ### What to show the user at session start
36
35
 
37
36
  \`\`\`
38
37
  Cclaw flow state: [current stage] ([N] of 8 stages completed)
39
38
  Knowledge highlights: [rule/pattern 1], [rule/pattern 2], [rule/pattern 3]
40
- Next action: /cc-[stage] to continue, or describe what you'd like to do.
39
+ Next action: /cc-next to continue, /cc to start new work, or describe what you'd like to do.
41
40
  \`\`\`
42
41
 
43
42
  ## Session Stop Protocol
@@ -46,8 +45,8 @@ Before ending a session or when context is full:
46
45
 
47
46
  1. **Verify no pending changes:** All modified files must be either committed or explicitly reverted.
48
47
  2. **Update flow state:** Mark the current stage as its actual status (DONE / DONE_WITH_CONCERNS / BLOCKED).
49
- 3. **Write knowledge:** If any non-obvious reusable insight appears, append one strict-schema JSON line to \`.cclaw/knowledge.jsonl\` with type \`rule\`, \`pattern\`, \`lesson\`, or \`compound\`.
50
- 4. **Create checkpoint:** Write a brief status note to the current artifact or as a comment in flow-state.json.
48
+ 3. **Capture knowledge:** If any non-obvious reusable insight appears during stage work, add a strict JSON bullet to the current artifact \`## Learnings\`; stage completion harvests it into \`.cclaw/knowledge.jsonl\`.
49
+ 4. **Leave handoff context:** Put blockers and remaining work in the current stage artifact, not a separate state file.
51
50
 
52
51
  ### Stop conditions (agent must halt and report)
53
52
 
@@ -61,44 +60,13 @@ Before ending a session or when context is full:
61
60
  When resuming work after a break:
62
61
 
63
62
  1. Re-read \`.cclaw/state/flow-state.json\` (may have changed externally).
64
- 2. Re-read the current stage's artifact to verify it matches your last checkpoint.
65
- 3. Re-load recent knowledge entries.
63
+ 2. Re-read the current stage's artifact to verify it matches the last handoff.
64
+ 3. Re-load the knowledge digest first, then scan \`.cclaw/knowledge.jsonl\` only if the digest lacks enough evidence.
66
65
  4. Continue from the last incomplete step — do not restart the stage.
67
66
 
68
- ## Proactive Suggestion Memory
67
+ ### Optional session-history scan for compound
69
68
 
70
- Cclaw can emit short stage-specific reminders at session start to reduce misses.
71
-
72
- - State file: \`.cclaw/state/suggestion-memory.json\`
73
- - Default: \`enabled: true\`
74
- - Persistent opt-out: set \`enabled: false\` and keep the file in repo-local state
75
- - Optional per-stage mute: add stage names to \`mutedStages\`
76
-
77
- Example:
78
-
79
- \`\`\`json
80
- {
81
- "enabled": false,
82
- "mutedStages": ["plan"],
83
- "lastSuggestedStage": "review",
84
- "lastSuggestedAt": "2026-04-11T14:30:00Z"
85
- }
86
- \`\`\`
87
-
88
- ## Checkpoint Format
89
-
90
- When creating a checkpoint at session boundaries:
91
-
92
- \`\`\`json
93
- {
94
- "stage": "tdd",
95
- "status": "in_progress",
96
- "lastCompletedStep": "GREEN for task T2",
97
- "remainingSteps": ["REFACTOR T2", "RED T3", "GREEN T3", "REFACTOR T3"],
98
- "blockers": [],
99
- "timestamp": "2026-04-11T14:30:00Z"
100
- }
101
- \`\`\`
69
+ During post-ship \`compound_review\`, ask before scanning external session history. If the user opts in, inspect only relevant Cursor/Claude/Codex transcripts for repeated failures or process lessons, summarize matches, and then apply the same overlap/refresh/supersede rules before touching \`.cclaw/knowledge.jsonl\`.
102
70
 
103
71
  ## Context Management
104
72
 
@@ -114,14 +82,14 @@ When approaching context limits:
114
82
  | Rationalization | Reality |
115
83
  |---|---|
116
84
  | "I'll remember where I was" | Context is lost between sessions. Write it down. |
117
- | "This is almost done, no need for checkpoint" | "Almost done" is the most dangerous state — changes are half-applied. |
85
+ | "This is almost done, no need for handoff" | "Almost done" is the most dangerous state — changes are half-applied. |
118
86
  | "The tests will tell me the state" | Tests tell you pass/fail, not intent or remaining work. |
119
87
 
120
88
  ## Red Flags
121
89
 
122
90
  - Ending a session with modified but uncommitted files
123
91
  - No flow state update after completing work
124
- - Restarting a stage from scratch instead of resuming from checkpoint
92
+ - Restarting a stage from scratch instead of resuming from artifact context
125
93
  - Ignoring knowledge from prior sessions
126
94
  `;
127
95
  }
@@ -130,8 +98,8 @@ export function sessionHooksAgentsMdBlock() {
130
98
 
131
99
  Session boundary behavior (real hooks inject context automatically; guidelines cover manual steps):
132
100
  - **Start:** Hooks inject flow state + knowledge snapshot. Check for in-progress work, show status.
133
- - **Stop:** Hooks remind about checkpoint. Verify no pending changes, update flow state, append useful knowledge.
134
- - **Resume:** Re-read state, verify artifact, re-load knowledge, continue from last step.
101
+ - **Stop:** Hooks remind about handoff. Verify no pending changes, update the current artifact handoff, and capture reusable knowledge in \`## Learnings\`; stage completion harvests it.
102
+ - **Resume:** Re-read state, verify artifact, re-load knowledge, continue from last step. For compound closeout, optional session-history scans require user opt-in.
135
103
 
136
104
  Skill: \`.cclaw/skills/session/SKILL.md\`
137
105
  Policy: \`.cclaw/skills/iron-laws/SKILL.md\`
@@ -1,8 +1,3 @@
1
1
  import type { FlowStage, FlowTrack } from "../types.js";
2
- /**
3
- * Long-form Batch Execution walkthrough. Rendered once into
4
- * \`.cclaw/references/stages/tdd-batch-walkthrough.md\` by the installer.
5
- */
6
- export declare const TDD_BATCH_WALKTHROUGH_MARKDOWN = "# TDD \u2014 Batch Execution Walkthrough\n\nDetailed RED / GREEN / REFACTOR transcript for a 3-task batch. Illustrative\nonly \u2014 do not copy the command names blindly, match them to your stack.\n\n## Batch 1 example tasks\n\n| Task ID | Description | AC | Verification |\n|---|---|---|---|\n| T-1 `[~3m]` | Add `User.emailNormalized` column | AC-1 | `npm test -- users/schema` |\n| T-2 `[~4m]` | Normalize on write in `UserRepo.save` | AC-1 | `npm test -- users/repo` |\n| T-3 `[~3m]` | Reject duplicates in `UserService.signup` | AC-2 | `npm test -- users/service` |\n\n## Execution transcript\n\n### T-1 \u2014 RED\n\n> Run: `npm test -- users/schema` \u2192 **FAIL** (missing column: `emailNormalized`). Captured the failure stack as RED evidence. No production code touched yet.\n\n### T-1 \u2014 GREEN\n\n> Added the column in the schema module. Re-ran `npm test -- users/schema` \u2192 **PASS**. Ran the full suite `npm test` \u2192 **PASS**. Captured both outputs as GREEN evidence.\n\n### T-1 \u2014 REFACTOR\n\n> Extracted the column definition into a shared `NormalizedEmail` type used by T-2/T-3. Re-ran `npm test` \u2192 **PASS**. Captured REFACTOR note: \"Extracted NormalizedEmail type to keep T-2/T-3 DRY; zero behavior change, all tests still green.\"\n\n### T-2 \u2014 RED / GREEN / REFACTOR\n\nWrite the repo test that expects normalised writes, watch it fail (RED), implement normalisation inside `UserRepo.save` only (GREEN), then refactor the normaliser out of the repo into a helper shared with T-3 (REFACTOR).\n\n### T-3 \u2014 RED / GREEN / REFACTOR\n\nWrite the service-level duplicate test that expects a rejection, watch it fail (RED), add the duplicate check in `UserService.signup` (GREEN), refactor the error message into a named constant (REFACTOR).\n\n## Batch gate check\n\nAfter T-3 REFACTOR, before declaring Batch 1 done:\n\n1. Run the full suite (`npm test`) one final time \u2192 **PASS** captured as batch-exit evidence.\n2. Verify the TDD artifact contains RED, GREEN, and REFACTOR evidence for T-1, T-2, **and** T-3. No partial batches.\n3. Only now mark Batch 1 complete. Batch 2 cannot start until this step.\n\n## When to stop mid-batch (do NOT push through)\n\n- A RED test fails for a reason you did not predict (e.g. an unrelated flaky test) \u2192 **pause**, diagnose, log an operational-self-improvement entry, and decide with the user before proceeding.\n- A GREEN step would require touching code outside the task's acceptance criterion \u2192 **pause**, the task is scoped wrong; adjust the plan or open a follow-up task.\n- The same RED failure reappears after a GREEN change \u2192 **escalate** per the 3-attempts rule; do not keep patching.\n";
7
2
  export declare function stageSkillFolder(stage: FlowStage): string;
8
3
  export declare function stageSkillMarkdown(stage: FlowStage, track?: FlowTrack): string;
@@ -1,10 +1,8 @@
1
1
  import { RUNTIME_ROOT, STAGE_TO_SKILL_FOLDER } from "../constants.js";
2
- import { STAGE_EXAMPLES_REFERENCE_DIR, stageExamples } from "./examples.js";
3
- import { STAGE_COMMON_GUIDANCE_REL_PATH } from "./stage-common-guidance.js";
4
- import { stageAutoSubagentDispatch, stageSchema } from "./stage-schema.js";
2
+ import { stageExamples } from "./examples.js";
3
+ import { reviewStackAwareRoutes, reviewStackAwareRoutingSummary, stageAutoSubagentDispatch, stageSchema, stageTrackRenderContext } from "./stage-schema.js";
4
+ import { conversationLanguagePolicyMarkdown } from "./language-policy.js";
5
5
  const VERIFICATION_STAGES = ["tdd", "review", "ship"];
6
- const DECISION_PROTOCOL_PATH = `${RUNTIME_ROOT}/references/protocols/decision.md`;
7
- const COMPLETION_PROTOCOL_PATH = `${RUNTIME_ROOT}/references/protocols/completion.md`;
8
6
  function whenNotToUseBlock(items) {
9
7
  if (items.length === 0) {
10
8
  return "";
@@ -14,10 +12,16 @@ ${items.map((item) => `- ${item}`).join("\n")}
14
12
 
15
13
  `;
16
14
  }
17
- function contextLoadingBlock(trace) {
15
+ function contextLoadingBlock(trace, executionModel) {
18
16
  const readLines = trace.readsFrom.length > 0
19
17
  ? trace.readsFrom.map((value) => `- \`${value}\``).join("\n")
20
18
  : "- (first stage — no upstream artifacts)";
19
+ const inputs = executionModel.inputs.length > 0
20
+ ? executionModel.inputs.map((item) => `- ${item}`).join("\n")
21
+ : "- (first stage — no required inputs)";
22
+ const requiredContext = executionModel.requiredContext.length > 0
23
+ ? executionModel.requiredContext.map((item) => `- ${item}`).join("\n")
24
+ : "- None beyond this skill";
21
25
  return `## Context Loading
22
26
 
23
27
  Before execution:
@@ -25,7 +29,16 @@ Before execution:
25
29
  2. Load active artifacts from \`.cclaw/artifacts/\`.
26
30
  3. Load upstream artifacts required by this stage:
27
31
  ${readLines}
28
- 4. Use the injected knowledge digest from session-start; only fall back to full
32
+ 4. Extract upstream decisions, constraints, and open questions into the current
33
+ artifact's \`Upstream Handoff\` section when that section exists.
34
+ 5. Before doing stage work, give a compact user-facing drift preamble: "Carrying forward: <1-3 bullets>. Drift since upstream: None / <specific drift>. Recommendation: continue / re-scope."
35
+ 6. If you change an upstream decision, record an explicit drift reason in the
36
+ current artifact before continuing.
37
+ 7. Confirm stage inputs:
38
+ ${inputs}
39
+ 8. Confirm required context:
40
+ ${requiredContext}
41
+ 9. Use the injected knowledge digest from session-start; only fall back to full
29
42
  \`.cclaw/knowledge.jsonl\` when the digest is insufficient.
30
43
  `;
31
44
  }
@@ -82,6 +95,20 @@ function reviewSectionsBlock(sectionsInput) {
82
95
  ${sections}
83
96
  `;
84
97
  }
98
+ function stackAwareReviewRoutingBlock(stage) {
99
+ if (stage !== "review")
100
+ return "";
101
+ const routes = reviewStackAwareRoutes()
102
+ .map((route) => `- ${route.stack}: ${route.signals.map((signal) => `\`${signal}\``).join(", ")} -> ${route.agent} lens for ${route.focus}.`)
103
+ .join("\n");
104
+ return `## Stack-Aware Review Routing
105
+ ${reviewStackAwareRoutingSummary()}
106
+
107
+ Default general review still runs. Add only the matching stack lens when repo signals or changed files justify it.
108
+
109
+ ${routes}
110
+ `;
111
+ }
85
112
  function reviewLoopBlock(reviewLoop) {
86
113
  if (!reviewLoop)
87
114
  return "";
@@ -99,14 +126,16 @@ function verificationBlock(stage) {
99
126
  return "";
100
127
  return `## Verification Before Completion
101
128
 
102
- Provide fresh, stage-local verification evidence from this turn:
129
+ This is the gate function for completion claims. No "done", "all good", or
130
+ "tests pass" unless fresh evidence from this turn proves it.
103
131
 
104
- 1. Run verification commands (tests/build/lint/type-check) for the changed scope.
105
- 2. Confirm output, do not infer success from prior runs.
106
- 3. If this is a bug fix, capture RED -> GREEN evidence for the regression path.
132
+ - Run verification commands (tests/build/lint/type-check) for the changed scope.
133
+ - Confirm output directly; do not infer success from prior runs or green memories.
134
+ - If this is a bug fix, capture RED -> GREEN evidence for the regression path.
135
+ - If a command fails, report the failure as diagnostic evidence and stop before completion.
136
+ - If you only inspected files or reasoned about the change, say so; that is not verification.
107
137
 
108
- Reference utility skill:
109
- \`.cclaw/skills/verification-before-completion/SKILL.md\`
138
+ Keep this verification evidence in the artifact before completion.
110
139
  `;
111
140
  }
112
141
  function batchExecutionModeBlock(stage, track) {
@@ -121,7 +150,7 @@ Apply concise turn announces: one announce per batch boundary (or when risk/plan
121
150
  changes materially), then execute tasks without repetitive boilerplate.
122
151
 
123
152
  Detailed walkthrough:
124
- \`.cclaw/${STAGE_EXAMPLES_REFERENCE_DIR}/tdd-batch-walkthrough.md\`
153
+ Use the current plan artifact for batch order and keep RED -> GREEN -> REFACTOR evidence in the TDD artifact.
125
154
  `;
126
155
  }
127
156
  function crossStageTraceBlock(trace) {
@@ -170,46 +199,6 @@ function mergedAntiPatterns(philosophy, execution) {
170
199
  }
171
200
  return merged.map((item) => `- ${item}`).join("\n");
172
201
  }
173
- function stageSpecificSeeAlso(stage) {
174
- const refs = {
175
- brainstorm: [
176
- `- \`${RUNTIME_ROOT}/skills/learnings/SKILL.md\``,
177
- `- \`${RUNTIME_ROOT}/references/stages/brainstorm-examples.md\``
178
- ],
179
- scope: [
180
- `- \`${RUNTIME_ROOT}/skills/learnings/SKILL.md\``,
181
- `- \`${RUNTIME_ROOT}/references/stages/scope-examples.md\``
182
- ],
183
- design: [
184
- `- \`${RUNTIME_ROOT}/skills/security/SKILL.md\``,
185
- `- \`${RUNTIME_ROOT}/skills/performance/SKILL.md\``
186
- ],
187
- spec: [
188
- `- \`${RUNTIME_ROOT}/skills/docs/SKILL.md\``,
189
- `- \`${RUNTIME_ROOT}/references/stages/spec-examples.md\``
190
- ],
191
- plan: [
192
- `- \`${RUNTIME_ROOT}/skills/subagent-dev/SKILL.md\``,
193
- `- \`${RUNTIME_ROOT}/skills/parallel-dispatch/SKILL.md\``
194
- ],
195
- tdd: [
196
- `- \`${RUNTIME_ROOT}/skills/debugging/SKILL.md\``,
197
- `- \`${RUNTIME_ROOT}/references/stages/tdd-batch-walkthrough.md\``
198
- ],
199
- review: [
200
- `- \`${RUNTIME_ROOT}/skills/security/SKILL.md\``,
201
- `- \`${RUNTIME_ROOT}/skills/parallel-dispatch/SKILL.md\``,
202
- `- \`${RUNTIME_ROOT}/skills/verification-before-completion/SKILL.md\``
203
- ],
204
- ship: [
205
- `- \`${RUNTIME_ROOT}/skills/ci-cd/SKILL.md\``,
206
- `- \`${RUNTIME_ROOT}/skills/docs/SKILL.md\``,
207
- `- \`${RUNTIME_ROOT}/skills/verification-before-completion/SKILL.md\``,
208
- `- \`${RUNTIME_ROOT}/skills/finishing-a-development-branch/SKILL.md\``
209
- ]
210
- };
211
- return refs[stage];
212
- }
213
202
  function completionParametersBlock(schema, track) {
214
203
  const gateList = schema.executionModel.requiredGates.map((g) => `\`${g.id}\``).join(", ");
215
204
  const mandatory = schema.reviewLens.mandatoryDelegations.length > 0
@@ -230,7 +219,7 @@ function completionParametersBlock(schema, track) {
230
219
  - Fill \`## Learnings\` before closeout: either \`- None this stage.\` or JSON bullets with required keys \`type\`, \`trigger\`, \`action\`, \`confidence\` (knowledge-schema compatible).
231
220
  - Record mandatory delegation completion/waiver in \`${RUNTIME_ROOT}/state/delegation-log.json\` with rationale as needed.
232
221
  - Use the completion helper instead of raw \`flow-state.json\` edits (legacy direct edits trigger workflow-guard warnings or strict-mode blocks).
233
- - Completion protocol reference: \`${COMPLETION_PROTOCOL_PATH}\`
222
+ - Completion protocol: verify required gates, update the artifact, then use the completion helper.
234
223
  `;
235
224
  }
236
225
  function quickStartBlock(stage, track) {
@@ -244,59 +233,6 @@ function quickStartBlock(stage, track) {
244
233
  4. Satisfy gates (${gatePreview}${schema.executionModel.requiredGates.length > 3 ? ` +${schema.executionModel.requiredGates.length - 3}` : ""}).
245
234
  `;
246
235
  }
247
- /**
248
- * Long-form Batch Execution walkthrough. Rendered once into
249
- * \`.cclaw/references/stages/tdd-batch-walkthrough.md\` by the installer.
250
- */
251
- export const TDD_BATCH_WALKTHROUGH_MARKDOWN = `# TDD — Batch Execution Walkthrough
252
-
253
- Detailed RED / GREEN / REFACTOR transcript for a 3-task batch. Illustrative
254
- only — do not copy the command names blindly, match them to your stack.
255
-
256
- ## Batch 1 example tasks
257
-
258
- | Task ID | Description | AC | Verification |
259
- |---|---|---|---|
260
- | T-1 \`[~3m]\` | Add \`User.emailNormalized\` column | AC-1 | \`npm test -- users/schema\` |
261
- | T-2 \`[~4m]\` | Normalize on write in \`UserRepo.save\` | AC-1 | \`npm test -- users/repo\` |
262
- | T-3 \`[~3m]\` | Reject duplicates in \`UserService.signup\` | AC-2 | \`npm test -- users/service\` |
263
-
264
- ## Execution transcript
265
-
266
- ### T-1 — RED
267
-
268
- > Run: \`npm test -- users/schema\` → **FAIL** (missing column: \`emailNormalized\`). Captured the failure stack as RED evidence. No production code touched yet.
269
-
270
- ### T-1 — GREEN
271
-
272
- > Added the column in the schema module. Re-ran \`npm test -- users/schema\` → **PASS**. Ran the full suite \`npm test\` → **PASS**. Captured both outputs as GREEN evidence.
273
-
274
- ### T-1 — REFACTOR
275
-
276
- > Extracted the column definition into a shared \`NormalizedEmail\` type used by T-2/T-3. Re-ran \`npm test\` → **PASS**. Captured REFACTOR note: "Extracted NormalizedEmail type to keep T-2/T-3 DRY; zero behavior change, all tests still green."
277
-
278
- ### T-2 — RED / GREEN / REFACTOR
279
-
280
- Write the repo test that expects normalised writes, watch it fail (RED), implement normalisation inside \`UserRepo.save\` only (GREEN), then refactor the normaliser out of the repo into a helper shared with T-3 (REFACTOR).
281
-
282
- ### T-3 — RED / GREEN / REFACTOR
283
-
284
- Write the service-level duplicate test that expects a rejection, watch it fail (RED), add the duplicate check in \`UserService.signup\` (GREEN), refactor the error message into a named constant (REFACTOR).
285
-
286
- ## Batch gate check
287
-
288
- After T-3 REFACTOR, before declaring Batch 1 done:
289
-
290
- 1. Run the full suite (\`npm test\`) one final time → **PASS** captured as batch-exit evidence.
291
- 2. Verify the TDD artifact contains RED, GREEN, and REFACTOR evidence for T-1, T-2, **and** T-3. No partial batches.
292
- 3. Only now mark Batch 1 complete. Batch 2 cannot start until this step.
293
-
294
- ## When to stop mid-batch (do NOT push through)
295
-
296
- - A RED test fails for a reason you did not predict (e.g. an unrelated flaky test) → **pause**, diagnose, log an operational-self-improvement entry, and decide with the user before proceeding.
297
- - A GREEN step would require touching code outside the task's acceptance criterion → **pause**, the task is scoped wrong; adjust the plan or open a follow-up task.
298
- - The same RED failure reappears after a GREEN change → **escalate** per the 3-attempts rule; do not keep patching.
299
- `;
300
236
  export function stageSkillFolder(stage) {
301
237
  return STAGE_TO_SKILL_FOLDER[stage];
302
238
  }
@@ -383,6 +319,7 @@ function dedupeGuidance(items, blockedBy) {
383
319
  }
384
320
  export function stageSkillMarkdown(stage, track = "standard") {
385
321
  const schema = stageSchema(stage, track);
322
+ const trackContext = stageTrackRenderContext(track);
386
323
  const philosophy = schema.philosophy;
387
324
  const executionModel = schema.executionModel;
388
325
  const artifactRules = schema.artifactRules;
@@ -400,7 +337,6 @@ export function stageSkillMarkdown(stage, track = "standard") {
400
337
  const interactionFocus = dedupeGuidance(executionModel.interactionProtocol, [...executionModel.checklist, ...executionModel.process]).slice(0, 5);
401
338
  const processFlowMermaid = renderProcessFlowMermaid(executionModel);
402
339
  const platformNotesBlock = renderPlatformNotesBlock(executionModel.platformNotes);
403
- const stageRefs = stageSpecificSeeAlso(stage);
404
340
  const reviewLoopSection = reviewLoopBlock(reviewLens.reviewLoop);
405
341
  const mandatoryDelegationSummary = mandatoryDelegations.length > 0
406
342
  ? mandatoryDelegations.map((name) => `\`${name}\``).join(", ")
@@ -422,12 +358,14 @@ If you are about to violate the Iron Law, STOP. No amount of urgency, partial pr
422
358
 
423
359
  ${quickStartBlock(stage, track)}
424
360
 
361
+ ${conversationLanguagePolicyMarkdown()}
425
362
  ## Philosophy
426
363
  ${philosophy.purpose}
427
364
 
428
365
  ## Complexity Tier
429
366
  - Active tier: \`${schema.complexityTier}\`
430
367
  - Mandatory delegations at this tier: ${mandatoryDelegationSummary}
368
+ - Track render context: \`${trackContext.track}\` (${trackContext.usesPlanTerminology ? "plan-first wording" : "acceptance-first wording"})
431
369
 
432
370
  ## When to Use
433
371
  ${philosophy.whenToUse.map((item) => `- ${item}`).join("\n")}
@@ -445,14 +383,9 @@ This is the stage **state machine** — the canonical ordered flow. For every de
445
383
 
446
384
  ${processFlowMermaid.length > 0 ? processFlowMermaid : "```mermaid\nflowchart TD\n S1[\"Execute Checklist\"] --> S2[\"Satisfy required gates\"] --> S3[\"Verify before closeout\"]\n```"}
447
385
 
448
- ## Inputs
449
- ${executionModel.inputs.length > 0 ? executionModel.inputs.map((item) => `- ${item}`).join("\n") : "- (first stage — no required inputs)"}
450
-
451
- ## Required Context
452
- ${executionModel.requiredContext.length > 0 ? executionModel.requiredContext.map((item) => `- ${item}`).join("\n") : "- None beyond this skill"}
453
-
454
- ${platformNotesBlock}${contextLoadingBlock(artifactRules.crossStageTrace)}
386
+ ${platformNotesBlock}${contextLoadingBlock(artifactRules.crossStageTrace, executionModel)}
455
387
  ${autoSubagentDispatchBlock(stage, track)}
388
+ ${stackAwareReviewRoutingBlock(stage)}
456
389
  ${researchPlaybooksBlock(executionModel.researchPlaybooks ?? [])}
457
390
 
458
391
  ## Checklist
@@ -469,7 +402,7 @@ These are **rules for HOW you interact with the user** during this stage — ton
469
402
 
470
403
  ${interactionFocus.length > 0 ? interactionFocus.map((item, i) => `${i + 1}. ${item}`).join("\n") : "- Keep communication concise and decision-focused; rely on the Checklist for execution order."}
471
404
 
472
- Decision protocol reference: \`${DECISION_PROTOCOL_PATH}\`
405
+ Decision protocol: ask only decision-changing questions, record the chosen option, rationale, risk, and rollback when the stage makes a non-trivial call.
473
406
 
474
407
  ${batchExecutionModeBlock(stage, track)}
475
408
  ## Required Gates
@@ -480,7 +413,7 @@ ${evidenceList}
480
413
 
481
414
  ${verificationBlock(stage)}
482
415
 
483
- ## Verification
416
+ ## Exit Criteria
484
417
  ${executionModel.exitCriteria.map((item) => `- [ ] ${item}`).join("\n")}
485
418
 
486
419
  ${completionParametersBlock(schema, track)}
@@ -497,15 +430,9 @@ ${reviewLens.outputs.map((item) => `- ${item}`).join("\n")}
497
430
  ${reviewSectionsBlock(reviewLens.reviewSections)}
498
431
 
499
432
  ## Shared Stage Guidance
500
- See:
501
- - \`${STAGE_COMMON_GUIDANCE_REL_PATH}\`
502
- - \`${DECISION_PROTOCOL_PATH}\`
503
- - \`${COMPLETION_PROTOCOL_PATH}\`
504
-
505
- ## See Also
506
- - \`${RUNTIME_ROOT}/skills/using-cclaw/SKILL.md\`
507
- - \`${RUNTIME_ROOT}/skills/session/SKILL.md\`
508
- ${stageRefs.join("\n")}
509
- - \`${RUNTIME_ROOT}/commands/${stage}.md\`
433
+ - Follow the handoff menu: advance, revise, pause, rewind, or archive only when the user explicitly chooses it.
434
+ - Carry upstream decisions forward explicitly; record drift instead of silently changing direction.
435
+ - Before closeout, fill \`## Learnings\` with \`- None this stage.\` or 1-3 strict JSON bullets.
436
+ - Keep decisions explicit: context, options, chosen option, rationale, risk, and rollback.
510
437
  `;
511
438
  }
@@ -1,2 +1 @@
1
- export declare const STAGE_COMMON_GUIDANCE_REL_PATH = ".cclaw/references/stages/common-guidance.md";
2
1
  export declare function stageCommonGuidanceMarkdown(): string;
@@ -1,32 +1,35 @@
1
- import { RUNTIME_ROOT } from "../constants.js";
2
- export const STAGE_COMMON_GUIDANCE_REL_PATH = `${RUNTIME_ROOT}/references/stages/common-guidance.md`;
1
+ import { conversationLanguagePolicyMarkdown } from "./language-policy.js";
3
2
  export function stageCommonGuidanceMarkdown() {
4
3
  return `# Common Stage Guidance
5
4
 
6
5
  Shared guidance loaded by every stage skill. Keep this file concise and stable so
7
6
  per-stage skills can stay focused on stage-specific work.
8
7
 
8
+ ${conversationLanguagePolicyMarkdown()}
9
9
  ## Shared completion protocol
10
10
 
11
- - Stage-specific skills expose **Completion Parameters** only.
12
- - Generic execution steps live in \`.cclaw/references/protocols/completion.md\`.
13
- - Do not restate the protocol in each stage file.
11
+ - Stage-specific skills expose **Completion Parameters** plus the gates that
12
+ matter for that stage.
13
+ - Generic execution stays inline: verify required gates, update the artifact,
14
+ harvest learnings, then use \`/cc-next\` for progression.
15
+ - Do not create separate protocol files.
14
16
 
15
17
  ## Shared decision protocol
16
18
 
17
- - Decision wording, ask-tool format, retry budget, and escalation rules live in
18
- \`.cclaw/references/protocols/decision.md\`.
19
- - Stage files should reference that path, not duplicate the full text.
19
+ - Ask only decision-changing questions.
20
+ - Prefer one focused question over broad questionnaires.
21
+ - When choices are equivalent, recommend one path and state the trade-off.
22
+ - If a blocker remains after a short retry, stop and ask the user.
20
23
 
21
24
  ## Shared handoff menu
22
25
 
23
26
  Use this same closeout menu for every stage:
24
27
 
25
- - **A) Advance** — run \`/cc-next\` and continue.
28
+ - **A) Advance** — run \`/cc-next\` and continue the critical path; after \`ship\`, the same command drives \`retro -> compound -> archive\`.
26
29
  - **B) Revise this stage** — stay on current stage and apply feedback.
27
30
  - **C) Pause / park** — run \`/cc-view status\`, then stop and resume later.
28
- - **D) Rewind** — run \`/cc-ops rewind <target-stage>\`.
29
- - **E) Abandon** — archive with \`/cc-ops archive --skip-retro --retro-reason="<reason>"\` when user explicitly wants to end the run.
31
+ - **D) Rewind** — run \`npx cclaw-cli internal rewind <target-stage> "<reason>"\` as a support/runtime repair action.
32
+ - **E) Abandon** — only when the user explicitly wants to end a non-ship active run early, archive with \`npx cclaw-cli archive --skip-retro --retro-reason="<reason>"\`. Once in post-ship closeout, continue \`/cc-next\` through retro/compound/archive instead.
30
33
 
31
34
  Recommendation defaults:
32
35
 
@@ -80,8 +83,8 @@ insight (for example, purely mechanical edits with no new decisions).
80
83
  ## Progressive disclosure baseline
81
84
 
82
85
  - Start with the current stage skill.
83
- - Load deeper references only when required by a blocker or gate.
84
- - Prefer \`.cclaw/references/stages/<stage>-examples.md\` and protocol files over
85
- copying large instruction blocks into stage skills.
86
+ - Load deeper skills or docs only when required by a blocker or gate.
87
+ - Keep examples as short shape cues inside the current skill instead of
88
+ materializing separate reference files.
86
89
  `;
87
90
  }
@@ -3,10 +3,12 @@ import type { StageComplexityTier, StageAutoSubagentDispatch, StageSchema } from
3
3
  export type { ArtifactValidation, CrossStageTrace, ReviewSection, StageComplexityTier, StageExecutionModel, StagePhilosophy, StageArtifactRules, StageReviewLoop, StageReviewLens, StageAutoSubagentDispatch, StageGate, StageSchemaLegacyInput, StageSchema, StageSchemaInput, StageSchemaV2Input } from "./stages/schema-types.js";
4
4
  export declare const SKILL_ENVELOPE_KINDS: readonly ["stage-output", "gate-result", "delegation-record"];
5
5
  export type SkillEnvelopeKind = (typeof SKILL_ENVELOPE_KINDS)[number];
6
+ export declare const NON_FLOW_ENVELOPE_STAGE: "non-flow";
7
+ export type SkillEnvelopeStage = FlowStage | typeof NON_FLOW_ENVELOPE_STAGE;
6
8
  export interface SkillEnvelope {
7
9
  version: "1";
8
10
  kind: SkillEnvelopeKind;
9
- stage: FlowStage;
11
+ stage: SkillEnvelopeStage;
10
12
  payload: unknown;
11
13
  emittedAt: string;
12
14
  agent?: string;
@@ -15,6 +17,28 @@ export interface SkillEnvelopeValidation {
15
17
  ok: boolean;
16
18
  errors: string[];
17
19
  }
20
+ export interface StageStackAwareReviewRoute {
21
+ stack: string;
22
+ agent: "reviewer";
23
+ signals: string[];
24
+ focus: string;
25
+ }
26
+ export interface StageDelegationSummary {
27
+ stage: FlowStage;
28
+ mandatoryAgents: string[];
29
+ proactiveAgents: string[];
30
+ primaryAgents: string[];
31
+ stackAwareRoutes: StageStackAwareReviewRoute[];
32
+ }
33
+ export declare function reviewStackAwareRoutes(): StageStackAwareReviewRoute[];
34
+ export declare function reviewStackAwareRoutingSummary(): string;
35
+ /**
36
+ * Canonical delegation summary derived from STAGE_AUTO_SUBAGENT_DISPATCH.
37
+ *
38
+ * Keep all generated routing surfaces (skills, AGENTS.md) on this helper so
39
+ * stage->agent defaults are maintained in one place.
40
+ */
41
+ export declare function stageDelegationSummary(complexityTier?: StageComplexityTier): StageDelegationSummary[];
18
42
  export declare function validateSkillEnvelope(value: unknown): SkillEnvelopeValidation;
19
43
  export declare function parseSkillEnvelope(raw: string): SkillEnvelope | null;
20
44
  /** Transition guard: agents with `mode: "mandatory"` in auto-subagent dispatch for this stage. */
@@ -26,4 +50,5 @@ export declare function stageRecommendedGateIds(stage: FlowStage, track?: FlowTr
26
50
  export declare function nextCclawCommand(stage: FlowStage): string;
27
51
  export declare function buildTransitionRules(): TransitionRule[];
28
52
  export declare function stagePolicyNeedles(stage: FlowStage, track?: FlowTrack): string[];
53
+ export declare function stageTrackRenderContext(track?: FlowTrack): import("./track-render-context.js").TrackRenderContext;
29
54
  export declare function stageAutoSubagentDispatch(stage: FlowStage): StageAutoSubagentDispatch[];