cclaw-cli 0.4.0 → 0.5.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.
package/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
  **A focused, installer-first workflow that turns AI coding sessions into predictable shipped outcomes.**
4
4
 
5
5
  `cclaw` gives your agent one clear path:
6
- **brainstorm -> scope -> design -> spec -> plan -> test -> build -> review -> ship**
6
+ **brainstorm -> scope -> design -> spec -> plan -> tdd -> review -> ship**
7
7
 
8
8
  No giant command jungle. No runtime daemon. No process theater.
9
9
  Just a disciplined flow that stays lightweight and works across major coding harnesses.
@@ -17,10 +17,9 @@ flowchart LR
17
17
  C --> D[Design]
18
18
  D --> E[Spec]
19
19
  E --> F[Plan]
20
- F --> G[Test]
21
- G --> H[Build]
22
- H --> I[Review]
23
- I --> J[Ship]
20
+ F --> G[TDD]
21
+ G --> H[Review]
22
+ H --> I[Ship]
24
23
  ```
25
24
 
26
25
  ```mermaid
@@ -29,7 +28,7 @@ sequenceDiagram
29
28
  participant H as Harness
30
29
  participant V as cclaw Hooks + Skills
31
30
  participant S as State + Learnings
32
- U->>H: /cc-brainstorm
31
+ U->>H: /cc <idea>
33
32
  H->>V: Load stage contract + HARD-GATE
34
33
  V->>S: Read context (state/learnings)
35
34
  V-->>H: Structured execution guidance
@@ -65,7 +64,8 @@ npx cclaw-cli init
65
64
  Then run in your harness:
66
65
 
67
66
  ```text
68
- /cc-brainstorm
67
+ /cc <idea>
68
+ /cc-next
69
69
  ```
70
70
 
71
71
  Core installer lifecycle:
@@ -5,8 +5,8 @@ export declare const CCLAW_VERSION = "0.1.1";
5
5
  export declare const FLOW_VERSION = "1.0.0";
6
6
  export declare const DEFAULT_HARNESSES: HarnessId[];
7
7
  export declare const REQUIRED_DIRS: readonly [".cclaw", ".cclaw/commands", ".cclaw/skills", ".cclaw/contexts", ".cclaw/templates", ".cclaw/artifacts", ".cclaw/state", ".cclaw/runs", ".cclaw/rules", ".cclaw/adapters", ".cclaw/agents", ".cclaw/hooks"];
8
- export declare const REQUIRED_GITIGNORE_PATTERNS: readonly ["# cclaw generated artifacts", ".cclaw/", ".claude/commands/cc-*.md", ".cursor/commands/cc-*.md", ".opencode/commands/cc-*.md", ".codex/commands/cc-*.md", ".claude/hooks/hooks.json", ".cursor/hooks.json", ".codex/hooks.json", ".opencode/plugins/cclaw-plugin.mjs", ".cursor/rules/cclaw-workflow.mdc"];
8
+ export declare const REQUIRED_GITIGNORE_PATTERNS: readonly ["# cclaw generated artifacts", ".cclaw/", ".claude/commands/cc-*.md", ".claude/commands/cc.md", ".cursor/commands/cc-*.md", ".cursor/commands/cc.md", ".opencode/commands/cc-*.md", ".opencode/commands/cc.md", ".codex/commands/cc-*.md", ".codex/commands/cc.md", ".claude/hooks/hooks.json", ".cursor/hooks.json", ".codex/hooks.json", ".opencode/plugins/cclaw-plugin.mjs", ".cursor/rules/cclaw-workflow.mdc"];
9
9
  export declare const COMMAND_FILE_ORDER: FlowStage[];
10
- export declare const UTILITY_COMMANDS: readonly ["learn", "autoplan", "next"];
10
+ export declare const UTILITY_COMMANDS: readonly ["learn", "next"];
11
11
  export declare const SUBAGENT_SKILL_FOLDERS: readonly ["subagent-dev", "parallel-dispatch"];
12
12
  export type UtilityCommand = (typeof UTILITY_COMMANDS)[number];
package/dist/constants.js CHANGED
@@ -26,9 +26,13 @@ export const REQUIRED_GITIGNORE_PATTERNS = [
26
26
  "# cclaw generated artifacts",
27
27
  `${RUNTIME_ROOT}/`,
28
28
  ".claude/commands/cc-*.md",
29
+ ".claude/commands/cc.md",
29
30
  ".cursor/commands/cc-*.md",
31
+ ".cursor/commands/cc.md",
30
32
  ".opencode/commands/cc-*.md",
33
+ ".opencode/commands/cc.md",
31
34
  ".codex/commands/cc-*.md",
35
+ ".codex/commands/cc.md",
32
36
  ".claude/hooks/hooks.json",
33
37
  ".cursor/hooks.json",
34
38
  ".codex/hooks.json",
@@ -41,12 +45,11 @@ export const COMMAND_FILE_ORDER = [
41
45
  "design",
42
46
  "spec",
43
47
  "plan",
44
- "test",
45
- "build",
48
+ "tdd",
46
49
  "review",
47
50
  "ship"
48
51
  ];
49
- export const UTILITY_COMMANDS = ["learn", "autoplan", "next"];
52
+ export const UTILITY_COMMANDS = ["learn", "next"];
50
53
  export const SUBAGENT_SKILL_FOLDERS = [
51
54
  "subagent-dev",
52
55
  "parallel-dispatch"
@@ -30,7 +30,7 @@ export declare const CCLAW_AGENTS: AgentDefinition[];
30
30
  */
31
31
  export declare function agentMarkdown(agent: AgentDefinition): string;
32
32
  /**
33
- * Markdown table mapping Cclaw slash commands to recommended specialist agents.
33
+ * Markdown table mapping Cclaw stage entry points to specialist agents.
34
34
  */
35
35
  export declare function agentRoutingTable(): string;
36
36
  /**
@@ -41,7 +41,7 @@ export const CCLAW_AGENTS = [
41
41
  },
42
42
  {
43
43
  name: "spec-reviewer",
44
- description: "MANDATORY after implementation: MUST BE USED during `/cc-review` (and any review gate) to verify acceptance criteria against the actual codebase — not against claims.",
44
+ description: "MANDATORY after implementation: MUST BE USED during the review stage (via `/cc-next`) to verify acceptance criteria against the actual codebase — not against claims.",
45
45
  tools: ["Read", "Grep", "Glob"],
46
46
  model: "balanced",
47
47
  activation: "mandatory",
@@ -64,7 +64,7 @@ export const CCLAW_AGENTS = [
64
64
  },
65
65
  {
66
66
  name: "code-reviewer",
67
- description: "MANDATORY for all code changes: MUST BE USED during `/cc-review` for any diff/PR-sized work — correctness, maintainability, and ship risk.",
67
+ description: "MANDATORY for all code changes: MUST BE USED during the review stage (via `/cc-next`) for any diff/PR-sized work — correctness, maintainability, and ship risk.",
68
68
  tools: ["Read", "Grep", "Glob"],
69
69
  model: "balanced",
70
70
  activation: "mandatory",
@@ -128,7 +128,7 @@ export const CCLAW_AGENTS = [
128
128
  tools: ["Read", "Write", "Edit", "Grep", "Glob", "Bash"],
129
129
  model: "balanced",
130
130
  activation: "proactive",
131
- relatedStages: ["test", "build"],
131
+ relatedStages: ["tdd"],
132
132
  body: [
133
133
  "You are a **test-driven development** guide and implementer.",
134
134
  "",
@@ -157,7 +157,7 @@ export const CCLAW_AGENTS = [
157
157
  tools: ["Read", "Write", "Edit", "Grep", "Glob"],
158
158
  model: "fast",
159
159
  activation: "proactive",
160
- relatedStages: ["build", "ship"],
160
+ relatedStages: ["tdd", "ship"],
161
161
  body: [
162
162
  "You are a **documentation and comment maintenance** specialist.",
163
163
  "",
@@ -208,20 +208,16 @@ ${taskDelegation}
208
208
  `;
209
209
  }
210
210
  /**
211
- * Markdown table mapping Cclaw slash commands to recommended specialist agents.
211
+ * Markdown table mapping Cclaw stage entry points to specialist agents.
212
212
  */
213
213
  export function agentRoutingTable() {
214
- return `| Command | Primary Agent | Supporting Agents |
214
+ return `| Stage Entry | Primary Agent | Supporting Agents |
215
215
  |---|---|---|
216
- | /cc-brainstorm | planner | — |
217
- | /cc-scope | planner | |
218
- | /cc-design | planner, security-reviewer | |
219
- | /cc-spec | planner | spec-reviewer |
220
- | /cc-plan | planner | |
221
- | /cc-test | test-author | — |
222
- | /cc-build | test-author | doc-updater |
223
- | /cc-review | spec-reviewer, code-reviewer | security-reviewer |
224
- | /cc-ship | — | doc-updater |
216
+ | Brainstorm (start with \`/cc <idea>\`) | planner | — |
217
+ | Scope / Design / Spec / Plan (advance via \`/cc-next\`) | planner | security-reviewer on design, spec-reviewer on spec |
218
+ | TDD (via \`/cc-next\`) | test-author | doc-updater |
219
+ | Review (via \`/cc-next\`) | spec-reviewer, code-reviewer | security-reviewer |
220
+ | Ship (via \`/cc-next\`) | | doc-updater |
225
221
  `;
226
222
  }
227
223
  /**
@@ -235,7 +231,7 @@ Cclaw provides specialist agents under \`.cclaw/agents/\` for targeted delegatio
235
231
  ${agentRoutingTable()}
236
232
 
237
233
  **Activation modes:**
238
- - **Mandatory:** MUST be used when the related stage runs (spec-reviewer, code-reviewer during /review)
234
+ - **Mandatory:** MUST be used when the related stage runs (spec-reviewer, code-reviewer during review)
239
235
  - **Proactive:** Should be used automatically when context matches (planner for complex features, security-reviewer for auth code)
240
236
  - **On-demand:** Invoked only when explicitly requested
241
237
 
@@ -167,7 +167,7 @@ T1 ──▶ T2 ──▶ T3
167
167
  ### Risk note
168
168
 
169
169
  If T3 grows too large, split “transport” vs “UI state machine” into two tasks while keeping the dependency graph acyclic.`,
170
- test: `### RED test (Vitest) — written before production code
170
+ tdd: `### RED test (Vitest) — written before production code
171
171
 
172
172
  \`\`\`typescript
173
173
  import { describe, it, expect } from "vitest";
@@ -204,8 +204,9 @@ Error: Cannot find module '../notificationFeed' imported from src/notificationFe
204
204
  ### Common mistakes to avoid
205
205
 
206
206
  - “GREEN” that secretly imports a helper that already implements the behavior (that is skipping RED).
207
- - Assertions that pass because the function returns \`undefined\` and the matcher is too loose.`,
208
- build: `### GREEN (minimal implementation to pass RED)
207
+ - Assertions that pass because the function returns \`undefined\` and the matcher is too loose.
208
+
209
+ ### GREEN (minimal implementation to pass RED)
209
210
 
210
211
  \`\`\`typescript
211
212
  export type FeedItem = { dedupeKey: string; read: boolean };
@@ -270,8 +270,7 @@ if [ "$SUGGESTIONS_ENABLED" = "true" ] && [ "$STAGE_MUTED" != "true" ]; then
270
270
  design) STAGE_SUGGESTION="Suggestion: map failure modes per new codepath and confirm architecture boundaries before moving forward." ;;
271
271
  spec) STAGE_SUGGESTION="Suggestion: ensure every acceptance criterion is measurable and mapped to a concrete test." ;;
272
272
  plan) STAGE_SUGGESTION="Suggestion: group tasks into dependency waves and keep WAIT_FOR_CONFIRM pending until approval." ;;
273
- test) STAGE_SUGGESTION="Suggestion: RED only in this stage capture failing output for each selected slice." ;;
274
- build) STAGE_SUGGESTION="Suggestion: apply minimal GREEN change, run full suite, then document REFACTOR notes." ;;
273
+ tdd) STAGE_SUGGESTION="Suggestion: execute RED GREEN REFACTOR for each selected slice and capture evidence per cycle." ;;
275
274
  review) STAGE_SUGGESTION="Suggestion: run Layer 1 before Layer 2 and reconcile findings into 07-review-army.json." ;;
276
275
  ship) STAGE_SUGGESTION="Suggestion: verify preflight + rollback plan before selecting exactly one finalization mode." ;;
277
276
  *) STAGE_SUGGESTION="" ;;
@@ -401,7 +400,7 @@ if [ "$STAGE" != "none" ] && [ -n "$STAGE_LEARNING_LINES" ] && command -v jq >/d
401
400
  fi
402
401
 
403
402
  # --- Build context message ---
404
- CTX="cclaw loaded. Flow: stage=$STAGE ($COMPLETED/9 completed, run=$ACTIVE_RUN). Active run artifacts: ${RUNTIME_ROOT}/runs/$ACTIVE_RUN/artifacts/"
403
+ CTX="cclaw loaded. Flow: stage=$STAGE ($COMPLETED/8 completed, run=$ACTIVE_RUN). Active run artifacts: ${RUNTIME_ROOT}/runs/$ACTIVE_RUN/artifacts/"
405
404
  if [ -n "$CONTEXT_MODE_NOTE" ]; then
406
405
  CTX="$CTX
407
406
  $CONTEXT_MODE_NOTE"
@@ -932,8 +931,7 @@ export default function cclawPlugin(ctx) {
932
931
  design: "Suggestion: map failure modes per new codepath and confirm architecture boundaries before moving forward.",
933
932
  spec: "Suggestion: ensure every acceptance criterion is measurable and mapped to a concrete test.",
934
933
  plan: "Suggestion: group tasks into dependency waves and keep WAIT_FOR_CONFIRM pending until approval.",
935
- test: "Suggestion: RED only in this stage capture failing output for each selected slice.",
936
- build: "Suggestion: apply minimal GREEN change, run full suite, then document REFACTOR notes.",
934
+ tdd: "Suggestion: execute RED GREEN REFACTOR for each selected slice and capture evidence per cycle.",
937
935
  review: "Suggestion: run Layer 1 before Layer 2 and reconcile findings into 07-review-army.json.",
938
936
  ship: "Suggestion: verify preflight + rollback plan before selecting exactly one finalization mode."
939
937
  };
@@ -995,7 +993,7 @@ export default function cclawPlugin(ctx) {
995
993
  const contextMode = readContextMode();
996
994
  const stageSuggestion = readStageSuggestion(stage);
997
995
  const stageLearnings = readStageLearnings(stage);
998
- const parts = [\`cclaw loaded. Flow: stage=\${stage} (\${completed}/9 completed, run=\${activeRunId}). Active run artifacts: ${RUNTIME_ROOT}/runs/\${activeRunId}/artifacts/\`];
996
+ const parts = [\`cclaw loaded. Flow: stage=\${stage} (\${completed}/8 completed, run=\${activeRunId}). Active run artifacts: ${RUNTIME_ROOT}/runs/\${activeRunId}/artifacts/\`];
999
997
  parts.push(
1000
998
  contextMode.guide
1001
999
  ? \`Context mode: \${contextMode.mode} (guide: \${contextMode.guide})\`
@@ -44,7 +44,7 @@ Treat learnings as durable project memory: patterns, pitfalls, preferences, arch
44
44
  **Minimal valid example (conceptual):**
45
45
 
46
46
  \`\`\`json
47
- {"ts":"2026-04-11T12:00:00Z","skill":"build","type":"pattern","key":"run-migrations-before-seed","insight":"Seed scripts assume schema v7; run sqlx migrate before npm run seed.","confidence":8,"source":"observed","files":["scripts/seed.ts"]}
47
+ {"ts":"2026-04-11T12:00:00Z","skill":"tdd","type":"pattern","key":"run-migrations-before-seed","insight":"Seed scripts assume schema v7; run sqlx migrate before npm run seed.","confidence":8,"source":"observed","files":["scripts/seed.ts"]}
48
48
  \`\`\`
49
49
 
50
50
  ## Confidence Decay Rules
@@ -19,34 +19,26 @@ This meta-skill helps you discover and apply the right cclaw stage for the curre
19
19
 
20
20
  ## Skill Discovery Flowchart
21
21
 
22
- When a task arrives, identify the development phase and invoke the matching command:
22
+ Use \`/cc\` to start or \`/cc-next\` to continue:
23
23
 
24
24
  \`\`\`
25
25
  Task arrives
26
26
  |
27
- +-- Vague idea / needs exploration? --> /cc-brainstorm
28
- +-- Need to shape scope / challenge premises? --> /cc-scope
29
- +-- Have scope, need architecture / design lock? --> /cc-design
30
- +-- Have design, need formal specification? --> /cc-spec
31
- +-- Have spec, need task breakdown / plan? --> /cc-plan
32
- +-- Have plan, need to write tests first? --> /cc-test
33
- +-- Have failing tests, need implementation? --> /cc-build
34
- +-- Have implementation, need review? --> /cc-review
35
- +-- Reviewed and approved, need to ship? --> /cc-ship
36
- |
37
- +-- Cross-cutting:
38
- | +-- Want to check/add project learnings? --> /cc-learn
39
- | +-- Want full brainstorm-to-plan in one shot? --> /cc-autoplan
40
- |
27
+ +-- New idea / starting fresh? --> /cc <idea> (starts brainstorm)
28
+ +-- Resuming / continuing? --> /cc or /cc-next
29
+ +-- Want to check/add project learnings? --> /cc-learn
41
30
  +-- No cclaw stage applies? --> Respond normally
42
31
  \`\`\`
43
32
 
33
+ Stage progression is handled automatically by \`/cc-next\`. The flow moves through:
34
+ brainstorm → scope → design → spec → plan → tdd → review → ship
35
+
44
36
  ## Flow State Check
45
37
 
46
38
  Before starting work, ALWAYS:
47
39
 
48
40
  1. Read \`.cclaw/state/flow-state.json\` for the current stage.
49
- 2. If a stage is active, invoke the matching \`/cc-*\` command.
41
+ 2. If a stage is active, continue with \`/cc\` or \`/cc-next\` (do not jump directly to per-stage commands).
50
42
  3. If no stage applies (e.g. simple question, unrelated task), respond normally.
51
43
 
52
44
  ## Activation Rules
@@ -56,25 +48,24 @@ Before starting work, ALWAYS:
56
48
  3. **One stage at a time.** Complete the current stage before advancing to the next.
57
49
  4. **Gates must pass.** Every stage has required gates — the agent cannot claim completion without satisfying them.
58
50
  5. **Artifacts are mandatory.** Each stage writes to \`.cclaw/artifacts/\` and keeps the active run copy in \`.cclaw/runs/<activeRunId>/artifacts/\` — this is the evidence trail.
59
- 6. **When in doubt, start with brainstorm.** If the task is non-trivial and there's no prior artifact, begin with \`/cc-brainstorm\`.
51
+ 6. **When in doubt, use \`/cc\`.** If the task is non-trivial and there's no prior artifact, run \`/cc <idea>\` to start brainstorming.
60
52
 
61
53
  ## Stage Quick Reference
62
54
 
63
- | Stage | Command | HARD-GATE | Artifact |
64
- |-------|---------|-----------|----------|
65
- | Brainstorm | \`/cc-brainstorm\` | No implementation planning | \`01-brainstorm.md\` |
66
- | Scope | \`/cc-scope\` | Challenge premises first | \`02-scope.md\` |
67
- | Design | \`/cc-design\` | Search before building | \`03-design.md\` |
68
- | Spec | \`/cc-spec\` | Observable + testable criteria | \`04-spec.md\` |
69
- | Plan | \`/cc-plan\` | One task = one purpose | \`05-plan.md\` |
70
- | Test | \`/cc-test\` | RED tests fail first | \`06-tdd.md\` |
71
- | Build | \`/cc-build\` | Minimal code to pass RED | \`06-tdd.md\` (shared with test) |
72
- | Review | \`/cc-review\` | Two-layer review | \`07-review.md\` |
73
- | Ship | \`/cc-ship\` | All tests green on merge | \`08-ship.md\` |
55
+ | Stage | How to enter | HARD-GATE | Artifact |
56
+ |-------|--------------|-----------|----------|
57
+ | Brainstorm | \`/cc <idea>\` (or \`/cc\` on fresh flow) | No implementation planning | \`01-brainstorm.md\` |
58
+ | Scope | via \`/cc-next\` | Challenge premises first | \`02-scope.md\` |
59
+ | Design | via \`/cc-next\` | Search before building | \`03-design.md\` |
60
+ | Spec | via \`/cc-next\` | Observable + testable criteria | \`04-spec.md\` |
61
+ | Plan | via \`/cc-next\` | One task = one purpose | \`05-plan.md\` |
62
+ | TDD | via \`/cc-next\` | RED GREEN REFACTOR per slice | \`06-tdd.md\` |
63
+ | Review | via \`/cc-next\` | Two-layer review | \`07-review.md\` |
64
+ | Ship | via \`/cc-next\` | All tests green on merge | \`08-ship.md\` |
74
65
 
75
66
  ## Skill Loading
76
67
 
77
- Each \`/cc-*\` command loads:
68
+ \`/cc-next\` (and \`/cc\`) automatically loads the right stage files:
78
69
  1. **\`.cclaw/skills/<stage>/SKILL.md\`** — the full procedural guide (read this first and follow it)
79
70
  2. **\`.cclaw/commands/<stage>.md\`** — thin orchestrator (entry/exit summary, gates, anchors)
80
71
 
@@ -118,8 +109,6 @@ Use this loading order to keep context lean while preserving depth:
118
109
  ### See also
119
110
  - \`.cclaw/skills/session/SKILL.md\` for session start/stop/resume behavior
120
111
  - \`.cclaw/skills/learnings/SKILL.md\` for durable memory capture and reuse
121
- - \`.cclaw/skills/autoplan/SKILL.md\` when user requests multi-stage orchestration
122
-
123
112
  ## Decision Protocol
124
113
 
125
114
  When a stage requires user input (approval, choice, direction), use this structured pattern:
@@ -143,7 +132,7 @@ When a stage requires user input (approval, choice, direction), use this structu
143
132
  ## Failure Modes
144
133
 
145
134
  Watch for these anti-patterns:
146
- - **Skipping stages** — jumping from brainstorm to build without design/spec/plan
135
+ - **Skipping stages** — jumping from brainstorm to tdd without design/spec/plan
147
136
  - **Ignoring gates** — claiming completion without evidence
148
137
  - **Premature implementation** — writing code before RED tests exist
149
138
  - **Hollow reviews** — "looks good" without checking spec compliance
@@ -27,7 +27,7 @@ export function nextCommandContract() {
27
27
  - **Current stage complete (all gates passed)** → advance \`currentStage\` and load the next skill.
28
28
  - **Flow complete** → report done.
29
29
 
30
- This is the only command the user needs to drive the entire flow. Individual \`/cc-<stage>\` commands are shortcuts for jumping to a specific stage.
30
+ 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\`.
31
31
 
32
32
  ## HARD-GATE
33
33
 
@@ -74,7 +74,7 @@ This is the only command the user needs to drive the entire flow. Individual \`/
74
74
  export function nextCommandSkillMarkdown() {
75
75
  const flowPath = flowStatePath();
76
76
  const delegationPath = delegationLogPathLine();
77
- const stageRows = ["brainstorm", "scope", "design", "spec", "plan", "test", "build", "review", "ship"]
77
+ const stageRows = ["brainstorm", "scope", "design", "spec", "plan", "tdd", "review", "ship"]
78
78
  .map((stage) => {
79
79
  const schema = stageSchema(stage);
80
80
  const next = schema.next === "done" ? "(terminal)" : schema.next;
@@ -226,10 +226,9 @@ stage_index() {
226
226
  design) echo 3 ;;
227
227
  spec) echo 4 ;;
228
228
  plan) echo 5 ;;
229
- test) echo 6 ;;
230
- build) echo 7 ;;
231
- review) echo 8 ;;
232
- ship) echo 9 ;;
229
+ tdd) echo 6 ;;
230
+ review) echo 7 ;;
231
+ ship) echo 8 ;;
233
232
  *) echo 0 ;;
234
233
  esac
235
234
  }
@@ -262,8 +261,8 @@ is_preimplementation_stage() {
262
261
 
263
262
  detect_target_stage() {
264
263
  local text="$1"
265
- for stage in brainstorm scope design spec plan test build review ship; do
266
- if printf '%s' "$text" | grep -Eq "(/cc-$stage|cc-$stage)\\b"; then
264
+ for stage in brainstorm scope design spec plan tdd review ship; do
265
+ if printf '%s' "$text" | grep -Eq "(/cc-$stage|cc-$stage)([^[:alnum:]_-]|$)"; then
267
266
  printf '%s' "$stage"
268
267
  return 0
269
268
  fi
@@ -272,7 +271,22 @@ detect_target_stage() {
272
271
  return 0
273
272
  }
274
273
 
274
+ is_flow_progression_command() {
275
+ local text="$1"
276
+ if printf '%s' "$text" | grep -Eq '(/cc-next|cc-next)([^[:alnum:]_-]|$)'; then
277
+ return 0
278
+ fi
279
+ if printf '%s' "$text" | grep -Eq '/cc([^[:alnum:]_-]|$)'; then
280
+ return 0
281
+ fi
282
+ return 1
283
+ }
284
+
275
285
  TARGET_STAGE=$(detect_target_stage "$PAYLOAD_LOWER")
286
+ FLOW_COMMAND_INVOKED=0
287
+ if is_flow_progression_command "$PAYLOAD_LOWER"; then
288
+ FLOW_COMMAND_INVOKED=1
289
+ fi
276
290
  if [ -n "$TARGET_STAGE" ] && [ "$CURRENT_STAGE" != "none" ]; then
277
291
  CURRENT_IDX=$(stage_index "$CURRENT_STAGE")
278
292
  TARGET_IDX=$(stage_index "$TARGET_STAGE")
@@ -305,7 +319,7 @@ if is_preimplementation_stage "$CURRENT_STAGE" && ! is_plan_mode_safe_tool "$TOO
305
319
  fi
306
320
  fi
307
321
 
308
- if [ -n "$TARGET_STAGE" ]; then
322
+ if [ -n "$TARGET_STAGE" ] || [ "$FLOW_COMMAND_INVOKED" -eq 1 ]; then
309
323
  if [ "$LAST_FLOW_READ_AT" -le 0 ] || [ "$NOW_EPOCH" -le 0 ] || [ $((NOW_EPOCH - LAST_FLOW_READ_AT)) -gt "$MAX_FLOW_READ_AGE_SEC" ]; then
310
324
  if [ -n "$REASONS" ]; then
311
325
  REASONS="$REASONS,stage_invocation_without_recent_flow_read"
@@ -357,7 +371,7 @@ PY
357
371
  fi
358
372
 
359
373
  if [ -n "$REASONS" ]; then
360
- NOTE="Cclaw workflow guard: detected potential flow violation (\${REASONS}). Re-read ${RUNTIME_ROOT}/state/flow-state.json, avoid source edits before build/test stages, and continue from current stage ordering."
374
+ NOTE="Cclaw workflow guard: detected potential flow violation (\${REASONS}). Re-read ${RUNTIME_ROOT}/state/flow-state.json, avoid source edits before tdd stage, and continue from current stage ordering."
361
375
  if command -v jq >/dev/null 2>&1; then
362
376
  ENTRY=$(jq -n -c \
363
377
  --arg ts "$TS" \
@@ -90,7 +90,7 @@ When creating a checkpoint at session boundaries:
90
90
 
91
91
  \`\`\`json
92
92
  {
93
- "stage": "build",
93
+ "stage": "tdd",
94
94
  "status": "in_progress",
95
95
  "lastCompletedStep": "GREEN for task T2",
96
96
  "remainingSteps": ["REFACTOR T2", "RED T3", "GREEN T3", "REFACTOR T3"],
@@ -133,7 +133,7 @@ Mandatory agents for this stage: ${mandatoryList}. Stage transition is BLOCKED u
133
133
  On session stop or stage completion, the agent should write delegation entries to \`${delegationLogRel}\` for audit.
134
134
  `;
135
135
  }
136
- const VERIFICATION_STAGES = ["build", "review", "ship"];
136
+ const VERIFICATION_STAGES = ["tdd", "review", "ship"];
137
137
  function waveExecutionModeBlock(stage) {
138
138
  const schema = stageSchema(stage);
139
139
  if (!schema.waveExecutionAllowed) {
@@ -158,9 +158,15 @@ function stageCompletionProtocol(schema) {
158
158
  : ` - Add \`"${stage}"\` to \`completedStages\` array
159
159
  - Move all gate IDs for this stage (${gateList}) into \`stageGateCatalog.${stage}.passed\`
160
160
  - Clear \`stageGateCatalog.${stage}.blocked\``;
161
- const nextAction = nextStage
162
- ? `3. Tell the user: **"Stage \`${stage}\` complete. Next stage: \`${nextStage}\`. Run \`/cc-next\` to continue."**`
163
- : `3. Tell the user: **"Flow complete. All stages finished."**`;
161
+ let nextAction;
162
+ if (nextStage) {
163
+ const nextSchema = stageSchema(nextStage);
164
+ const nextDescription = nextSchema.skillDescription.charAt(0).toLowerCase() + nextSchema.skillDescription.slice(1);
165
+ nextAction = `3. Tell the user:\n\n > **Stage \`${stage}\` complete.** Next: **${nextStage}** — ${nextDescription}\n >\n > Run \`/cc-next\` to continue.`;
166
+ }
167
+ else {
168
+ nextAction = `3. Tell the user:\n\n > **Flow complete.** All stages finished. The project is ready for release.`;
169
+ }
164
170
  return `## Stage Completion Protocol
165
171
 
166
172
  When all required gates are satisfied and the artifact is written:
@@ -197,12 +203,9 @@ function progressiveDisclosureBlock(stage) {
197
203
  "- `.cclaw/skills/subagent-dev/SKILL.md` — for specialist delegation prompts by task slice",
198
204
  "- `.cclaw/skills/parallel-dispatch/SKILL.md` — for multi-agent review planning and reconciliation setup"
199
205
  ],
200
- test: [
201
- "- `.cclaw/skills/debugging/SKILL.md` — when RED behavior is unclear or flakes appear",
202
- "- `.cclaw/skills/subagent-dev/SKILL.md` — for machine-only test-slice delegation"
203
- ],
204
- build: [
205
- "- `.cclaw/skills/debugging/SKILL.md` — for root-cause workflow when implementation fails tests",
206
+ tdd: [
207
+ "- `.cclaw/skills/debugging/SKILL.md` — when RED behavior is unclear, flakes appear, or implementation fails tests",
208
+ "- `.cclaw/skills/subagent-dev/SKILL.md` — for machine-only test-slice delegation",
206
209
  "- `.cclaw/skills/performance/SKILL.md` — when implementation choices impact latency/throughput"
207
210
  ],
208
211
  review: [
@@ -69,7 +69,7 @@ export interface StageSchema {
69
69
  artifactValidation: ArtifactValidation[];
70
70
  namedAntiPattern?: NamedAntiPattern;
71
71
  decisionRecordFormat?: string;
72
- /** When true, stage skill includes wave auto-execute guidance (test/build). */
72
+ /** When true, stage skill includes wave auto-execute guidance (tdd). */
73
73
  waveExecutionAllowed?: boolean;
74
74
  /** Agent names that MUST be dispatched (or waived) before stage transition — derived from mandatory auto-subagent rows. */
75
75
  mandatoryDelegations: string[];