cclaw-cli 0.49.0 → 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 -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 +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 -21
  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 -1534
  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 -344
  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 -358
  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 -105
  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 -18
  93. package/dist/content/contexts.js +0 -24
  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,3 +1,4 @@
1
+ import { stageDelegationSummary } from "./stage-schema.js";
1
2
  /**
2
3
  * Markdown content generators for Cclaw’s subagent orchestration skills and enhanced
3
4
  * specialist payloads. Cclaw materializes static instructions — this module does not
@@ -10,6 +11,22 @@ const SUBAGENT_AGENT_NAMES = [
10
11
  "test-author",
11
12
  "doc-updater"
12
13
  ];
14
+ function formatAgentList(agents) {
15
+ return agents.length > 0 ? agents.join(", ") : "none";
16
+ }
17
+ function automaticStageDelegationTable() {
18
+ const summary = stageDelegationSummary("standard");
19
+ const rows = summary.map((row) => {
20
+ return `| ${row.stage} | ${formatAgentList(row.mandatoryAgents)} | ${formatAgentList(row.proactiveAgents)} |`;
21
+ }).join("\n");
22
+ return `| Stage | Mandatory agents | Proactive agents |
23
+ |---|---|---|
24
+ ${rows}`;
25
+ }
26
+ function stageSummary(stage) {
27
+ return stageDelegationSummary("standard").find((row) => row.stage === stage)
28
+ ?? { stage, mandatoryAgents: [], proactiveAgents: [], primaryAgents: [], stackAwareRoutes: [] };
29
+ }
13
30
  export function subagentDrivenDevSkill() {
14
31
  return `---
15
32
  name: subagent-driven-development
@@ -30,56 +47,48 @@ This pattern is intentionally **Superpowers-style**: cheap parallelism where it
30
47
 
31
48
  ## Automatic Stage Delegation in Cclaw
32
49
 
33
- For cclaw flow stages, machine-only specialist work should auto-dispatch without waiting for a manual user request:
50
+ For cclaw flow stages, machine-only specialist work should auto-dispatch without waiting for a manual user request. The table below is generated from the canonical stage dispatch registry:
34
51
 
35
- - **design/plan:** planner
36
- - **tdd:** test-author
37
- - **review:** reviewer + security-reviewer (security-reviewer is always mandatory; produce an explicit no-change attestation when no trust boundaries moved)
38
- - **ship:** doc-updater
52
+ ${automaticStageDelegationTable()}
39
53
 
40
54
  Human input remains mandatory only at explicit approval gates (plan approval, user challenge resolution, release finalization mode).
41
55
 
42
- ### Review parallel fan-out protocol
56
+ ### Review dispatch protocol
43
57
 
44
- In review stage, prefer a fixed six-pass fan-out before reconciliation:
58
+ In review stage, run mandatory specialists \`${formatAgentList(stageSummary("review").mandatoryAgents)}\` by default:
45
59
 
46
- 1. \`review-spec\` (Layer 1)
47
- 2. \`review-correctness\` (Layer 2a)
48
- 3. \`review-security\` (Layer 2b)
49
- 4. \`review-performance\` (Layer 2c)
50
- 5. \`review-architecture\` (Layer 2d)
51
- 6. \`review-external-safety\` (Layer 2e)
60
+ 1. \`reviewer\` owns Layer 1 spec compliance plus integrated Layer 2 tags (correctness, performance, architecture, external-safety).
61
+ 2. \`security-reviewer\` owns the mandatory security sweep or no-change attestation.
62
+ 3. Add \`adversarial-review\` only when trust boundaries changed, Critical/Important ambiguity remains, or the diff is both large and high-risk.
52
63
 
53
- Dispatch these in parallel where the harness supports isolated workers, then run
54
- one reconciliation pass that merges findings into \`.cclaw/artifacts/07-review-army.json\`
55
- with explicit source tags per finding.
64
+ Reconcile findings into \`.cclaw/artifacts/07-review-army.json\` with explicit source tags per finding.
56
65
 
57
- ### TDD phase fan-out protocol
66
+ ### TDD evidence protocol
58
67
 
59
- Treat RED, GREEN, and REFACTOR as separate delegated intents:
68
+ Treat RED, GREEN, and REFACTOR as phase intents inside one mandatory \`test-author\` delegation by default:
60
69
 
61
70
  - \`tdd-red\`: tests only, no production writes
62
71
  - \`tdd-green\`: minimal production implementation, no new RED tests
63
72
  - \`tdd-refactor\`: cleanup only after GREEN is proven
64
73
 
65
74
  Set \`CCLAW_ACTIVE_AGENT\` to the active phase name when possible so workflow-guard
66
- can enforce phase-appropriate write boundaries.
75
+ can enforce phase-appropriate write boundaries. Use separate workers only when the harness and slice boundary make the split genuinely useful; the mandatory gate is the evidence-backed \`test-author\` row, not three default subagents.
67
76
 
68
77
  ## Model & Harness Routing Notes
69
78
 
70
79
  ### Harness routing
71
80
 
72
- | Harness | Fallback | Delegation tool | Structured ask | Parity playbook |
81
+ | Harness | Fallback | Delegation tool | Structured ask | Capability source |
73
82
  |---|---|---|---|---|
74
- | Claude | \`native\` | Task (named subagent_type) | AskUserQuestion | \`.cclaw/references/harnesses/claude-playbook.md\` |
75
- | Cursor | \`generic-dispatch\` | Task (generic subagent_type: explore/generalPurpose/…) | AskQuestion | \`.cclaw/references/harnesses/cursor-playbook.md\` |
76
- | OpenCode | \`role-switch\` | plugin dispatch _or_ in-session role-switch | \`question\` (permission-gated; \`permission.question: "allow"\`) | \`.cclaw/references/harnesses/opencode-playbook.md\` |
77
- | Codex | \`role-switch\` | in-session role-switch (mandatory evidenceRefs) | \`request_user_input\` (experimental; Plan / Collaboration mode) | \`.cclaw/references/harnesses/codex-playbook.md\` |
83
+ | Claude | \`native\` | Task (named subagent_type) | AskUserQuestion | \`cclaw doctor\` |
84
+ | Cursor | \`generic-dispatch\` | Task (generic subagent_type: explore/generalPurpose/…) | AskQuestion | \`cclaw doctor\` |
85
+ | OpenCode | \`role-switch\` | plugin dispatch _or_ in-session role-switch | \`question\` (permission-gated; \`permission.question: "allow"\`) | \`cclaw doctor\` |
86
+ | Codex | \`role-switch\` | in-session role-switch (mandatory evidenceRefs) | \`request_user_input\` (experimental; Plan / Collaboration mode) | \`cclaw doctor\` |
78
87
 
79
88
  **Dispatch rules driven by \`subagentFallback\`:**
80
89
 
81
90
  - \`native\` — use the harness's own named subagent primitive; delegation entry uses \`fulfillmentMode: "isolated"\`.
82
- - \`generic-dispatch\` — map each cclaw agent onto the generic dispatcher via the harness playbook; delegation entry uses \`fulfillmentMode: "generic-dispatch"\`.
91
+ - \`generic-dispatch\` — map each cclaw agent onto the generic dispatcher with a role prompt; delegation entry uses \`fulfillmentMode: "generic-dispatch"\`.
83
92
  - \`role-switch\` — announce the role in-session, perform the work, append a delegation row with \`fulfillmentMode: "role-switch"\` and ≥1 \`evidenceRef\`. Without evidenceRefs the \`delegation:mandatory:current_stage\` check reports \`missingEvidence\` and blocks stage completion.
84
93
 
85
94
  The only time a \`harness_limitation\` waiver fires automatically is when every installed harness declares \`subagentFallback: "waiver"\`. cclaw 0.33 no longer maps Codex onto auto-waiver — the agent must role-switch with evidence.
@@ -115,9 +124,9 @@ Concrete per-stage rules so the controller does not have to guess which tier fit
115
124
  | design | planner (always) | security-reviewer (if trust boundary touched) | run \`research/framework-docs-lookup.md\` + \`research/best-practices-lookup.md\` in-thread | escalate one specialist to \`deep\` only if a failure mode is Critical-severity |
116
125
  | spec | — | reviewer (if spec > 200 lines or multiple ACs) | — | escalate to \`deep\` only for spec ↔ design contradictions |
117
126
  | plan | planner (solo, always) | — | — | never fan out at plan stage; one owner for dependency graph |
118
- | tdd | — | test-author (each slice) · reviewer (slice-local) | doc-updater (API surface changes) | escalate to \`deep\` only when a RED test cannot be expressed (design leak) |
119
- | review | — | reviewer · security-reviewer (both mandatory) | doc-updater for release-note drift checks | escalate a \`balanced\` reviewer to \`deep\` only when two reviewers disagree on severity |
120
- | ship | — | security-reviewer (if blast radius is high) | doc-updater (changelog/migration notes) | escalate to \`balanced\` reviewer only if preflight finds a regression |
127
+ | tdd | — | ${formatAgentList(stageSummary("tdd").primaryAgents)} (per slice, carrying RED/GREEN/REFACTOR evidence) · reviewer (slice-local only when sliceReview triggers) | doc-updater (API surface changes) | escalate to \`deep\` only when a RED test cannot be expressed (design leak) |
128
+ | review | — | ${formatAgentList(stageSummary("review").mandatoryAgents)} (both mandatory) | doc-updater for release-note drift checks | escalate a \`balanced\` reviewer to \`deep\` only when two reviewers disagree on severity |
129
+ | ship | — | ${formatAgentList(stageSummary("ship").proactiveAgents)} (if blast radius is high) | doc-updater (changelog/migration notes) | escalate to \`balanced\` reviewer only if preflight finds a regression |
121
130
 
122
131
  **De-escalation rules (avoid over-spending):**
123
132
  - If a \`deep\` planner run returns low-uncertainty output (single unambiguous plan), do **not** add a second \`deep\` pass in the same stage.
@@ -131,6 +140,16 @@ Concrete per-stage rules so the controller does not have to guess which tier fit
131
140
 
132
141
  If you catch yourself writing “read PLAN.md Task 3” or “implement the next unchecked item,” stop: expand the work into explicit text in the Task body before dispatching.
133
142
 
143
+ ## Anti-Drift Team Defaults
144
+
145
+ Borrow the good part of Team/Ruflo-style orchestration without adding a swarm runtime:
146
+
147
+ - **One controller owns alignment.** The parent keeps the task list, gate state, and final synthesis.
148
+ - **Small fan-out by default.** Run at most 3-5 parallel agents, and only for independent read-only research or non-overlapping files.
149
+ - **No parallel writes to adjacent surfaces.** If tasks may touch the same module, serialize them.
150
+ - **Checkpoint before synthesis.** Each agent returns status, files inspected/changed, evidence, and blockers before the parent acts.
151
+ - **Consensus is for hard calls only.** Use two reviewers when severity or architecture is disputed; otherwise one evidence-backed reviewer is enough.
152
+
134
153
  ## When to Use
135
154
 
136
155
  - Mid/large plans with multiple discrete tasks, dependencies, or risky overlap.
@@ -1,4 +1,4 @@
1
1
  export declare const ARTIFACT_TEMPLATES: Record<string, string>;
2
2
  export declare const RULEBOOK_MARKDOWN = "# Cclaw Rulebook\n\n## MUST_ALWAYS\n- Follow flow order: brainstorm -> scope -> design -> spec -> plan -> tdd -> review -> ship\n- Require explicit user confirmation after plan before TDD\n- Keep evidence artifacts in `.cclaw/artifacts/`\n- Enforce RED before GREEN in TDD\n- Run two-layer review (spec_compliance and code_quality) before ship\n- Validate all inputs before processing \u2014 never trust external data without sanitization\n- Prefer immutable data patterns and pure functions where the language supports them\n- Follow existing repo conventions, patterns, and directory structure \u2014 match the codebase\n- Verify claims with fresh evidence: \"tests pass\" requires running tests in this message\n- Use conventional commits: `type(scope): description` (feat, fix, refactor, test, docs, chore)\n\n## MUST_NEVER\n- Skip RED phase and jump directly to GREEN in TDD\n- Ship with critical review findings\n- Start implementation during /brainstorm\n- Modify generated cclaw files manually when CLI can regenerate them\n- Commit `.cclaw/` or generated shim files\n- Expose secrets, tokens, API keys, or absolute system paths in agent output\n- Duplicate existing functionality without explicit justification \u2014 search before building\n- Bypass security checks, linting hooks, or type checking to \"move faster\"\n- Claim success (\"Done,\" \"All good,\" \"Tests pass\") without running verification in this message\n- Make changes outside the blast radius of the current task without user consent\n\n## DELEGATION\nWhen a task requires specialist knowledge (security audit, performance profiling, database review),\ndelegate to a specialized agent or skill if the harness supports it. The primary agent should:\n1. Identify the specialist domain\n2. Provide focused context (relevant files, the specific concern)\n3. Evaluate the specialist output before acting on it \u2014 do not blindly apply recommendations\n";
3
- export declare const CURSOR_WORKFLOW_RULE_MDC = "---\ndescription: cclaw workflow guardrails for Cursor agent sessions\nglobs:\n - \"**/*\"\nalwaysApply: true\n---\n\n<!-- cclaw-managed-cursor-workflow-rule -->\n\n# Cclaw Workflow Guardrails\n\n## Activation Rule\n\nBefore responding to coding work:\n1. Read `.cclaw/state/flow-state.json`.\n2. Start with `/cc` or continue with `/cc-next`.\n3. If no software-stage flow applies, respond normally.\n\n## Stage Order\n\n`brainstorm -> scope -> design -> spec -> plan -> tdd -> review -> ship`\n\nTrack-specific skips are allowed only when `flow-state.track` + `skippedStages` explicitly say so.\n\n## Task Classification\n\n| Class | Route |\n|---|---|\n| non-trivial software work | `/cc <idea>` |\n| trivial software fix | `/cc <idea>` (quick or medium track) |\n| bugfix with repro | `/cc <idea>` and enforce RED-first in tdd |\n| pure question / non-software | direct answer (no stage flow) |\n\n## Command Surface\n\n- `/cc` = entry and resume.\n- `/cc-next` = only progression path.\n- `/cc-learn` = knowledge capture and recall.\n\n## Verification Discipline\n\n- No completion claim without fresh command evidence in this turn.\n- Do not mark gates passed from memory.\n- Keep evidence in `.cclaw/artifacts/`; archive via `/cc-ops archive` (agent flow) or archive runtime.\n\n## Delegation And Approvals\n\n- Machine-only checks in design/plan/tdd/review/ship should auto-dispatch when tooling supports it.\n- Ask for user input only at explicit approval gates (scope mode, plan approval, challenge resolution, ship finalization).\n- If harness capabilities are partial, record waiver reasons in delegation logs.\n\n## Routing Source Of Truth\n\n- Primary router: `.cclaw/skills/using-cclaw/SKILL.md`.\n- Protocols: `.cclaw/references/protocols/*.md`.\n- Preamble budget: `.cclaw/references/protocols/ethos.md`.\n";
3
+ export declare const CURSOR_WORKFLOW_RULE_MDC = "---\ndescription: cclaw workflow guardrails for Cursor agent sessions\nglobs:\n - \"**/*\"\nalwaysApply: true\n---\n\n<!-- cclaw-managed-cursor-workflow-rule -->\n\n# Cclaw Workflow Guardrails\n\n## Activation Rule\n\nBefore responding to coding work:\n1. Read `.cclaw/state/flow-state.json`.\n2. Start with `/cc` or continue with `/cc-next`.\n3. If no software-stage flow applies, respond normally.\n\n## Stage Order\n\n`brainstorm -> scope -> design -> spec -> plan -> tdd -> review -> ship`\n\nTrack-specific skips are allowed only when `flow-state.track` + `skippedStages` explicitly say so.\n\n## Task Classification\n\n| Class | Route |\n|---|---|\n| non-trivial software work | `/cc <idea>` |\n| trivial software fix | `/cc <idea>` (quick or medium track) |\n| bugfix with repro | `/cc <idea>` and enforce RED-first in tdd |\n| pure question / non-software | direct answer (no stage flow) |\n\n## Command Surface\n\n- `/cc` = entry and resume.\n- `/cc-next` = only progression path.\n- Knowledge capture and recall use the `learnings` skill when requested.\n\n## Verification Discipline\n\n- No completion claim without fresh command evidence in this turn.\n- Do not mark gates passed from memory.\n- Keep evidence in `.cclaw/artifacts/`; archive via `cclaw archive`.\n\n## Delegation And Approvals\n\n- Machine-only checks in design/plan/tdd/review/ship should auto-dispatch when tooling supports it.\n- Ask for user input only at explicit approval gates (scope mode, plan approval, challenge resolution, ship finalization).\n- If harness capabilities are partial, record waiver reasons in delegation logs.\n\n## Routing Source Of Truth\n\n- Primary router: `.cclaw/skills/using-cclaw/SKILL.md`.\n- Stage behavior: current stage skill plus `.cclaw/state/flow-state.json`.\n- Preamble budget: keep role/status announcements brief and avoid repeating\n them unless the stage or role changes.\n";
4
4
  export declare function buildRulesJson(): Record<string, unknown>;
@@ -2,15 +2,23 @@ import { CCLAW_VERSION, SHIP_FINALIZATION_MODES } from "../constants.js";
2
2
  import { orderedStageSchemas } from "./stage-schema.js";
3
3
  import { FLOW_STAGES } from "../types.js";
4
4
  const SHIP_FINALIZATION_ENUM_LINES = SHIP_FINALIZATION_MODES.map((mode) => ` - ${mode}`).join("\n");
5
- export const ARTIFACT_TEMPLATES = {
6
- "01-brainstorm.md": `---
7
- stage: brainstorm
5
+ const MARKDOWN_CODE_FENCE = "```";
6
+ function artifactFrontmatter(stage) {
7
+ return `---
8
+ stage: ${stage}
8
9
  schema_version: 1
9
10
  version: ${CCLAW_VERSION}
10
- feature: <feature-id>
11
+ run: <run-id>
11
12
  locked_decisions: []
12
13
  inputs_hash: sha256:pending
13
- ---
14
+ ---`;
15
+ }
16
+ const SEED_SHELF_SECTION = `## Seed Shelf Candidates (optional)
17
+ | Seed file | Trigger when | Suggested action | Status (planted/deferred/ignored) |
18
+ |---|---|---|---|
19
+ | .cclaw/seeds/SEED-YYYY-MM-DD-<slug>.md | | | |`;
20
+ export const ARTIFACT_TEMPLATES = {
21
+ "01-brainstorm.md": `${artifactFrontmatter("brainstorm")}
14
22
 
15
23
  # Brainstorm Artifact
16
24
 
@@ -53,10 +61,7 @@ inputs_hash: sha256:pending
53
61
  - **Rationale:**
54
62
  - **Approval:** pending
55
63
 
56
- ## Seed Shelf Candidates (optional)
57
- | Seed file | Trigger when | Suggested action | Status (planted/deferred/ignored) |
58
- |---|---|---|---|
59
- | .cclaw/seeds/SEED-YYYY-MM-DD-<slug>.md | | | |
64
+ ${SEED_SHELF_SECTION}
60
65
 
61
66
  ## Design
62
67
  - **Architecture:**
@@ -70,17 +75,17 @@ inputs_hash: sha256:pending
70
75
  ## Learnings
71
76
  - None this stage.
72
77
  `,
73
- "02-scope.md": `---
74
- stage: scope
75
- schema_version: 1
76
- version: ${CCLAW_VERSION}
77
- feature: <feature-id>
78
- locked_decisions: []
79
- inputs_hash: sha256:pending
80
- ---
78
+ "02-scope.md": `${artifactFrontmatter("scope")}
81
79
 
82
80
  # Scope Artifact
83
81
 
82
+ ## Upstream Handoff
83
+ - Source artifacts: \`00-idea.md\`, \`01-brainstorm-<slug>.md\`
84
+ - Decisions carried forward:
85
+ - Constraints carried forward:
86
+ - Open questions:
87
+ - Drift from upstream (or \`None\`):
88
+
84
89
  ## Pre-Scope System Audit
85
90
  | Check | Command | Findings |
86
91
  |---|---|---|
@@ -165,10 +170,7 @@ inputs_hash: sha256:pending
165
170
  |---|---|
166
171
  | | |
167
172
 
168
- ## Seed Shelf Candidates (optional)
169
- | Seed file | Trigger when | Suggested action | Status (planted/deferred/ignored) |
170
- |---|---|---|---|
171
- | .cclaw/seeds/SEED-YYYY-MM-DD-<slug>.md | | | |
173
+ ${SEED_SHELF_SECTION}
172
174
 
173
175
  ## Error & Rescue Registry
174
176
  | Capability | Failure mode | Detection | Fallback |
@@ -201,14 +203,7 @@ inputs_hash: sha256:pending
201
203
  ## Learnings
202
204
  - None this stage.
203
205
  `,
204
- "02a-research.md": `---
205
- stage: design
206
- schema_version: 1
207
- version: ${CCLAW_VERSION}
208
- feature: <feature-id>
209
- locked_decisions: []
210
- inputs_hash: sha256:pending
211
- ---
206
+ "02a-research.md": `${artifactFrontmatter("design")}
212
207
 
213
208
  # Research Report
214
209
 
@@ -242,17 +237,17 @@ inputs_hash: sha256:pending
242
237
  ## Learnings
243
238
  - None this stage.
244
239
  `,
245
- "03-design.md": `---
246
- stage: design
247
- schema_version: 1
248
- version: ${CCLAW_VERSION}
249
- feature: <feature-id>
250
- locked_decisions: []
251
- inputs_hash: sha256:pending
252
- ---
240
+ "03-design.md": `${artifactFrontmatter("design")}
253
241
 
254
242
  # Design Artifact
255
243
 
244
+ ## Upstream Handoff
245
+ - Source artifacts: \`02-scope-<slug>.md\`, \`02a-research.md\` when present
246
+ - Decisions carried forward:
247
+ - Constraints carried forward:
248
+ - Open questions:
249
+ - Drift from upstream (or \`None\`):
250
+
256
251
  ## Codebase Investigation
257
252
  | File | Current responsibility | Patterns discovered |
258
253
  |---|---|---|
@@ -282,9 +277,9 @@ inputs_hash: sha256:pending
282
277
 
283
278
  <!-- diagram: architecture -->
284
279
 
285
- \`\`\`
280
+ ${MARKDOWN_CODE_FENCE}
286
281
  (ASCII, Mermaid, or tool-generated diagram showing component boundaries and data flow direction)
287
- \`\`\`
282
+ ${MARKDOWN_CODE_FENCE}
288
283
 
289
284
  ## Data-Flow Shadow Paths
290
285
  <!-- diagram: data-flow-shadow-paths -->
@@ -296,33 +291,33 @@ inputs_hash: sha256:pending
296
291
 
297
292
  <!-- diagram: error-flow -->
298
293
 
299
- \`\`\`
294
+ ${MARKDOWN_CODE_FENCE}
300
295
  (failure detection -> rescue action -> user-visible outcome)
301
- \`\`\`
296
+ ${MARKDOWN_CODE_FENCE}
302
297
 
303
298
  ## State Machine Diagram
304
299
 
305
300
  <!-- diagram: state-machine -->
306
301
 
307
- \`\`\`
302
+ ${MARKDOWN_CODE_FENCE}
308
303
  (state transitions for the critical flow lifecycle)
309
- \`\`\`
304
+ ${MARKDOWN_CODE_FENCE}
310
305
 
311
306
  ## Rollback Flowchart
312
307
 
313
308
  <!-- diagram: rollback-flowchart -->
314
309
 
315
- \`\`\`
310
+ ${MARKDOWN_CODE_FENCE}
316
311
  (trigger -> rollback actions -> verification)
317
- \`\`\`
312
+ ${MARKDOWN_CODE_FENCE}
318
313
 
319
314
  ## Deployment Sequence Diagram
320
315
 
321
316
  <!-- diagram: deployment-sequence -->
322
317
 
323
- \`\`\`
318
+ ${MARKDOWN_CODE_FENCE}
324
319
  (rollout order, guard checks, and verification sequence)
325
- \`\`\`
320
+ ${MARKDOWN_CODE_FENCE}
326
321
 
327
322
  ## Stale Diagram Audit
328
323
  | File | Last modified | Diagram marker baseline | Status | Notes |
@@ -413,10 +408,7 @@ inputs_hash: sha256:pending
413
408
  |---|---|---|---|
414
409
  | | | | |
415
410
 
416
- ## Seed Shelf Candidates (optional)
417
- | Seed file | Trigger when | Suggested action | Status (planted/deferred/ignored) |
418
- |---|---|---|---|
419
- | .cclaw/seeds/SEED-YYYY-MM-DD-<slug>.md | | | |
411
+ ${SEED_SHELF_SECTION}
420
412
 
421
413
  ## Completion Dashboard
422
414
  | Review Section | Status | Issues |
@@ -435,17 +427,17 @@ inputs_hash: sha256:pending
435
427
  ## Learnings
436
428
  - None this stage.
437
429
  `,
438
- "04-spec.md": `---
439
- stage: spec
440
- schema_version: 1
441
- version: ${CCLAW_VERSION}
442
- feature: <feature-id>
443
- locked_decisions: []
444
- inputs_hash: sha256:pending
445
- ---
430
+ "04-spec.md": `${artifactFrontmatter("spec")}
446
431
 
447
432
  # Specification Artifact
448
433
 
434
+ ## Upstream Handoff
435
+ - Source artifacts: \`02-scope-<slug>.md\`, \`03-design-<slug>.md\`
436
+ - Decisions carried forward:
437
+ - Constraints carried forward:
438
+ - Open questions:
439
+ - Drift from upstream (or \`None\`):
440
+
449
441
  ## Acceptance Criteria
450
442
  | ID | Requirement Ref (R#) | Criterion (observable/measurable/falsifiable) | Design Decision Ref |
451
443
  |---|---|---|---|
@@ -464,6 +456,11 @@ inputs_hash: sha256:pending
464
456
  - Constraints:
465
457
  - Assumptions:
466
458
 
459
+ ## Assumptions Before Finalization
460
+ | Assumption | Source / confidence | Validation path | Disposition |
461
+ |---|---|---|---|
462
+ | | | | accepted/rejected/open |
463
+
467
464
  ## Testability Map
468
465
  | Criterion ID | Verification approach | Command/manual steps |
469
466
  |---|---|---|
@@ -491,17 +488,17 @@ inputs_hash: sha256:pending
491
488
  ## Learnings
492
489
  - None this stage.
493
490
  `,
494
- "05-plan.md": `---
495
- stage: plan
496
- schema_version: 1
497
- version: ${CCLAW_VERSION}
498
- feature: <feature-id>
499
- locked_decisions: []
500
- inputs_hash: sha256:pending
501
- ---
491
+ "05-plan.md": `${artifactFrontmatter("plan")}
502
492
 
503
493
  # Plan Artifact
504
494
 
495
+ ## Upstream Handoff
496
+ - Source artifacts: \`03-design-<slug>.md\`, \`04-spec.md\`
497
+ - Decisions carried forward:
498
+ - Constraints carried forward:
499
+ - Open questions:
500
+ - Drift from upstream (or \`None\`):
501
+
505
502
  ## Dependency Graph
506
503
  -
507
504
 
@@ -540,6 +537,12 @@ Execution rule: complete and verify each batch before starting the next batch.
540
537
  |---|---|
541
538
  | AC-1 | T-1 |
542
539
 
540
+ ## Execution Posture
541
+ - Posture: sequential | dependency-batched | parallel-safe | blocked
542
+ - Stop conditions:
543
+ - Risk triggers:
544
+ - TDD checkpoint plan: RED commit/checkpoint -> GREEN commit/checkpoint -> REFACTOR commit/checkpoint (or deferred because: )
545
+
543
546
  ## Locked Decision Coverage
544
547
  | Decision ID | Source section | Plan tasks implementing decision | Status |
545
548
  |---|---|---|---|
@@ -570,17 +573,32 @@ Execution rule: complete and verify each batch before starting the next batch.
570
573
  ## Learnings
571
574
  - None this stage.
572
575
  `,
573
- "06-tdd.md": `---
574
- stage: tdd
575
- schema_version: 1
576
- version: ${CCLAW_VERSION}
577
- feature: <feature-id>
578
- locked_decisions: []
579
- inputs_hash: sha256:pending
580
- ---
576
+ "06-tdd.md": `${artifactFrontmatter("tdd")}
581
577
 
582
578
  # TDD Artifact
583
579
 
580
+ ## Upstream Handoff
581
+ - Source artifacts: \`04-spec.md\`, \`05-plan.md\`
582
+ - Decisions carried forward:
583
+ - Constraints carried forward:
584
+ - Open questions:
585
+ - Drift from upstream (or \`None\`):
586
+
587
+ ## Test Discovery
588
+ | Slice | Existing tests / helpers / fixtures | Exact command(s) | Pattern to extend |
589
+ |---|---|---|---|
590
+ | S-1 | | | |
591
+
592
+ ## System-Wide Impact Check
593
+ | Slice | Callbacks/state/interfaces/contracts affected | Coverage decision |
594
+ |---|---|---|
595
+ | S-1 | | covered/out-of-scope because |
596
+
597
+ ## Execution Posture
598
+ - Posture: sequential | dependency-batched | blocked
599
+ - RED/GREEN/REFACTOR checkpoint plan:
600
+ - Incremental commits: yes/no/deferred because
601
+
584
602
  ## RED Evidence
585
603
  | Slice | Test name | Command | Failure output summary |
586
604
  |---|---|---|---|
@@ -637,17 +655,17 @@ inputs_hash: sha256:pending
637
655
  ## Learnings
638
656
  - None this stage.
639
657
  `,
640
- "07-review.md": `---
641
- stage: review
642
- schema_version: 1
643
- version: ${CCLAW_VERSION}
644
- feature: <feature-id>
645
- locked_decisions: []
646
- inputs_hash: sha256:pending
647
- ---
658
+ "07-review.md": `${artifactFrontmatter("review")}
648
659
 
649
660
  # Review Artifact
650
661
 
662
+ ## Upstream Handoff
663
+ - Source artifacts: \`04-spec.md\`, \`05-plan.md\`, \`06-tdd.md\`
664
+ - Decisions carried forward:
665
+ - Constraints carried forward:
666
+ - Open questions:
667
+ - Drift from upstream (or \`None\`):
668
+
651
669
  ## Layer 1 Verdict
652
670
  | Criterion | Verdict | Evidence |
653
671
  |---|---|---|
@@ -664,46 +682,25 @@ inputs_hash: sha256:pending
664
682
  |---|---|---|---|---|---|---|
665
683
  | CR-1 | reviewer / bot / ci | Critical/Important/Suggestion | path:line or n/a | | open/in-progress/resolved/accepted-risk/rejected-with-evidence | |
666
684
 
667
- ## Review Army Contract
685
+ ## Review Findings Contract
668
686
  - See \`07-review-army.json\`
669
687
  - Reconciliation summary:
670
688
 
671
- ## Review Readiness Dashboard
689
+ ## Review Readiness Snapshot
672
690
 
673
- | Pass | Status | Completed at (UTC) | Reviewer / source | Commit at review | Drift vs HEAD |
674
- |---|---|---|---|---|---|
675
- | Layer 1 spec compliance | pass / fail / pending | <ISO 8601> | reviewer | <short sha> | <files changed since> |
676
- | Layer 2 — correctness | pass / fail / pending | <ISO 8601> | reviewer | <short sha> | <files changed since> |
677
- | Layer 2 — security | pass / fail / pending | <ISO 8601> | security-reviewer | <short sha> | <files changed since> |
678
- | Layer 2 — performance | pass / fail / pending | <ISO 8601> | reviewer | <short sha> | <files changed since> |
679
- | Layer 2 — architecture | pass / fail / pending | <ISO 8601> | reviewer | <short sha> | <files changed since> |
680
- | Adversarial review | pass / fail / n/a | <ISO 8601 or —> | adversarial-review skill | <short sha or —> | <drift or —> |
681
- | Review army schema valid | pass / fail | <ISO 8601> | jsonschema | <short sha> | n/a |
682
-
683
- ### Delegation log snapshot (current run, current stage)
684
- - Path: \`.cclaw/state/delegation-log.json\`
685
- - Required: <list of mandatory specialists>
686
- - Completed: <list with timestamps>
687
- - Waived (with reason): <list or "none">
688
- - Pending: <list or "none">
689
-
690
- ### Staleness signal
691
- - Worktree commit at last review pass: \`<short sha>\`
692
- - Worktree commit now: \`<short sha>\`
693
- - Files changed since last review pass: \`<count>\` (run \`git diff --stat <sha>..HEAD\` to inspect)
694
- - If drift > 0 lines, mark Layer 1 / Layer 2 results as **STALE — re-run before ship**.
695
-
696
- ### Headline
697
- - Open critical blockers: <count>
698
- - Adversarial review pass: pass / fail / n/a
691
+ - Completed checks: Layer 1, Layer 2 tags, security sweep, schema validation
692
+ - Delegation log: \`.cclaw/state/delegation-log.json\` required/completed/waived/pending
693
+ - Staleness signal: commit at last review pass vs current commit
694
+ - Open critical blockers:
699
695
  - Ship recommendation: APPROVED | APPROVED_WITH_CONCERNS | BLOCKED
700
696
 
701
- ## Completeness Score
697
+
698
+ ## Completeness Snapshot
702
699
  - AC coverage: <N>/<M> (<percent>%)
703
700
  - Task coverage (tasks backed by ≥1 test slice): <N>/<M>
704
701
  - Slice coverage (slices linked to ≥1 AC): <N>/<M>
705
- - Adversarial review pass: true | false
706
- - Overall score: <0-100>
702
+ - Adversarial review: not triggered | pass | fail
703
+ - Overall: complete | concerns | blocked
707
704
 
708
705
  ## Trace Matrix Check
709
706
  - Command: \`cclaw internal trace-matrix\`
@@ -754,17 +751,17 @@ inputs_hash: sha256:pending
754
751
  }
755
752
  }
756
753
  `,
757
- "08-ship.md": `---
758
- stage: ship
759
- schema_version: 1
760
- version: ${CCLAW_VERSION}
761
- feature: <feature-id>
762
- locked_decisions: []
763
- inputs_hash: sha256:pending
764
- ---
754
+ "08-ship.md": `${artifactFrontmatter("ship")}
765
755
 
766
756
  # Ship Artifact
767
757
 
758
+ ## Upstream Handoff
759
+ - Source artifacts: \`06-tdd.md\`, \`07-review.md\`
760
+ - Decisions carried forward:
761
+ - Constraints carried forward:
762
+ - Open questions:
763
+ - Drift from upstream (or \`None\`):
764
+
768
765
  ## Preflight Results
769
766
  - Review verdict:
770
767
  - Build:
@@ -798,21 +795,14 @@ ${SHIP_FINALIZATION_ENUM_LINES}
798
795
  - Exceptions (if any):
799
796
 
800
797
  ## Retro Gate Handoff
801
- - Run \`/cc-ops retro\` before archive.
798
+ - Complete the retro gate before archive.
802
799
  - Retro artifact path: \`.cclaw/artifacts/09-retro.md\`
803
800
  - Archive remains blocked until retro gate is complete.
804
801
 
805
802
  ## Learnings
806
803
  - None this stage.
807
804
  `,
808
- "09-retro.md": `---
809
- stage: retro
810
- schema_version: 1
811
- version: ${CCLAW_VERSION}
812
- feature: <feature-id>
813
- locked_decisions: []
814
- inputs_hash: sha256:pending
815
- ---
805
+ "09-retro.md": `${artifactFrontmatter("retro")}
816
806
 
817
807
  # Retro Artifact
818
808
 
@@ -919,13 +909,13 @@ Track-specific skips are allowed only when \`flow-state.track\` + \`skippedStage
919
909
 
920
910
  - \`/cc\` = entry and resume.
921
911
  - \`/cc-next\` = only progression path.
922
- - \`/cc-learn\` = knowledge capture and recall.
912
+ - Knowledge capture and recall use the \`learnings\` skill when requested.
923
913
 
924
914
  ## Verification Discipline
925
915
 
926
916
  - No completion claim without fresh command evidence in this turn.
927
917
  - Do not mark gates passed from memory.
928
- - Keep evidence in \`.cclaw/artifacts/\`; archive via \`/cc-ops archive\` (agent flow) or archive runtime.
918
+ - Keep evidence in \`.cclaw/artifacts/\`; archive via \`cclaw archive\`.
929
919
 
930
920
  ## Delegation And Approvals
931
921
 
@@ -936,8 +926,9 @@ Track-specific skips are allowed only when \`flow-state.track\` + \`skippedStage
936
926
  ## Routing Source Of Truth
937
927
 
938
928
  - Primary router: \`.cclaw/skills/using-cclaw/SKILL.md\`.
939
- - Protocols: \`.cclaw/references/protocols/*.md\`.
940
- - Preamble budget: \`.cclaw/references/protocols/ethos.md\`.
929
+ - Stage behavior: current stage skill plus \`.cclaw/state/flow-state.json\`.
930
+ - Preamble budget: keep role/status announcements brief and avoid repeating
931
+ them unless the stage or role changes.
941
932
  `;
942
933
  export function buildRulesJson() {
943
934
  return {
@@ -0,0 +1,17 @@
1
+ import type { FlowTrack } from "../types.js";
2
+ export interface TrackRenderContext {
3
+ track: FlowTrack;
4
+ usesPlanTerminology: boolean;
5
+ traceabilitySourceNoun: string;
6
+ traceabilityIdNoun: string;
7
+ traceabilitySliceNoun: string;
8
+ upstreamArtifactLabel: string;
9
+ upstreamArtifactPath: string;
10
+ }
11
+ export declare function trackRenderContext(track: FlowTrack): TrackRenderContext;
12
+ /**
13
+ * Render track-aware terminology for text that defaults to standard-track plan
14
+ * wording. Keep this centralized so quick-track rewrites do not drift across
15
+ * stage content generators.
16
+ */
17
+ export declare function renderTrackTerminology(value: string, context: TrackRenderContext): string;
@@ -0,0 +1,44 @@
1
+ function artifactFileName(path) {
2
+ return path.split("/").pop() ?? path;
3
+ }
4
+ export function trackRenderContext(track) {
5
+ if (track === "quick") {
6
+ return {
7
+ track,
8
+ usesPlanTerminology: false,
9
+ traceabilitySourceNoun: "acceptance criterion",
10
+ traceabilityIdNoun: "acceptance criterion ID",
11
+ traceabilitySliceNoun: "acceptance slice",
12
+ upstreamArtifactLabel: "spec artifact",
13
+ upstreamArtifactPath: ".cclaw/artifacts/04-spec.md"
14
+ };
15
+ }
16
+ return {
17
+ track,
18
+ usesPlanTerminology: true,
19
+ traceabilitySourceNoun: "plan task",
20
+ traceabilityIdNoun: "plan task ID",
21
+ traceabilitySliceNoun: "plan slice",
22
+ upstreamArtifactLabel: "plan artifact",
23
+ upstreamArtifactPath: ".cclaw/artifacts/05-plan.md"
24
+ };
25
+ }
26
+ /**
27
+ * Render track-aware terminology for text that defaults to standard-track plan
28
+ * wording. Keep this centralized so quick-track rewrites do not drift across
29
+ * stage content generators.
30
+ */
31
+ export function renderTrackTerminology(value, context) {
32
+ if (context.usesPlanTerminology) {
33
+ return value;
34
+ }
35
+ return value
36
+ .replace(/\btask from the plan\b/giu, `${context.traceabilitySourceNoun} from the spec`)
37
+ .replace(/\bplan task ID\b/giu, context.traceabilityIdNoun)
38
+ .replace(/\bplan task\b/giu, context.traceabilitySourceNoun)
39
+ .replace(/\bplan row\b/giu, "acceptance row")
40
+ .replace(/\btraceable to plan slice\b/giu, `traceable to ${context.traceabilitySliceNoun}`)
41
+ .replace(/\bplan slice\b/giu, context.traceabilitySliceNoun)
42
+ .replace(/\bplan artifact\b/giu, context.upstreamArtifactLabel)
43
+ .replace(/05-plan\.md/gu, artifactFileName(context.upstreamArtifactPath));
44
+ }