cclaw-cli 0.5.17 → 0.7.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.
- package/dist/cli.d.ts +6 -2
- package/dist/cli.js +45 -5
- package/dist/config.d.ts +12 -2
- package/dist/config.js +79 -5
- package/dist/constants.d.ts +2 -2
- package/dist/constants.js +3 -2
- package/dist/content/hooks.d.ts +1 -0
- package/dist/content/hooks.js +145 -0
- package/dist/content/learnings.js +91 -18
- package/dist/content/meta-skill.js +52 -3
- package/dist/content/next-command.js +8 -0
- package/dist/content/observe.js +18 -0
- package/dist/content/session-hooks.js +1 -1
- package/dist/content/stage-schema.d.ts +18 -1
- package/dist/content/stage-schema.js +36 -10
- package/dist/content/start-command.js +30 -7
- package/dist/content/status-command.d.ts +9 -0
- package/dist/content/status-command.js +154 -0
- package/dist/content/templates.js +41 -5
- package/dist/content/utility-skills.d.ts +16 -2
- package/dist/content/utility-skills.js +721 -3
- package/dist/delegation.d.ts +6 -1
- package/dist/delegation.js +3 -2
- package/dist/doctor.js +38 -1
- package/dist/flow-state.d.ts +16 -4
- package/dist/flow-state.js +50 -11
- package/dist/harness-adapters.js +1 -0
- package/dist/install.d.ts +4 -1
- package/dist/install.js +174 -10
- package/dist/policy.js +2 -1
- package/dist/runs.d.ts +15 -0
- package/dist/runs.js +59 -4
- package/dist/types.d.ts +42 -0
- package/dist/types.js +33 -0
- package/package.json +1 -1
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
// Knowledge store content for /cc-learn and stage self-improvement prompts.
|
|
3
3
|
// ---------------------------------------------------------------------------
|
|
4
4
|
const KNOWLEDGE_PATH = ".cclaw/knowledge.md";
|
|
5
|
+
const KNOWLEDGE_JSONL_PATH = ".cclaw/knowledge.jsonl";
|
|
5
6
|
const LEARN_SKILL_NAME = "learnings";
|
|
6
|
-
const LEARN_SKILL_DESCRIPTION = "Project-scoped knowledge store: review and append rule/pattern/lesson entries
|
|
7
|
+
const LEARN_SKILL_DESCRIPTION = "Project-scoped knowledge store: review and append rule/pattern/lesson/compound entries. Maintains a human-readable markdown mirror at .cclaw/knowledge.md and a canonical JSONL store at .cclaw/knowledge.jsonl.";
|
|
7
8
|
export function learnSkillMarkdown() {
|
|
8
9
|
return `---
|
|
9
10
|
name: ${LEARN_SKILL_NAME}
|
|
@@ -14,18 +15,24 @@ description: "${LEARN_SKILL_DESCRIPTION}"
|
|
|
14
15
|
|
|
15
16
|
## Overview
|
|
16
17
|
|
|
17
|
-
This skill manages the
|
|
18
|
+
This skill manages the project knowledge store. The store has **two mirrored formats**:
|
|
18
19
|
|
|
19
|
-
|
|
20
|
+
- \`${KNOWLEDGE_PATH}\` — human-readable, append-only markdown (the reading view).
|
|
21
|
+
- \`${KNOWLEDGE_JSONL_PATH}\` — canonical, machine-queryable JSONL (one JSON object per line). Used by the curator, /cc-status, and future analytics.
|
|
22
|
+
|
|
23
|
+
Every \`/cc-learn add\` appends to **both** files. \`/cc-learn search\` prefers the JSONL store if it exists; otherwise it falls back to the markdown file.
|
|
24
|
+
|
|
25
|
+
Use the store to keep durable knowledge that should survive sessions:
|
|
20
26
|
- **rule**: hard constraint to follow every time
|
|
21
27
|
- **pattern**: repeatable way that works well in this project
|
|
22
28
|
- **lesson**: non-obvious outcome from a failure or trade-off
|
|
29
|
+
- **compound**: post-ship insight about how to make the *next* feature faster (process accelerator, not domain rule)
|
|
23
30
|
|
|
24
31
|
## HARD-GATE
|
|
25
32
|
|
|
26
|
-
Under \`/cc-learn\`, only modify the knowledge store (\`${KNOWLEDGE_PATH}\`) or an explicitly user-approved summary file. Do not modify application code here.
|
|
33
|
+
Under \`/cc-learn\`, only modify the knowledge store files (\`${KNOWLEDGE_PATH}\` and \`${KNOWLEDGE_JSONL_PATH}\`) or an explicitly user-approved summary file. Do not modify application code here.
|
|
27
34
|
|
|
28
|
-
## Entry format (append-only)
|
|
35
|
+
## Entry format — markdown mirror (append-only)
|
|
29
36
|
|
|
30
37
|
\`\`\`markdown
|
|
31
38
|
### 2026-04-14T12:00:00Z [pattern] short-title
|
|
@@ -33,12 +40,62 @@ Under \`/cc-learn\`, only modify the knowledge store (\`${KNOWLEDGE_PATH}\`) or
|
|
|
33
40
|
- Context: one short line
|
|
34
41
|
- Insight: one short line
|
|
35
42
|
- Reuse: one short line
|
|
43
|
+
- Confidence: high | medium | low (optional)
|
|
44
|
+
- Domain: api | infra | ui | testing | … (optional)
|
|
45
|
+
- Project: <repo or scope name> (optional)
|
|
36
46
|
\`\`\`
|
|
37
47
|
|
|
48
|
+
## Entry format — canonical JSONL (one entry per line)
|
|
49
|
+
|
|
50
|
+
\`\`\`json
|
|
51
|
+
{"type":"pattern","title":"short-title","stage":"design","context":"one short line","insight":"one short line","reuse":"one short line","created":"2026-04-14T12:00:00Z","confidence":"high","domain":"api","project":"cclaw","supersedes":null,"superseded":false,"archived":false}
|
|
52
|
+
\`\`\`
|
|
53
|
+
|
|
54
|
+
Schema:
|
|
55
|
+
|
|
56
|
+
| field | type | required | notes |
|
|
57
|
+
|---|---|---|---|
|
|
58
|
+
| \`type\` | \`"rule" \\| "pattern" \\| "lesson" \\| "compound"\` | yes | Lowercase. |
|
|
59
|
+
| \`title\` | string | yes | Short title, used as a human-readable identifier. |
|
|
60
|
+
| \`stage\` | \`FlowStage\` | yes | One of brainstorm / scope / design / spec / plan / tdd / review / ship. |
|
|
61
|
+
| \`context\` | string | yes | What situation triggered this. |
|
|
62
|
+
| \`insight\` | string | yes | What must be remembered. |
|
|
63
|
+
| \`reuse\` | string | yes | How to apply this next time — concrete trigger/action. |
|
|
64
|
+
| \`created\` | ISO 8601 UTC string | yes | When the entry was written. |
|
|
65
|
+
| \`confidence\` | \`"high" \\| "medium" \\| "low"\` | optional | Default \`medium\` if omitted. |
|
|
66
|
+
| \`domain\` | string | optional | Free-form taxonomy (\`api\`, \`infra\`, \`ui\`, …). |
|
|
67
|
+
| \`project\` | string | optional | Repo or scope name when the entry crosses features. |
|
|
68
|
+
| \`supersedes\` | string \\| null | optional | Title of the entry this one replaces. |
|
|
69
|
+
| \`superseded\` | boolean | optional | \`true\` when a newer entry replaces this one. |
|
|
70
|
+
| \`archived\` | boolean | optional | \`true\` once the curator soft-archives the entry. |
|
|
71
|
+
|
|
38
72
|
Rules:
|
|
39
|
-
- Type must be exactly one of \`rule\`, \`pattern\`, \`lesson\` (lowercase).
|
|
40
|
-
- Never rewrite history silently; append a newer correction entry instead.
|
|
73
|
+
- Type must be exactly one of \`rule\`, \`pattern\`, \`lesson\`, \`compound\` (lowercase).
|
|
74
|
+
- Never rewrite history silently; append a newer correction entry instead. To replace, set \`supersedes\` to the old title in the new JSONL entry and in the new markdown entry prefix with \`Supersedes: <old-title>\`. Flip \`superseded: true\` on the old JSONL entry via a new JSONL line (the file is append-only; use a \`replace\` line by convention — see Curation policy).
|
|
41
75
|
- Keep entries concise and actionable.
|
|
76
|
+
- Optional fields (\`Confidence\`, \`Domain\`, \`Project\`) are forward-compatible and used by the **knowledge-curation** skill — fill them when known.
|
|
77
|
+
|
|
78
|
+
## Backward-compat migration (markdown → JSONL)
|
|
79
|
+
|
|
80
|
+
Run \`/cc-learn migrate\` once per repo when \`${KNOWLEDGE_JSONL_PATH}\` is missing:
|
|
81
|
+
|
|
82
|
+
1. Parse \`${KNOWLEDGE_PATH}\`. Each entry starts with \`### <ISO8601> [<type>] <title>\` and is followed by \`- <Field>: <value>\` lines until the next \`###\` or EOF.
|
|
83
|
+
2. Map fields to JSONL schema:
|
|
84
|
+
- Heading timestamp → \`created\`; heading \`[type]\` → \`type\`; heading title → \`title\`.
|
|
85
|
+
- Bullet \`Stage:\`, \`Context:\`, \`Insight:\`, \`Reuse:\`, \`Confidence:\`, \`Domain:\`, \`Project:\` → matching fields.
|
|
86
|
+
- A \`Supersedes:\` prefix line becomes \`"supersedes": "<old-title>"\`.
|
|
87
|
+
3. Emit one JSON object per line to \`${KNOWLEDGE_JSONL_PATH}\` preserving the original order. Set defaults: \`confidence = "medium"\`, \`superseded = false\`, \`archived = false\`, missing optional fields = \`null\`.
|
|
88
|
+
4. Do **not** rewrite \`${KNOWLEDGE_PATH}\`. The markdown stays as the human-readable mirror; new additions continue to write both files.
|
|
89
|
+
5. After migration, \`/cc-learn search\` reads the JSONL store first; if absent, it continues to parse the markdown file (so users who never migrate still work).
|
|
90
|
+
|
|
91
|
+
## Curation policy (target: ≤ 50 active entries)
|
|
92
|
+
|
|
93
|
+
The knowledge file is append-only, but entries can be **superseded** rather than deleted:
|
|
94
|
+
|
|
95
|
+
- When you discover a more correct rule, append a new entry with \`Supersedes: <old-title>\`.
|
|
96
|
+
- During \`/cc-learn curate\`, the assistant surfaces candidates for soft-archive (move to \`.cclaw/knowledge.archive.md\`) when the active file exceeds 50 entries or contains stale/duplicate entries.
|
|
97
|
+
|
|
98
|
+
See the **knowledge-curation** utility skill for the full curation protocol.
|
|
42
99
|
|
|
43
100
|
## Subcommands
|
|
44
101
|
|
|
@@ -47,13 +104,24 @@ Rules:
|
|
|
47
104
|
- If file is missing or empty, report that clearly.
|
|
48
105
|
|
|
49
106
|
### \`/cc-learn search <query>\`
|
|
50
|
-
-
|
|
107
|
+
- If \`${KNOWLEDGE_JSONL_PATH}\` exists: stream it, JSON.parse each line, filter where any of \`title\`, \`context\`, \`insight\`, \`reuse\`, \`domain\` contains \`<query>\` (case-insensitive). Skip \`archived: true\` unless \`--include-archived\` is passed.
|
|
108
|
+
- Otherwise: case-insensitive text search in \`${KNOWLEDGE_PATH}\`.
|
|
51
109
|
- Return matched headings and nearby lines.
|
|
52
110
|
|
|
53
111
|
### \`/cc-learn add\`
|
|
54
112
|
- Ask for: \`type\`, \`short title\`, \`context\`, \`insight\`, \`reuse\`.
|
|
55
|
-
-
|
|
56
|
-
-
|
|
113
|
+
- Optionally ask for: \`confidence\`, \`domain\`, \`project\`, \`supersedes\`.
|
|
114
|
+
- Append one markdown entry to \`${KNOWLEDGE_PATH}\` (human mirror).
|
|
115
|
+
- Append one JSON line to \`${KNOWLEDGE_JSONL_PATH}\` (canonical store) using the same UTC timestamp as the markdown entry's heading.
|
|
116
|
+
- Re-read both tails to confirm both writes.
|
|
117
|
+
|
|
118
|
+
### \`/cc-learn migrate\`
|
|
119
|
+
- Parse \`${KNOWLEDGE_PATH}\` and emit \`${KNOWLEDGE_JSONL_PATH}\` per the Backward-compat migration protocol above.
|
|
120
|
+
- Safe to re-run: if JSONL already exists, report the current entry count and exit (no destructive rewrite).
|
|
121
|
+
|
|
122
|
+
### \`/cc-learn curate\`
|
|
123
|
+
- Hand off to the **knowledge-curation** skill (read-only audit + soft-archive plan).
|
|
124
|
+
- Never deletes from \`${KNOWLEDGE_PATH}\` or \`${KNOWLEDGE_JSONL_PATH}\` without an explicit user-approved archive plan. Soft-archive in JSONL means appending a new line with the same \`title\` and \`archived: true\` (entries are never physically removed).
|
|
57
125
|
`;
|
|
58
126
|
}
|
|
59
127
|
export function learnCommandContract() {
|
|
@@ -61,19 +129,23 @@ export function learnCommandContract() {
|
|
|
61
129
|
|
|
62
130
|
## Purpose
|
|
63
131
|
|
|
64
|
-
Manage the project knowledge store
|
|
132
|
+
Manage the project knowledge store. Two mirrored formats:
|
|
133
|
+
- \`${KNOWLEDGE_PATH}\` — human-readable markdown (append-only, tail view).
|
|
134
|
+
- \`${KNOWLEDGE_JSONL_PATH}\` — canonical JSONL (one entry per line) used by the curator and machine consumers.
|
|
65
135
|
|
|
66
136
|
## HARD-GATE
|
|
67
137
|
|
|
68
|
-
Do not edit source code from this command. Only operate on \`${KNOWLEDGE_PATH}
|
|
138
|
+
Do not edit source code from this command. Only operate on \`${KNOWLEDGE_PATH}\`, \`${KNOWLEDGE_JSONL_PATH}\`, or user-approved summary output.
|
|
69
139
|
|
|
70
140
|
## Subcommands
|
|
71
141
|
|
|
72
142
|
| subcommand | args | description |
|
|
73
143
|
|---|---|---|
|
|
74
|
-
| (default) | — | Show recent knowledge entries (tail view). |
|
|
75
|
-
| \`search\` | \`<query>\` | Search knowledge
|
|
76
|
-
| \`add\` | — | Append a new entry
|
|
144
|
+
| (default) | — | Show recent knowledge entries (tail view from markdown mirror). |
|
|
145
|
+
| \`search\` | \`<query>\` | Search knowledge for relevant prior rules/patterns/lessons. Prefers JSONL when present. |
|
|
146
|
+
| \`add\` | — | Append a new entry (\`rule\` / \`pattern\` / \`lesson\` / \`compound\`) to **both** markdown and JSONL. |
|
|
147
|
+
| \`migrate\` | — | Emit the canonical JSONL mirror from the markdown file (idempotent). |
|
|
148
|
+
| \`curate\` | — | Hand off to the **knowledge-curation** skill: read-only audit + soft-archive plan when the active file exceeds the curation threshold. |
|
|
77
149
|
`;
|
|
78
150
|
}
|
|
79
151
|
export function selfImprovementBlock(stageName) {
|
|
@@ -83,7 +155,7 @@ After this stage, ask:
|
|
|
83
155
|
- Did I discover a non-obvious reusable **rule** or **pattern**?
|
|
84
156
|
- Did a failure reveal a reusable **lesson**?
|
|
85
157
|
|
|
86
|
-
If yes, append one concise entry to \`${KNOWLEDGE_PATH}
|
|
158
|
+
If yes, append one concise entry to **both** the markdown mirror (\`${KNOWLEDGE_PATH}\`) and the canonical JSONL store (\`${KNOWLEDGE_JSONL_PATH}\`) with the same timestamp:
|
|
87
159
|
|
|
88
160
|
\`\`\`bash
|
|
89
161
|
TS="$(date -u +%Y-%m-%dT%H:%M:%SZ)"
|
|
@@ -94,9 +166,10 @@ cat >> ${KNOWLEDGE_PATH} <<EOF
|
|
|
94
166
|
- Insight: what should be remembered
|
|
95
167
|
- Reuse: how to apply this next time
|
|
96
168
|
EOF
|
|
169
|
+
printf '%s\\n' '{"type":"pattern","title":"short-title","stage":"${stageName}","context":"what situation triggered this","insight":"what should be remembered","reuse":"how to apply this next time","created":"'"$TS"'","confidence":"medium","domain":null,"project":null,"supersedes":null,"superseded":false,"archived":false}' >> ${KNOWLEDGE_JSONL_PATH}
|
|
97
170
|
\`\`\`
|
|
98
171
|
|
|
99
|
-
Type must be exactly one of: \`rule\`, \`pattern\`, \`lesson\`.
|
|
172
|
+
Type must be exactly one of: \`rule\`, \`pattern\`, \`lesson\`, \`compound\`.
|
|
100
173
|
`;
|
|
101
174
|
}
|
|
102
175
|
export function learningsSearchPreamble(stage) {
|
|
@@ -110,7 +183,7 @@ If the file is empty, continue normally.
|
|
|
110
183
|
export function learningsAgentsMdBlock() {
|
|
111
184
|
return `### Knowledge Store
|
|
112
185
|
|
|
113
|
-
\`${KNOWLEDGE_PATH}\` — append-only markdown memory with entry types \`rule\`, \`pattern\`, \`lesson\`.
|
|
186
|
+
\`${KNOWLEDGE_PATH}\` — append-only markdown memory with entry types \`rule\`, \`pattern\`, \`lesson\`, \`compound\`.
|
|
114
187
|
At session start and stage transitions, load recent entries and apply relevant ones.
|
|
115
188
|
If a non-obvious reusable rule/pattern/lesson is discovered, append a new entry.
|
|
116
189
|
`;
|
|
@@ -89,6 +89,41 @@ These skills live in \`.cclaw/skills/\` but have no slash commands. They activat
|
|
|
89
89
|
|
|
90
90
|
**Activation rule:** When a contextual skill applies, read its SKILL.md and follow it as a supplementary lens alongside the current stage. Do not skip the stage workflow — the contextual skill adds depth, not a detour.
|
|
91
91
|
|
|
92
|
+
### Opt-in language rule packs
|
|
93
|
+
|
|
94
|
+
cclaw stays language-agnostic by default. Projects that want language-specific
|
|
95
|
+
review lenses can enable opt-in rule packs in \`.cclaw/config.yaml\`:
|
|
96
|
+
|
|
97
|
+
\`\`\`yaml
|
|
98
|
+
languageRulePacks:
|
|
99
|
+
- typescript # → skills/language-typescript/SKILL.md
|
|
100
|
+
- python # → skills/language-python/SKILL.md
|
|
101
|
+
- go # → skills/language-go/SKILL.md
|
|
102
|
+
\`\`\`
|
|
103
|
+
|
|
104
|
+
After editing the list, run \`cclaw sync\` to materialize the enabled pack SKILL.md
|
|
105
|
+
files. Packs activate during \`tdd\` and \`review\` when the diff touches files in
|
|
106
|
+
their language. They are additive lenses — Tier-1 rules block merge, Tier-2 rules
|
|
107
|
+
require a named follow-up. Never silently override them.
|
|
108
|
+
|
|
109
|
+
## Custom Skills (project-owned, sync-safe)
|
|
110
|
+
|
|
111
|
+
\`.cclaw/custom-skills/\` is a sync-safe directory. \`cclaw sync\` and \`cclaw upgrade\` **never overwrite** files there.
|
|
112
|
+
|
|
113
|
+
Use it to add **project-specific** skills that complement the managed library:
|
|
114
|
+
|
|
115
|
+
- Each skill: \`.cclaw/custom-skills/<folder>/SKILL.md\` following the public-API frontmatter schema documented in \`.cclaw/custom-skills/README.md\`.
|
|
116
|
+
- The frontmatter public API is stable across cclaw releases: \`name\`, \`description\` (required), plus optional \`stages\`, \`triggers\`, \`hardGate\`, \`owners\`, \`version\`.
|
|
117
|
+
- Routing precedence when loading a stage:
|
|
118
|
+
1. Active stage skill under \`.cclaw/skills/<stage>/\`.
|
|
119
|
+
2. Managed utility skills whose trigger matches (\`landscape-check\`, \`security-audit\`, \`adversarial-review\`, etc.).
|
|
120
|
+
3. **Custom skills** whose \`stages\` array includes the active stage (or is missing) AND whose \`description\` / \`triggers\` match the prompt.
|
|
121
|
+
- Custom skills are **never mandatory delegations** — they are opt-in lenses. If you need a mandatory dispatch, promote the skill upstream or add a managed specialist instead.
|
|
122
|
+
- Activate by mentioning the skill name explicitly, or rely on semantic routing from the description + triggers.
|
|
123
|
+
- See \`.cclaw/custom-skills/README.md\` for the full convention and a starter template under \`.cclaw/custom-skills/example/\`.
|
|
124
|
+
|
|
125
|
+
If a custom skill turns out to generalize (e.g. another project would want the same lens), promote it to a managed skill via a contribution to the cclaw repo — managed skills get versioning and maintenance.
|
|
126
|
+
|
|
92
127
|
## Progressive Disclosure (Depth / See Also)
|
|
93
128
|
|
|
94
129
|
Use this loading order to keep context lean while preserving depth:
|
|
@@ -117,13 +152,27 @@ When a stage requires user input (approval, choice, direction), use this structu
|
|
|
117
152
|
2. **Present options** as labeled choices (A, B, C...) with:
|
|
118
153
|
- One-line description of each option
|
|
119
154
|
- Trade-off or consequence
|
|
155
|
+
- **\`Completeness: X/10\`** — how thoroughly does this option cover the dimensions the stage cares about (failure modes, data flow, blast radius, observability, rollback, etc. — pick the dimensions that matter for *this* decision and subtract for each gap). Force a numeric score; vague text scores ≤ 5.
|
|
120
156
|
- Mark one as **(recommended)** with brief why
|
|
121
|
-
3. **
|
|
157
|
+
3. **Pick the highest-scoring option as the recommendation.** If scores tie, prefer the option with the smallest blast radius (review/ship), the lowest risk (design/spec), or the most reversible outcome (ship finalization).
|
|
158
|
+
4. **Use the harness ask-user tool** when available:
|
|
122
159
|
- Claude Code: \`AskUserQuestion\` tool
|
|
123
160
|
- Cursor: \`AskQuestion\` tool with options array
|
|
124
161
|
- Codex/OpenCode: numbered list in message (no native ask tool)
|
|
125
|
-
|
|
126
|
-
|
|
162
|
+
5. **Wait for response.** Do not proceed until the user picks.
|
|
163
|
+
6. **Commit to the choice.** Once decided, do not re-argue.
|
|
164
|
+
|
|
165
|
+
### Completeness scoring rubric (apply per option)
|
|
166
|
+
|
|
167
|
+
| Score | Meaning |
|
|
168
|
+
|---|---|
|
|
169
|
+
| 9-10 | Closes the decision with no carry-over risk; covers every dimension stage cares about. |
|
|
170
|
+
| 7-8 | Closes the decision with a small named follow-up; one dimension partially covered. |
|
|
171
|
+
| 5-6 | Plausible but leaves at least one dimension visibly open; needs follow-up before next stage. |
|
|
172
|
+
| 3-4 | Workaround, not a solution; defers the real problem. |
|
|
173
|
+
| 0-2 | Wishful thinking; do not recommend. |
|
|
174
|
+
|
|
175
|
+
Always show the score next to the option label, e.g. \`(B) [Completeness: 8/10]\`.
|
|
127
176
|
|
|
128
177
|
### When to use structured asks vs conversational
|
|
129
178
|
- **Structured (tool):** Architecture choices, scope decisions, approval gates, mode selection, scope boundary issues
|
|
@@ -56,6 +56,14 @@ This is the only progression command the user needs to drive the entire flow. St
|
|
|
56
56
|
→ If current stage's \`next\` is **\`done\`**: report **"Flow complete. All stages finished."** and stop.
|
|
57
57
|
→ Otherwise: load **\`${RUNTIME_ROOT}/skills/<skillFolder>/SKILL.md\`** and **\`${RUNTIME_ROOT}/commands/<nextStage>.md\`** for the successor stage. Execute that stage's protocol.
|
|
58
58
|
|
|
59
|
+
### Track-aware successor resolution
|
|
60
|
+
|
|
61
|
+
\`flow-state.json\` carries a \`track\` field (\`"quick"\` or \`"standard"\`) and a \`skippedStages\` array.
|
|
62
|
+
|
|
63
|
+
- If \`track === "quick"\`, the critical path is **spec → tdd → review → ship**. When advancing, skip any stage listed in \`skippedStages\` — i.e. after the current stage completes, pick the next stage that is NOT in \`skippedStages\`.
|
|
64
|
+
- If \`track === "standard"\`, advance through all 8 stages in their natural order.
|
|
65
|
+
- Never reintroduce a skipped stage mid-run. If the user wants upstream scoping work, they must archive the run and start a new one with \`track: "standard"\`.
|
|
66
|
+
|
|
59
67
|
## Resume Semantics
|
|
60
68
|
|
|
61
69
|
\`/cc-next\` in a **new session** = resume from where you left off:
|
package/dist/content/observe.js
CHANGED
|
@@ -1613,6 +1613,14 @@ export function claudeHooksJsonWithObservation() {
|
|
|
1613
1613
|
command: `bash ${RUNTIME_ROOT}/hooks/stop-checkpoint.sh`,
|
|
1614
1614
|
timeout: 10
|
|
1615
1615
|
}]
|
|
1616
|
+
}],
|
|
1617
|
+
PreCompact: [{
|
|
1618
|
+
matcher: "manual|auto",
|
|
1619
|
+
hooks: [{
|
|
1620
|
+
type: "command",
|
|
1621
|
+
command: `bash ${RUNTIME_ROOT}/hooks/pre-compact.sh`,
|
|
1622
|
+
timeout: 10
|
|
1623
|
+
}]
|
|
1616
1624
|
}]
|
|
1617
1625
|
}
|
|
1618
1626
|
}, null, 2);
|
|
@@ -1632,6 +1640,8 @@ export function cursorHooksJsonWithObservation() {
|
|
|
1632
1640
|
command: `bash ${RUNTIME_ROOT}/hooks/session-start.sh`
|
|
1633
1641
|
}],
|
|
1634
1642
|
sessionCompact: [{
|
|
1643
|
+
command: `bash ${RUNTIME_ROOT}/hooks/pre-compact.sh`
|
|
1644
|
+
}, {
|
|
1635
1645
|
command: `bash ${RUNTIME_ROOT}/hooks/session-start.sh`
|
|
1636
1646
|
}],
|
|
1637
1647
|
preToolUse: [{
|
|
@@ -1684,6 +1694,14 @@ export function codexHooksJsonWithObservation() {
|
|
|
1684
1694
|
command: `bash ${RUNTIME_ROOT}/hooks/stop-checkpoint.sh`,
|
|
1685
1695
|
timeout: 10
|
|
1686
1696
|
}]
|
|
1697
|
+
}],
|
|
1698
|
+
PreCompact: [{
|
|
1699
|
+
matcher: "manual|auto",
|
|
1700
|
+
hooks: [{
|
|
1701
|
+
type: "command",
|
|
1702
|
+
command: `bash ${RUNTIME_ROOT}/hooks/pre-compact.sh`,
|
|
1703
|
+
timeout: 10
|
|
1704
|
+
}]
|
|
1687
1705
|
}]
|
|
1688
1706
|
}
|
|
1689
1707
|
}, null, 2);
|
|
@@ -34,7 +34,7 @@ When a new session begins in any harness:
|
|
|
34
34
|
### What to show the user at session start
|
|
35
35
|
|
|
36
36
|
\`\`\`
|
|
37
|
-
Cclaw flow state: [current stage] ([N] of
|
|
37
|
+
Cclaw flow state: [current stage] ([N] of 8 stages completed)
|
|
38
38
|
Knowledge highlights: [rule/pattern 1], [rule/pattern 2], [rule/pattern 3]
|
|
39
39
|
Next action: /cc-[stage] to continue, or describe what you'd like to do.
|
|
40
40
|
\`\`\`
|
|
@@ -28,10 +28,25 @@ export interface ArtifactValidation {
|
|
|
28
28
|
}
|
|
29
29
|
export interface StageAutoSubagentDispatch {
|
|
30
30
|
agent: "planner" | "spec-reviewer" | "code-reviewer" | "security-reviewer" | "test-author" | "doc-updater";
|
|
31
|
-
|
|
31
|
+
/**
|
|
32
|
+
* - `mandatory` — must be dispatched (or explicitly waived) before stage transition.
|
|
33
|
+
* - `proactive` — should be dispatched automatically when context matches `when`.
|
|
34
|
+
* - `conditional` — dispatched only when `condition` evaluates true at runtime; counted as
|
|
35
|
+
* mandatory **only when the condition holds**.
|
|
36
|
+
*/
|
|
37
|
+
mode: "mandatory" | "proactive" | "conditional";
|
|
32
38
|
when: string;
|
|
33
39
|
purpose: string;
|
|
34
40
|
requiresUserGate: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Optional machine-friendly trigger expression for `conditional` rows.
|
|
43
|
+
* Supported predicates: `diff_lines_gt:<N>`, `files_touched_gt:<N>`,
|
|
44
|
+
* `trust_boundary_changed`, `release_blast_radius_high`.
|
|
45
|
+
* Multiple predicates joined by `||` mean ANY trigger satisfies the condition.
|
|
46
|
+
*/
|
|
47
|
+
condition?: string;
|
|
48
|
+
/** Optional skill folder the dispatched agent should load as additional context. */
|
|
49
|
+
skill?: string;
|
|
35
50
|
}
|
|
36
51
|
export interface NamedAntiPattern {
|
|
37
52
|
title: string;
|
|
@@ -80,6 +95,8 @@ export declare const QUESTION_FORMAT_SPEC: string;
|
|
|
80
95
|
export declare const ERROR_BUDGET_SPEC: string;
|
|
81
96
|
/** Transition guard: agents with `mode: "mandatory"` in auto-subagent dispatch for this stage. */
|
|
82
97
|
export declare function mandatoryDelegationsForStage(stage: FlowStage): string[];
|
|
98
|
+
/** Conditional dispatches that become mandatory only when their `condition` predicate evaluates true. */
|
|
99
|
+
export declare function conditionalDispatchesForStage(stage: FlowStage): StageAutoSubagentDispatch[];
|
|
83
100
|
export declare function stageSchema(stage: FlowStage): StageSchema;
|
|
84
101
|
export declare function orderedStageSchemas(): StageSchema[];
|
|
85
102
|
export declare function stageGateIds(stage: FlowStage): string[];
|
|
@@ -195,7 +195,7 @@ const SCOPE = {
|
|
|
195
195
|
"**Error and Rescue Registry** — For each capability: what breaks, how detected, what fallback."
|
|
196
196
|
],
|
|
197
197
|
interactionProtocol: [
|
|
198
|
-
"For scope mode selection: use the Decision Protocol — present expand/selective/hold/reduce as labeled options with trade-offs and mark one as (recommended). Base your recommendation on default heuristics: greenfield -> expand, enhancement -> selective, bugfix/hotfix/refactor -> hold, broad blast radius -> reduce. If AskQuestion/AskUserQuestion is available, send exactly ONE question per call, validate fields against runtime schema, and on schema error immediately fall back to plain-text question instead of retrying guessed payloads.",
|
|
198
|
+
"For scope mode selection: use the Decision Protocol — present expand/selective/hold/reduce as labeled options with trade-offs and mark one as (recommended). **Score each option `Completeness: X/10`** (10 = covers every prime-directive failure mode, four data-flow paths, observability, and deferred handling for the in-scope set; subtract for each gap). Recommend the highest-scoring option; if scores tie, pick the lowest blast radius. Base your recommendation on default heuristics: greenfield -> expand, enhancement -> selective, bugfix/hotfix/refactor -> hold, broad blast radius -> reduce. If AskQuestion/AskUserQuestion is available, send exactly ONE question per call, validate fields against runtime schema, and on schema error immediately fall back to plain-text question instead of retrying guessed payloads.",
|
|
199
199
|
"Walk through the scope checklist interactively. Each checklist item that surfaces a decision should be presented to the user as a question, not as a monologue. Do not dump all items at once.",
|
|
200
200
|
"Challenge premise and verify the problem framing before anything else.",
|
|
201
201
|
"Take a position on every scope decision. Avoid hedging phrases like 'this could work' or 'there are many ways'; state your recommendation and one concrete condition that would change it.",
|
|
@@ -405,7 +405,7 @@ const DESIGN = {
|
|
|
405
405
|
interactionProtocol: [
|
|
406
406
|
"Review architecture decisions section-by-section.",
|
|
407
407
|
"For EACH issue found in a review section, present it ONE AT A TIME. Do NOT batch multiple issues.",
|
|
408
|
-
"For each issue: use the Decision Protocol — describe concretely with file/line references, present labeled options (A/B/C) with trade-offs, effort estimate (S/M/L/XL), risk level (Low/Med/High), and mark one as (recommended). If AskQuestion/AskUserQuestion is available, send exactly ONE question per call, validate fields against runtime schema, and on schema error immediately fall back to plain-text question instead of retrying guessed payloads.",
|
|
408
|
+
"For each issue: use the Decision Protocol — describe concretely with file/line references, present labeled options (A/B/C) with trade-offs, effort estimate (S/M/L/XL), risk level (Low/Med/High), **`Completeness: X/10` per option** (10 = fully addresses architecture/data-flow/failure-modes/test+perf review concerns for the issue, subtract for each unaddressed dimension), and mark one as (recommended). Prefer the highest-scoring option; if scores tie, prefer the lower-risk one. If AskQuestion/AskUserQuestion is available, send exactly ONE question per call, validate fields against runtime schema, and on schema error immediately fall back to plain-text question instead of retrying guessed payloads.",
|
|
409
409
|
"Only proceed to the next review section after ALL issues in the current section are resolved.",
|
|
410
410
|
"If a section has no issues, say 'No issues found' and move on.",
|
|
411
411
|
"Do not skip failure-mode mapping.",
|
|
@@ -1108,10 +1108,11 @@ const REVIEW = {
|
|
|
1108
1108
|
checklist: [
|
|
1109
1109
|
"Diff Scope — Run `git diff` against base branch. If no diff, exit early with APPROVED (no changes to review). Scope the review to changed files unless blast-radius analysis requires wider inspection.",
|
|
1110
1110
|
"Change-Size Check — ~100 lines = normal. ~300 lines = consider splitting. ~1000+ lines = strongly recommend stacked PRs. Flag large diffs to the user.",
|
|
1111
|
+
"Adversarial Trigger Check — compute changed-line count (`git diff --shortstat <base>..HEAD`), files-touched count, and whether trust boundaries changed (auth/secrets/external inputs/permissions). If `lines > 100` OR `files > 10` OR `trust boundary changed`, **dispatch a SECOND code-reviewer agent with the `adversarial-review` skill loaded** and reconcile its findings into the review army (treat the conditional dispatch as mandatory whenever the trigger holds; record the trigger that fired in the dashboard).",
|
|
1111
1112
|
"Load upstream evidence — read TDD artifact (RED + GREEN + REFACTOR), spec, and plan. Verify evidence chain is unbroken.",
|
|
1112
1113
|
"Layer 1: Spec Compliance — check every acceptance criterion against implementation. Verdict: pass/fail per criterion.",
|
|
1113
1114
|
"Layer 2a: Correctness — logic errors, race conditions, boundary violations, null handling.",
|
|
1114
|
-
"Layer 2b: Security — input validation, auth boundaries, secrets exposure, injection vectors.",
|
|
1115
|
+
"Layer 2b: Security — input validation, auth boundaries, secrets exposure, injection vectors. **Mandatory:** also load and execute the `.cclaw/skills/security-audit/SKILL.md` utility skill (proactive pattern sweep across diff + touched modules, not just the diff itself) and merge findings into the review army. The Layer 2 security pass is not complete until the audit sweep records a finding count (0 acceptable) with file:line evidence for every Critical.",
|
|
1115
1116
|
"Layer 2c: Performance — N+1 queries, memory leaks, missing caching, hot paths.",
|
|
1116
1117
|
"Layer 2d: Architecture Fit — does the implementation match the locked design? Coupling, cohesion, interface contracts.",
|
|
1117
1118
|
"Layer 2e: External Safety — SQL safety, concurrency, secrets in logs, enum completeness (grep outside diff), LLM trust boundaries.",
|
|
@@ -1124,7 +1125,7 @@ const REVIEW = {
|
|
|
1124
1125
|
"Run Layer 1 (spec compliance) completely before starting Layer 2.",
|
|
1125
1126
|
"In each review section, present findings ONE AT A TIME. Do NOT batch.",
|
|
1126
1127
|
"Classify every finding as Critical, Important, or Suggestion.",
|
|
1127
|
-
"For each Critical finding: use the Decision Protocol — present resolution options (A/B/C) with trade-offs and mark one as (recommended). If AskQuestion/AskUserQuestion is available, send exactly ONE question per call, validate fields against runtime schema, and on schema error immediately fall back to plain-text question instead of retrying guessed payloads.",
|
|
1128
|
+
"For each Critical finding: use the Decision Protocol — present resolution options (A/B/C) with trade-offs, **score each option `Completeness: X/10`** (10 = fully closes the finding with no carry-over risk; subtract for partial fixes, deferred follow-ups, or new risk introduced), and mark one as (recommended). Prefer the highest-scoring option; if scores tie, prefer the option with the smallest blast radius. If AskQuestion/AskUserQuestion is available, send exactly ONE question per call, validate fields against runtime schema, and on schema error immediately fall back to plain-text question instead of retrying guessed payloads.",
|
|
1128
1129
|
"Resolve all critical blockers before ship.",
|
|
1129
1130
|
"For final verdict: use AskQuestion/AskUserQuestion only if runtime schema is confirmed; otherwise collect verdict with a plain-text single-choice prompt (APPROVED / APPROVED_WITH_CONCERNS / BLOCKED).",
|
|
1130
1131
|
"**STOP.** Do NOT proceed to ship until the user provides an explicit verdict."
|
|
@@ -1147,7 +1148,9 @@ const REVIEW = {
|
|
|
1147
1148
|
{ id: "review_layer2_architecture", description: "Architecture fit review completed." },
|
|
1148
1149
|
{ id: "review_severity_classified", description: "All findings are severity-tagged." },
|
|
1149
1150
|
{ id: "review_criticals_resolved", description: "No unresolved critical blockers remain." },
|
|
1150
|
-
{ id: "review_army_json_valid", description: "07-review-army.json passes schema validation (validateReviewArmy)." }
|
|
1151
|
+
{ id: "review_army_json_valid", description: "07-review-army.json passes schema validation (validateReviewArmy)." },
|
|
1152
|
+
{ id: "review_completeness_scored", description: "Completeness score is computed and recorded (AC coverage, task coverage, slice coverage, adversarial pass)." },
|
|
1153
|
+
{ id: "review_security_audit_swept", description: "The security-audit utility skill was run against the diff scope and the modules it touches. Finding count (0 if clean) recorded in the review army with file:line evidence for every Critical." }
|
|
1151
1154
|
],
|
|
1152
1155
|
requiredEvidence: [
|
|
1153
1156
|
"Artifact written to `.cclaw/artifacts/07-review.md`.",
|
|
@@ -1288,7 +1291,8 @@ const REVIEW = {
|
|
|
1288
1291
|
{ section: "Layer 1 Verdict", required: true, validationRule: "Per-criterion pass/fail with references." },
|
|
1289
1292
|
{ section: "Layer 2 Findings", required: true, validationRule: "Each finding has severity, description, and resolution status." },
|
|
1290
1293
|
{ section: "Review Army Contract", required: true, validationRule: "Structured findings include id/severity/confidence/fingerprint/reportedBy/status with dedup reconciliation summary." },
|
|
1291
|
-
{ section: "Review Readiness Dashboard", required: true, validationRule: "
|
|
1294
|
+
{ section: "Review Readiness Dashboard", required: true, validationRule: "Includes a per-pass table (Layer 1 / Layer 2 / Adversarial / Schema) with a 'Completed at' column, a Delegation log snapshot block (path .cclaw/state/delegation-log.json with required/completed/waived/pending), a Staleness signal block (commit at last review pass and current commit), and a Headline with open critical blockers + ship recommendation. At minimum, the section text must contain the substrings 'Completed at', 'delegation-log.json', 'commit at last review pass', and 'Ship recommendation'." },
|
|
1295
|
+
{ section: "Completeness Score", required: true, validationRule: "Records AC coverage, task coverage, test-slice coverage, and adversarial-review pass status as numeric or boolean values. At minimum, a line like 'AC coverage: N/M' or 'AC coverage: 100%'." },
|
|
1292
1296
|
{ section: "Severity Summary", required: true, validationRule: "Per-severity count lines for critical, important, and suggestion buckets." },
|
|
1293
1297
|
{ section: "Final Verdict", required: true, validationRule: "Exactly one of: APPROVED, APPROVED_WITH_CONCERNS, BLOCKED." }
|
|
1294
1298
|
],
|
|
@@ -1332,7 +1336,7 @@ const SHIP = {
|
|
|
1332
1336
|
interactionProtocol: [
|
|
1333
1337
|
"Run preflight checks before any release action.",
|
|
1334
1338
|
"Document release notes and rollback plan explicitly.",
|
|
1335
|
-
"For finalization mode: use the Decision Protocol — present modes as labeled options (A/B/C/D) with consequences and mark one as (recommended). If AskQuestion/AskUserQuestion is available, send exactly ONE question per call, validate fields against runtime schema, and on schema error immediately fall back to plain-text question instead of retrying guessed payloads.",
|
|
1339
|
+
"For finalization mode: use the Decision Protocol — present modes as labeled options (A/B/C/D) with consequences, **score each option `Completeness: X/10`** (10 = fully addresses release blast-radius, rollback readiness, observability, and stakeholder communication), and mark one as (recommended). Prefer the highest-scoring option; if scores tie, prefer the most reversible one. If AskQuestion/AskUserQuestion is available, send exactly ONE question per call, validate fields against runtime schema, and on schema error immediately fall back to plain-text question instead of retrying guessed payloads.",
|
|
1336
1340
|
"Do not proceed if critical blockers remain from review.",
|
|
1337
1341
|
"**STOP.** Present finalization options and wait for user selection before executing any finalization action."
|
|
1338
1342
|
],
|
|
@@ -1450,7 +1454,8 @@ const SHIP = {
|
|
|
1450
1454
|
{ section: "Rollback Plan", required: true, validationRule: "Trigger conditions, rollback steps (exact commands), verification steps." },
|
|
1451
1455
|
{ section: "Monitoring", required: false, validationRule: "If applicable: what metrics/logs to watch post-deploy. Risk note if no monitoring." },
|
|
1452
1456
|
{ section: "Finalization", required: true, validationRule: "Exactly one finalization enum token selected. Execution result documented. Worktree cleaned if applicable." },
|
|
1453
|
-
{ section: "Completion Status", required: false, validationRule: "If present: exactly one of SHIPPED, SHIPPED_WITH_EXCEPTIONS, BLOCKED. Exceptions documented when applicable." }
|
|
1457
|
+
{ section: "Completion Status", required: false, validationRule: "If present: exactly one of SHIPPED, SHIPPED_WITH_EXCEPTIONS, BLOCKED. Exceptions documented when applicable." },
|
|
1458
|
+
{ section: "Compound Step", required: false, validationRule: "Optional retrospective: at least one bullet of the form 'Insight: ... | Action: append [compound] entry to .cclaw/knowledge.md', or an explicit 'No compound insight this run.' line." }
|
|
1454
1459
|
],
|
|
1455
1460
|
namedAntiPattern: {
|
|
1456
1461
|
title: "Green CI Means Safe to Merge",
|
|
@@ -1512,6 +1517,13 @@ const STAGE_AUTO_SUBAGENT_DISPATCH = {
|
|
|
1512
1517
|
when: "When acceptance criteria are unclear or constraints conflict.",
|
|
1513
1518
|
purpose: "Normalize measurable criteria and testability mapping.",
|
|
1514
1519
|
requiresUserGate: false
|
|
1520
|
+
},
|
|
1521
|
+
{
|
|
1522
|
+
agent: "spec-reviewer",
|
|
1523
|
+
mode: "proactive",
|
|
1524
|
+
when: "When acceptance criteria and edge cases are drafted and need independent validation before plan stage.",
|
|
1525
|
+
purpose: "Independent review of spec against measurability, testability, and completeness before locking the contract for plan.",
|
|
1526
|
+
requiresUserGate: false
|
|
1515
1527
|
}
|
|
1516
1528
|
],
|
|
1517
1529
|
plan: [
|
|
@@ -1558,8 +1570,18 @@ const STAGE_AUTO_SUBAGENT_DISPATCH = {
|
|
|
1558
1570
|
agent: "security-reviewer",
|
|
1559
1571
|
mode: "mandatory",
|
|
1560
1572
|
when: "Always in review stage. Even when no trust boundaries changed, produce an explicit 'no-change' security attestation.",
|
|
1561
|
-
purpose: "Guarantee a dedicated security pass on every diff: auth, input validation, secrets, injection, privilege, and blast-radius review are never opt-in.",
|
|
1562
|
-
requiresUserGate: false
|
|
1573
|
+
purpose: "Guarantee a dedicated security pass on every diff: auth, input validation, secrets, injection, privilege, and blast-radius review are never opt-in. MUST load the `security-audit` skill and run a pattern-based sweep across the diff scope and touched modules in addition to the per-diff Layer 2 security checklist.",
|
|
1574
|
+
requiresUserGate: false,
|
|
1575
|
+
skill: "security-audit"
|
|
1576
|
+
},
|
|
1577
|
+
{
|
|
1578
|
+
agent: "code-reviewer",
|
|
1579
|
+
mode: "conditional",
|
|
1580
|
+
condition: "diff_lines_gt:100||files_touched_gt:10||trust_boundary_changed",
|
|
1581
|
+
when: "When the diff exceeds 100 changed lines, touches more than 10 files, or modifies trust boundaries — dispatch a SECOND, independent code-reviewer with the adversarial-review skill loaded so the review army has at least two voices on a high-blast-radius change.",
|
|
1582
|
+
purpose: "Adversarial second-opinion review on large or trust-sensitive diffs. The second reviewer treats the implementation as hostile and tries to break it (hostile-user, future-maintainer, competitor lenses) instead of sympathetically explaining it.",
|
|
1583
|
+
requiresUserGate: false,
|
|
1584
|
+
skill: "adversarial-review"
|
|
1563
1585
|
}
|
|
1564
1586
|
],
|
|
1565
1587
|
ship: [
|
|
@@ -1585,6 +1607,10 @@ export function mandatoryDelegationsForStage(stage) {
|
|
|
1585
1607
|
.filter((d) => d.mode === "mandatory")
|
|
1586
1608
|
.map((d) => d.agent);
|
|
1587
1609
|
}
|
|
1610
|
+
/** Conditional dispatches that become mandatory only when their `condition` predicate evaluates true. */
|
|
1611
|
+
export function conditionalDispatchesForStage(stage) {
|
|
1612
|
+
return STAGE_AUTO_SUBAGENT_DISPATCH[stage].filter((d) => d.mode === "conditional");
|
|
1613
|
+
}
|
|
1588
1614
|
export function stageSchema(stage) {
|
|
1589
1615
|
const base = STAGE_SCHEMA_MAP[stage];
|
|
1590
1616
|
return {
|
|
@@ -33,10 +33,22 @@ This is the **recommended way to start** working with cclaw. Use \`/cc-next\` fo
|
|
|
33
33
|
|
|
34
34
|
1. Read \`${flowPath}\`.
|
|
35
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.
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
36
|
+
3. **Track heuristic** — classify the idea text and **recommend** a track (the user can override before any state mutation):
|
|
37
|
+
- **quick** (\`spec → tdd → review → ship\`) — single-purpose work where the spec is essentially already known.
|
|
38
|
+
Triggers (case-insensitive substring or close variant): \`bug\`, \`bugfix\`, \`fix\`, \`hotfix\`, \`patch\`, \`typo\`, \`regression\`, \`copy change\`, \`rename\`, \`bump\`, \`upgrade dep\`, \`config tweak\`, \`docs only\`, \`comment\`, \`lint\`, \`format\`, \`small\`, \`tiny\`, \`one-liner\`, \`revert\`.
|
|
39
|
+
- **standard** (full 8 stages — default) — anything that introduces a new capability, touches multiple modules, or has unclear scope.
|
|
40
|
+
Triggers: \`new feature\`, \`add\`, \`build\`, \`design\`, \`refactor\`, \`migration\`, \`platform\`, \`architecture\`, \`endpoint\`, \`schema\`, \`api\`, \`integrate\`, \`workflow\`, \`onboarding\`, or any prompt that does not match quick triggers.
|
|
41
|
+
- When triggers conflict (e.g. "small refactor that touches 5 modules") prefer **standard** — quick is opt-in and only safe when scope is genuinely tiny.
|
|
42
|
+
4. Present the recommendation as a single decision with explicit options:
|
|
43
|
+
> \`Recommended track: <quick|standard>\` because \`<one-line reason citing matched triggers>\`.
|
|
44
|
+
> Override? (A) keep \`<recommended>\` (B) switch to \`<other>\` (C) cancel.
|
|
45
|
+
If \`AskQuestion\`/\`AskUserQuestion\` is available, send exactly ONE question; on schema error, fall back to plain text.
|
|
46
|
+
5. Persist the chosen track to \`${flowPath}\` (\`track\` field). Compute \`skippedStages\` from the track and write that too. Use the **first stage of the chosen track** as \`currentStage\` (quick → \`spec\`, standard → \`brainstorm\`).
|
|
47
|
+
6. Write the prompt to \`.cclaw/artifacts/00-idea.md\` as the raw idea capture, and append a \`Track:\` line referencing the chosen track and the matched heuristic.
|
|
48
|
+
7. Load the **first-stage skill for the chosen track** and its command file:
|
|
49
|
+
- quick → \`.cclaw/skills/specification-authoring/SKILL.md\` + \`.cclaw/commands/spec.md\`
|
|
50
|
+
- standard → \`.cclaw/skills/brainstorming/SKILL.md\` + \`.cclaw/commands/brainstorm.md\`
|
|
51
|
+
8. Execute that stage with the prompt as initial context.
|
|
40
52
|
|
|
41
53
|
### Without prompt (\`/cc\`)
|
|
42
54
|
|
|
@@ -81,9 +93,20 @@ Do **not** silently discard an existing flow when the user provides a prompt. If
|
|
|
81
93
|
- Inform: "You have an active flow at stage **{currentStage}** with {N} completed stages. Starting a new brainstorm will reset progress."
|
|
82
94
|
- Ask: "Continue with reset? (A) Yes, start fresh (B) No, resume current flow"
|
|
83
95
|
- If (B) → switch to Path B behavior.
|
|
84
|
-
3.
|
|
85
|
-
|
|
86
|
-
|
|
96
|
+
3. **Classify the idea** using the heuristic below and present a single track recommendation. Wait for explicit confirmation or override before mutating any state.
|
|
97
|
+
|
|
98
|
+
**Track heuristic** (lowercase substring match against the user prompt):
|
|
99
|
+
|
|
100
|
+
| Track | Triggers | Use when |
|
|
101
|
+
|---|---|---|
|
|
102
|
+
| \`quick\` | \`bug\`, \`bugfix\`, \`fix\`, \`hotfix\`, \`patch\`, \`typo\`, \`regression\`, \`rename\`, \`bump\`, \`upgrade dep\`, \`docs only\`, \`comment\`, \`lint\`, \`format\`, \`small\`, \`tiny\`, \`one-liner\`, \`revert\`, \`copy change\` | Single-purpose, spec is essentially known, low blast radius |
|
|
103
|
+
| \`standard\` | \`new feature\`, \`add\`, \`build\`, \`design\`, \`refactor\`, \`migration\`, \`platform\`, \`architecture\`, \`endpoint\`, \`schema\`, \`api\`, \`integrate\`, \`workflow\`, \`onboarding\` (or no quick trigger matched) | Anything new, multi-module, or unclear scope |
|
|
104
|
+
|
|
105
|
+
- On conflict, prefer \`standard\` (quick is opt-in for genuinely tiny work).
|
|
106
|
+
- Always state the recommendation as a one-line reason citing the matched trigger.
|
|
107
|
+
4. Persist the chosen track in \`${flowPath}\` (\`track\` + \`skippedStages\`). Set \`currentStage\` to the first stage of the chosen track (\`quick\` → \`spec\`, \`standard\` → \`brainstorm\`). Reset gate catalog.
|
|
108
|
+
5. Write \`${RUNTIME_ROOT}/artifacts/00-idea.md\` with the user's prompt and an explicit \`Track:\` line capturing the heuristic decision.
|
|
109
|
+
6. Load and execute the **first stage skill of the chosen track** (\`brainstorming\` for standard, \`specification-authoring\` for quick) plus its matching command file.
|
|
87
110
|
|
|
88
111
|
### Path B: \`/cc\` (no arguments)
|
|
89
112
|
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Command contract for /cc-status — a read-only snapshot command.
|
|
3
|
+
* Does not mutate state. Always safe to run.
|
|
4
|
+
*/
|
|
5
|
+
export declare function statusCommandContract(): string;
|
|
6
|
+
/**
|
|
7
|
+
* Skill body for /cc-status — read-only status snapshot.
|
|
8
|
+
*/
|
|
9
|
+
export declare function statusCommandSkillMarkdown(): string;
|