cclaw-cli 0.51.24 → 0.51.26
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 +135 -414
- package/dist/artifact-linter.js +10 -6
- package/dist/config.d.ts +1 -1
- package/dist/config.js +28 -3
- package/dist/content/core-agents.d.ts +110 -0
- package/dist/content/core-agents.js +255 -3
- package/dist/content/examples.js +8 -5
- package/dist/content/harness-doc.d.ts +1 -0
- package/dist/content/harness-doc.js +3 -0
- package/dist/content/hooks.d.ts +1 -0
- package/dist/content/hooks.js +189 -0
- package/dist/content/next-command.js +10 -6
- package/dist/content/reference-patterns.d.ts +18 -0
- package/dist/content/reference-patterns.js +391 -0
- package/dist/content/skills.js +42 -36
- package/dist/content/stage-common-guidance.js +19 -3
- package/dist/content/stage-schema.d.ts +12 -0
- package/dist/content/stage-schema.js +184 -28
- package/dist/content/stages/_lint-metadata/index.js +3 -2
- package/dist/content/stages/brainstorm.js +7 -3
- package/dist/content/stages/design.js +12 -3
- package/dist/content/stages/review.js +7 -5
- package/dist/content/stages/schema-types.d.ts +9 -2
- package/dist/content/stages/scope.js +8 -2
- package/dist/content/stages/ship.js +3 -2
- package/dist/content/stages/tdd.js +18 -13
- package/dist/content/start-command.js +3 -2
- package/dist/content/status-command.js +17 -6
- package/dist/content/subagents.js +286 -40
- package/dist/content/templates.js +64 -3
- package/dist/content/tree-command.js +7 -1
- package/dist/delegation.d.ts +34 -1
- package/dist/delegation.js +168 -8
- package/dist/doctor-registry.js +9 -0
- package/dist/doctor.js +121 -6
- package/dist/gate-evidence.js +25 -2
- package/dist/harness-adapters.d.ts +6 -0
- package/dist/harness-adapters.js +28 -4
- package/dist/install.js +5 -10
- package/dist/internal/advance-stage.js +179 -26
- package/dist/run-persistence.js +21 -3
- package/dist/tdd-verification-evidence.d.ts +17 -0
- package/dist/tdd-verification-evidence.js +43 -0
- package/dist/types.d.ts +10 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,471 +1,192 @@
|
|
|
1
1
|
# cclaw
|
|
2
2
|
|
|
3
|
-
**
|
|
4
|
-
runtime that gives your AI coding agent one inspectable path from idea to
|
|
5
|
-
shipped PR — **plus an automatic closeout chain** that turns every ship
|
|
6
|
-
into reusable knowledge:
|
|
3
|
+
**cclaw is a file-backed flow runtime for coding agents.** It turns Claude Code, Cursor, OpenCode, and Codex into one repeatable path from idea to shipped change: visible stages, hard gates, real subagent evidence, and resumable closeout in your repo.
|
|
7
4
|
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
```text
|
|
6
|
+
idea
|
|
7
|
+
|
|
|
8
|
+
v
|
|
9
|
+
+-------------+ +--------+ +--------+ +------+ +------+ +-----+
|
|
10
|
+
| brainstorm | ---> | scope | ---> | design | ---> | spec | ---> | plan | ---> | tdd |
|
|
11
|
+
+-------------+ +--------+ +--------+ +------+ +------+ +-----+
|
|
12
|
+
|
|
|
13
|
+
v
|
|
14
|
+
+--------+ +------+
|
|
15
|
+
| review | ---> | ship |
|
|
16
|
+
+--------+ +------+
|
|
17
|
+
|
|
|
18
|
+
v
|
|
19
|
+
retro -> compound -> archive
|
|
20
|
+
```
|
|
10
21
|
|
|
11
|
-
|
|
12
|
-
file-backed audit trail, and the same slash commands work across Claude
|
|
13
|
-
Code, Cursor, OpenCode, and OpenAI Codex.
|
|
22
|
+
The promise is simple: at any point you can ask **where are we, what is blocked, what evidence exists, and what should run next?**
|
|
14
23
|
|
|
15
|
-
|
|
16
|
-
inside your harness — no hidden control plane, no background daemon, no
|
|
17
|
-
operational knobs to memorise.
|
|
24
|
+
## First 5 Minutes
|
|
18
25
|
|
|
19
|
-
|
|
26
|
+
Requirements: Node.js 20+ and a git project root.
|
|
20
27
|
|
|
21
|
-
|
|
28
|
+
```bash
|
|
29
|
+
cd /path/to/your/repo
|
|
30
|
+
npx cclaw-cli
|
|
31
|
+
```
|
|
22
32
|
|
|
23
|
-
|
|
24
|
-
- Engineering teams that need a **single, repeatable path** for AI-assisted
|
|
25
|
-
changes across multiple harnesses and languages.
|
|
26
|
-
- Staff engineers and tech leads who want **enforceable discipline**:
|
|
27
|
-
locked-in decisions, no placeholders, mandatory TDD, traceable plans.
|
|
28
|
-
- Maintainers who want a compact, file-backed flow their harness agents can actually follow.
|
|
33
|
+
Then work from your coding harness:
|
|
29
34
|
|
|
30
|
-
|
|
35
|
+
```text
|
|
36
|
+
/cc <idea> start a tracked flow
|
|
37
|
+
/cc-next resume or advance the current flow
|
|
38
|
+
/cc-view status inspect current state without changing it
|
|
39
|
+
```
|
|
31
40
|
|
|
32
|
-
|
|
41
|
+
For scripted setup:
|
|
33
42
|
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
│ Idea │ → │ /cc │ → │Classify│ → │Track │ → │Stages│
|
|
37
|
-
└─────────┘ └──────┘ └────────┘ └──────┘ └──┬───┘
|
|
38
|
-
│
|
|
39
|
-
┌───────────────────────────────────────────────┘
|
|
40
|
-
▼
|
|
41
|
-
brainstorm → scope → design → spec → plan → tdd → review → ship
|
|
42
|
-
│ │ │ │ │ │ │ │
|
|
43
|
-
▼ ▼ ▼ ▼ ▼ ▼ ▼ ▼
|
|
44
|
-
01.md 02.md 03.md 04.md 05.md 06.md 07.md 08.md
|
|
45
|
-
│ │
|
|
46
|
-
└──── gates + subagents + knowledge capture │
|
|
47
|
-
happen at every step │
|
|
48
|
-
▼
|
|
49
|
-
┌─────────────────────────┐
|
|
50
|
-
│ automatic closeout │
|
|
51
|
-
│ (resumable state │
|
|
52
|
-
│ machine, never manual)│
|
|
53
|
-
└────────────┬────────────┘
|
|
54
|
-
▼
|
|
55
|
-
retro ──► compound ──► archive
|
|
56
|
-
09.md (knowledge (runs/
|
|
57
|
-
promoted) <slug>/)
|
|
43
|
+
```bash
|
|
44
|
+
npx cclaw-cli init --harnesses=claude,cursor --no-interactive
|
|
58
45
|
```
|
|
59
46
|
|
|
60
|
-
|
|
61
|
-
holds the single source of truth for "where are we" — including
|
|
62
|
-
`closeout.shipSubstate` so a ship → retro → compound → archive chain
|
|
63
|
-
resumes at the exact step after any interruption. `knowledge.jsonl`
|
|
64
|
-
accumulates reusable lessons **throughout** the flow, not only at the
|
|
65
|
-
end; stage artifacts live under `.cclaw/artifacts/` until archive rolls
|
|
66
|
-
them into `.cclaw/runs/<date-slug>/`.
|
|
47
|
+
If generated files or hooks look stale, run `cclaw doctor`. If they need to be regenerated, run `npx cclaw-cli sync`.
|
|
67
48
|
|
|
68
|
-
|
|
69
|
-
You ──► /cc <idea>
|
|
70
|
-
│
|
|
71
|
-
▼
|
|
72
|
-
harness loads stage contract + HARD-GATE
|
|
73
|
-
│
|
|
74
|
-
▼
|
|
75
|
-
cclaw reads state + knowledge, guides execution
|
|
76
|
-
│
|
|
77
|
-
▼
|
|
78
|
-
artifacts written, handoff captured
|
|
79
|
-
│
|
|
80
|
-
▼
|
|
81
|
-
next stage is explicit in flow-state.json
|
|
82
|
-
```
|
|
49
|
+
## Why cclaw
|
|
83
50
|
|
|
84
|
-
|
|
51
|
+
AI coding sessions fail when decisions live only in chat. cclaw puts the operating truth in files:
|
|
85
52
|
|
|
86
|
-
|
|
53
|
+
```text
|
|
54
|
+
.cclaw/
|
|
55
|
+
artifacts/ active stage docs: 00-idea.md through 09-retro.md
|
|
56
|
+
state/flow-state.json current stage, gates, stale markers, closeout.shipSubstate
|
|
57
|
+
state/delegation-log.json
|
|
58
|
+
subagent dispatches, waivers, evidence refs
|
|
59
|
+
knowledge.jsonl reusable lessons harvested from stage artifacts
|
|
60
|
+
runs/ archived run snapshots
|
|
61
|
+
```
|
|
87
62
|
|
|
88
|
-
|
|
63
|
+
That gives you:
|
|
89
64
|
|
|
90
|
-
-
|
|
91
|
-
-
|
|
92
|
-
|
|
65
|
+
- **One path** from idea to ship, with `quick`, `medium`, and `standard` tracks.
|
|
66
|
+
- **Real gates** for evidence, tests, review, delegation, stale-stage recovery, and closeout.
|
|
67
|
+
- **Subagents with accountability**: controller owns state, workers do bounded tasks, overseers validate, evidence lands in `delegation-log.json`.
|
|
68
|
+
- **Recovery instead of confusion**: `/cc-view status` tells you the blocker and the next command.
|
|
69
|
+
- **Portable harness behavior** across Claude Code, Cursor, OpenCode, and Codex.
|
|
93
70
|
|
|
94
|
-
|
|
95
|
-
cd /path/to/your/repo
|
|
96
|
-
npx cclaw-cli
|
|
97
|
-
```
|
|
71
|
+
## The Daily Loop
|
|
98
72
|
|
|
99
|
-
|
|
100
|
-
|
|
73
|
+
```text
|
|
74
|
+
1. Start or resume
|
|
75
|
+
/cc <idea> or /cc-next
|
|
101
76
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
77
|
+
2. Work the current stage
|
|
78
|
+
The agent writes/updates .cclaw/artifacts/<stage>.md
|
|
79
|
+
|
|
80
|
+
3. Prove the gate
|
|
81
|
+
stage-complete records evidence in flow-state.json
|
|
105
82
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
OpenCode, or Codex); optional maintenance commands are listed in the
|
|
109
|
-
CLI reference.
|
|
83
|
+
4. Inspect when stuck
|
|
84
|
+
/cc-view status
|
|
110
85
|
|
|
111
|
-
|
|
112
|
-
|
|
86
|
+
5. Close out after ship
|
|
87
|
+
/cc-next continues retro -> compound -> archive
|
|
88
|
+
```
|
|
113
89
|
|
|
114
|
-
|
|
90
|
+
Tracks keep the flow proportional:
|
|
115
91
|
|
|
116
92
|
```text
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
├── templates/ # artifact skeletons for each stage
|
|
121
|
-
├── rules/ # opt-in language rule packs
|
|
122
|
-
├── agents/ # subagent definitions
|
|
123
|
-
├── hooks/ # harness-agnostic hook runtime
|
|
124
|
-
├── artifacts/ # active run artifacts (00-idea.md -> 09-retro.md)
|
|
125
|
-
├── runs/ # archived run snapshots: YYYY-MM-DD-slug/
|
|
126
|
-
├── state/ # flow-state.json + stage activity log
|
|
127
|
-
└── knowledge.jsonl # append-only lessons + patterns
|
|
93
|
+
quick spec -> tdd -> review -> ship
|
|
94
|
+
medium brainstorm -> spec -> plan -> tdd -> review -> ship
|
|
95
|
+
standard brainstorm -> scope -> design -> spec -> plan -> tdd -> review -> ship
|
|
128
96
|
```
|
|
129
97
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
- `.claude/commands/cc*.md` + `.claude/hooks/hooks.json`
|
|
133
|
-
- `.cursor/commands/cc*.md` + `.cursor/hooks.json` + `.cursor/rules/cclaw-workflow.mdc`
|
|
134
|
-
- `.opencode/commands/cc*.md` + `.opencode/plugins/cclaw-plugin.mjs`
|
|
135
|
-
- `.agents/skills/cc*/SKILL.md` + `.codex/hooks.json` (Codex; skills are
|
|
136
|
-
activated via `/use cc` or description-based auto-matching. Hooks
|
|
137
|
-
require Codex CLI ≥ v0.114 and `[features] codex_hooks = true` in
|
|
138
|
-
`~/.codex/config.toml`; `cclaw init --codex` offers to patch that flag
|
|
139
|
-
for you. `cclaw doctor` reports stale legacy Codex layouts.)
|
|
140
|
-
- `AGENTS.md` with a managed routing block (includes a Codex-specific note)
|
|
141
|
-
— see [`docs/agents-block.example.md`](./docs/agents-block.example.md)
|
|
142
|
-
for a static example of what the harness reads.
|
|
143
|
-
|
|
144
|
-
### `.cclaw/config.yaml` — the minimal surface
|
|
145
|
-
|
|
146
|
-
`cclaw init` writes five keys, on purpose:
|
|
147
|
-
|
|
148
|
-
```yaml
|
|
149
|
-
version: ${CCLAW_VERSION}
|
|
150
|
-
flowVersion: 1.0.0
|
|
151
|
-
harnesses:
|
|
152
|
-
- claude
|
|
153
|
-
- cursor
|
|
154
|
-
- opencode
|
|
155
|
-
- codex
|
|
156
|
-
strictness: advisory # advisory | strict — one knob for prompt-guard + TDD
|
|
157
|
-
gitHookGuards: false # opt in to managed .git/hooks/pre-commit + pre-push
|
|
158
|
-
```
|
|
98
|
+
Track selection is **model-guided and advisory** during `/cc`. Runtime enforcement begins after state is written: `/cc-next` follows the selected track, required gates, delegation rules, stale-stage markers, and `closeout.shipSubstate`.
|
|
159
99
|
|
|
160
|
-
|
|
161
|
-
`languageRulePacks` line appears (auto-populated from `package.json`,
|
|
162
|
-
`pyproject.toml` / `requirements.txt`, `go.mod`). That is the full
|
|
163
|
-
default surface — a new user sees nothing they need to understand yet.
|
|
100
|
+
## When Blocked
|
|
164
101
|
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
reintroduces defaults you removed.
|
|
102
|
+
Start here:
|
|
103
|
+
|
|
104
|
+
```text
|
|
105
|
+
/cc-view status
|
|
106
|
+
```
|
|
171
107
|
|
|
172
|
-
|
|
108
|
+
A useful status should read like an operator note, not a raw dump:
|
|
173
109
|
|
|
174
|
-
|
|
110
|
+
```text
|
|
111
|
+
Current: tdd (standard)
|
|
112
|
+
Blocked by: NO_SOURCE_CONTEXT
|
|
113
|
+
Next: cclaw internal rewind plan "add bootstrap slice", then /cc-next
|
|
114
|
+
Evidence needed: fresh RED/GREEN/REFACTOR slice and verification output
|
|
115
|
+
```
|
|
175
116
|
|
|
176
|
-
|
|
117
|
+
Common exits:
|
|
177
118
|
|
|
178
|
-
All four appear as slash commands in every supported harness. This is the
|
|
179
|
-
top-level user surface: `/cc`, `/cc-next`, `/cc-ideate`, and `/cc-view status`
|
|
180
|
-
cover the happy path. Operator/support tools stay separate so the harness
|
|
181
|
-
does not feel like a command framework.
|
|
182
119
|
|
|
183
|
-
|
|
|
184
|
-
|
|
185
|
-
|
|
|
186
|
-
|
|
|
187
|
-
|
|
|
188
|
-
|
|
|
120
|
+
| Situation | Next action |
|
|
121
|
+
| ------------------------------------------------- | ------------------------------------------------------------------------------------ |
|
|
122
|
+
| Missing gates | Run `/cc-next`, finish the stage, then complete with evidence. |
|
|
123
|
+
| Mandatory delegation missing evidence | Dispatch the worker/overseer or waive explicitly with rationale. |
|
|
124
|
+
| `NO_SOURCE_CONTEXT` or `NO_TEST_SURFACE` | Rewind to `plan`/`spec`, define the source or test surface, then resume TDD. |
|
|
125
|
+
| `NO_IMPLEMENTABLE_SLICE` or `RED_NOT_EXPRESSIBLE` | Rework `design`/`spec`/`plan` until one vertical slice is testable. |
|
|
126
|
+
| `NO_VCS_MODE` | Restore git, set `vcs: none` with hash evidence, or configure `tdd.verificationRef`. |
|
|
127
|
+
| Review blocked | `cclaw internal rewind tdd "review_blocked_by_critical <finding-ids>"`. |
|
|
128
|
+
| Stale stage after rewind | Redo the marked stage, then `cclaw internal rewind --ack <stage>`. |
|
|
129
|
+
| Broken hooks or generated files | `cclaw doctor`, then `npx cclaw-cli sync` if needed. |
|
|
189
130
|
|
|
190
|
-
Operational extras stay off the main surface: `/cc-next` handles progression
|
|
191
|
-
and closeout, `cclaw archive` handles explicit archival/reset, and
|
|
192
|
-
`cclaw doctor` verifies install/runtime wiring. Doctor is not a replacement
|
|
193
|
-
for a real harness smoke test; it catches broken files, stale hooks, and
|
|
194
|
-
schema drift before the user loses a run.
|
|
195
131
|
|
|
196
|
-
|
|
132
|
+
## Subagents Without Theater
|
|
197
133
|
|
|
198
134
|
```text
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
135
|
+
user goal
|
|
136
|
+
|
|
|
137
|
+
v
|
|
138
|
+
controller ---------------> worker: bounded implementation/test/doc task
|
|
139
|
+
| |
|
|
140
|
+
| v
|
|
141
|
+
+----------------------> overseer: read-only validation
|
|
142
|
+
|
|
|
143
|
+
v
|
|
144
|
+
evidence refs + terminal status
|
|
145
|
+
|
|
|
146
|
+
v
|
|
147
|
+
.cclaw/state/delegation-log.json
|
|
209
148
|
```
|
|
210
149
|
|
|
211
|
-
|
|
150
|
+
The controller owns `flow-state.json`, sequencing, synthesis, and the final answer. Workers own scoped work. Overseers verify. A waiver means the work was **not** done by a real worker and must say why proceeding is acceptable.
|
|
212
151
|
|
|
213
|
-
|
|
214
|
-
{
|
|
215
|
-
"currentStage": "brainstorm",
|
|
216
|
-
"track": "medium",
|
|
217
|
-
"skippedStages": ["scope", "design"],
|
|
218
|
-
"stageGateCatalog": { "brainstorm": { "passed": [], "blocked": [] } },
|
|
219
|
-
"completedStages": []
|
|
220
|
-
}
|
|
221
|
-
```
|
|
152
|
+
## What Is Enforced
|
|
222
153
|
|
|
223
|
-
|
|
154
|
+
Enforced by generated helpers and state checks:
|
|
224
155
|
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
156
|
+
- Stage completion goes through `node .cclaw/hooks/stage-complete.mjs <stage>`.
|
|
157
|
+
- Required gates need evidence before advancement.
|
|
158
|
+
- Mandatory delegations need terminal evidence or explicit waiver.
|
|
159
|
+
- Stale stages block until redone and acknowledged.
|
|
160
|
+
- Review criticals route back to TDD.
|
|
161
|
+
- Ship continues through `retro -> compound -> archive` with `closeout.shipSubstate`.
|
|
229
162
|
|
|
230
|
-
|
|
163
|
+
Advisory/model-guided:
|
|
231
164
|
|
|
232
|
-
-
|
|
165
|
+
- Initial track heuristic wording.
|
|
166
|
+
- Proactive subagents that are not mandatory for the active stage/tier.
|
|
167
|
+
- Reference patterns that shape prompts but do not add runtime states.
|
|
233
168
|
|
|
234
|
-
##
|
|
169
|
+
## The Deeper Contract
|
|
235
170
|
|
|
236
|
-
|
|
237
|
-
```
|
|
171
|
+
The README is the front door. The full operating contract lives here:
|
|
238
172
|
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
## The eight stages, the three tracks, and auto-closeout
|
|
244
|
-
|
|
245
|
-
cclaw has eight **critical-path** stages plus an automatic three-step
|
|
246
|
-
closeout chain (retro → compound → archive). A single prompt rarely needs
|
|
247
|
-
all eight critical-path stages, so `/cc` picks a **track** up front so
|
|
248
|
-
the flow matches the task.
|
|
249
|
-
|
|
250
|
-
| Track | Critical path | Typical trigger |
|
|
251
|
-
|---|---|---|
|
|
252
|
-
| **quick** | `spec → tdd → review → ship` | `bug`, `hotfix`, `typo`, `rename`, `bump`, `docs only`, one-liners |
|
|
253
|
-
| **medium** | `brainstorm → spec → plan → tdd → review → ship` | `add endpoint`, `add field`, `extend existing`, `wire integration` |
|
|
254
|
-
| **standard** _(default)_ | all 8 stages (+ mandatory design-time parallel research fleet) | `new feature`, `refactor`, `migration`, `platform`, `schema`, `architecture` |
|
|
255
|
-
|
|
256
|
-
**Every track ends with the same auto-closeout chain.** Once ship
|
|
257
|
-
completes, `/cc-next` automatically drives
|
|
258
|
-
`retro → compound → archive` — with `closeout.shipSubstate` carrying the
|
|
259
|
-
exact step across sessions, so a crashed or backgrounded run resumes
|
|
260
|
-
without re-drafting retros or re-asking structured questions. See
|
|
261
|
-
[Ship and closeout](#ship-and-closeout--automatic-resumable).
|
|
262
|
-
|
|
263
|
-
Each critical-path stage produces a dated artifact under
|
|
264
|
-
`.cclaw/artifacts/`: `00-idea.md` (seed), `01-brainstorm.md`, `02-scope.md`,
|
|
265
|
-
`02a-research.md` (design research fleet synthesis), `03-design.md` through
|
|
266
|
-
`08-ship.md`. Closeout adds `09-retro.md`; archive then rolls the whole
|
|
267
|
-
bundle into `.cclaw/runs/<YYYY-MM-DD-slug>/` and resets the active flow for
|
|
268
|
-
the next run.
|
|
269
|
-
|
|
270
|
-
### Track heuristics are configurable (advisory)
|
|
271
|
-
|
|
272
|
-
Every team has its own vocabulary. Override the built-in trigger lists in
|
|
273
|
-
`.cclaw/config.yaml`:
|
|
274
|
-
|
|
275
|
-
```yaml
|
|
276
|
-
trackHeuristics:
|
|
277
|
-
fallback: standard
|
|
278
|
-
tracks:
|
|
279
|
-
quick:
|
|
280
|
-
triggers: [hotfix, rollback, prod-incident]
|
|
281
|
-
veto: [schema, migration] # never route quick even if a trigger hits
|
|
282
|
-
standard:
|
|
283
|
-
triggers: [epic, platform-team, core-infra]
|
|
284
|
-
```
|
|
173
|
+
- [Scheme of Work](./docs/scheme-of-work.md): stages, gates, recovery, closeout, state files.
|
|
174
|
+
- [Configuration](./docs/config.md): strictness, tracks, TDD, compound, language packs, hooks.
|
|
175
|
+
- [Harnesses](./docs/harnesses.md): Claude, Cursor, OpenCode, Codex capabilities and fallbacks.
|
|
176
|
+
- [Generated Agent Block Example](./docs/agents-block.example.md): what gets injected into harness guidance.
|
|
285
177
|
|
|
286
|
-
|
|
287
|
-
the `/cc` skill and contract prose so the LLM applies them during
|
|
288
|
-
classification — there is no Node-level router that mechanically enforces
|
|
289
|
-
the outcome. That is why the knobs are deliberately minimal: per-track
|
|
290
|
-
`triggers` + `veto` on top of defaults, plus `fallback`. Evaluation order is
|
|
291
|
-
fixed (`standard -> medium -> quick`, narrow-to-broad); regex `patterns`
|
|
292
|
-
and a `priority` override were removed in v0.38.0 because nothing in
|
|
293
|
-
runtime consumed them.
|
|
294
|
-
|
|
295
|
-
### Mid-flow reclassification
|
|
296
|
-
|
|
297
|
-
If you seed a task as `quick` and evidence in spec shows it actually needs a
|
|
298
|
-
schema migration, cclaw **stops and asks** before quietly advancing.
|
|
299
|
-
Reclassification is append-only: the old decision stays in history.
|
|
300
|
-
|
|
301
|
-
---
|
|
302
|
-
|
|
303
|
-
## Guardrails that ship in the box
|
|
304
|
-
|
|
305
|
-
These are the things that make cclaw "enterprise-strong" without turning
|
|
306
|
-
it into ceremony:
|
|
307
|
-
|
|
308
|
-
- **Locked decisions (D-XX IDs).** Scope decisions are numbered and must
|
|
309
|
-
reappear in plan + TDD artifacts. The artifact linter catches any
|
|
310
|
-
silent drift.
|
|
311
|
-
- **No placeholders.** `TBD`, `TODO`, `similar to task`, and "static for
|
|
312
|
-
now"-style scope reduction are flagged before a stage completes.
|
|
313
|
-
- **Stale-stage detection.** If an upstream artifact changes after a
|
|
314
|
-
downstream stage is already complete, cclaw marks the downstream stage
|
|
315
|
-
stale and refuses to advance until you re-run it (or explicitly
|
|
316
|
-
acknowledge via a manual override).
|
|
317
|
-
- **Mandatory subagent delegation** at TDD, with per-harness waivers.
|
|
318
|
-
- **Turn Announce Discipline.** Every stage entry/exit emits a visible
|
|
319
|
-
line so users can see what the agent is doing, not just what it says.
|
|
320
|
-
- **Inline protocols.** Decision, Completion, and Ethos discipline is embedded in the active stage skill so users do not need to chase generated reference files.
|
|
321
|
-
- **Knowledge capture throughout the flow.** Every stage completion
|
|
322
|
-
protocol emits typed entries (`rule` / `pattern` / `lesson`) to
|
|
323
|
-
`.cclaw/knowledge.jsonl` as the flow progresses — not only at retro.
|
|
324
|
-
Retro itself adds a `compound` entry, and the automatic compound pass
|
|
325
|
-
after ship promotes recurring entries into first-class
|
|
326
|
-
rules/protocols/skills (base threshold from
|
|
327
|
-
`compound.recurrenceThreshold`, temporarily lowered to 2 for repositories
|
|
328
|
-
with <5 archived runs, plus a critical-severity single-hit override) so
|
|
329
|
-
the **next** run is easier. Strict JSONL schema keeps the whole thing
|
|
330
|
-
machine-queryable.
|
|
331
|
-
- **Automatic integrity checks.** Runtime health is verified on every
|
|
332
|
-
stage transition — no command you need to remember to run.
|
|
333
|
-
|
|
334
|
-
---
|
|
335
|
-
|
|
336
|
-
## TDD that actually runs
|
|
337
|
-
|
|
338
|
-
The `tdd` stage is not prose guidance. It requires:
|
|
339
|
-
|
|
340
|
-
- an explicit **RED** test run (captured in `.cclaw/artifacts/06-tdd.md`)
|
|
341
|
-
- a mandatory **`test-author`** subagent dispatch (logged to
|
|
342
|
-
`.cclaw/state/delegation-log.json`)
|
|
343
|
-
- a **GREEN** full-suite run before exit
|
|
344
|
-
- optional **REFACTOR** pass with coverage preservation
|
|
345
|
-
|
|
346
|
-
`/cc-next` will not advance past `tdd` until the delegation log shows the
|
|
347
|
-
subagent as `completed`. Codex and OpenCode use generated native subagents
|
|
348
|
-
by default; a role-switch row is only a degraded fallback and must include
|
|
349
|
-
`evidenceRefs` — see [Harness support](#harness-support).
|
|
350
|
-
|
|
351
|
-
---
|
|
352
|
-
|
|
353
|
-
## Ship and closeout — automatic, resumable
|
|
354
|
-
|
|
355
|
-
Shipping writes `08-ship.md`. `/cc-next` then automatically walks the
|
|
356
|
-
run through a deterministic three-step closeout without extra
|
|
357
|
-
commands from you:
|
|
358
|
-
|
|
359
|
-
1. **Retro (`09-retro.md`).** cclaw drafts a retrospective from your
|
|
360
|
-
stage artifacts, the delegation log, and the knowledge entries
|
|
361
|
-
recorded during the run. It then asks exactly **one** structured
|
|
362
|
-
question:
|
|
363
|
-
- **accept** *(default)* — keep the draft, record one `compound`
|
|
364
|
-
knowledge entry, advance.
|
|
365
|
-
- **edit** — you edit `09-retro.md` in place, then `/cc-next` again.
|
|
366
|
-
- **skip** — record a one-line reason, continue (archive will
|
|
367
|
-
surface the skip in the run manifest).
|
|
368
|
-
2. **Compound pass.** If the knowledge store has clusters recurring 3+
|
|
369
|
-
times, cclaw proposes concrete lifts into rules/protocols/skills and
|
|
370
|
-
asks once: apply-all / apply-selected / skip. An empty pass advances
|
|
371
|
-
silently.
|
|
372
|
-
3. **Archive.** Moves artifacts into `.cclaw/runs/YYYY-MM-DD-<slug>/`,
|
|
373
|
-
snapshots `state/`, writes a manifest, and resets `flow-state.json`
|
|
374
|
-
to the track's initial stage.
|
|
375
|
-
|
|
376
|
-
The chain is driven by `closeout.shipSubstate` inside `flow-state.json`
|
|
377
|
-
(`retro_review` → `compound_review` → `ready_to_archive` → `archived`).
|
|
378
|
-
If your session dies mid-closeout, a new `/cc-next` resumes at the
|
|
379
|
-
exact step — retro drafts are not regenerated and no structured ask is
|
|
380
|
-
repeated silently.
|
|
381
|
-
|
|
382
|
-
For the default path, `/cc-next` is the only command; explicit archival/reset remains available through `cclaw archive`.
|
|
383
|
-
|
|
384
|
-
---
|
|
385
|
-
|
|
386
|
-
## Harness support
|
|
387
|
-
|
|
388
|
-
cclaw is honest about what each harness can and cannot do, and it
|
|
389
|
-
closes every real gap with a documented fallback — not a silent waiver.
|
|
390
|
-
|
|
391
|
-
| Harness | Dispatch | Fallback | Hook surface | Structured ask |
|
|
392
|
-
|---|---|---|---|---|
|
|
393
|
-
| Claude Code | full (named subagents) | `native` | full | `AskUserQuestion` |
|
|
394
|
-
| Cursor | generic Task dispatcher | `generic-dispatch` | full | `AskQuestion` |
|
|
395
|
-
| OpenCode | native subagents (`.opencode/agents`) | `native` | plugin | `question` (permission-gated; `permission.question: "allow"`) |
|
|
396
|
-
| OpenAI Codex | native parallel subagents (`.codex/agents`) | `native` | limited (Bash-only `PreToolUse`/`PostToolUse`; requires `codex_hooks` feature flag) | `request_user_input` (experimental; Plan / Collaboration mode) |
|
|
397
|
-
|
|
398
|
-
What the fallbacks mean:
|
|
399
|
-
|
|
400
|
-
- `native` — Claude, OpenCode, and Codex run mandatory delegations in
|
|
401
|
-
isolated subagent workers; cclaw records them with `fulfillmentMode: "isolated"`.
|
|
402
|
-
- `generic-dispatch` — Cursor has a real Task tool with a fixed
|
|
403
|
-
vocabulary of `subagent_type`s (`explore`, `generalPurpose`, …).
|
|
404
|
-
cclaw maps each named agent (planner / reviewer / test-author /
|
|
405
|
-
security-reviewer / doc-updater) onto the generic dispatcher with a
|
|
406
|
-
structured role prompt.
|
|
407
|
-
- `role-switch` — degraded fallback only when the active runtime cannot
|
|
408
|
-
expose its declared dispatch surface. The agent announces
|
|
409
|
-
`## cclaw role-switch: <stage>/<agent> (<mode>)`, loads
|
|
410
|
-
`.cclaw/agents/<agent>.md`, writes outputs to the stage artifact, and
|
|
411
|
-
records a delegation row with `fulfillmentMode: "role-switch"` plus at
|
|
412
|
-
least one `evidenceRef`. A role-switch `completed` row without
|
|
413
|
-
evidenceRefs is classified as `missingEvidence` by `cclaw doctor`.
|
|
414
|
-
- `waiver` — reserved. Only fires auto-waivers if every installed
|
|
415
|
-
harness declares it. Currently unused — v0.33 removed the old
|
|
416
|
-
Codex-only auto-waiver path.
|
|
417
|
-
|
|
418
|
-
> **Codex note (v0.40+).** Codex CLI deprecated custom prompts in v0.89
|
|
419
|
-
> (Jan 2026), but Codex ≥ v0.114 (Mar 2026) grew an experimental
|
|
420
|
-
> lifecycle hooks API. cclaw installs Codex entry points as native
|
|
421
|
-
> **skills** under `.agents/skills/cc*/SKILL.md` (invoke with `/use cc`,
|
|
422
|
-
> `/use cc-next`, `/use cc-view`, `/use cc-ideate`, or
|
|
423
|
-
> by typing `/cc …` in plain text — Codex auto-matches from the skill
|
|
424
|
-
> description) **and** writes `.codex/hooks.json` so session-start
|
|
425
|
-
> rehydration, stop-handoff, prompt-guard, workflow-guard, and
|
|
426
|
-
> context-monitor fire automatically — as long as you enable the
|
|
427
|
-
> `codex_hooks` feature flag in `~/.codex/config.toml`. `cclaw init
|
|
428
|
-
> --codex` asks for consent before patching that file. Codex's
|
|
429
|
-
> `PreToolUse`/`PostToolUse` are Bash-only; the stage skills compensate
|
|
430
|
-
> for `Write`/`Edit`/`MCP` tool calls with explicit in-turn checks. Run
|
|
431
|
-
> `cclaw doctor` to see the current state of hooks, the feature flag,
|
|
432
|
-
> and any legacy layout to clean up.
|
|
433
|
-
|
|
434
|
-
The full capability matrix lives in
|
|
435
|
-
[`docs/harnesses.md`](./docs/harnesses.md). Harness capability gaps are
|
|
436
|
-
reported by `cclaw doctor` instead of generating reference files into the
|
|
437
|
-
user project.
|
|
438
|
-
|
|
439
|
-
Runtime state stays small: `flow-state.json` is the source of truth, while
|
|
440
|
-
stage activity is an append-only trace for what happened during the run.
|
|
441
|
-
Derived diagnostics are produced on demand by `cclaw doctor`.
|
|
442
|
-
|
|
443
|
-
---
|
|
444
|
-
|
|
445
|
-
## CLI reference
|
|
446
|
-
|
|
447
|
-
`cclaw-cli` is deliberately small: it installs, syncs, upgrades, diagnoses, and removes the generated harness runtime. Day-to-day flow work happens inside your harness via `/cc*` commands and Node hooks.
|
|
178
|
+
## CLI Reference
|
|
448
179
|
|
|
449
180
|
```bash
|
|
450
|
-
npx cclaw-cli #
|
|
451
|
-
|
|
452
|
-
npx cclaw-cli sync #
|
|
453
|
-
npx cclaw-cli upgrade # refresh generated files
|
|
454
|
-
npx cclaw-cli archive # explicit
|
|
455
|
-
npx cclaw-cli uninstall # remove .cclaw
|
|
181
|
+
npx cclaw-cli # interactive setup or installed status hint
|
|
182
|
+
npx cclaw-cli init --harnesses=<list> --no-interactive
|
|
183
|
+
npx cclaw-cli sync # regenerate managed runtime files
|
|
184
|
+
npx cclaw-cli upgrade # refresh generated files while preserving config
|
|
185
|
+
npx cclaw-cli archive # explicit archive/reset; normal closeout uses /cc-next
|
|
186
|
+
npx cclaw-cli uninstall # remove .cclaw and generated harness shims
|
|
456
187
|
npx cclaw-cli --version
|
|
457
188
|
```
|
|
458
189
|
|
|
459
|
-
The generated `node .cclaw/hooks/stage-complete.mjs <stage>` helper is the canonical stage-closeout path and must not require a runtime `cclaw` binary in `PATH`.
|
|
460
|
-
|
|
461
|
-
For CI or scripted installs, `cclaw-cli init --harnesses=<list>
|
|
462
|
-
--no-interactive` is the non-interactive form. All other tunables
|
|
463
|
-
(prompt-guard strictness, TDD enforcement, language rule packs, track
|
|
464
|
-
heuristics) are set by editing `.cclaw/config.yaml` directly — see
|
|
465
|
-
[`docs/config.md`](./docs/config.md) for the full key reference.
|
|
466
|
-
|
|
467
|
-
---
|
|
468
|
-
|
|
469
190
|
## License
|
|
470
191
|
|
|
471
|
-
[MIT](./LICENSE)
|
|
192
|
+
[MIT](./LICENSE)
|
package/dist/artifact-linter.js
CHANGED
|
@@ -1762,12 +1762,15 @@ export async function lintArtifact(projectRoot, stage, track = "standard") {
|
|
|
1762
1762
|
}
|
|
1763
1763
|
else {
|
|
1764
1764
|
const learnings = parseLearningsSection(learningsBody);
|
|
1765
|
+
const meaningfulStageNoneWarning = learnings.ok && learnings.none && ["design", "tdd", "review"].includes(stage)
|
|
1766
|
+
? " Warning: design/tdd/review usually produce reusable decisions, test patterns, or review lessons; keep `None this stage` only for truly mechanical work."
|
|
1767
|
+
: "";
|
|
1765
1768
|
findings.push({
|
|
1766
1769
|
section: "Learnings",
|
|
1767
1770
|
required: requireLearnings,
|
|
1768
1771
|
rule: "`## Learnings` must contain either a single `- None this stage.` bullet or JSON bullets compatible with knowledge.jsonl fields (type/trigger/action/confidence required).",
|
|
1769
1772
|
found: learnings.ok,
|
|
1770
|
-
details: learnings.details
|
|
1773
|
+
details: `${learnings.details}${meaningfulStageNoneWarning}`
|
|
1771
1774
|
});
|
|
1772
1775
|
}
|
|
1773
1776
|
if (stage === "brainstorm") {
|
|
@@ -2479,13 +2482,14 @@ export async function checkReviewSecurityNoChangeAttestation(projectRoot) {
|
|
|
2479
2482
|
const securityTableRowPattern = /^\|\s*[^|\n]+\|\s*[^|\n]+\|\s*security\s*\|\s*[^|\n]+\|\s*[^|\n]+\|/imu;
|
|
2480
2483
|
const securityBulletPattern = /^[*-]\s+.*\b(?:security|auth|injection|secret|credential|permission)\b/imu;
|
|
2481
2484
|
const hasSecurityFinding = securityTableRowPattern.test(securityBody) || securityBulletPattern.test(securityBody);
|
|
2482
|
-
const attestationMatch =
|
|
2483
|
-
const
|
|
2484
|
-
|
|
2485
|
-
|
|
2485
|
+
const attestationMatch = /\b(NO_CHANGE_ATTESTATION|NO_SECURITY_IMPACT)\b\s*:\s*(.*)/iu.exec(securityBody);
|
|
2486
|
+
const attestationToken = attestationMatch?.[1] ?? "NO_CHANGE_ATTESTATION";
|
|
2487
|
+
const hasNoChangeAttestation = Boolean(attestationMatch && attestationMatch[2]?.trim().length > 0);
|
|
2488
|
+
if (attestationMatch && attestationMatch[2]?.trim().length === 0) {
|
|
2489
|
+
errors.push(`${attestationToken} must include a non-empty rationale.`);
|
|
2486
2490
|
}
|
|
2487
2491
|
if (!hasSecurityFinding && !hasNoChangeAttestation) {
|
|
2488
|
-
errors.push("Layer 2 security evidence missing: include at least one security finding or `NO_CHANGE_ATTESTATION: <reason>`.");
|
|
2492
|
+
errors.push("Layer 2 security evidence missing: include at least one security finding or `NO_CHANGE_ATTESTATION: <reason>` / `NO_SECURITY_IMPACT: <reason>`.");
|
|
2489
2493
|
}
|
|
2490
2494
|
return {
|
|
2491
2495
|
ok: errors.length === 0,
|