cclaw-cli 0.3.0 → 0.5.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.
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Command contract for /cc — the unified entry point.
3
+ * No args → behaves like /cc-next (resume or start brainstorm).
4
+ * With prompt → starts brainstorm with the given idea.
5
+ */
6
+ export declare function startCommandContract(): string;
7
+ /**
8
+ * Skill body for /cc — the unified entry point.
9
+ */
10
+ export declare function startCommandSkillMarkdown(): string;
@@ -0,0 +1,109 @@
1
+ import { RUNTIME_ROOT } from "../constants.js";
2
+ const START_SKILL_FOLDER = "flow-start";
3
+ const START_SKILL_NAME = "flow-start";
4
+ function flowStatePath() {
5
+ return `${RUNTIME_ROOT}/state/flow-state.json`;
6
+ }
7
+ /**
8
+ * Command contract for /cc — the unified entry point.
9
+ * No args → behaves like /cc-next (resume or start brainstorm).
10
+ * With prompt → starts brainstorm with the given idea.
11
+ */
12
+ export function startCommandContract() {
13
+ const flowPath = flowStatePath();
14
+ return `# /cc
15
+
16
+ ## Purpose
17
+
18
+ **The unified entry point for the cclaw flow.**
19
+
20
+ - \`/cc\` (no arguments) → behaves exactly like \`/cc-next\`: reads flow state and resumes the current stage, or starts brainstorm if the flow is fresh.
21
+ - \`/cc <prompt>\` (with an idea/description) → saves the prompt as brainstorm context and begins the brainstorm stage, regardless of current flow state.
22
+
23
+ This is the **recommended way to start** working with cclaw. Use \`/cc-next\` for subsequent stage progression.
24
+
25
+ ## HARD-GATE
26
+
27
+ - **Do not** skip reading \`${flowPath}\` — always check current state before acting.
28
+ - **Do not** start implementation stages directly from \`/cc <prompt>\` — always begin at brainstorm.
29
+
30
+ ## Algorithm
31
+
32
+ ### With prompt (\`/cc <text>\`)
33
+
34
+ 1. Read \`${flowPath}\`.
35
+ 2. If flow already has completed stages beyond brainstorm, warn the user that starting a new brainstorm will reset progress. Ask for confirmation before proceeding.
36
+ 3. Write the prompt to \`.cclaw/artifacts/00-idea.md\` as the raw idea capture.
37
+ 4. Set \`currentStage: "brainstorm"\` in flow state (reset if needed).
38
+ 5. Load \`.cclaw/skills/brainstorming/SKILL.md\` and \`.cclaw/commands/brainstorm.md\`.
39
+ 6. Execute brainstorm with the prompt as initial context.
40
+
41
+ ### Without prompt (\`/cc\`)
42
+
43
+ 1. Read \`${flowPath}\`.
44
+ 2. If flow state is missing → run \`cclaw init\` guidance and stop.
45
+ 3. Behave exactly like \`/cc-next\`: check current stage gates, resume if incomplete, advance if complete.
46
+
47
+ ## Primary skill
48
+
49
+ **${RUNTIME_ROOT}/skills/${START_SKILL_FOLDER}/SKILL.md**
50
+ `;
51
+ }
52
+ /**
53
+ * Skill body for /cc — the unified entry point.
54
+ */
55
+ export function startCommandSkillMarkdown() {
56
+ const flowPath = flowStatePath();
57
+ return `---
58
+ name: ${START_SKILL_NAME}
59
+ description: "Unified entry point for the cclaw flow. No args = resume/next. With prompt = start brainstorm with idea."
60
+ ---
61
+
62
+ # /cc — Flow Entry Point
63
+
64
+ ## Overview
65
+
66
+ \`/cc\` is the **starting command** for cclaw. It intelligently routes:
67
+
68
+ - **No arguments** → acts as \`/cc-next\` (resume current stage or advance to next)
69
+ - **With a prompt** → captures the idea and starts brainstorm
70
+
71
+ ## HARD-GATE
72
+
73
+ Do **not** silently discard an existing flow when the user provides a prompt. If completed stages exist, inform and confirm before resetting.
74
+
75
+ ## Protocol
76
+
77
+ ### Path A: \`/cc <prompt>\`
78
+
79
+ 1. Read \`${flowPath}\`.
80
+ 2. If \`completedStages\` is non-empty:
81
+ - Inform: "You have an active flow at stage **{currentStage}** with {N} completed stages. Starting a new brainstorm will reset progress."
82
+ - Ask: "Continue with reset? (A) Yes, start fresh (B) No, resume current flow"
83
+ - If (B) → switch to Path B behavior.
84
+ 3. Write \`${RUNTIME_ROOT}/artifacts/00-idea.md\` with the user's prompt.
85
+ 4. Update \`${flowPath}\`: set \`currentStage: "brainstorm"\`, clear \`completedStages\`, reset gate catalog.
86
+ 5. Load and execute: \`${RUNTIME_ROOT}/skills/brainstorming/SKILL.md\` + \`${RUNTIME_ROOT}/commands/brainstorm.md\`.
87
+
88
+ ### Path B: \`/cc\` (no arguments)
89
+
90
+ Delegate entirely to \`/cc-next\` behavior:
91
+
92
+ 1. Read \`${flowPath}\`.
93
+ 2. Check gates for \`currentStage\`.
94
+ 3. If incomplete → load current stage skill and execute.
95
+ 4. If complete → advance to next stage and execute.
96
+ 5. If flow is done → report completion.
97
+
98
+ ## When to use \`/cc\` vs \`/cc-next\`
99
+
100
+ | Scenario | Command |
101
+ |---|---|
102
+ | Starting work for the first time | \`/cc\` or \`/cc <idea>\` |
103
+ | Resuming in a new session | \`/cc\` |
104
+ | Progressing after completing a stage | \`/cc-next\` |
105
+ | Starting with a specific idea | \`/cc <idea>\` |
106
+
107
+ Both commands read the same \`flow-state.json\`. The difference is that \`/cc <prompt>\` always targets brainstorm, while \`/cc\` and \`/cc-next\` follow the state.
108
+ `;
109
+ }
@@ -34,7 +34,7 @@ This pattern is intentionally **Superpowers-style**: cheap parallelism where it
34
34
  For cclaw flow stages, machine-only specialist work should auto-dispatch without waiting for a manual user request:
35
35
 
36
36
  - **design/plan:** planner
37
- - **test/build:** test-author
37
+ - **tdd:** test-author
38
38
  - **review:** spec-reviewer + code-reviewer (security-reviewer when trust boundaries moved)
39
39
  - **ship:** doc-updater
40
40
 
@@ -295,7 +295,7 @@ Implementation that touches shared source trees must remain **sequential** unles
295
295
  - **3–4:** appendix / “worth tracking” section (not merge-blocking alone)
296
296
  - **1–2:** suppress from primary narrative unless paired with stronger evidence
297
297
 
298
- ### Review Army Artifact Contract (required in /cc-review)
298
+ ### Review Army Artifact Contract (required in review stage via /cc-next)
299
299
 
300
300
  Write a structured reconciliation artifact at \`.cclaw/artifacts/07-review-army.json\` using this schema:
301
301
 
@@ -620,7 +620,7 @@ Status contract: DONE | DONE_WITH_CONCERNS | NEEDS_CONTEXT | BLOCKED.
620
620
  - Controller sequentially dispatches **implementer → reviewer** loops per task.
621
621
  - HARD-GATE: paste **self-contained task text**; never point subagents at plan files to “discover” scope.
622
622
  - **Spec fixers** are **fresh agents** after failed spec reviews — avoids parent-context pollution.
623
- - **Machine-only flow checks auto-dispatch** by stage (design/plan/test/build/review/ship) without asking the user to trigger each specialist manually.
623
+ - **Machine-only flow checks auto-dispatch** by stage (design/plan/tdd/review/ship) without asking the user to trigger each specialist manually.
624
624
 
625
625
  ### Parallel Agents (\`dispatching-parallel-agents\` skill)
626
626
 
@@ -1,4 +1,4 @@
1
1
  export declare const ARTIFACT_TEMPLATES: Record<string, string>;
2
- export declare const RULEBOOK_MARKDOWN = "# Cclaw Rulebook\n\n## MUST_ALWAYS\n- Follow flow order: brainstorm -> scope -> design -> spec -> plan -> test -> build -> review -> ship\n- Require explicit user confirmation after /plan before /test or /build\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 /test and jump directly to /build\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- Follow stage order: brainstorm -> scope -> design -> spec -> plan -> test -> build -> review -> ship.\n- Read `.cclaw/state/flow-state.json` before acting; continue from current stage when active.\n- Use `/cc-next` only after required gates pass; never bypass explicit pause/approval rules.\n- Keep evidence in `.cclaw/artifacts/` and canonical run copies in `.cclaw/runs/<activeRunId>/artifacts/`.\n- For machine-only checks in design/plan/test/build/review/ship, dispatch required specialists automatically when tooling supports it.\n- Ask for user input only at explicit approval gates (scope mode, plan approval, user challenge resolution, ship finalization).\n- Treat `.cclaw/skills/using-cclaw/SKILL.md` as routing source of truth; load contextual utility skills only when their triggers apply.\n";
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- Follow stage order: brainstorm -> scope -> design -> spec -> plan -> tdd -> review -> ship.\n- Read `.cclaw/state/flow-state.json` before acting; continue from current stage when active.\n- Use `/cc-next` only after required gates pass; never bypass explicit pause/approval rules.\n- Keep evidence in `.cclaw/artifacts/` and canonical run copies in `.cclaw/runs/<activeRunId>/artifacts/`.\n- For machine-only checks in design/plan/tdd/review/ship, dispatch required specialists automatically when tooling supports it.\n- Ask for user input only at explicit approval gates (scope mode, plan approval, user challenge resolution, ship finalization).\n- Treat `.cclaw/skills/using-cclaw/SKILL.md` as routing source of truth; load contextual utility skills only when their triggers apply.\n";
4
4
  export declare function buildRulesJson(): Record<string, unknown>;
@@ -292,8 +292,8 @@ Execution rule: complete and verify each wave before starting the next wave.
292
292
  export const RULEBOOK_MARKDOWN = `# Cclaw Rulebook
293
293
 
294
294
  ## MUST_ALWAYS
295
- - Follow flow order: brainstorm -> scope -> design -> spec -> plan -> test -> build -> review -> ship
296
- - Require explicit user confirmation after /plan before /test or /build
295
+ - Follow flow order: brainstorm -> scope -> design -> spec -> plan -> tdd -> review -> ship
296
+ - Require explicit user confirmation after plan before TDD
297
297
  - Keep evidence artifacts in \`.cclaw/artifacts/\`
298
298
  - Enforce RED before GREEN in TDD
299
299
  - Run two-layer review (spec_compliance and code_quality) before ship
@@ -304,7 +304,7 @@ export const RULEBOOK_MARKDOWN = `# Cclaw Rulebook
304
304
  - Use conventional commits: \`type(scope): description\` (feat, fix, refactor, test, docs, chore)
305
305
 
306
306
  ## MUST_NEVER
307
- - Skip /test and jump directly to /build
307
+ - Skip RED phase and jump directly to GREEN in TDD
308
308
  - Ship with critical review findings
309
309
  - Start implementation during /brainstorm
310
310
  - Modify generated cclaw files manually when CLI can regenerate them
@@ -333,11 +333,11 @@ alwaysApply: true
333
333
 
334
334
  # Cclaw Workflow Guardrails
335
335
 
336
- - Follow stage order: brainstorm -> scope -> design -> spec -> plan -> test -> build -> review -> ship.
336
+ - Follow stage order: brainstorm -> scope -> design -> spec -> plan -> tdd -> review -> ship.
337
337
  - Read \`.cclaw/state/flow-state.json\` before acting; continue from current stage when active.
338
338
  - Use \`/cc-next\` only after required gates pass; never bypass explicit pause/approval rules.
339
339
  - Keep evidence in \`.cclaw/artifacts/\` and canonical run copies in \`.cclaw/runs/<activeRunId>/artifacts/\`.
340
- - For machine-only checks in design/plan/test/build/review/ship, dispatch required specialists automatically when tooling supports it.
340
+ - For machine-only checks in design/plan/tdd/review/ship, dispatch required specialists automatically when tooling supports it.
341
341
  - Ask for user input only at explicit approval gates (scope mode, plan approval, user challenge resolution, ship finalization).
342
342
  - Treat \`.cclaw/skills/using-cclaw/SKILL.md\` as routing source of truth; load contextual utility skills only when their triggers apply.
343
343
  `;
@@ -26,7 +26,7 @@ Do not approve code with known Critical security issues. No exceptions.
26
26
  - Before shipping any user-facing feature
27
27
  - When adding authentication, authorization, or secrets handling
28
28
  - When handling user input, file uploads, or external API data
29
- - During the review stage (\`/cc-review\`) as a specialist lens
29
+ - During the review stage (entered via \`/cc-next\`) as a specialist lens
30
30
  - When the security-reviewer agent persona is activated
31
31
 
32
32
  ## Checklist
@@ -534,7 +534,7 @@ Do not keep stale or oversized context loaded when task intent changes. Context
534
534
 
535
535
  Modes are stored in \`.cclaw/contexts/\`:
536
536
  - \`default\` — balanced execution
537
- - \`execution\` — fast plan/test/build throughput
537
+ - \`execution\` — fast plan/tdd throughput
538
538
  - \`review\` — defect/risk discovery
539
539
  - \`incident\` — stabilization and recovery
540
540
 
package/dist/doctor.js CHANGED
@@ -304,23 +304,12 @@ export async function doctorChecks(projectRoot, options = {}) {
304
304
  });
305
305
  continue;
306
306
  }
307
- for (const stage of COMMAND_FILE_ORDER) {
308
- const shimPath = path.join(projectRoot, adapter.commandDir, `cc-${stage}.md`);
309
- let shimOk = await exists(shimPath);
310
- let details = shimPath;
311
- if (shimOk) {
312
- const content = await fs.readFile(shimPath, "utf8");
313
- const hasSkillReference = content.includes(`.cclaw/skills/${stageSkillFolder(stage)}/SKILL.md`);
314
- const hasCommandReference = content.includes(`.cclaw/commands/${stage}.md`);
315
- shimOk = hasSkillReference && hasCommandReference;
316
- details = hasSkillReference && hasCommandReference
317
- ? `${shimPath} aligned`
318
- : `${shimPath} missing stage references`;
319
- }
307
+ for (const shim of ["cc.md", "cc-next.md", "cc-learn.md"]) {
308
+ const shimPath = path.join(projectRoot, adapter.commandDir, shim);
320
309
  checks.push({
321
- name: `shim:${harness}:${stage}`,
322
- ok: shimOk,
323
- details
310
+ name: `shim:${harness}:${shim.replace(".md", "")}`,
311
+ ok: await exists(shimPath),
312
+ details: shimPath
324
313
  });
325
314
  }
326
315
  }
@@ -329,12 +318,13 @@ export async function doctorChecks(projectRoot, options = {}) {
329
318
  if (await exists(agentsFile)) {
330
319
  const content = await fs.readFile(agentsFile, "utf8");
331
320
  const hasMarkers = content.includes(CCLAW_MARKER_START) && content.includes(CCLAW_MARKER_END);
332
- const hasAllCommands = COMMAND_FILE_ORDER.every((stage) => content.includes(`/cc-${stage}`));
333
- const hasRouting = content.includes("Intent → Stage Routing") || content.includes("Intent → Stage");
321
+ const hasCcCommand = content.includes("/cc");
322
+ const hasCcNext = content.includes("/cc-next");
323
+ const hasCcLearn = content.includes("/cc-learn");
334
324
  const hasVerification = content.includes("Verification Discipline");
335
325
  const hasMinimalMarker = content.includes("intentionally minimal for cross-project use");
336
326
  const hasMetaSkillPointer = content.includes(".cclaw/skills/using-cclaw/SKILL.md");
337
- agentsBlockOk = hasMarkers && hasAllCommands && hasRouting && hasVerification && hasMinimalMarker && hasMetaSkillPointer;
327
+ agentsBlockOk = hasMarkers && hasCcCommand && hasCcNext && hasCcLearn && hasVerification && hasMinimalMarker && hasMetaSkillPointer;
338
328
  }
339
329
  checks.push({
340
330
  name: "agents:cclaw_block",
@@ -342,7 +332,7 @@ export async function doctorChecks(projectRoot, options = {}) {
342
332
  details: `${agentsFile} must contain the managed cclaw marker block with routing, verification, and minimal detail pointer`
343
333
  });
344
334
  // Utility commands
345
- for (const cmd of ["learn", "autoplan"]) {
335
+ for (const cmd of ["learn"]) {
346
336
  const cmdPath = path.join(projectRoot, RUNTIME_ROOT, "commands", `${cmd}.md`);
347
337
  checks.push({
348
338
  name: `utility_command:${cmd}`,
@@ -353,7 +343,6 @@ export async function doctorChecks(projectRoot, options = {}) {
353
343
  // Utility skills
354
344
  for (const [folder, label] of [
355
345
  ["learnings", "learnings"],
356
- ["autoplan", "autoplan"],
357
346
  ["subagent-dev", "sdd"],
358
347
  ["parallel-dispatch", "parallel-agents"],
359
348
  ["session", "session"],
@@ -782,26 +771,6 @@ export async function doctorChecks(projectRoot, options = {}) {
782
771
  ? `stage "${gateEvidence.stage}" gate evidence is consistent (required=${gateEvidence.requiredCount}, passed=${gateEvidence.passedCount}, blocked=${gateEvidence.blockedCount})`
783
772
  : gateEvidence.issues.join(" ")
784
773
  });
785
- // Utility shims in harness dirs
786
- for (const harness of configuredHarnesses) {
787
- const adapter = HARNESS_ADAPTERS[harness];
788
- if (!adapter) {
789
- checks.push({
790
- name: `harness:${harness}:supported`,
791
- ok: false,
792
- details: `Unsupported harness "${harness}" in ${RUNTIME_ROOT}/config.yaml`
793
- });
794
- continue;
795
- }
796
- for (const cmd of ["learn", "autoplan"]) {
797
- const shimPath = path.join(projectRoot, adapter.commandDir, `cc-${cmd}.md`);
798
- checks.push({
799
- name: `shim:${harness}:${cmd}`,
800
- ok: await exists(shimPath),
801
- details: shimPath
802
- });
803
- }
804
- }
805
774
  // Self-improvement block in stage skills
806
775
  for (const stage of COMMAND_FILE_ORDER) {
807
776
  const skillPath = path.join(projectRoot, RUNTIME_ROOT, "skills", stageSkillFolder(stage), "SKILL.md");
@@ -1,8 +1,7 @@
1
1
  import fs from "node:fs/promises";
2
2
  import path from "node:path";
3
- import { COMMAND_FILE_ORDER, RUNTIME_ROOT } from "./constants.js";
3
+ import { RUNTIME_ROOT } from "./constants.js";
4
4
  import { CCLAW_AGENTS, agentMarkdown } from "./content/agents.js";
5
- import { stageSkillFolder } from "./content/skills.js";
6
5
  import { ensureDir, exists, writeFileSafe } from "./fs-utils.js";
7
6
  export const CCLAW_MARKER_START = "<!-- cclaw-start -->";
8
7
  export const CCLAW_MARKER_END = "<!-- cclaw-end -->";
@@ -18,30 +17,7 @@ export const HARNESS_ADAPTERS = {
18
17
  opencode: { id: "opencode", commandDir: ".opencode/commands" },
19
18
  codex: { id: "codex", commandDir: ".codex/commands" }
20
19
  };
21
- function shimFileName(stage) {
22
- return `cc-${stage}.md`;
23
- }
24
- function shimContent(harness, stage) {
25
- const skillFolder = stageSkillFolder(stage);
26
- return `---
27
- name: cc-${stage}
28
- description: Generated shim for ${harness}. Runs one flow stage with command+skill context.
29
- source: generated-by-cclaw
30
- ---
31
-
32
- # cclaw ${stage}
33
-
34
- Load and execute:
35
- 1. \`.cclaw/skills/${skillFolder}/SKILL.md\`
36
- 2. \`.cclaw/commands/${stage}.md\`
37
-
38
- This command is stage-scoped: do only this stage and then hand off to the next one.
39
- Use \`.cclaw/state/flow-state.json\` for transition guards and status tracking.
40
- Do not skip required handoff gates.
41
- `;
42
- }
43
20
  function agentsMdBlock() {
44
- const stageList = COMMAND_FILE_ORDER.map((s) => `| \`/cc-${s}\` | \`.cclaw/skills/${stageSkillFolder(s)}/SKILL.md\` + \`.cclaw/commands/${s}.md\` |`).join("\n");
45
21
  return `${CCLAW_MARKER_START}
46
22
  ## Cclaw — Workflow Adapter
47
23
 
@@ -52,20 +28,19 @@ function agentsMdBlock() {
52
28
 
53
29
  Before responding to a coding request:
54
30
  1. Read \`.cclaw/state/flow-state.json\` for the current stage.
55
- 2. If a stage applies, invoke the matching \`/cc-*\` command.
31
+ 2. Use \`/cc\` to start or \`/cc-next\` to continue the flow.
56
32
  3. If no stage applies, respond normally.
57
33
 
58
- ### Intent Stage Routing
34
+ ### Commands (3 total)
59
35
 
60
- | Command | Loads |
36
+ | Command | Purpose |
61
37
  |---|---|
62
- ${stageList}
63
- | \`/cc-learn\` | \`.cclaw/skills/learnings/SKILL.md\` + \`.cclaw/commands/learn.md\` |
64
- | \`/cc-autoplan\` | \`.cclaw/skills/autoplan/SKILL.md\` + \`.cclaw/commands/autoplan.md\` |
65
- | \`/cc-next\` | \`.cclaw/skills/flow-next-step/SKILL.md\` + \`.cclaw/commands/next.md\` |
38
+ | \`/cc\` | **Entry point.** No args = resume current stage. With prompt = start brainstorm with idea. |
39
+ | \`/cc-next\` | **Progression.** Advances to the next stage when current is complete. |
40
+ | \`/cc-learn\` | **Cross-cutting.** Capture or review project learnings. |
66
41
 
67
- **Stage order:** brainstorm > scope > design > spec > plan > test > build > review > ship.
68
- One stage per invocation. Gates must pass before handoff.
42
+ **Stage order:** brainstorm > scope > design > spec > plan > tdd > review > ship.
43
+ \`/cc-next\` loads the right stage skill automatically. Gates must pass before handoff.
69
44
 
70
45
  ### Verification Discipline
71
46
 
@@ -115,8 +90,9 @@ export async function removeCclawFromAgentsMd(projectRoot) {
115
90
  }
116
91
  }
117
92
  function utilityShimContent(harness, command, skillFolder, commandFile) {
93
+ const shimName = command === "cc" ? "cc" : `cc-${command}`;
118
94
  return `---
119
- name: cc-${command}
95
+ name: ${shimName}
120
96
  description: Generated shim for ${harness}. Utility command — not a flow stage.
121
97
  source: generated-by-cclaw
122
98
  ---
@@ -145,14 +121,9 @@ export async function syncHarnessShims(projectRoot, harnesses) {
145
121
  }
146
122
  const commandDir = path.join(projectRoot, adapter.commandDir);
147
123
  await ensureDir(commandDir);
148
- for (const stage of COMMAND_FILE_ORDER) {
149
- const fullPath = path.join(commandDir, shimFileName(stage));
150
- await writeFileSafe(fullPath, shimContent(harness, stage));
151
- }
152
- // Utility command shims
153
- await writeFileSafe(path.join(commandDir, "cc-learn.md"), utilityShimContent(harness, "learn", "learnings", "learn.md"));
154
- await writeFileSafe(path.join(commandDir, "cc-autoplan.md"), utilityShimContent(harness, "autoplan", "autoplan", "autoplan.md"));
124
+ await writeFileSafe(path.join(commandDir, "cc.md"), utilityShimContent(harness, "cc", "flow-start", "start.md"));
155
125
  await writeFileSafe(path.join(commandDir, "cc-next.md"), utilityShimContent(harness, "next", "flow-next-step", "next.md"));
126
+ await writeFileSafe(path.join(commandDir, "cc-learn.md"), utilityShimContent(harness, "learn", "learnings", "learn.md"));
156
127
  }
157
128
  await syncAgentFiles(projectRoot);
158
129
  await syncAgentsMd(projectRoot);
package/dist/install.js CHANGED
@@ -6,10 +6,10 @@ import { promisify } from "node:util";
6
6
  import { COMMAND_FILE_ORDER, REQUIRED_DIRS, RUNTIME_ROOT, UTILITY_COMMANDS } from "./constants.js";
7
7
  import { writeConfig, createDefaultConfig, readConfig, configPath } from "./config.js";
8
8
  import { commandContract } from "./content/contracts.js";
9
- import { autoplanSkillMarkdown, autoplanCommandContract } from "./content/autoplan.js";
10
9
  import { contextModeFiles, createInitialContextModeState } from "./content/contexts.js";
11
10
  import { learnSkillMarkdown, learnCommandContract } from "./content/learnings.js";
12
11
  import { nextCommandContract, nextCommandSkillMarkdown } from "./content/next-command.js";
12
+ import { startCommandContract, startCommandSkillMarkdown } from "./content/start-command.js";
13
13
  import { subagentDrivenDevSkill, parallelAgentsSkill } from "./content/subagents.js";
14
14
  import { sessionHooksSkillMarkdown } from "./content/session-hooks.js";
15
15
  import { sessionStartScript, stopCheckpointScript, opencodePluginJs, claudeHooksJson, cursorHooksJson, codexHooksJson } from "./content/hooks.js";
@@ -192,8 +192,8 @@ async function writeSkills(projectRoot) {
192
192
  }
193
193
  // Utility skills (not flow stages)
194
194
  await writeFileSafe(runtimePath(projectRoot, "skills", "learnings", "SKILL.md"), learnSkillMarkdown());
195
- await writeFileSafe(runtimePath(projectRoot, "skills", "autoplan", "SKILL.md"), autoplanSkillMarkdown());
196
195
  await writeFileSafe(runtimePath(projectRoot, "skills", "flow-next-step", "SKILL.md"), nextCommandSkillMarkdown());
196
+ await writeFileSafe(runtimePath(projectRoot, "skills", "flow-start", "SKILL.md"), startCommandSkillMarkdown());
197
197
  await writeFileSafe(runtimePath(projectRoot, "skills", "subagent-dev", "SKILL.md"), subagentDrivenDevSkill());
198
198
  await writeFileSafe(runtimePath(projectRoot, "skills", "parallel-dispatch", "SKILL.md"), parallelAgentsSkill());
199
199
  await writeFileSafe(runtimePath(projectRoot, "skills", "session", "SKILL.md"), sessionHooksSkillMarkdown());
@@ -205,8 +205,8 @@ async function writeSkills(projectRoot) {
205
205
  }
206
206
  async function writeUtilityCommands(projectRoot) {
207
207
  await writeFileSafe(runtimePath(projectRoot, "commands", "learn.md"), learnCommandContract());
208
- await writeFileSafe(runtimePath(projectRoot, "commands", "autoplan.md"), autoplanCommandContract());
209
208
  await writeFileSafe(runtimePath(projectRoot, "commands", "next.md"), nextCommandContract());
209
+ await writeFileSafe(runtimePath(projectRoot, "commands", "start.md"), startCommandContract());
210
210
  }
211
211
  function toObject(value) {
212
212
  if (!value || typeof value !== "object" || Array.isArray(value)) {
@@ -688,6 +688,9 @@ async function cleanLegacyArtifacts(projectRoot) {
688
688
  for (const legacyFolder of [
689
689
  "project-learnings",
690
690
  "auto-orchestration",
691
+ "autoplan",
692
+ "red-first-testing",
693
+ "incremental-implementation",
691
694
  "subagent-driven-development",
692
695
  "dispatching-parallel-agents",
693
696
  "session-guidelines",
@@ -730,7 +733,8 @@ async function cleanStaleFiles(projectRoot) {
730
733
  ...COMMAND_FILE_ORDER.map((stage) => `viby-${stage}.md`),
731
734
  ...UTILITY_COMMANDS.map((cmd) => `viby-${cmd}.md`),
732
735
  ...COMMAND_FILE_ORDER.map((stage) => `cc-${stage}.md`),
733
- ...UTILITY_COMMANDS.map((cmd) => `cc-${cmd}.md`)
736
+ ...UTILITY_COMMANDS.map((cmd) => `cc-${cmd}.md`),
737
+ "cc.md"
734
738
  ]);
735
739
  for (const adapter of Object.values(HARNESS_ADAPTERS)) {
736
740
  const commandDir = path.join(projectRoot, adapter.commandDir);
@@ -744,7 +748,7 @@ async function cleanStaleFiles(projectRoot) {
744
748
  entries = [];
745
749
  }
746
750
  for (const entry of entries) {
747
- if (!/^cc-.*\.md$/u.test(entry))
751
+ if (!/^cc(?:-.*)?\.md$/u.test(entry))
748
752
  continue;
749
753
  if (expectedShimFiles.has(entry))
750
754
  continue;
@@ -930,7 +934,7 @@ export async function uninstallCclaw(projectRoot) {
930
934
  try {
931
935
  const entries = await fs.readdir(fullDir);
932
936
  for (const entry of entries) {
933
- if (/^(?:viby|cc)-.*\.md$/u.test(entry)) {
937
+ if (/^(?:viby|cc)(?:-.*)?\.md$/u.test(entry)) {
934
938
  await fs.rm(path.join(fullDir, entry), { force: true });
935
939
  }
936
940
  }
package/dist/policy.js CHANGED
@@ -66,7 +66,7 @@ export async function policyChecks(projectRoot, options = {}) {
66
66
  });
67
67
  }
68
68
  // --- verification section for build/review/ship skills ---
69
- if (["build", "review", "ship"].includes(stage)) {
69
+ if (["tdd", "review", "ship"].includes(stage)) {
70
70
  rules.push({
71
71
  filePath: skillFile,
72
72
  needle: "## Verification Before Completion",
@@ -89,16 +89,7 @@ export async function policyChecks(projectRoot, options = {}) {
89
89
  { file: runtimeFile("skills/learnings/SKILL.md"), needle: "## Subcommands", name: "utility_skill:learnings:subcommands" },
90
90
  { file: runtimeFile("skills/learnings/SKILL.md"), needle: "## Confidence Decay", name: "utility_skill:learnings:decay" },
91
91
  { file: runtimeFile("skills/learnings/SKILL.md"), needle: "## HARD-GATE", name: "utility_skill:learnings:hard_gate" },
92
- { file: runtimeFile("skills/autoplan/SKILL.md"), needle: "## Phase Sequence", name: "utility_skill:autoplan:phases" },
93
- { file: runtimeFile("skills/autoplan/SKILL.md"), needle: "Decision Principles", name: "utility_skill:autoplan:principles" },
94
- { file: runtimeFile("skills/autoplan/SKILL.md"), needle: "## Decision Taxonomy", name: "utility_skill:autoplan:taxonomy" },
95
- { file: runtimeFile("skills/autoplan/SKILL.md"), needle: "## HARD-GATE", name: "utility_skill:autoplan:hard_gate" },
96
- { file: runtimeFile("skills/autoplan/SKILL.md"), needle: "## Restore Points", name: "utility_skill:autoplan:restore_points" },
97
- { file: runtimeFile("skills/autoplan/SKILL.md"), needle: "## Scope Mode Heuristics (Phase 2)", name: "utility_skill:autoplan:scope_heuristics" },
98
92
  { file: runtimeFile("commands/learn.md"), needle: "## Subcommands", name: "utility_command:learn:subcommands" },
99
- { file: runtimeFile("commands/autoplan.md"), needle: "## Phase Sequence", name: "utility_command:autoplan:phases" },
100
- { file: runtimeFile("commands/autoplan.md"), needle: "## Decision Principles", name: "utility_command:autoplan:principles" },
101
- { file: runtimeFile("commands/autoplan.md"), needle: "## Scope Mode Heuristics (Phase 2)", name: "utility_command:autoplan:scope_heuristics" },
102
93
  { file: runtimeFile("skills/subagent-dev/SKILL.md"), needle: "## HARD-GATE", name: "utility_skill:sdd:hard_gate" },
103
94
  { file: runtimeFile("skills/subagent-dev/SKILL.md"), needle: "## Status Contract", name: "utility_skill:sdd:status_contract" },
104
95
  { file: runtimeFile("skills/subagent-dev/SKILL.md"), needle: "Implementer", name: "utility_skill:sdd:implementer_template" },
package/dist/types.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export declare const FLOW_STAGES: readonly ["brainstorm", "scope", "design", "spec", "plan", "test", "build", "review", "ship"];
1
+ export declare const FLOW_STAGES: readonly ["brainstorm", "scope", "design", "spec", "plan", "tdd", "review", "ship"];
2
2
  export type FlowStage = (typeof FLOW_STAGES)[number];
3
3
  export declare const HARNESS_IDS: readonly ["claude", "cursor", "opencode", "codex"];
4
4
  export type HarnessId = (typeof HARNESS_IDS)[number];
package/dist/types.js CHANGED
@@ -4,8 +4,7 @@ export const FLOW_STAGES = [
4
4
  "design",
5
5
  "spec",
6
6
  "plan",
7
- "test",
8
- "build",
7
+ "tdd",
9
8
  "review",
10
9
  "ship"
11
10
  ];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cclaw-cli",
3
- "version": "0.3.0",
3
+ "version": "0.5.0",
4
4
  "description": "Installer-first flow toolkit for coding agents",
5
5
  "type": "module",
6
6
  "bin": {
@@ -1,7 +0,0 @@
1
- /**
2
- * Autoplan orchestrator content for cclaw.
3
- * Generates markdown instructions that AI agents follow; cclaw does not execute the pipeline.
4
- */
5
- export declare function autoplanSkillMarkdown(): string;
6
- export declare function autoplanCommandContract(): string;
7
- export declare function autoplanAgentsMdBlock(): string;