cclaw-cli 0.11.0 → 0.13.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/README.md +4 -3
- package/dist/cli.d.ts +8 -0
- package/dist/cli.js +311 -10
- package/dist/config.js +19 -0
- package/dist/constants.d.ts +2 -2
- package/dist/constants.js +13 -1
- package/dist/content/core-agents.d.ts +44 -0
- package/dist/content/core-agents.js +225 -0
- package/dist/content/diff-command.d.ts +2 -0
- package/dist/content/diff-command.js +83 -0
- package/dist/content/doctor-references.d.ts +2 -0
- package/dist/content/doctor-references.js +144 -0
- package/dist/content/examples.js +1 -1
- package/dist/content/feature-command.d.ts +2 -0
- package/dist/content/feature-command.js +120 -0
- package/dist/content/harnesses-doc.d.ts +1 -0
- package/dist/content/harnesses-doc.js +103 -0
- package/dist/content/hook-events.d.ts +4 -0
- package/dist/content/hook-events.js +42 -0
- package/dist/content/hooks.js +47 -1
- package/dist/content/meta-skill.js +3 -2
- package/dist/content/next-command.js +8 -6
- package/dist/content/observe.d.ts +5 -1
- package/dist/content/observe.js +134 -2
- package/dist/content/protocols.js +34 -6
- package/dist/content/research-playbooks.d.ts +8 -0
- package/dist/content/research-playbooks.js +135 -0
- package/dist/content/retro-command.d.ts +2 -0
- package/dist/content/retro-command.js +77 -0
- package/dist/content/rewind-command.d.ts +3 -0
- package/dist/content/rewind-command.js +120 -0
- package/dist/content/skills.js +20 -0
- package/dist/content/stage-schema.d.ts +3 -1
- package/dist/content/stage-schema.js +20 -51
- package/dist/content/status-command.js +43 -35
- package/dist/content/subagents.d.ts +1 -1
- package/dist/content/subagents.js +23 -38
- package/dist/content/tdd-log-command.d.ts +2 -0
- package/dist/content/tdd-log-command.js +75 -0
- package/dist/content/templates.d.ts +1 -1
- package/dist/content/templates.js +84 -16
- package/dist/content/tree-command.d.ts +2 -0
- package/dist/content/tree-command.js +91 -0
- package/dist/delegation.d.ts +1 -0
- package/dist/delegation.js +27 -1
- package/dist/doctor-registry.d.ts +8 -0
- package/dist/doctor-registry.js +127 -0
- package/dist/doctor.d.ts +5 -0
- package/dist/doctor.js +261 -7
- package/dist/feature-system.d.ts +18 -0
- package/dist/feature-system.js +247 -0
- package/dist/flow-state.d.ts +25 -0
- package/dist/flow-state.js +8 -1
- package/dist/harness-adapters.d.ts +7 -0
- package/dist/harness-adapters.js +127 -13
- package/dist/init-detect.d.ts +2 -0
- package/dist/init-detect.js +45 -0
- package/dist/install.js +98 -3
- package/dist/policy.js +27 -0
- package/dist/runs.d.ts +33 -1
- package/dist/runs.js +365 -6
- package/dist/tdd-cycle.d.ts +22 -0
- package/dist/tdd-cycle.js +82 -0
- package/dist/types.d.ts +4 -0
- package/package.json +2 -1
- package/dist/content/agents.d.ts +0 -48
- package/dist/content/agents.js +0 -411
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* In-thread research playbooks.
|
|
3
|
+
*
|
|
4
|
+
* These files intentionally have no YAML frontmatter and are not standalone
|
|
5
|
+
* delegated personas. The primary agent loads and executes them directly.
|
|
6
|
+
*/
|
|
7
|
+
export const RESEARCH_PLAYBOOKS = {
|
|
8
|
+
"repo-scan.md": `# Repo Scan Playbook
|
|
9
|
+
|
|
10
|
+
## Purpose
|
|
11
|
+
|
|
12
|
+
Build a grounded map of existing modules and reuse candidates before design lock.
|
|
13
|
+
|
|
14
|
+
## Steps
|
|
15
|
+
|
|
16
|
+
1. Identify 3-8 task keywords (feature nouns + action verbs).
|
|
17
|
+
2. Search for likely modules with \`rg\` and \`Glob\` patterns.
|
|
18
|
+
3. List existing implementations or close analogs with file citations.
|
|
19
|
+
4. Flag duplication risk and obvious extension points.
|
|
20
|
+
|
|
21
|
+
## Output Contract
|
|
22
|
+
|
|
23
|
+
- Relevant modules: \`path - purpose\`
|
|
24
|
+
- Reuse candidates: \`file:line - why reusable\`
|
|
25
|
+
- Gaps: capabilities not currently present
|
|
26
|
+
|
|
27
|
+
## Guardrails
|
|
28
|
+
|
|
29
|
+
- Read-only procedure.
|
|
30
|
+
- Never invent paths or ownership.
|
|
31
|
+
- If scope is too broad, return bounded partial coverage explicitly.
|
|
32
|
+
`,
|
|
33
|
+
"learnings-lookup.md": `# Learnings Lookup Playbook
|
|
34
|
+
|
|
35
|
+
## Purpose
|
|
36
|
+
|
|
37
|
+
Reuse prior project knowledge before choosing a direction.
|
|
38
|
+
|
|
39
|
+
## Steps
|
|
40
|
+
|
|
41
|
+
1. Read \`.cclaw/knowledge.jsonl\`.
|
|
42
|
+
2. Match by stage/domain keywords from the current task.
|
|
43
|
+
3. Rank matches by confidence and recency.
|
|
44
|
+
4. Return the top entries verbatim.
|
|
45
|
+
|
|
46
|
+
## Output Contract
|
|
47
|
+
|
|
48
|
+
- Matched rules
|
|
49
|
+
- Matched patterns
|
|
50
|
+
- Matched lessons
|
|
51
|
+
- Matched compounds
|
|
52
|
+
- Explicit no-match note when empty
|
|
53
|
+
|
|
54
|
+
## Guardrails
|
|
55
|
+
|
|
56
|
+
- Append-only store: do not rewrite history entries.
|
|
57
|
+
- Prefer exact quote over paraphrase.
|
|
58
|
+
`,
|
|
59
|
+
"framework-docs-lookup.md": `# Framework Docs Lookup Playbook
|
|
60
|
+
|
|
61
|
+
## Purpose
|
|
62
|
+
|
|
63
|
+
Anchor design decisions to version-accurate framework/library docs.
|
|
64
|
+
|
|
65
|
+
## Steps
|
|
66
|
+
|
|
67
|
+
1. Resolve the actual dependency version from lockfiles/manifests.
|
|
68
|
+
2. Fetch official docs for that version (context7 when available).
|
|
69
|
+
3. Extract APIs used by the task and any migration or deprecation notes.
|
|
70
|
+
|
|
71
|
+
## Output Contract
|
|
72
|
+
|
|
73
|
+
- Library + version
|
|
74
|
+
- APIs/signatures touched
|
|
75
|
+
- Relevant breaking changes or gotchas
|
|
76
|
+
- Source links/references
|
|
77
|
+
|
|
78
|
+
## Guardrails
|
|
79
|
+
|
|
80
|
+
- No speculative APIs.
|
|
81
|
+
- If docs conflict or are unclear, mark UNKNOWN and escalate.
|
|
82
|
+
`,
|
|
83
|
+
"best-practices-lookup.md": `# Best Practices Lookup Playbook
|
|
84
|
+
|
|
85
|
+
## Purpose
|
|
86
|
+
|
|
87
|
+
Summarize citable domain practices for a narrow design decision.
|
|
88
|
+
|
|
89
|
+
## Steps
|
|
90
|
+
|
|
91
|
+
1. Narrow the domain to one concrete sub-problem.
|
|
92
|
+
2. Gather 3-5 authoritative sources.
|
|
93
|
+
3. Produce short practice and anti-pattern lists tied to sources.
|
|
94
|
+
|
|
95
|
+
## Output Contract
|
|
96
|
+
|
|
97
|
+
- Recommended practices (\`practice - rationale - source\`)
|
|
98
|
+
- Common traps (\`trap - why it fails - source\`)
|
|
99
|
+
- Decision hooks (1-3 questions to resolve before proceeding)
|
|
100
|
+
|
|
101
|
+
## Guardrails
|
|
102
|
+
|
|
103
|
+
- Cite authoritative sources (official docs/standards).
|
|
104
|
+
- State uncertainty explicitly when consensus is weak.
|
|
105
|
+
`,
|
|
106
|
+
"git-history.md": `# Git History Playbook
|
|
107
|
+
|
|
108
|
+
## Purpose
|
|
109
|
+
|
|
110
|
+
Detect churn, regressions, and ownership signals before locking scope/design.
|
|
111
|
+
|
|
112
|
+
## Steps
|
|
113
|
+
|
|
114
|
+
1. For impacted paths, inspect recent history and themes:
|
|
115
|
+
- \`git log --follow -n 20 -- <path>\`
|
|
116
|
+
2. Check ownership hotspots:
|
|
117
|
+
- \`git blame <path>\`
|
|
118
|
+
- \`git log --since="<window>" --format="%an" -- <path>\`
|
|
119
|
+
3. Search for regression signals:
|
|
120
|
+
- \`git log --since="<window>" --grep="revert|regression" -- <path>\`
|
|
121
|
+
|
|
122
|
+
## Output Contract
|
|
123
|
+
|
|
124
|
+
- Recent themes
|
|
125
|
+
- Revert/regression signals (with SHAs)
|
|
126
|
+
- Ownership hints
|
|
127
|
+
- Collision risks with ongoing refactors
|
|
128
|
+
|
|
129
|
+
## Guardrails
|
|
130
|
+
|
|
131
|
+
- Read-only git usage.
|
|
132
|
+
- If there is no history, say so explicitly.
|
|
133
|
+
`
|
|
134
|
+
};
|
|
135
|
+
export const RESEARCH_PLAYBOOK_FILES = Object.keys(RESEARCH_PLAYBOOKS).sort();
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { RUNTIME_ROOT } from "../constants.js";
|
|
2
|
+
const RETRO_SKILL_FOLDER = "flow-retro";
|
|
3
|
+
const RETRO_SKILL_NAME = "flow-retro";
|
|
4
|
+
function flowStatePath() {
|
|
5
|
+
return `${RUNTIME_ROOT}/state/flow-state.json`;
|
|
6
|
+
}
|
|
7
|
+
function retroArtifactPath() {
|
|
8
|
+
return `${RUNTIME_ROOT}/artifacts/09-retro.md`;
|
|
9
|
+
}
|
|
10
|
+
function knowledgePath() {
|
|
11
|
+
return `${RUNTIME_ROOT}/knowledge.jsonl`;
|
|
12
|
+
}
|
|
13
|
+
export function retroCommandContract() {
|
|
14
|
+
return `# /cc-retro
|
|
15
|
+
|
|
16
|
+
## Purpose
|
|
17
|
+
|
|
18
|
+
Mandatory retrospective gate before archive once ship is complete.
|
|
19
|
+
|
|
20
|
+
## HARD-GATE
|
|
21
|
+
|
|
22
|
+
- Do not mark retro complete without writing \`${retroArtifactPath()}\`.
|
|
23
|
+
- Do not finish retro without appending at least one \`type=compound\` entry into \`${knowledgePath()}\`.
|
|
24
|
+
|
|
25
|
+
## Algorithm
|
|
26
|
+
|
|
27
|
+
1. Read \`${flowStatePath()}\`; confirm ship stage is complete for current run.
|
|
28
|
+
2. Synthesize retrospective artifact \`${retroArtifactPath()}\` with:
|
|
29
|
+
- what slowed this run
|
|
30
|
+
- what accelerated this run
|
|
31
|
+
- concrete repeatable rule for next run
|
|
32
|
+
3. Append >=1 strict-schema JSONL entry to \`${knowledgePath()}\` with:
|
|
33
|
+
- \`type: "compound"\`
|
|
34
|
+
- \`stage: "ship"\` or \`"retro"\`
|
|
35
|
+
4. Update flow-state \`retro\` block:
|
|
36
|
+
- \`required: true\`
|
|
37
|
+
- \`completedAt: <ISO>\`
|
|
38
|
+
- \`compoundEntries: <count>\`
|
|
39
|
+
5. Report completion summary and remind user that \`cclaw archive\` is now unblocked.
|
|
40
|
+
|
|
41
|
+
## Primary skill
|
|
42
|
+
|
|
43
|
+
**${RUNTIME_ROOT}/skills/${RETRO_SKILL_FOLDER}/SKILL.md**
|
|
44
|
+
`;
|
|
45
|
+
}
|
|
46
|
+
export function retroCommandSkillMarkdown() {
|
|
47
|
+
return `---
|
|
48
|
+
name: ${RETRO_SKILL_NAME}
|
|
49
|
+
description: "Run mandatory retrospective and record compound knowledge before archive."
|
|
50
|
+
---
|
|
51
|
+
|
|
52
|
+
# /cc-retro
|
|
53
|
+
|
|
54
|
+
## HARD-GATE
|
|
55
|
+
|
|
56
|
+
Archive must remain blocked until retro artifact exists and compound knowledge was appended.
|
|
57
|
+
|
|
58
|
+
## Protocol
|
|
59
|
+
|
|
60
|
+
1. Confirm ship completion from \`${flowStatePath()}\`.
|
|
61
|
+
2. Create/update \`${retroArtifactPath()}\` with concise retrospective sections:
|
|
62
|
+
- outcomes
|
|
63
|
+
- bottlenecks
|
|
64
|
+
- reusable acceleration patterns
|
|
65
|
+
3. Append at least one \`compound\` knowledge entry into \`${knowledgePath()}\`.
|
|
66
|
+
4. Update \`flow-state.json.retro\` with completion timestamp + compound count.
|
|
67
|
+
5. Print explicit completion line:
|
|
68
|
+
- \`retro gate: complete\`
|
|
69
|
+
- \`compound entries added: <N>\`
|
|
70
|
+
|
|
71
|
+
## Validation
|
|
72
|
+
|
|
73
|
+
- \`${retroArtifactPath()}\` exists and is non-empty.
|
|
74
|
+
- \`${knowledgePath()}\` contains >=1 valid \`compound\` line.
|
|
75
|
+
- \`retro.completedAt\` is set in flow-state.
|
|
76
|
+
`;
|
|
77
|
+
}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { RUNTIME_ROOT } from "../constants.js";
|
|
2
|
+
const REWIND_SKILL_FOLDER = "flow-rewind";
|
|
3
|
+
const REWIND_SKILL_NAME = "flow-rewind";
|
|
4
|
+
function flowStatePath() {
|
|
5
|
+
return `${RUNTIME_ROOT}/state/flow-state.json`;
|
|
6
|
+
}
|
|
7
|
+
function artifactsPath() {
|
|
8
|
+
return `${RUNTIME_ROOT}/artifacts`;
|
|
9
|
+
}
|
|
10
|
+
function rewindLogPath() {
|
|
11
|
+
return `${RUNTIME_ROOT}/state/rewind-log.jsonl`;
|
|
12
|
+
}
|
|
13
|
+
export function rewindCommandContract() {
|
|
14
|
+
return `# /cc-rewind
|
|
15
|
+
|
|
16
|
+
## Purpose
|
|
17
|
+
|
|
18
|
+
Rewind active flow to an earlier stage and atomically invalidate downstream work.
|
|
19
|
+
|
|
20
|
+
## HARD-GATE
|
|
21
|
+
|
|
22
|
+
- Never rewind without preserving downstream artifact history.
|
|
23
|
+
- Mark downstream stages as stale; do not leave completedStages pointing to invalidated work.
|
|
24
|
+
- Record a rewind reason in \`${rewindLogPath()}\`.
|
|
25
|
+
|
|
26
|
+
## Inputs
|
|
27
|
+
|
|
28
|
+
\`/cc-rewind <target-stage> [reason]\`
|
|
29
|
+
|
|
30
|
+
## Algorithm
|
|
31
|
+
|
|
32
|
+
1. Read \`${flowStatePath()}\` and current track.
|
|
33
|
+
2. Validate \`target-stage\` belongs to the active track and is not ahead of current stage.
|
|
34
|
+
3. Compute downstream stages to invalidate (all stages after target that were completed or current).
|
|
35
|
+
4. Archive downstream artifacts into \`${artifactsPath()}/_rewind-archive/<rewind-id>/\`.
|
|
36
|
+
5. Rename active downstream artifacts to \`*.stale.md\`.
|
|
37
|
+
6. Update flow-state:
|
|
38
|
+
- \`currentStage = target-stage\`
|
|
39
|
+
- trim \`completedStages\` to stages before target-stage
|
|
40
|
+
- clear gate evidence/catalog for target-stage and downstream
|
|
41
|
+
- mark downstream entries in \`staleStages\`
|
|
42
|
+
- append \`rewinds[]\` record
|
|
43
|
+
7. Append JSON line to \`${rewindLogPath()}\`.
|
|
44
|
+
|
|
45
|
+
## Output
|
|
46
|
+
|
|
47
|
+
- Rewind id
|
|
48
|
+
- from -> to stage
|
|
49
|
+
- Invalidated stages list
|
|
50
|
+
- Number of stale artifacts
|
|
51
|
+
|
|
52
|
+
## Primary skill
|
|
53
|
+
|
|
54
|
+
**${RUNTIME_ROOT}/skills/${REWIND_SKILL_FOLDER}/SKILL.md**
|
|
55
|
+
`;
|
|
56
|
+
}
|
|
57
|
+
export function rewindAcknowledgeCommandContract() {
|
|
58
|
+
return `# /cc-rewind-ack
|
|
59
|
+
|
|
60
|
+
## Purpose
|
|
61
|
+
|
|
62
|
+
Acknowledge and clear stale-stage markers after downstream work is intentionally redone.
|
|
63
|
+
|
|
64
|
+
## Input
|
|
65
|
+
|
|
66
|
+
\`/cc-rewind-ack <stage>\`
|
|
67
|
+
|
|
68
|
+
## HARD-GATE
|
|
69
|
+
|
|
70
|
+
- Only clear stale marker for the requested stage.
|
|
71
|
+
- Never modify completedStages from this command.
|
|
72
|
+
|
|
73
|
+
## Algorithm
|
|
74
|
+
|
|
75
|
+
1. Read \`${flowStatePath()}\`.
|
|
76
|
+
2. If \`staleStages.<stage>\` is missing, report no-op.
|
|
77
|
+
3. Remove \`staleStages.<stage>\`.
|
|
78
|
+
4. Write updated flow-state.
|
|
79
|
+
5. Print remaining stale stages (if any).
|
|
80
|
+
|
|
81
|
+
## Primary skill
|
|
82
|
+
|
|
83
|
+
**${RUNTIME_ROOT}/skills/${REWIND_SKILL_FOLDER}/SKILL.md**
|
|
84
|
+
`;
|
|
85
|
+
}
|
|
86
|
+
export function rewindCommandSkillMarkdown() {
|
|
87
|
+
return `---
|
|
88
|
+
name: ${REWIND_SKILL_NAME}
|
|
89
|
+
description: "Rewind active flow stage safely and acknowledge stale invalidations."
|
|
90
|
+
---
|
|
91
|
+
|
|
92
|
+
# /cc-rewind + /cc-rewind-ack
|
|
93
|
+
|
|
94
|
+
## HARD-GATE
|
|
95
|
+
|
|
96
|
+
Rewind is an atomic state transition. Never leave flow-state half-updated (for example currentStage changed but stale markers/artifact archive missing).
|
|
97
|
+
|
|
98
|
+
## Protocol
|
|
99
|
+
|
|
100
|
+
### rewind
|
|
101
|
+
1. Validate target stage belongs to current track and is upstream.
|
|
102
|
+
2. Archive downstream artifacts under \`${artifactsPath()}/_rewind-archive/<rewind-id>/\`.
|
|
103
|
+
3. Mark downstream artifacts as stale (\`*.stale.md\`).
|
|
104
|
+
4. Reset downstream gate catalog and guard evidence.
|
|
105
|
+
5. Record \`rewinds[]\` and \`staleStages\` in flow-state.
|
|
106
|
+
6. Append rewind entry into \`${rewindLogPath()}\`.
|
|
107
|
+
|
|
108
|
+
### rewind-ack
|
|
109
|
+
1. Load flow-state stale map.
|
|
110
|
+
2. Remove exactly one stale stage marker.
|
|
111
|
+
3. Report remaining stale stages.
|
|
112
|
+
|
|
113
|
+
## Validation checklist
|
|
114
|
+
|
|
115
|
+
- \`${flowStatePath()}\` remains valid JSON.
|
|
116
|
+
- \`currentStage\` equals requested rewind target.
|
|
117
|
+
- invalidated stages are absent from \`completedStages\`.
|
|
118
|
+
- archived copies exist for each moved artifact.
|
|
119
|
+
`;
|
|
120
|
+
}
|
package/dist/content/skills.js
CHANGED
|
@@ -54,6 +54,22 @@ Mandatory delegations for this stage: ${mandatoryList}.
|
|
|
54
54
|
Record completion/waiver in \`${delegationLogRel}\` before stage completion.
|
|
55
55
|
`;
|
|
56
56
|
}
|
|
57
|
+
function researchPlaybooksBlock(stage) {
|
|
58
|
+
const playbooks = stageSchema(stage).researchPlaybooks ?? [];
|
|
59
|
+
if (playbooks.length === 0)
|
|
60
|
+
return "";
|
|
61
|
+
const rows = playbooks
|
|
62
|
+
.map((playbook) => `- \`${RUNTIME_ROOT}/skills/${playbook}\``)
|
|
63
|
+
.join("\n");
|
|
64
|
+
return `## Research Playbooks
|
|
65
|
+
|
|
66
|
+
Use these in-thread research procedures before locking this stage. They are
|
|
67
|
+
playbooks (not delegated personas), so execute them in the primary agent context
|
|
68
|
+
and record outcomes in the stage artifact when relevant.
|
|
69
|
+
|
|
70
|
+
${rows}
|
|
71
|
+
`;
|
|
72
|
+
}
|
|
57
73
|
function reviewSectionsBlock(stage) {
|
|
58
74
|
const schema = stageSchema(stage);
|
|
59
75
|
if (schema.reviewSections.length === 0)
|
|
@@ -92,6 +108,9 @@ function waveExecutionModeBlock(stage) {
|
|
|
92
108
|
|
|
93
109
|
Execute the current dependency wave task-by-task (RED -> GREEN -> REFACTOR).
|
|
94
110
|
Stop on BLOCKED status or when user input is required.
|
|
111
|
+
Apply preamble budget discipline: one preamble per wave, then continue without
|
|
112
|
+
repeating it for each task. Re-emit only when the wave boundary changes or the
|
|
113
|
+
plan changes materially.
|
|
95
114
|
|
|
96
115
|
Detailed walkthrough:
|
|
97
116
|
\`.cclaw/${STAGE_EXAMPLES_REFERENCE_DIR}/tdd-wave-walkthrough.md\`
|
|
@@ -313,6 +332,7 @@ ${schema.requiredContext.length > 0 ? schema.requiredContext.map((item) => `- ${
|
|
|
313
332
|
|
|
314
333
|
${contextLoadingBlock(stage)}
|
|
315
334
|
${autoSubagentDispatchBlock(stage)}
|
|
335
|
+
${researchPlaybooksBlock(stage)}
|
|
316
336
|
|
|
317
337
|
## Outputs
|
|
318
338
|
${schema.outputs.map((item) => `- ${item}`).join("\n")}
|
|
@@ -33,7 +33,7 @@ export interface ArtifactValidation {
|
|
|
33
33
|
validationRule: string;
|
|
34
34
|
}
|
|
35
35
|
export interface StageAutoSubagentDispatch {
|
|
36
|
-
agent: "planner" | "
|
|
36
|
+
agent: "planner" | "reviewer" | "security-reviewer" | "test-author" | "doc-updater";
|
|
37
37
|
/**
|
|
38
38
|
* - `mandatory` — must be dispatched (or explicitly waived) before stage transition.
|
|
39
39
|
* - `proactive` — should be dispatched automatically when context matches `when`.
|
|
@@ -81,6 +81,8 @@ export interface StageSchema {
|
|
|
81
81
|
requiredEvidence: string[];
|
|
82
82
|
inputs: string[];
|
|
83
83
|
requiredContext: string[];
|
|
84
|
+
/** In-thread research procedures for this stage (`.cclaw/skills/research/*.md`). */
|
|
85
|
+
researchPlaybooks?: string[];
|
|
84
86
|
outputs: string[];
|
|
85
87
|
blockers: string[];
|
|
86
88
|
exitCriteria: string[];
|
|
@@ -190,6 +190,10 @@ const BRAINSTORM = {
|
|
|
190
190
|
"current behavior of affected area",
|
|
191
191
|
"business and delivery constraints"
|
|
192
192
|
],
|
|
193
|
+
researchPlaybooks: [
|
|
194
|
+
"research/repo-scan.md",
|
|
195
|
+
"research/learnings-lookup.md"
|
|
196
|
+
],
|
|
193
197
|
outputs: [
|
|
194
198
|
"approved design direction",
|
|
195
199
|
"alternatives with trade-offs",
|
|
@@ -339,6 +343,9 @@ const SCOPE = {
|
|
|
339
343
|
"existing capabilities and reusable components",
|
|
340
344
|
"delivery deadlines and risk tolerance"
|
|
341
345
|
],
|
|
346
|
+
researchPlaybooks: [
|
|
347
|
+
"research/git-history.md"
|
|
348
|
+
],
|
|
342
349
|
outputs: ["scope mode decision", "scope contract", "discretion areas list", "deferred scope list", "scope summary", "scope completion dashboard"],
|
|
343
350
|
blockers: [
|
|
344
351
|
"scope mode not selected",
|
|
@@ -553,6 +560,10 @@ const DESIGN = {
|
|
|
553
560
|
"operational constraints",
|
|
554
561
|
"security and reliability expectations"
|
|
555
562
|
],
|
|
563
|
+
researchPlaybooks: [
|
|
564
|
+
"research/framework-docs-lookup.md",
|
|
565
|
+
"research/best-practices-lookup.md"
|
|
566
|
+
],
|
|
556
567
|
outputs: [
|
|
557
568
|
"architecture lock",
|
|
558
569
|
"risk and failure map",
|
|
@@ -1266,7 +1277,7 @@ const REVIEW = {
|
|
|
1266
1277
|
checklist: [
|
|
1267
1278
|
"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.",
|
|
1268
1279
|
"Change-Size Check — ~100 lines = normal. ~300 lines = consider splitting. ~1000+ lines = strongly recommend stacked PRs. Flag large diffs to the user.",
|
|
1269
|
-
"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
|
|
1280
|
+
"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 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).",
|
|
1270
1281
|
"Load upstream evidence — read TDD artifact (RED + GREEN + REFACTOR), spec, and plan. Verify evidence chain is unbroken.",
|
|
1271
1282
|
"Layer 1: Spec Compliance — check every acceptance criterion against implementation. Verdict: pass/fail per criterion.",
|
|
1272
1283
|
"Layer 2a: Correctness — logic errors, race conditions, boundary violations, null handling.",
|
|
@@ -1642,20 +1653,6 @@ const STAGE_AUTO_SUBAGENT_DISPATCH = {
|
|
|
1642
1653
|
when: "When request is ambiguous, multi-surface, or spans multiple modules.",
|
|
1643
1654
|
purpose: "Map scope and alternatives before direction lock.",
|
|
1644
1655
|
requiresUserGate: false
|
|
1645
|
-
},
|
|
1646
|
-
{
|
|
1647
|
-
agent: "repo-research-analyst",
|
|
1648
|
-
mode: "proactive",
|
|
1649
|
-
when: "When the user's idea touches an unfamiliar module, stack, or integration surface.",
|
|
1650
|
-
purpose: "Parallel fan-out: summarise existing code paths, tech stack, and similar features already present — feeds the alternatives list.",
|
|
1651
|
-
requiresUserGate: false
|
|
1652
|
-
},
|
|
1653
|
-
{
|
|
1654
|
-
agent: "learnings-researcher",
|
|
1655
|
-
mode: "proactive",
|
|
1656
|
-
when: "On every non-trivial brainstorm where `.cclaw/knowledge.jsonl` has entries.",
|
|
1657
|
-
purpose: "Surface prior learnings and anti-patterns that apply to the current task before direction lock.",
|
|
1658
|
-
requiresUserGate: false
|
|
1659
1656
|
}
|
|
1660
1657
|
],
|
|
1661
1658
|
scope: [
|
|
@@ -1665,13 +1662,6 @@ const STAGE_AUTO_SUBAGENT_DISPATCH = {
|
|
|
1665
1662
|
when: "Always during scope shaping.",
|
|
1666
1663
|
purpose: "Challenge premise, map alternatives, and produce explicit in/out contract.",
|
|
1667
1664
|
requiresUserGate: false
|
|
1668
|
-
},
|
|
1669
|
-
{
|
|
1670
|
-
agent: "git-history-analyzer",
|
|
1671
|
-
mode: "proactive",
|
|
1672
|
-
when: "When scope touches modules with churn, recent regressions, or unclear ownership.",
|
|
1673
|
-
purpose: "Read recent commits, PRs, and issue references for the affected paths before scope lock.",
|
|
1674
|
-
requiresUserGate: false
|
|
1675
1665
|
}
|
|
1676
1666
|
],
|
|
1677
1667
|
design: [
|
|
@@ -1688,20 +1678,6 @@ const STAGE_AUTO_SUBAGENT_DISPATCH = {
|
|
|
1688
1678
|
when: "When trust boundaries, auth, secrets, or external inputs are involved.",
|
|
1689
1679
|
purpose: "Catch design-level security risks before implementation.",
|
|
1690
1680
|
requiresUserGate: false
|
|
1691
|
-
},
|
|
1692
|
-
{
|
|
1693
|
-
agent: "framework-docs-researcher",
|
|
1694
|
-
mode: "proactive",
|
|
1695
|
-
when: "When a specific framework/library version is detected and a non-trivial API is in play.",
|
|
1696
|
-
purpose: "Retrieve version-specific docs + migration notes so the design does not rely on stale training priors.",
|
|
1697
|
-
requiresUserGate: false
|
|
1698
|
-
},
|
|
1699
|
-
{
|
|
1700
|
-
agent: "best-practices-researcher",
|
|
1701
|
-
mode: "conditional",
|
|
1702
|
-
when: "When the user flags a quality axis (performance, accessibility, reliability) as primary.",
|
|
1703
|
-
purpose: "Pull domain best-practices and contrast them with the current design choice.",
|
|
1704
|
-
requiresUserGate: false
|
|
1705
1681
|
}
|
|
1706
1682
|
],
|
|
1707
1683
|
spec: [
|
|
@@ -1713,7 +1689,7 @@ const STAGE_AUTO_SUBAGENT_DISPATCH = {
|
|
|
1713
1689
|
requiresUserGate: false
|
|
1714
1690
|
},
|
|
1715
1691
|
{
|
|
1716
|
-
agent: "
|
|
1692
|
+
agent: "reviewer",
|
|
1717
1693
|
mode: "proactive",
|
|
1718
1694
|
when: "When acceptance criteria and edge cases are drafted and need independent validation before plan stage.",
|
|
1719
1695
|
purpose: "Independent review of spec against measurability, testability, and completeness before locking the contract for plan.",
|
|
@@ -1747,17 +1723,10 @@ const STAGE_AUTO_SUBAGENT_DISPATCH = {
|
|
|
1747
1723
|
],
|
|
1748
1724
|
review: [
|
|
1749
1725
|
{
|
|
1750
|
-
agent: "
|
|
1726
|
+
agent: "reviewer",
|
|
1751
1727
|
mode: "mandatory",
|
|
1752
1728
|
when: "Always in review stage.",
|
|
1753
|
-
purpose: "
|
|
1754
|
-
requiresUserGate: false
|
|
1755
|
-
},
|
|
1756
|
-
{
|
|
1757
|
-
agent: "code-reviewer",
|
|
1758
|
-
mode: "mandatory",
|
|
1759
|
-
when: "Always in review stage.",
|
|
1760
|
-
purpose: "Assess correctness, maintainability, architecture, and ship risk.",
|
|
1729
|
+
purpose: "Run spec compliance and code-quality passes with file evidence.",
|
|
1761
1730
|
requiresUserGate: false
|
|
1762
1731
|
},
|
|
1763
1732
|
{
|
|
@@ -1769,10 +1738,10 @@ const STAGE_AUTO_SUBAGENT_DISPATCH = {
|
|
|
1769
1738
|
skill: "security-audit"
|
|
1770
1739
|
},
|
|
1771
1740
|
{
|
|
1772
|
-
agent: "
|
|
1741
|
+
agent: "reviewer",
|
|
1773
1742
|
mode: "conditional",
|
|
1774
1743
|
condition: "diff_lines_gt:100||files_touched_gt:10||trust_boundary_changed",
|
|
1775
|
-
when: "When the diff exceeds 100 changed lines, touches more than 10 files, or modifies trust boundaries — dispatch a SECOND, independent
|
|
1744
|
+
when: "When the diff exceeds 100 changed lines, touches more than 10 files, or modifies trust boundaries — dispatch a SECOND, independent reviewer with the adversarial-review skill loaded so the review army has at least two voices on a high-blast-radius change.",
|
|
1776
1745
|
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.",
|
|
1777
1746
|
requiresUserGate: false,
|
|
1778
1747
|
skill: "adversarial-review"
|
|
@@ -1787,10 +1756,10 @@ const STAGE_AUTO_SUBAGENT_DISPATCH = {
|
|
|
1787
1756
|
requiresUserGate: false
|
|
1788
1757
|
},
|
|
1789
1758
|
{
|
|
1790
|
-
agent: "
|
|
1759
|
+
agent: "security-reviewer",
|
|
1791
1760
|
mode: "proactive",
|
|
1792
|
-
when: "When release involves broad blast radius or unresolved concerns.",
|
|
1793
|
-
purpose: "Provide final
|
|
1761
|
+
when: "When release involves broad blast radius, trust-boundary movement, or unresolved security concerns.",
|
|
1762
|
+
purpose: "Provide final exploitability check before release finalization.",
|
|
1794
1763
|
requiresUserGate: false
|
|
1795
1764
|
}
|
|
1796
1765
|
]
|