cclaw-cli 0.49.0 → 0.51.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +57 -84
- package/dist/artifact-linter.d.ts +4 -0
- package/dist/artifact-linter.js +24 -3
- package/dist/cli.d.ts +1 -19
- package/dist/cli.js +49 -491
- package/dist/constants.d.ts +2 -13
- package/dist/constants.js +1 -43
- package/dist/content/closeout-guidance.d.ts +14 -0
- package/dist/content/closeout-guidance.js +42 -0
- package/dist/content/core-agents.js +55 -17
- package/dist/content/decision-protocol.d.ts +12 -0
- package/dist/content/decision-protocol.js +20 -0
- package/dist/content/diff-command.d.ts +1 -2
- package/dist/content/diff-command.js +8 -94
- package/dist/content/examples.d.ts +4 -10
- package/dist/content/examples.js +10 -20
- package/dist/content/hook-events.js +2 -2
- package/dist/content/hook-inline-snippets.d.ts +5 -2
- package/dist/content/hook-inline-snippets.js +33 -1
- package/dist/content/hook-manifest.d.ts +3 -4
- package/dist/content/hook-manifest.js +11 -12
- package/dist/content/hooks.js +44 -21
- package/dist/content/ideate-command.d.ts +2 -0
- package/dist/content/ideate-command.js +34 -25
- package/dist/content/iron-laws.d.ts +5 -5
- package/dist/content/iron-laws.js +5 -5
- package/dist/content/language-policy.d.ts +2 -0
- package/dist/content/language-policy.js +13 -0
- package/dist/content/learnings.d.ts +3 -4
- package/dist/content/learnings.js +26 -50
- package/dist/content/meta-skill.js +33 -22
- package/dist/content/next-command.js +41 -38
- package/dist/content/node-hooks.js +17 -345
- package/dist/content/opencode-plugin.js +5 -103
- package/dist/content/research-playbooks.js +14 -14
- package/dist/content/review-loop.d.ts +2 -0
- package/dist/content/review-loop.js +8 -0
- package/dist/content/session-hooks.js +15 -47
- package/dist/content/skills.d.ts +0 -5
- package/dist/content/skills.js +55 -128
- package/dist/content/stage-common-guidance.d.ts +0 -1
- package/dist/content/stage-common-guidance.js +17 -14
- package/dist/content/stage-schema.d.ts +26 -1
- package/dist/content/stage-schema.js +121 -40
- package/dist/content/stages/_lint-metadata/index.js +9 -15
- package/dist/content/stages/brainstorm.js +22 -43
- package/dist/content/stages/design.js +37 -57
- package/dist/content/stages/plan.js +22 -13
- package/dist/content/stages/review.js +24 -27
- package/dist/content/stages/scope.js +34 -46
- package/dist/content/stages/ship.js +7 -4
- package/dist/content/stages/spec.js +20 -9
- package/dist/content/stages/tdd.js +64 -44
- package/dist/content/start-command.js +13 -12
- package/dist/content/status-command.d.ts +2 -7
- package/dist/content/status-command.js +19 -146
- package/dist/content/subagents.d.ts +0 -5
- package/dist/content/subagents.js +51 -28
- package/dist/content/templates.d.ts +1 -1
- package/dist/content/templates.js +126 -135
- package/dist/content/track-render-context.d.ts +17 -0
- package/dist/content/track-render-context.js +44 -0
- package/dist/content/tree-command.d.ts +1 -2
- package/dist/content/tree-command.js +4 -87
- package/dist/content/utility-skills.d.ts +2 -29
- package/dist/content/utility-skills.js +2 -1534
- package/dist/content/view-command.js +31 -11
- package/dist/delegation.d.ts +1 -1
- package/dist/delegation.js +5 -15
- package/dist/doctor-registry.js +20 -21
- package/dist/doctor.js +88 -344
- package/dist/flow-state.d.ts +3 -0
- package/dist/flow-state.js +2 -0
- package/dist/harness-adapters.d.ts +1 -1
- package/dist/harness-adapters.js +51 -58
- package/dist/install.js +128 -358
- package/dist/internal/advance-stage.js +3 -9
- package/dist/internal/compound-readiness.d.ts +1 -1
- package/dist/internal/compound-readiness.js +1 -1
- package/dist/internal/tdd-loop-status.d.ts +1 -1
- package/dist/internal/tdd-loop-status.js +1 -1
- package/dist/knowledge-store.d.ts +16 -10
- package/dist/knowledge-store.js +51 -15
- package/dist/policy.js +16 -105
- package/dist/run-archive.d.ts +4 -6
- package/dist/run-archive.js +15 -20
- package/dist/run-persistence.d.ts +2 -2
- package/dist/run-persistence.js +3 -9
- package/package.json +1 -2
- package/dist/content/archive-command.d.ts +0 -2
- package/dist/content/archive-command.js +0 -124
- package/dist/content/compound-command.d.ts +0 -5
- package/dist/content/compound-command.js +0 -193
- package/dist/content/contexts.d.ts +0 -18
- package/dist/content/contexts.js +0 -24
- package/dist/content/contracts.d.ts +0 -2
- package/dist/content/contracts.js +0 -51
- package/dist/content/doctor-references.d.ts +0 -2
- package/dist/content/doctor-references.js +0 -150
- package/dist/content/eval-scaffold.d.ts +0 -15
- package/dist/content/eval-scaffold.js +0 -370
- package/dist/content/feature-command.d.ts +0 -2
- package/dist/content/feature-command.js +0 -123
- package/dist/content/flow-map.d.ts +0 -23
- package/dist/content/flow-map.js +0 -134
- package/dist/content/harness-doc.d.ts +0 -2
- package/dist/content/harness-doc.js +0 -202
- package/dist/content/harness-playbooks.d.ts +0 -24
- package/dist/content/harness-playbooks.js +0 -393
- package/dist/content/harness-tool-refs.d.ts +0 -20
- package/dist/content/harness-tool-refs.js +0 -268
- package/dist/content/ops-command.d.ts +0 -2
- package/dist/content/ops-command.js +0 -71
- package/dist/content/protocols.d.ts +0 -7
- package/dist/content/protocols.js +0 -215
- package/dist/content/retro-command.d.ts +0 -2
- package/dist/content/retro-command.js +0 -165
- package/dist/content/rewind-command.d.ts +0 -2
- package/dist/content/rewind-command.js +0 -106
- package/dist/content/tdd-log-command.d.ts +0 -2
- package/dist/content/tdd-log-command.js +0 -85
- package/dist/eval/agents/single-shot.d.ts +0 -27
- package/dist/eval/agents/single-shot.js +0 -79
- package/dist/eval/agents/with-tools.d.ts +0 -44
- package/dist/eval/agents/with-tools.js +0 -261
- package/dist/eval/agents/workflow.d.ts +0 -31
- package/dist/eval/agents/workflow.js +0 -155
- package/dist/eval/baseline.d.ts +0 -38
- package/dist/eval/baseline.js +0 -282
- package/dist/eval/config-loader.d.ts +0 -14
- package/dist/eval/config-loader.js +0 -395
- package/dist/eval/corpus.d.ts +0 -30
- package/dist/eval/corpus.js +0 -330
- package/dist/eval/cost-guard.d.ts +0 -102
- package/dist/eval/cost-guard.js +0 -190
- package/dist/eval/diff.d.ts +0 -64
- package/dist/eval/diff.js +0 -323
- package/dist/eval/llm-client.d.ts +0 -176
- package/dist/eval/llm-client.js +0 -267
- package/dist/eval/mode.d.ts +0 -28
- package/dist/eval/mode.js +0 -61
- package/dist/eval/progress.d.ts +0 -83
- package/dist/eval/progress.js +0 -59
- package/dist/eval/report.d.ts +0 -11
- package/dist/eval/report.js +0 -181
- package/dist/eval/rubric-loader.d.ts +0 -20
- package/dist/eval/rubric-loader.js +0 -143
- package/dist/eval/runner.d.ts +0 -81
- package/dist/eval/runner.js +0 -746
- package/dist/eval/runs.d.ts +0 -41
- package/dist/eval/runs.js +0 -114
- package/dist/eval/sandbox.d.ts +0 -38
- package/dist/eval/sandbox.js +0 -137
- package/dist/eval/tools/glob.d.ts +0 -2
- package/dist/eval/tools/glob.js +0 -163
- package/dist/eval/tools/grep.d.ts +0 -2
- package/dist/eval/tools/grep.js +0 -152
- package/dist/eval/tools/index.d.ts +0 -7
- package/dist/eval/tools/index.js +0 -35
- package/dist/eval/tools/read.d.ts +0 -2
- package/dist/eval/tools/read.js +0 -122
- package/dist/eval/tools/types.d.ts +0 -49
- package/dist/eval/tools/types.js +0 -41
- package/dist/eval/tools/write.d.ts +0 -2
- package/dist/eval/tools/write.js +0 -92
- package/dist/eval/types.d.ts +0 -561
- package/dist/eval/types.js +0 -47
- package/dist/eval/verifiers/judge.d.ts +0 -40
- package/dist/eval/verifiers/judge.js +0 -256
- package/dist/eval/verifiers/rules.d.ts +0 -24
- package/dist/eval/verifiers/rules.js +0 -218
- package/dist/eval/verifiers/structural.d.ts +0 -14
- package/dist/eval/verifiers/structural.js +0 -171
- package/dist/eval/verifiers/traceability.d.ts +0 -23
- package/dist/eval/verifiers/traceability.js +0 -84
- package/dist/eval/verifiers/workflow-consistency.d.ts +0 -21
- package/dist/eval/verifiers/workflow-consistency.js +0 -225
- package/dist/eval/workflow-corpus.d.ts +0 -7
- package/dist/eval/workflow-corpus.js +0 -207
- package/dist/feature-system.d.ts +0 -42
- package/dist/feature-system.js +0 -432
- package/dist/internal/knowledge-digest.d.ts +0 -7
- package/dist/internal/knowledge-digest.js +0 -93
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// ---------------------------------------------------------------------------
|
|
2
|
-
// Knowledge store content for
|
|
2
|
+
// Knowledge store content for the learnings skill and stage self-improvement prompts.
|
|
3
3
|
//
|
|
4
4
|
// The knowledge store is a single canonical JSONL file. Each line is one
|
|
5
5
|
// self-contained JSON object matching the strict schema in this module.
|
|
@@ -11,8 +11,8 @@ const LEARN_SKILL_NAME = "learnings";
|
|
|
11
11
|
const LEARN_SKILL_DESCRIPTION = "Project-scoped knowledge store: append and query rule/pattern/lesson/compound entries in the canonical JSONL file at .cclaw/knowledge.jsonl. Strict schema, append-only, machine-queryable.";
|
|
12
12
|
/**
|
|
13
13
|
* Canonical required JSONL field order (matches strict validator keys).
|
|
14
|
-
* Optional keys (
|
|
15
|
-
* required fields.
|
|
14
|
+
* Optional keys (`source`, `severity`, `supersedes`, `superseded_by`) may
|
|
15
|
+
* be appended after these required fields.
|
|
16
16
|
* Exported for tests and any programmatic writer that wants a stable base shape.
|
|
17
17
|
*/
|
|
18
18
|
export const KNOWLEDGE_JSONL_FIELDS = [
|
|
@@ -23,7 +23,7 @@ export const KNOWLEDGE_JSONL_FIELDS = [
|
|
|
23
23
|
"domain",
|
|
24
24
|
"stage",
|
|
25
25
|
"origin_stage",
|
|
26
|
-
"
|
|
26
|
+
"origin_run",
|
|
27
27
|
"frequency",
|
|
28
28
|
"universality",
|
|
29
29
|
"maturity",
|
|
@@ -49,7 +49,7 @@ Use the store to keep durable knowledge that should survive sessions:
|
|
|
49
49
|
- **rule**: hard constraint to follow every time.
|
|
50
50
|
- **pattern**: repeatable way that works well in this project.
|
|
51
51
|
- **lesson**: non-obvious outcome from a failure or trade-off.
|
|
52
|
-
- **compound**: post-ship insight about how to make the *next*
|
|
52
|
+
- **compound**: post-ship insight about how to make the *next* run faster (process accelerator, not domain rule).
|
|
53
53
|
|
|
54
54
|
## Continuous capture (stage closeout path)
|
|
55
55
|
|
|
@@ -63,22 +63,25 @@ Knowledge capture is now stage-native:
|
|
|
63
63
|
2. appends deduped entries to \`${KNOWLEDGE_PATH}\`,
|
|
64
64
|
3. writes a harvest marker into the artifact.
|
|
65
65
|
|
|
66
|
-
|
|
66
|
+
Manual/query operations (search, backfill, curation) use this skill when the
|
|
67
|
+
user asks for knowledge work. If a stage artifact contains JSON learnings but
|
|
68
|
+
\`${KNOWLEDGE_PATH}\` did not change, the missing step is almost always running
|
|
69
|
+
\`node .cclaw/hooks/stage-complete.mjs <stage>\` successfully.
|
|
67
70
|
|
|
68
71
|
## HARD-GATE
|
|
69
72
|
|
|
70
|
-
|
|
73
|
+
During manual knowledge operations, only modify \`${KNOWLEDGE_PATH}\`, \`${KNOWLEDGE_ARCHIVE_PATH}\`,
|
|
71
74
|
or an explicitly user-approved summary file. Do not modify application code here.
|
|
72
75
|
Do not invent alternate stores (no markdown mirror, no SQLite, no per-stage files).
|
|
73
76
|
|
|
74
77
|
## Entry format — strict JSONL schema
|
|
75
78
|
|
|
76
79
|
Exactly one JSON object per line. Required fields must appear in the order:
|
|
77
|
-
\`type, trigger, action, confidence, domain, stage, origin_stage,
|
|
80
|
+
\`type, trigger, action, confidence, domain, stage, origin_stage, origin_run, frequency, universality, maturity, created, first_seen_ts, last_seen_ts, project\`.
|
|
78
81
|
Optional fields \`source\` and \`severity\` may be appended after \`project\`.
|
|
79
82
|
|
|
80
83
|
\`\`\`json
|
|
81
|
-
{"type":"pattern","trigger":"when reviewing external payloads","action":"parse through zod before touching service layer","confidence":"high","domain":"api","stage":"review","origin_stage":"review","
|
|
84
|
+
{"type":"pattern","trigger":"when reviewing external payloads","action":"parse through zod before touching service layer","confidence":"high","domain":"api","stage":"review","origin_stage":"review","origin_run":"payload-hardening","frequency":1,"universality":"project","maturity":"raw","created":"2026-04-14T12:00:00Z","first_seen_ts":"2026-04-14T12:00:00Z","last_seen_ts":"2026-04-14T12:00:00Z","project":"cclaw"}
|
|
82
85
|
\`\`\`
|
|
83
86
|
|
|
84
87
|
| field | type | required | notes |
|
|
@@ -90,7 +93,7 @@ Optional fields \`source\` and \`severity\` may be appended after \`project\`.
|
|
|
90
93
|
| \`domain\` | string \\| null | yes | Free-form taxonomy (\`api\`, \`infra\`, \`ui\`, \`security\`, \`testing\`, …). Use \`null\` when cross-cutting. |
|
|
91
94
|
| \`stage\` | \`FlowStage\` \\| null | yes | One of brainstorm / scope / design / spec / plan / tdd / review / ship, or \`null\` when cross-stage. |
|
|
92
95
|
| \`origin_stage\` | \`FlowStage\` \\| null | yes | Stage where this learning was first observed. |
|
|
93
|
-
| \`
|
|
96
|
+
| \`origin_run\` | string \\| null | yes | Optional run, branch, or topic label where it was observed first. |
|
|
94
97
|
| \`frequency\` | integer >= 1 | yes | Number of times this same trigger/action pair has been observed. |
|
|
95
98
|
| \`universality\` | \`"project" \\| "personal" \\| "universal"\` | yes | Scope of applicability. |
|
|
96
99
|
| \`maturity\` | \`"raw" \\| "lifted-to-rule" \\| "lifted-to-enforcement"\` | yes | Lifecycle state of the learning. |
|
|
@@ -99,7 +102,7 @@ Optional fields \`source\` and \`severity\` may be appended after \`project\`.
|
|
|
99
102
|
| \`last_seen_ts\` | ISO 8601 UTC string | yes | Last re-confirmed timestamp. |
|
|
100
103
|
| \`project\` | string \\| null | yes | Repo or scope name. Use \`null\` when the entry crosses projects. |
|
|
101
104
|
| \`source\` | \`"stage" \\| "retro" \\| "compound" \\| "ideate" \\| "manual" \\| null\` | no | Origin channel for the entry when known. |
|
|
102
|
-
| \`severity\` | \`"critical" \\| "important" \\| "suggestion"\` | no | Priority signal for compound lifts; \`critical\` enables single-hit override in
|
|
105
|
+
| \`severity\` | \`"critical" \\| "important" \\| "suggestion"\` | no | Priority signal for compound lifts; \`critical\` enables single-hit override in compound readiness analysis. |
|
|
103
106
|
|
|
104
107
|
Rules:
|
|
105
108
|
- No other fields beyond the table above. Extra keys are forbidden and MUST be rejected by any writer.
|
|
@@ -111,68 +114,41 @@ Rules:
|
|
|
111
114
|
## Curation policy (target: ≤ 50 active entries)
|
|
112
115
|
|
|
113
116
|
- The file is append-only — entries are never physically deleted.
|
|
114
|
-
- When the canonical file exceeds 50 lines,
|
|
117
|
+
- When the canonical file exceeds 50 lines, a curation pass proposes
|
|
115
118
|
soft-archiving: the approved lines are **moved** to \`${KNOWLEDGE_ARCHIVE_PATH}\`
|
|
116
119
|
verbatim (same JSONL shape). The working file stays lean.
|
|
117
|
-
-
|
|
120
|
+
- Use the **Curate** action below for the full read-only audit and
|
|
121
|
+
user-approved soft-archive plan.
|
|
118
122
|
|
|
119
|
-
##
|
|
123
|
+
## Manual Actions
|
|
120
124
|
|
|
121
|
-
###
|
|
125
|
+
### Show recent entries
|
|
122
126
|
- Read \`${KNOWLEDGE_PATH}\`. Stream the last 30 lines; pretty-print each
|
|
123
127
|
line's \`type\` / \`trigger\` / \`action\` for human review.
|
|
124
|
-
- If file is missing or empty, report that clearly and suggest
|
|
128
|
+
- If file is missing or empty, report that clearly and suggest adding a
|
|
129
|
+
manual entry through this skill.
|
|
125
130
|
|
|
126
|
-
###
|
|
131
|
+
### Search \`<query>\`
|
|
127
132
|
- Stream \`${KNOWLEDGE_PATH}\`, JSON.parse each line, filter where any of
|
|
128
133
|
\`trigger\`, \`action\`, \`domain\`, \`project\` contains \`<query>\` (case-insensitive).
|
|
129
134
|
- Return the matched lines pretty-printed (do not mutate the file).
|
|
130
135
|
|
|
131
|
-
###
|
|
136
|
+
### Add
|
|
132
137
|
- Ask for required user-facing fields in order: \`type\`, \`trigger\`, \`action\`, \`confidence\`, \`domain\`, \`stage\`, \`universality\`, \`project\`.
|
|
133
138
|
- \`confidence\` must be one of \`high\`, \`medium\`, \`low\`. Default to \`medium\` if the user declines to set it.
|
|
134
139
|
- \`domain\`, \`stage\`, and \`project\` may be explicitly \`null\`.
|
|
135
140
|
- Prefer stage-native \`## Learnings\` capture for new flow work; use \`add\` mainly for backfilling historical lessons or ad-hoc entries outside a stage closeout.
|
|
136
|
-
- \`origin_stage\` defaults to \`stage\`; \`
|
|
141
|
+
- \`origin_stage\` defaults to \`stage\`; \`origin_run\` defaults to the current run, branch, or topic label (or \`null\` if unknown).
|
|
137
142
|
- \`frequency\` starts at \`1\`.
|
|
138
143
|
- \`maturity\` starts at \`raw\`.
|
|
139
144
|
- \`created\`, \`first_seen_ts\`, and \`last_seen_ts\` are set automatically to current UTC ISO timestamp.
|
|
140
145
|
- Append exactly one JSON line to \`${KNOWLEDGE_PATH}\` with the field order from the schema table above.
|
|
141
146
|
- Re-read the file tail to confirm the new line is valid JSON and parses back to the same object.
|
|
142
147
|
|
|
143
|
-
###
|
|
144
|
-
-
|
|
148
|
+
### Curate
|
|
149
|
+
- Produce a read-only audit + soft-archive plan.
|
|
145
150
|
- Never deletes. Soft-archive means **moving** full JSON lines from
|
|
146
151
|
\`${KNOWLEDGE_PATH}\` to \`${KNOWLEDGE_ARCHIVE_PATH}\` as part of a
|
|
147
152
|
user-approved curation pass.
|
|
148
153
|
`;
|
|
149
154
|
}
|
|
150
|
-
export function learnCommandContract() {
|
|
151
|
-
return `# /cc-learn
|
|
152
|
-
|
|
153
|
-
## Purpose
|
|
154
|
-
|
|
155
|
-
Manage the project knowledge store. One canonical file, strict JSONL:
|
|
156
|
-
- \`${KNOWLEDGE_PATH}\` — append-only JSONL, one entry per line.
|
|
157
|
-
- \`${KNOWLEDGE_ARCHIVE_PATH}\` — soft-archive target written only by curate.
|
|
158
|
-
|
|
159
|
-
Stage-native pipeline:
|
|
160
|
-
- During \`stage-complete.mjs\`, cclaw harvests \`## Learnings\` from the current
|
|
161
|
-
stage artifact into \`${KNOWLEDGE_PATH}\` automatically.
|
|
162
|
-
- Use \`/cc-learn\` for query, backfill, and curation workflows.
|
|
163
|
-
|
|
164
|
-
## HARD-GATE
|
|
165
|
-
|
|
166
|
-
Do not edit source code from this command. Only operate on \`${KNOWLEDGE_PATH}\`,
|
|
167
|
-
\`${KNOWLEDGE_ARCHIVE_PATH}\`, or user-approved summary output.
|
|
168
|
-
|
|
169
|
-
## Subcommands
|
|
170
|
-
|
|
171
|
-
| subcommand | args | description |
|
|
172
|
-
|---|---|---|
|
|
173
|
-
| (default) | — | Show recent knowledge entries (tail of JSONL, pretty-printed). |
|
|
174
|
-
| \`search\` | \`<query>\` | Stream-filter the JSONL for matching \`trigger\`, \`action\`, \`domain\`, \`project\`. |
|
|
175
|
-
| \`add\` | — | Append one JSON line (\`rule\` / \`pattern\` / \`lesson\` / \`compound\`) with the strict JSONL schema (15 required fields + optional \`source\` / \`severity\`). |
|
|
176
|
-
| \`curate\` | — | Hand off to the **knowledge-curation** skill: read-only audit + soft-archive plan when the file exceeds the curation threshold. |
|
|
177
|
-
`;
|
|
178
|
-
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { conversationLanguagePolicyMarkdown } from "./language-policy.js";
|
|
2
|
+
import { CLOSEOUT_CHAIN, closeoutChainInline, closeoutFlowMapSentence, closeoutProtocolBehaviorSentence } from "./closeout-guidance.js";
|
|
3
3
|
export const META_SKILL_NAME = "using-cclaw";
|
|
4
4
|
export function usingCclawSkillMarkdown() {
|
|
5
5
|
return `---
|
|
6
6
|
name: using-cclaw
|
|
7
|
-
description: "Routing brain for cclaw. Decide whether to start/resume a stage, answer directly, or use
|
|
7
|
+
description: "Routing brain for cclaw. Decide whether to start/resume a stage, answer directly, or use visible commands like /cc, /cc-next, /cc-ideate, and /cc-view."
|
|
8
8
|
---
|
|
9
9
|
|
|
10
10
|
# Using Cclaw
|
|
@@ -19,6 +19,7 @@ description: "Routing brain for cclaw. Decide whether to start/resume a stage, a
|
|
|
19
19
|
|
|
20
20
|
If the user explicitly overrides a stage rule, record it in the artifact.
|
|
21
21
|
|
|
22
|
+
${conversationLanguagePolicyMarkdown()}
|
|
22
23
|
## Skill-before-response gate
|
|
23
24
|
|
|
24
25
|
If \`.cclaw/state/flow-state.json\` exists and \`currentStage\` is set,
|
|
@@ -58,9 +59,10 @@ Task arrives
|
|
|
58
59
|
├─ New software work? -> /cc <idea>
|
|
59
60
|
├─ Repo-improvement discovery? -> /cc-ideate
|
|
60
61
|
├─ Resume existing flow? -> /cc or /cc-next
|
|
61
|
-
├─ Knowledge operation? ->
|
|
62
|
+
├─ Knowledge operation? -> load the learnings skill
|
|
62
63
|
├─ Read-only workspace view? -> /cc-view [status|tree|diff]
|
|
63
|
-
|
|
64
|
+
├─ Normal post-ship closeout? -> /cc-next drives ${closeoutChainInline()}
|
|
65
|
+
└─ Explicit early archival/reset? -> npx cclaw-cli archive [--name=<slug>]
|
|
64
66
|
\`\`\`
|
|
65
67
|
|
|
66
68
|
## Task classification
|
|
@@ -84,35 +86,44 @@ Before stage work:
|
|
|
84
86
|
## Platform reliability notes
|
|
85
87
|
|
|
86
88
|
- Managed hook dispatch uses \`.cclaw/hooks/run-hook.cmd\` (cross-platform wrapper).
|
|
87
|
-
- If hooks fail due missing runtime deps (for example \`node\` not on \`PATH\`), run \`cclaw doctor\` before continuing.
|
|
89
|
+
- If hooks fail due missing runtime deps (for example \`node\` not on \`PATH\`), run \`npx cclaw-cli doctor\` before continuing.
|
|
88
90
|
- Prefer cross-platform commands in artifacts/examples (\`npm test\`, \`pnpm test\`, \`python -m pytest\`, etc.) over shell-specific aliases whenever possible.
|
|
89
91
|
|
|
90
92
|
## Stage quick map
|
|
91
93
|
|
|
92
|
-
|
|
94
|
+
Use \`/cc <idea>\` for new work, \`/cc-next\` for progression and closeout, \`/cc-view\` for read-only state, and \`/cc-ideate\` for backlog discovery.
|
|
93
95
|
|
|
94
|
-
|
|
95
|
-
For the full surface (stages, routers, Ralph Loop, state files) load
|
|
96
|
-
\`${FLOW_MAP_REL_PATH}\` — it is the single-page overview of cclaw.
|
|
96
|
+
## Main vs Operator Surfaces
|
|
97
97
|
|
|
98
|
-
|
|
98
|
+
- **Main workflow:** \`/cc\`, \`/cc-next\`, \`/cc-ideate\`, \`/cc-view status\`, and \`node .cclaw/hooks/stage-complete.mjs <stage>\` inside the installed harness runtime.
|
|
99
|
+
- **Installer/support surface:** \`npx cclaw-cli init\`, \`npx cclaw-cli sync\`, \`npx cclaw-cli upgrade\`, \`npx cclaw-cli doctor\`, and explicit support/archive actions. Do not ask users to install or run a \`cclaw\` binary during normal stage flow.
|
|
100
|
+
- **Read-only support:** \`/cc-view tree\` and \`/cc-view diff\`.
|
|
101
|
+
- Use operator/support surfaces only for install/runtime diagnosis, explicit archival, or deeper inspection. Do not make them part of the happy path.
|
|
99
102
|
|
|
100
|
-
|
|
103
|
+
## Whole flow map
|
|
101
104
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
105
|
+
standard: brainstorm -> scope -> design -> spec -> plan -> tdd -> review -> ship -> ${CLOSEOUT_CHAIN}
|
|
106
|
+
medium: brainstorm -> spec -> plan -> tdd -> review -> ship -> ${CLOSEOUT_CHAIN}
|
|
107
|
+
quick: spec -> tdd -> review -> ship -> ${CLOSEOUT_CHAIN}
|
|
108
|
+
|
|
109
|
+
${closeoutFlowMapSentence()}
|
|
110
|
+
|
|
111
|
+
Tracks may skip critical-path stages via \`flow-state.track\` + \`skippedStages\`.
|
|
112
|
+
Use the current stage skill plus \`.cclaw/state/flow-state.json\` for orientation.
|
|
113
|
+
|
|
114
|
+
## Contextual Skill Activation
|
|
115
|
+
|
|
116
|
+
Use built-in judgment only when triggered by the current task:
|
|
117
|
+
|
|
118
|
+
- security, performance, debugging, docs, and CI/CD review lenses
|
|
119
|
+
- verification discipline before completion claims
|
|
120
|
+
- branch-finishing discipline during ship/finalization
|
|
106
121
|
- iron-laws as policy arbitration when instructions conflict
|
|
107
122
|
- language rule packs from \`.cclaw/config.yaml\` when enabled
|
|
108
123
|
|
|
109
|
-
## Protocol
|
|
110
|
-
|
|
111
|
-
Do not inline these protocols in stage skills; cite by path:
|
|
124
|
+
## Protocol Behavior
|
|
112
125
|
|
|
113
|
-
|
|
114
|
-
- Completion/resume protocol: \`${COMPLETION_PROTOCOL_REL_PATH}\`
|
|
115
|
-
- Engineering ethos + announce discipline: \`${ETHOS_PROTOCOL_REL_PATH}\`
|
|
126
|
+
${closeoutProtocolBehaviorSentence()}
|
|
116
127
|
|
|
117
128
|
## Knowledge guidance
|
|
118
129
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { RUNTIME_ROOT } from "../constants.js";
|
|
2
|
-
import {
|
|
2
|
+
import { conversationLanguagePolicyMarkdown } from "./language-policy.js";
|
|
3
3
|
import { stageSchema } from "./stage-schema.js";
|
|
4
|
+
import { closeoutChainInline, closeoutNextCommandGuidance, closeoutSubstateInline, closeoutSubstateProtocolBullets } from "./closeout-guidance.js";
|
|
4
5
|
import { stageSkillFolder } from "./skills.js";
|
|
5
6
|
const NEXT_SKILL_FOLDER = "flow-next-step";
|
|
6
7
|
const NEXT_SKILL_NAME = "flow-next-step";
|
|
@@ -58,21 +59,23 @@ export function nextCommandContract() {
|
|
|
58
59
|
|
|
59
60
|
- **Current stage not started / in progress** → load its skill and execute it.
|
|
60
61
|
- **Current stage complete (all gates passed)** → advance \`currentStage\` and load the next skill.
|
|
61
|
-
- **
|
|
62
|
+
- **Ship complete** → continue the resumable ${closeoutChainInline()} closeout via \`/cc-next\`.
|
|
63
|
+
- **Flow complete** → report done after closeout has archived the run.
|
|
62
64
|
|
|
63
65
|
This is the only progression command the user needs to drive the entire flow. Stage command contracts are internal implementation details loaded by \`/cc-next\`.
|
|
64
66
|
|
|
65
67
|
## HARD-GATE
|
|
66
68
|
|
|
69
|
+
${conversationLanguagePolicyMarkdown()}
|
|
67
70
|
- **Do not** invent gate completion: use only \`${flowPath}\` plus observable evidence in repo artifacts.
|
|
68
71
|
- **Do not** skip stages: advance only from \`currentStage\` to its configured successor.
|
|
69
|
-
-
|
|
72
|
+
- ${closeoutNextCommandGuidance()}
|
|
70
73
|
|
|
71
74
|
## Algorithm (mandatory)
|
|
72
75
|
|
|
73
76
|
1. Read **\`${flowPath}\`**. If missing → **BLOCKED** (state missing).
|
|
74
77
|
2. Parse JSON. Capture \`currentStage\` and \`stageGateCatalog[currentStage]\`.
|
|
75
|
-
3. If \`staleStages[currentStage]\` exists, do not advance automatically. Re-run the stage artifact work, then clear the marker with
|
|
78
|
+
3. If \`staleStages[currentStage]\` exists, do not advance automatically. Re-run the stage artifact work, then clear the marker with \`cclaw internal rewind --ack <currentStage>\`.
|
|
76
79
|
4. Read **\`${reconciliationNoticesPath}\`** when present. If it contains entries for \`activeRunId + currentStage\` and the listed gate is still blocked in \`stageGateCatalog[currentStage].blocked\`, emit a structured warning before any stage-advance decision.
|
|
77
80
|
5. Let \`G\` = \`requiredGates\` for **\`currentStage\`** from the stage schema.
|
|
78
81
|
6. Let \`catalog\` = \`stageGateCatalog[currentStage]\` from flow state.
|
|
@@ -81,11 +84,11 @@ This is the only progression command the user needs to drive the entire flow. St
|
|
|
81
84
|
9. If \`M\` is non-empty, inspect **\`${delegationPath}\`**. Treat as satisfied only if each mandatory agent is **completed** or **waived**.
|
|
82
85
|
10. For each satisfied mandatory delegation row, verify \`evidenceRefs\` is a non-empty array (unless status is \`waived\` with rationale). Missing evidenceRefs means delegation is unresolved.
|
|
83
86
|
11. If any mandatory delegation is missing and no waiver exists: **STOP** and ask the user whether to dispatch now or waive with rationale. Do not mark gates passed while delegation is unresolved.
|
|
84
|
-
12. If \`currentStage === "review"\` and \`catalog.blocked\` includes \`review_criticals_resolved\`, treat this as a hard remediation branch: recommend
|
|
87
|
+
12. If \`currentStage === "review"\` and \`catalog.blocked\` includes \`review_criticals_resolved\`, treat this as a hard remediation branch: recommend \`cclaw internal rewind tdd "review_blocked_by_critical"\` with the blocking finding IDs, and do not attempt to advance toward ship.
|
|
85
88
|
|
|
86
89
|
### Path A: Current stage is NOT complete (any gate unmet or delegation missing)
|
|
87
90
|
|
|
88
|
-
→ Load **\`${RUNTIME_ROOT}/skills/<skillFolder>/SKILL.md\`**
|
|
91
|
+
→ Load **\`${RUNTIME_ROOT}/skills/<skillFolder>/SKILL.md\`** for the current stage.
|
|
89
92
|
→ Execute that stage's protocol. The stage skill handles the full interaction including STOP points and gate tracking.
|
|
90
93
|
→ Stage completion must use \`node .cclaw/hooks/stage-complete.mjs <currentStage>\` (canonical), which validates delegations + gate evidence before mutating \`flow-state.json\`.
|
|
91
94
|
|
|
@@ -95,24 +98,11 @@ ${ralphLoopContractSnippet()}
|
|
|
95
98
|
|
|
96
99
|
→ If current stage's \`next\` is **\`done\`**:
|
|
97
100
|
|
|
98
|
-
|
|
99
|
-
- \`"idle"\` or missing -> set \`closeout.shipSubstate = "retro_review"\`, then
|
|
100
|
-
load \`${RUNTIME_ROOT}/commands/retro.md\` + \`${RUNTIME_ROOT}/skills/flow-retro/SKILL.md\`
|
|
101
|
-
and execute the retro protocol (draft + one structured accept/edit/skip ask).
|
|
102
|
-
- \`"retro_review"\` -> continue the retro protocol (re-ask the structured
|
|
103
|
-
question; the draft already exists — do not regenerate it).
|
|
104
|
-
- \`"compound_review"\` -> load \`${RUNTIME_ROOT}/commands/compound.md\` +
|
|
105
|
-
\`${RUNTIME_ROOT}/skills/flow-compound/SKILL.md\`, execute the compound
|
|
106
|
-
scan, ask user **one** structured question (apply / skip) per candidate
|
|
107
|
-
cluster or a single accept-all / skip choice, and advance substate on
|
|
108
|
-
completion or skip.
|
|
109
|
-
- \`"ready_to_archive"\` -> load \`${RUNTIME_ROOT}/commands/archive.md\` +
|
|
110
|
-
\`${RUNTIME_ROOT}/skills/flow-archive/SKILL.md\`, run archive, reset state.
|
|
111
|
-
- \`"archived"\` (transient) -> report "run archived" and stop.
|
|
101
|
+
${closeoutSubstateProtocolBullets()}
|
|
112
102
|
|
|
113
103
|
Otherwise report **"Flow complete. All stages finished."** and stop.
|
|
114
104
|
|
|
115
|
-
→ Otherwise: load **\`${RUNTIME_ROOT}/skills/<skillFolder>/SKILL.md\`**
|
|
105
|
+
→ Otherwise: load **\`${RUNTIME_ROOT}/skills/<skillFolder>/SKILL.md\`** for the successor stage. Execute that stage's protocol.
|
|
116
106
|
|
|
117
107
|
### Track-aware successor resolution
|
|
118
108
|
|
|
@@ -128,7 +118,7 @@ ${ralphLoopContractSnippet()}
|
|
|
128
118
|
\`/cc-next\` in a **new session** = resume from where you left off:
|
|
129
119
|
- Flow-state records \`currentStage\` and which gates have passed.
|
|
130
120
|
- The stage skill reads upstream artifacts and picks up context.
|
|
131
|
-
-
|
|
121
|
+
- ${closeoutSubstateInline()} carries the post-ship substate, so a crashed
|
|
132
122
|
session during retro/compound/archive resumes at the exact step without
|
|
133
123
|
regenerating the retro draft.
|
|
134
124
|
- No special resume command needed — \`/cc-next\` IS the resume command.
|
|
@@ -151,9 +141,7 @@ Validate envelopes with:
|
|
|
151
141
|
|
|
152
142
|
## Surface reference
|
|
153
143
|
|
|
154
|
-
|
|
155
|
-
state files) load \`${FLOW_MAP_REL_PATH}\`. It is the single-page
|
|
156
|
-
overview and is safe to read at any time.
|
|
144
|
+
Use the flow-start skill plus \`.cclaw/state/flow-state.json\` for orientation when needed.
|
|
157
145
|
`;
|
|
158
146
|
}
|
|
159
147
|
/**
|
|
@@ -182,6 +170,22 @@ description: "The primary progression command. Reads flow state, starts/resumes
|
|
|
182
170
|
|
|
183
171
|
\`/cc-next\` is **the only command you need** to drive the entire cclaw flow.
|
|
184
172
|
|
|
173
|
+
## Operator Output Contract
|
|
174
|
+
|
|
175
|
+
${conversationLanguagePolicyMarkdown()}
|
|
176
|
+
Default output should be compact, like OMC/OMX operator surfaces:
|
|
177
|
+
|
|
178
|
+
\`\`\`
|
|
179
|
+
Stage: <currentStage> (<track>)
|
|
180
|
+
Gates: <passed>/<required> passed, <blocked> blocked
|
|
181
|
+
Delegations: <done>/<mandatory> done
|
|
182
|
+
Blockers: <none | gate/delegation/reconciliation ids>
|
|
183
|
+
Next: <exact next action, usually /cc-next or one named remediation>
|
|
184
|
+
\`\`\`
|
|
185
|
+
|
|
186
|
+
Only expand beyond this when blocked, when asking a structured question, or when
|
|
187
|
+
the user explicitly requests detail. Do not dump full artifacts in progression output.
|
|
188
|
+
|
|
185
189
|
**How it works:**
|
|
186
190
|
1. Reads \`flow-state.json\` to find \`currentStage\`
|
|
187
191
|
2. Checks if all gates for that stage are satisfied
|
|
@@ -200,7 +204,7 @@ Do **not** mark gates satisfied from memory alone. Cite **artifact evidence** (p
|
|
|
200
204
|
|
|
201
205
|
1. Open **\`${flowPath}\`**.
|
|
202
206
|
2. Record \`currentStage\` and \`stageGateCatalog[currentStage]\`.
|
|
203
|
-
3. If \`staleStages[currentStage]\` exists, re-run the stage and clear marker via
|
|
207
|
+
3. If \`staleStages[currentStage]\` exists, re-run the stage and clear marker via \`cclaw internal rewind --ack <currentStage>\` before advancing.
|
|
204
208
|
4. If the file is missing or invalid JSON → **BLOCKED** (report and stop).
|
|
205
209
|
5. Read \`${reconciliationNoticesPath}\` when present. For entries matching \`activeRunId + currentStage\` whose gate is still in \`stageGateCatalog[currentStage].blocked\`, show a warning with gate id + reason before proceeding.
|
|
206
210
|
|
|
@@ -221,42 +225,41 @@ If reconciliation warnings were emitted in Step 1, treat them as a pre-advance s
|
|
|
221
225
|
|
|
222
226
|
**Path A — stage NOT complete (any gate unmet):**
|
|
223
227
|
|
|
224
|
-
Load the current stage
|
|
228
|
+
Load the current stage skill:
|
|
225
229
|
- \`${RUNTIME_ROOT}/skills/<skillFolder>/SKILL.md\`
|
|
226
|
-
- \`${RUNTIME_ROOT}/commands/<currentStage>.md\`
|
|
227
230
|
|
|
228
231
|
Execute the stage protocol. The stage skill handles interaction, STOP points, gate tracking, and stage completion via \`node .cclaw/hooks/stage-complete.mjs <stage>\` (canonical flow-state mutation path).
|
|
229
232
|
|
|
230
233
|
${ralphLoopContractSnippet()}
|
|
231
234
|
|
|
232
|
-
Special-case for review: if \`review_criticals_resolved\` is in \`blocked\`, route to rework instead of looping review forever — recommend
|
|
235
|
+
Special-case for review: if \`review_criticals_resolved\` is in \`blocked\`, route to rework instead of looping review forever — recommend \`cclaw internal rewind tdd "review_blocked_by_critical"\`.
|
|
233
236
|
|
|
234
237
|
**Path B — stage IS complete (all gates met, all delegations done):**
|
|
235
238
|
|
|
236
239
|
If \`next\` is \`done\`:
|
|
237
240
|
|
|
238
241
|
When \`currentStage\` is \`ship\`, automatically drive the **closeout chain**
|
|
239
|
-
by inspecting
|
|
242
|
+
by inspecting ${closeoutSubstateInline()}:
|
|
240
243
|
|
|
241
244
|
| shipSubstate | Action |
|
|
242
245
|
|-----------------------|-----------------------------------------------------|
|
|
243
246
|
| \`idle\` / missing | Flip to \`retro_review\` and start retro protocol |
|
|
244
|
-
| \`retro_review\` |
|
|
245
|
-
| \`compound_review\` |
|
|
246
|
-
| \`ready_to_archive\` | Run archive
|
|
247
|
+
| \`retro_review\` | Draft/update \`09-retro.md\`, ask accept/edit/skip |
|
|
248
|
+
| \`compound_review\` | Compound closeout: overlap scan, refresh/supersede, ask approve/skip |
|
|
249
|
+
| \`ready_to_archive\` | Run \`npx cclaw-cli archive\`; reset flow-state on success |
|
|
247
250
|
| \`archived\` | Report "run archived"; stop |
|
|
248
251
|
|
|
249
|
-
Each step owns its own state transition. \`/cc-next\`
|
|
250
|
-
|
|
251
|
-
skill and command contract and executes the protocol in-session.
|
|
252
|
+
Each step owns its own state transition. \`/cc-next\` keeps retro and compound
|
|
253
|
+
in-session, then uses the archive runtime only at \`ready_to_archive\`.
|
|
252
254
|
|
|
253
255
|
Otherwise report **"Flow complete. All stages finished."** and stop.
|
|
254
256
|
|
|
255
|
-
Otherwise (non-terminal \`next\`): load the next stage
|
|
256
|
-
contract, begin execution.
|
|
257
|
+
Otherwise (non-terminal \`next\`): load the next stage skill and begin execution.
|
|
257
258
|
|
|
258
259
|
## Stage order
|
|
259
260
|
|
|
261
|
+
This table is the critical path. After \`ship\`, \`/cc-next\` continues closeout via ${closeoutSubstateInline()}: ${closeoutChainInline()}.
|
|
262
|
+
|
|
260
263
|
| Stage | Next | Skill path |
|
|
261
264
|
|---|---|---|
|
|
262
265
|
${stageRows}
|