cclaw-cli 2.0.0 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/artifact-linter/brainstorm.js +13 -2
- package/dist/artifact-linter/design.js +14 -3
- package/dist/artifact-linter/scope.js +20 -33
- package/dist/artifact-linter/shared.d.ts +48 -7
- package/dist/artifact-linter/shared.js +130 -55
- package/dist/artifact-linter.d.ts +11 -1
- package/dist/artifact-linter.js +30 -16
- package/dist/cli.js +2 -9
- package/dist/config.d.ts +11 -67
- package/dist/config.js +59 -649
- package/dist/content/examples.js +8 -0
- package/dist/content/hook-events.js +0 -3
- package/dist/content/hook-manifest.d.ts +5 -2
- package/dist/content/hook-manifest.js +18 -64
- package/dist/content/hooks.js +2 -1
- package/dist/content/node-hooks.d.ts +0 -26
- package/dist/content/node-hooks.js +237 -105
- package/dist/content/observe.js +2 -1
- package/dist/content/opencode-plugin.js +1 -72
- package/dist/content/review-prompts.js +3 -3
- package/dist/content/skills-elicitation.js +58 -20
- package/dist/content/skills.js +19 -6
- package/dist/content/stage-schema.js +36 -18
- package/dist/content/stages/brainstorm.js +3 -3
- package/dist/content/stages/design.js +4 -4
- package/dist/content/stages/plan.js +3 -3
- package/dist/content/stages/schema-types.d.ts +9 -0
- package/dist/content/stages/scope.js +8 -8
- package/dist/content/stages/tdd.js +11 -11
- package/dist/content/templates.d.ts +8 -1
- package/dist/content/templates.js +80 -18
- package/dist/gate-evidence.d.ts +25 -1
- package/dist/gate-evidence.js +35 -8
- package/dist/harness-adapters.js +8 -0
- package/dist/hook-schema.js +3 -0
- package/dist/hook-schemas/claude-hooks.v1.json +0 -2
- package/dist/hook-schemas/codex-hooks.v1.json +0 -3
- package/dist/hook-schemas/cursor-hooks.v1.json +0 -2
- package/dist/install.d.ts +2 -7
- package/dist/install.js +42 -131
- package/dist/internal/advance-stage/advance.d.ts +1 -0
- package/dist/internal/advance-stage/advance.js +5 -2
- package/dist/internal/compound-readiness.js +1 -16
- package/dist/internal/early-loop-status.js +1 -3
- package/dist/internal/runtime-integrity.js +0 -20
- package/dist/policy.js +6 -9
- package/dist/runtime/run-hook.mjs +237 -213
- package/dist/tdd-verification-evidence.js +6 -18
- package/dist/types.d.ts +0 -56
- package/package.json +1 -1
|
@@ -609,10 +609,7 @@ export default function cclawPlugin(ctx) {
|
|
|
609
609
|
eventType === "session.updated";
|
|
610
610
|
if (isSessionLifecycle) {
|
|
611
611
|
// Keep OpenCode aligned with Claude/Cursor/Codex: session-start is
|
|
612
|
-
// the canonical rehydrate path
|
|
613
|
-
// Ralph Loop, compound readiness, and hook-error breadcrumbs. The
|
|
614
|
-
// plugin refreshes its local bootstrap cache afterwards so the system
|
|
615
|
-
// transform sees the side effects from the hook runtime.
|
|
612
|
+
// the canonical rehydrate path.
|
|
616
613
|
await runHookScript("session-start", eventData ?? {});
|
|
617
614
|
await refreshBootstrapCache(true);
|
|
618
615
|
}
|
|
@@ -620,74 +617,6 @@ export default function cclawPlugin(ctx) {
|
|
|
620
617
|
await runHookScript("stop-handoff", { loop_count: 0 });
|
|
621
618
|
}
|
|
622
619
|
},
|
|
623
|
-
"tool.execute.before": async (input, output) => {
|
|
624
|
-
const disabled = isCclawDisabled();
|
|
625
|
-
if (disabled.disabled) {
|
|
626
|
-
// Explicit user override (CCLAW_DISABLE=1 et al): stay fully out
|
|
627
|
-
// of the way. Any real problem with the guard chain should not
|
|
628
|
-
// prevent the user from unblocking themselves.
|
|
629
|
-
noteDisabled(disabled);
|
|
630
|
-
return;
|
|
631
|
-
}
|
|
632
|
-
const payload = normalizeToolPayload(input, output);
|
|
633
|
-
if (isSafeReadOnlyTool(payload)) {
|
|
634
|
-
// Read-only tools bypass guards — they cannot mutate state and
|
|
635
|
-
// blocking them gives users an unusable session when guards are
|
|
636
|
-
// misconfigured or cclaw isn't fully initialized.
|
|
637
|
-
return;
|
|
638
|
-
}
|
|
639
|
-
if (!isCclawInitialized()) {
|
|
640
|
-
// Project has no flow-state or hook runtime: cclaw isn't in use
|
|
641
|
-
// here. Never block the user's tools because of setup they didn't
|
|
642
|
-
// ask for. Surface a single advisory so they can notice.
|
|
643
|
-
noteNotInitialized();
|
|
644
|
-
return;
|
|
645
|
-
}
|
|
646
|
-
const [promptOk, workflowOk] = await Promise.all([
|
|
647
|
-
runHookScript("prompt-guard", payload),
|
|
648
|
-
runHookScript("workflow-guard", payload)
|
|
649
|
-
]);
|
|
650
|
-
if (!promptOk || !workflowOk) {
|
|
651
|
-
const failed = !promptOk ? "prompt-guard" : "workflow-guard";
|
|
652
|
-
const rawDetail = lastHookStderr.get(failed) || "";
|
|
653
|
-
const detail = rawDetail.length > 0 ? rawDetail.slice(-400) : "(no stderr captured)";
|
|
654
|
-
if (looksLikeInfrastructureFailure(rawDetail)) {
|
|
655
|
-
// Never let a broken hook runtime or misrouted child-process
|
|
656
|
-
// stderr (yargs help, Node crash, ENOENT, timeout) masquerade
|
|
657
|
-
// as a policy block. Log the infra hit and let the user keep
|
|
658
|
-
// working regardless of strictness.
|
|
659
|
-
logToFile(
|
|
660
|
-
"infra: " + failed + " non-zero exit with non-guard stderr — treated as infrastructure failure, tool allowed. " +
|
|
661
|
-
"stderr=" + detail.replace(/\\s+/g, " ").slice(0, 300)
|
|
662
|
-
);
|
|
663
|
-
return;
|
|
664
|
-
}
|
|
665
|
-
const strictness = await resolveStrictness();
|
|
666
|
-
if (strictness !== "strict") {
|
|
667
|
-
// Advisory mode (the default) — every guard refusal is a hint,
|
|
668
|
-
// not a hard stop. Users report the "failure" as a log line
|
|
669
|
-
// and keep working. Only \`strictness: strict\` in config.yaml
|
|
670
|
-
// or CCLAW_STRICTNESS=strict upgrades this to a thrown block.
|
|
671
|
-
logToFile(
|
|
672
|
-
"advisory: " + failed + " flagged tool.execute.before (strictness=" +
|
|
673
|
-
strictness + "). detail=" + detail.replace(/\\s+/g, " ").slice(0, 300)
|
|
674
|
-
);
|
|
675
|
-
return;
|
|
676
|
-
}
|
|
677
|
-
throw new Error(
|
|
678
|
-
"cclaw " + failed + " blocked tool.execute.before.\\n" +
|
|
679
|
-
"Reason: " + detail + "\\n" +
|
|
680
|
-
"Diagnose: run \`npx cclaw-cli sync\` in project root.\\n" +
|
|
681
|
-
"Bypass (temporary): export CCLAW_DISABLE=1 before starting OpenCode,\\n" +
|
|
682
|
-
"or set \`strictness: advisory\` in .cclaw/config.yaml."
|
|
683
|
-
);
|
|
684
|
-
}
|
|
685
|
-
},
|
|
686
|
-
"tool.execute.after": async (input, output) => {
|
|
687
|
-
const payload = normalizeToolPayload(input, output);
|
|
688
|
-
await runHookScript("context-monitor", payload);
|
|
689
|
-
void refreshBootstrapCache(false);
|
|
690
|
-
},
|
|
691
620
|
"experimental.chat.system.transform": (payload) => {
|
|
692
621
|
const bootstrap = getBootstrap();
|
|
693
622
|
if (!bootstrap) return payload;
|
|
@@ -53,7 +53,7 @@ value. Do not nitpick wording.
|
|
|
53
53
|
| 10-star delta | Is there a better high-leverage scope move worth cherry-picking? |
|
|
54
54
|
| Boundary | Are accepted, deferred, and excluded items unambiguous? |
|
|
55
55
|
| Mode fit | Does the selected mode match the evidence: SCOPE EXPANSION, SELECTIVE EXPANSION, HOLD SCOPE, or SCOPE REDUCTION? |
|
|
56
|
-
| Downstream refs | Are R-IDs and
|
|
56
|
+
| Downstream refs | Are R-IDs and D-XX decision IDs ready for design/spec/plan? |
|
|
57
57
|
|
|
58
58
|
## Output
|
|
59
59
|
|
|
@@ -82,7 +82,7 @@ rework, missing failure behavior, or unverifiable acceptance criteria.
|
|
|
82
82
|
| Architecture | Are component boundaries concrete and aligned with scope? |
|
|
83
83
|
| Data flow | Are inputs, outputs, persistence, and async/sync edges explicit? |
|
|
84
84
|
| Failure modes | Does every meaningful failure have detection, rescue, and user-visible behavior? |
|
|
85
|
-
| Traceability | Do design decisions reference relevant R-IDs and
|
|
85
|
+
| Traceability | Do design decisions reference relevant R-IDs and D-XX decision IDs? |
|
|
86
86
|
| Verification | Is each risky choice testable by spec/plan/TDD? |
|
|
87
87
|
| Overbuild | Is any architecture stronger than the locked scope actually needs? |
|
|
88
88
|
|
|
@@ -95,7 +95,7 @@ Record findings in the design artifact's review section:
|
|
|
95
95
|
**Status:** Approved | Issues Found
|
|
96
96
|
|
|
97
97
|
**Issues:**
|
|
98
|
-
- [R#/
|
|
98
|
+
- [R#/D-XX]: <specific issue> — <why it matters>
|
|
99
99
|
|
|
100
100
|
**Recommendations:**
|
|
101
101
|
- <advisory item or None>
|
|
@@ -18,18 +18,38 @@ export function adaptiveElicitationSkillMarkdown() {
|
|
|
18
18
|
const budgetTable = renderQuestionBudgetHintTable();
|
|
19
19
|
return `---
|
|
20
20
|
name: adaptive-elicitation
|
|
21
|
-
description: "Harness-native one-question-at-a-time dialogue for brainstorm/scope/design with stop signals, smart-skip, and append-only Q&A logging."
|
|
21
|
+
description: "Harness-native one-question-at-a-time dialogue for brainstorm/scope/design with stop signals, smart-skip, and append-only Q&A logging. Walking forcing questions in order is mandatory; the linter blocks stage-complete when Q&A Log is below floor."
|
|
22
22
|
---
|
|
23
23
|
|
|
24
24
|
# Adaptive Elicitation
|
|
25
25
|
|
|
26
26
|
Pinned anchor: "Don't tell it what to do, give it success criteria and watch it go."
|
|
27
27
|
|
|
28
|
-
##
|
|
28
|
+
## Anti-pattern (BAD examples — never do these)
|
|
29
|
+
|
|
30
|
+
These behaviors are the exact reason this skill exists. The linter will block your stage-complete if you do them.
|
|
31
|
+
|
|
32
|
+
- **Bad**: User asks for a "simple web app" -> agent asks 1 question about stack -> 1 question about auth -> drafts the brainstorm artifact and asks for approval.
|
|
33
|
+
- **Good**: User asks for a "simple web app" -> agent asks Q1 (what pain) -> Q2 (direct path) -> Q3 (do-nothing cost) -> Q4 (first operator/user) -> Q5 (no-go boundaries) -> self-eval: clear -> drafts the brainstorm artifact.
|
|
34
|
+
|
|
35
|
+
- **Bad**: Agent immediately dispatches a subagent (\`product-discovery\`, \`critic\`, \`planner\`) at the start of brainstorm/scope/design to "gather context" before any user dialogue.
|
|
36
|
+
- **Good**: Agent walks the Q&A loop with the user first; subagent dispatch happens only after the user approves the elicitation outcome.
|
|
37
|
+
|
|
38
|
+
- **Bad**: Agent batches 3-5 grill questions into one large message and asks the user to answer them all at once.
|
|
39
|
+
- **Good**: Agent asks one grill question, waits, logs the answer, asks the next.
|
|
40
|
+
|
|
41
|
+
- **Bad**: Agent skips forcing questions because it "already has a good idea" of the answer.
|
|
42
|
+
- **Good**: Agent asks the forcing question; if the user's reply confirms the assumption, log it as \`asked (confirmed assumption)\` and move on. Do not silently skip.
|
|
43
|
+
|
|
44
|
+
## HARD-GATE (machine-enforced)
|
|
45
|
+
|
|
29
46
|
- User does not run cclaw manually. Do not tell the user to run CLI commands for answers.
|
|
30
47
|
- Ask exactly one question per turn and wait for the answer before asking the next one.
|
|
31
48
|
- Use harness-native question tools first; prose fallback is allowed only when the tool is unavailable.
|
|
32
49
|
- Keep a running Q&A trace in the active artifact under \`## Q&A Log\` in \`${RUNTIME_ROOT}/artifacts/\` as append-only rows.
|
|
50
|
+
- **Hard floor**: do NOT advance the stage (do NOT call \`stage-complete.mjs\`) until \`## Q&A Log\` contains at least \`min(track, stage)\` substantive entries OR an explicit user stop-signal is recorded as a row. The linter rule \`qa_log_below_min\` enforces this; \`stage-complete\` will fail otherwise.
|
|
51
|
+
- **NEVER run shell hash commands** (\`shasum\`, \`sha256sum\`, \`md5sum\`, \`Get-FileHash\`, \`certutil\`, etc.) to compute artifact hashes. If a linter ever asks you for a hash, that is a linter bug — report failure and stop, do not auto-fix in bash.
|
|
52
|
+
- **NEVER paste cclaw command lines into chat** (e.g. \`node .cclaw/hooks/stage-complete.mjs ... --evidence-json '{...}'\`). Run them via the tool layer; report only the resulting summary. The user does not run cclaw manually and seeing the command line is noise.
|
|
33
53
|
|
|
34
54
|
## Harness Question Surface
|
|
35
55
|
|
|
@@ -43,67 +63,81 @@ If unavailable, ask one concise prose question and explicitly wait for chat answ
|
|
|
43
63
|
|
|
44
64
|
## Core Protocol
|
|
45
65
|
|
|
46
|
-
1. Ask one decision-changing question.
|
|
66
|
+
1. Ask one decision-changing question via the harness-native question tool.
|
|
47
67
|
2. Wait for the answer.
|
|
48
68
|
3. Append one row to \`## Q&A Log\`: \`Turn | Question | User answer (1-line) | Decision impact\`.
|
|
49
69
|
4. Self-evaluate:
|
|
50
70
|
- What did I learn?
|
|
51
71
|
- Is context enough to draft now? (yes/no + reason)
|
|
52
|
-
-
|
|
53
|
-
|
|
72
|
+
- Have I covered all stage forcing questions in order? (yes/no + which remain)
|
|
73
|
+
- If forcing questions remain or context is incomplete, what is the next decision-changing question?
|
|
74
|
+
5. Repeat until **all forcing questions are answered/skipped/waived AND self-evaluation says context is sufficient**, OR user records an explicit stop-signal row.
|
|
54
75
|
|
|
55
76
|
## Question Shape Rules
|
|
56
77
|
|
|
57
78
|
- Prefer single-select multiple choice when one direction/priority/next step must be chosen.
|
|
58
79
|
- Use multi-select only for compatible sets (goals, constraints, non-goals).
|
|
59
|
-
- Smart-skip
|
|
80
|
+
- Smart-skip: if a question is already answered earlier (directly or implicitly), log \`skipped (already covered: turn N)\` instead of skipping silently. The smart-skip row counts as a substantive Q&A Log entry for floor purposes.
|
|
60
81
|
|
|
61
82
|
## Stop Signals (Natural Language)
|
|
62
83
|
|
|
63
84
|
Treat these as stop-and-draft signals:
|
|
64
|
-
- RU: "достаточно", "хватит", "давай драфт"
|
|
65
|
-
- EN: "enough", "skip", "just draft it", "stop asking", "move on"
|
|
85
|
+
- RU: "достаточно", "хватит", "давай драфт", "хватит вопросов"
|
|
86
|
+
- EN: "enough", "skip", "just draft it", "stop asking", "move on", "no more questions"
|
|
66
87
|
- UA: "досить", "вистачить", "давай драфт", "рухаємось далі"
|
|
67
88
|
|
|
68
89
|
When detected:
|
|
90
|
+
- Append a Q&A Log row exactly like: \`Turn N | (stop-signal) | <user quote> | stop-and-draft\` — this row satisfies the linter floor escape hatch.
|
|
69
91
|
- Do not ask another question in this stage loop.
|
|
70
92
|
- Move to drafting with available context.
|
|
71
|
-
- For internal agent
|
|
93
|
+
- For the next internal agent-only call to advance-stage, pass \`--skip-questions\`. **The user never sees or types this flag.**
|
|
72
94
|
|
|
73
95
|
## Conditional Grilling (Only On Risk Triggers)
|
|
74
96
|
|
|
75
|
-
|
|
97
|
+
When one of these triggers appears, continue the elicitation loop with sharper questions **one at a time** (do NOT batch them):
|
|
76
98
|
- Irreversibility (data deletion, schema migration, breaking API/contract)
|
|
77
99
|
- Security/auth boundary changes
|
|
78
100
|
- Domain-model ambiguity with multiple plausible invariants
|
|
79
101
|
|
|
102
|
+
Each grill question follows the same Core Protocol: ask one, wait, log, self-eval, ask next.
|
|
103
|
+
|
|
80
104
|
Do not ask extra questions "for theater" on simple low-risk work.
|
|
81
105
|
|
|
82
|
-
## Question Budget Hint (
|
|
106
|
+
## Question Budget Hint (linter-enforced floor)
|
|
83
107
|
|
|
84
|
-
|
|
108
|
+
Source of truth: \`questionBudgetHint(track, stage)\`. The \`Min\` column is enforced by \`qa_log_below_min\` linter rule — \`stage-complete\` fails when below.
|
|
85
109
|
|
|
86
110
|
${budgetTable}
|
|
87
111
|
|
|
88
112
|
Track mapping note: \`quick\` ~= lightweight, \`medium\` ~= standard, \`standard\` ~= deep.
|
|
89
|
-
Stop based on clarity/user signal, not raw count.
|
|
90
113
|
|
|
91
|
-
|
|
114
|
+
How to use the columns:
|
|
115
|
+
- \`Min\` — hard floor. Below this, \`stage-complete\` is blocked unless escape hatch is recorded.
|
|
116
|
+
- \`Recommended\` — target for normal flows.
|
|
117
|
+
- \`Hard cap warning\` — point at which to stop or compress remaining forcing questions into one final batched ask. Not skip.
|
|
118
|
+
|
|
119
|
+
## Stage Forcing Questions (walk in order, one per turn)
|
|
92
120
|
|
|
93
|
-
|
|
121
|
+
**Walk the forcing questions list one-by-one in order, asking each as a separate turn.** Do NOT batch. Do NOT pick favorites — go in order. For each question record one of:
|
|
122
|
+
- \`asked\` — question was asked and answered.
|
|
123
|
+
- \`asked (confirmed assumption)\` — question was asked, user confirmed your prior reading.
|
|
124
|
+
- \`skipped (already covered: turn N)\` — answered implicitly by an earlier reply; cite the turn.
|
|
125
|
+
- \`waived (user override)\` — user explicitly waived this question.
|
|
94
126
|
|
|
95
|
-
|
|
127
|
+
Stage forcing question lists:
|
|
128
|
+
|
|
129
|
+
- **Brainstorm**:
|
|
96
130
|
- What pain are we solving?
|
|
97
131
|
- What is the most direct path?
|
|
98
132
|
- What happens if we do nothing?
|
|
99
133
|
- Who is the operator/user impacted first?
|
|
100
134
|
- What are non-negotiable no-go boundaries?
|
|
101
|
-
- Scope
|
|
135
|
+
- **Scope**:
|
|
102
136
|
- What is definitely in and definitely out?
|
|
103
137
|
- Which decisions are already locked upstream?
|
|
104
138
|
- What is the rollback path if this fails?
|
|
105
139
|
- What are the top failure modes we must design for?
|
|
106
|
-
- Design
|
|
140
|
+
- **Design**:
|
|
107
141
|
- What is the data flow end-to-end?
|
|
108
142
|
- Where are the seams/interfaces and ownership boundaries?
|
|
109
143
|
- Which invariants must always hold?
|
|
@@ -118,6 +152,10 @@ For irreversible moves (deletion, schema migration, breaking API):
|
|
|
118
152
|
|
|
119
153
|
## Completion Rule
|
|
120
154
|
|
|
121
|
-
|
|
122
|
-
|
|
155
|
+
Continue asking forcing questions in order until one of:
|
|
156
|
+
- (a) all forcing questions for the stage are answered/skipped/waived AND self-evaluation says context is sufficient, OR
|
|
157
|
+
- (b) user records an explicit stop-signal row in \`## Q&A Log\`, OR
|
|
158
|
+
- (c) the \`hard cap warning\` count is reached and you compressed the remaining forcing questions into one final batched ask (not skip).
|
|
159
|
+
|
|
160
|
+
Do NOT exit the loop after the first 1-2 questions just because you can draft something. The point of the loop is to surface the user's actual constraints, not to confirm your initial reading.`;
|
|
123
161
|
}
|
package/dist/content/skills.js
CHANGED
|
@@ -175,18 +175,23 @@ function autoSubagentDispatchBlock(stage, track) {
|
|
|
175
175
|
const userGate = rule.requiresUserGate ? "required" : "not required";
|
|
176
176
|
const dispatchClass = rule.dispatchClass ?? "stage-specialist";
|
|
177
177
|
const returnSchema = rule.returnSchema ?? "agent-default";
|
|
178
|
-
|
|
178
|
+
const runPhase = rule.runPhase ?? "any";
|
|
179
|
+
return `| ${rule.agent} | ${rule.mode} | ${runPhase} | ${dispatchClass} | ${returnSchema} | ${userGate} | ${rule.when} | ${rule.purpose} |`;
|
|
179
180
|
})
|
|
180
181
|
.join("\n");
|
|
181
182
|
const mandatory = schema.mandatoryDelegations;
|
|
182
183
|
const mandatoryList = mandatory.length > 0 ? mandatory.map((a) => `\`${a}\``).join(", ") : "none";
|
|
183
184
|
const delegationLogRel = `${RUNTIME_ROOT}/state/delegation-log.json`;
|
|
184
185
|
const delegationEventsRel = `${RUNTIME_ROOT}/state/delegation-events.jsonl`;
|
|
186
|
+
const hasPostElicitation = rules.some((rule) => rule.runPhase === "post-elicitation");
|
|
187
|
+
const runPhaseLegend = hasPostElicitation
|
|
188
|
+
? `\nRun Phase legend: \`post-elicitation\` = run only AFTER the adaptive elicitation Q&A loop converges (forcing questions answered/skipped/waived OR user stop-signal recorded). \`pre-elicitation\` = run before any user dialogue (rare). \`any\` = no ordering constraint.`
|
|
189
|
+
: "";
|
|
185
190
|
return `## Automatic Subagent Dispatch
|
|
186
|
-
| Agent | Mode | Class | Return Schema | User Gate | Trigger | Purpose |
|
|
187
|
-
|
|
191
|
+
| Agent | Mode | Run Phase | Class | Return Schema | User Gate | Trigger | Purpose |
|
|
192
|
+
|---|---|---|---|---|---|---|---|
|
|
188
193
|
${rows}
|
|
189
|
-
Mandatory: ${mandatoryList}. Record lifecycle rows in \`${delegationLogRel}\` and append-only \`${delegationEventsRel}\` before completion
|
|
194
|
+
Mandatory: ${mandatoryList}. Record lifecycle rows in \`${delegationLogRel}\` and append-only \`${delegationEventsRel}\` before completion.${runPhaseLegend}
|
|
190
195
|
### Harness Dispatch Contract — use true harness dispatch: Claude Task, Cursor generic dispatch, OpenCode \`.opencode/agents/<agent>.md\` via Task/@agent, Codex \`.codex/agents/<agent>.toml\`. Do not collapse OpenCode or Codex to role-switch by default. Worker ACK Contract: ACK must include \`spanId\`, \`dispatchId\`, \`dispatchSurface\`, \`agentDefinitionPath\`, and \`ackTs\`; never claim \`fulfillmentMode: "isolated"\` without matching lifecycle proof. Helper: \`.cclaw/hooks/delegation-record.mjs --status=<status> --span-id=<spanId> --dispatch-id=<dispatchId> --dispatch-surface=<surface> --agent-definition-path=<path> --json\`. Exact recipe: scheduled -> launched -> acknowledged -> completed with the same span; completed isolated/generic rows require a prior ACK event for that span or \`--ack-ts=<iso>\`.
|
|
191
196
|
|
|
192
197
|
${perHarnessLifecycleRecipeBlock()}`;
|
|
@@ -392,6 +397,14 @@ function delegationAndCompletionBlock(schema, track) {
|
|
|
392
397
|
${normalizedDispatch}
|
|
393
398
|
|
|
394
399
|
${completionBlock}
|
|
400
|
+
|
|
401
|
+
### Stage Closure (harness-only UX)
|
|
402
|
+
|
|
403
|
+
- **NEVER paste the \`stage-complete.mjs\` command line into chat.** The user does not run cclaw manually; seeing \`node .cclaw/hooks/stage-complete.mjs ... --evidence-json '{...}' --waive-delegation=...\` is noise. Run the helper via the tool layer; report only the resulting summary.
|
|
404
|
+
- **NEVER paste the \`--evidence-json\` payload into chat.** It is structured data for the helper, not for the user. The same evidence already lives in the artifact section.
|
|
405
|
+
- On failure, report a compact human-readable summary based on the helper's JSON \`findings\` array — list failing section names only (one line each), include the full helper JSON in a single fenced \`json\` block. Do not echo the invoking command.
|
|
406
|
+
- **NEVER run shell hash commands** (\`shasum\`, \`sha256sum\`, \`md5sum\`, \`Get-FileHash\`, \`certutil\`, etc.) for hash compute. If the linter ever asks for a hash, that is a linter bug — report failure and stop, do not auto-fix in bash.
|
|
407
|
+
- The helper defaults to quiet success (\`CCLAW_STAGE_COMPLETE_QUIET=1\`); rely on the resulting JSON, not stdout chatter.
|
|
395
408
|
`;
|
|
396
409
|
}
|
|
397
410
|
function quickStartBlock(stage, track) {
|
|
@@ -638,10 +651,10 @@ CLI commands, using existing \`cclaw run resume\` and \`internal verify-current-
|
|
|
638
651
|
|
|
639
652
|
1. **Wave Start**: author wave plan as \`.cclaw/wave-plans/<wave-n>.md\` referencing previous wave's ship artifact.
|
|
640
653
|
2. **Carry-forward Audit**: at brainstorm of the next wave, re-read previous wave ship artifact and explicitly record in the existing \`## Wave Carry-forward\` section:
|
|
641
|
-
- Carrying forward: <scope
|
|
654
|
+
- Carrying forward: <scope D-XX decision references still valid>
|
|
642
655
|
- Drift detected: <decisions no longer valid + reason>
|
|
643
656
|
- Re-scope needed: <yes/no>
|
|
644
|
-
- Never create a second \`## Locked Decisions\` heading in brainstorm; reference prior
|
|
657
|
+
- Never create a second \`## Locked Decisions\` heading in brainstorm; reference prior D-XX IDs inline.
|
|
645
658
|
3. **Resume Path**: if a wave was interrupted mid-stage, \`cclaw run resume\` restores state. Run \`internal verify-current-state\` before continuing.
|
|
646
659
|
4. **Wave End**: at ship, architect cross-stage verification runs from dispatch matrix. If \`DRIFT_DETECTED\`, fix before ship.
|
|
647
660
|
5. **Next Wave Trigger**: launch new \`/cc <topic>\` for next wave and reference previous wave ship artifact in upstream handoff.
|
|
@@ -445,14 +445,16 @@ const STAGE_AUTO_SUBAGENT_DISPATCH = {
|
|
|
445
445
|
agent: "product-discovery",
|
|
446
446
|
mode: "mandatory",
|
|
447
447
|
requiredAtTier: "standard",
|
|
448
|
-
|
|
448
|
+
runPhase: "post-elicitation",
|
|
449
|
+
when: "Always for standard/deep brainstorm to validate value, persona/JTBD, success metric, and why-now framing. Runs only after the adaptive elicitation Q&A loop converges.",
|
|
449
450
|
purpose: "Run product-discovery mode to pressure-test problem/value fit and produce product evidence for the Problem Decision Record.",
|
|
450
451
|
requiresUserGate: false
|
|
451
452
|
},
|
|
452
453
|
{
|
|
453
454
|
agent: "divergent-thinker",
|
|
454
455
|
mode: "proactive",
|
|
455
|
-
|
|
456
|
+
runPhase: "post-elicitation",
|
|
457
|
+
when: "When brainstorm has >1 candidate direction or user signals openness to alternatives. Runs only after the adaptive elicitation Q&A loop converges.",
|
|
456
458
|
purpose: "Expand option-space with alternative framings and approaches before planner/critic convergence.",
|
|
457
459
|
requiresUserGate: false
|
|
458
460
|
},
|
|
@@ -460,7 +462,8 @@ const STAGE_AUTO_SUBAGENT_DISPATCH = {
|
|
|
460
462
|
agent: "critic",
|
|
461
463
|
mode: "mandatory",
|
|
462
464
|
requiredAtTier: "standard",
|
|
463
|
-
|
|
465
|
+
runPhase: "post-elicitation",
|
|
466
|
+
when: "Always for standard/deep brainstorm to challenge the premise, do-nothing path, and higher-upside alternatives. Runs only after the adaptive elicitation Q&A loop converges.",
|
|
464
467
|
purpose: "Attack assumptions and surface non-goals before direction approval, with pre-commitment predictions validated against evidence.",
|
|
465
468
|
requiresUserGate: false,
|
|
466
469
|
skill: "critic-multi-perspective"
|
|
@@ -468,7 +471,8 @@ const STAGE_AUTO_SUBAGENT_DISPATCH = {
|
|
|
468
471
|
{
|
|
469
472
|
agent: "researcher",
|
|
470
473
|
mode: "proactive",
|
|
471
|
-
|
|
474
|
+
runPhase: "post-elicitation",
|
|
475
|
+
when: "When repository, market, docs, or prior-art context changes the approach set. Runs only after the adaptive elicitation Q&A loop converges.",
|
|
472
476
|
purpose: "Provide search-before-read summaries and context-readiness evidence before large reads or decisions.",
|
|
473
477
|
requiresUserGate: false
|
|
474
478
|
}
|
|
@@ -478,14 +482,16 @@ const STAGE_AUTO_SUBAGENT_DISPATCH = {
|
|
|
478
482
|
agent: "planner",
|
|
479
483
|
mode: "mandatory",
|
|
480
484
|
requiredAtTier: "standard",
|
|
481
|
-
|
|
485
|
+
runPhase: "post-elicitation",
|
|
486
|
+
when: "Always during scope shaping. Runs only after the adaptive elicitation Q&A loop converges and the user has approved the scope contract draft.",
|
|
482
487
|
purpose: "Challenge premise, map alternatives, and produce explicit in/out contract.",
|
|
483
488
|
requiresUserGate: false
|
|
484
489
|
},
|
|
485
490
|
{
|
|
486
491
|
agent: "divergent-thinker",
|
|
487
492
|
mode: "proactive",
|
|
488
|
-
|
|
493
|
+
runPhase: "post-elicitation",
|
|
494
|
+
when: "When scope mode is SCOPE EXPANSION or SELECTIVE EXPANSION, or scope contract has fewer than 3 alternatives considered. Runs only after the adaptive elicitation Q&A loop converges.",
|
|
489
495
|
purpose: "Generate additional framings and approach variants before scope convergence hardens.",
|
|
490
496
|
requiresUserGate: false
|
|
491
497
|
},
|
|
@@ -493,7 +499,8 @@ const STAGE_AUTO_SUBAGENT_DISPATCH = {
|
|
|
493
499
|
agent: "critic",
|
|
494
500
|
mode: "mandatory",
|
|
495
501
|
requiredAtTier: "standard",
|
|
496
|
-
|
|
502
|
+
runPhase: "post-elicitation",
|
|
503
|
+
when: "Always during scope shaping for standard/deep work. Runs only after the adaptive elicitation Q&A loop converges.",
|
|
497
504
|
purpose: "Test whether the selected scope mode is too timid, too broad, or hiding a smaller useful slice, using pre-commitment predictions and validation.",
|
|
498
505
|
requiresUserGate: false,
|
|
499
506
|
skill: "critic-multi-perspective"
|
|
@@ -501,14 +508,16 @@ const STAGE_AUTO_SUBAGENT_DISPATCH = {
|
|
|
501
508
|
{
|
|
502
509
|
agent: "researcher",
|
|
503
510
|
mode: "proactive",
|
|
504
|
-
|
|
511
|
+
runPhase: "post-elicitation",
|
|
512
|
+
when: "When churn, prior attempts, reference patterns, or external constraints may change scope boundaries. Runs only after the adaptive elicitation Q&A loop converges.",
|
|
505
513
|
purpose: "Summarize search/context findings before the scope contract locks accepted/rejected/deferred ideas.",
|
|
506
514
|
requiresUserGate: false
|
|
507
515
|
},
|
|
508
516
|
{
|
|
509
517
|
agent: "product-discovery",
|
|
510
518
|
mode: "proactive",
|
|
511
|
-
|
|
519
|
+
runPhase: "post-elicitation",
|
|
520
|
+
when: "When scope choices change user value, success metrics, or product positioning (Mode: discovery). Runs only after the adaptive elicitation Q&A loop converges.",
|
|
512
521
|
purpose: "Keep accepted/deferred reference ideas tied to user value and measurable success under product-discovery mode.",
|
|
513
522
|
requiresUserGate: false
|
|
514
523
|
},
|
|
@@ -516,14 +525,16 @@ const STAGE_AUTO_SUBAGENT_DISPATCH = {
|
|
|
516
525
|
agent: "product-discovery",
|
|
517
526
|
mode: "proactive",
|
|
518
527
|
requiredAtTier: "standard",
|
|
519
|
-
|
|
528
|
+
runPhase: "post-elicitation",
|
|
529
|
+
when: "When scope mode resolves to SCOPE EXPANSION or SELECTIVE EXPANSION (Mode: strategist). Runs only after the adaptive elicitation Q&A loop converges.",
|
|
520
530
|
purpose: "Drive 10x vision and concrete expansion proposals before locking the scope contract via product-discovery strategist mode.",
|
|
521
531
|
requiresUserGate: false
|
|
522
532
|
},
|
|
523
533
|
{
|
|
524
534
|
agent: "scope-guardian-reviewer",
|
|
525
535
|
mode: "proactive",
|
|
526
|
-
|
|
536
|
+
runPhase: "post-elicitation",
|
|
537
|
+
when: "When scope mode is SCOPE EXPANSION or SELECTIVE EXPANSION, or scope contract has many accepted ideas. Runs only after the adaptive elicitation Q&A loop converges.",
|
|
527
538
|
purpose: "Challenge complexity growth and enforce minimum-change scope discipline before scope lock.",
|
|
528
539
|
requiresUserGate: false,
|
|
529
540
|
skill: "document-scope-guard"
|
|
@@ -534,7 +545,8 @@ const STAGE_AUTO_SUBAGENT_DISPATCH = {
|
|
|
534
545
|
agent: "architect",
|
|
535
546
|
mode: "mandatory",
|
|
536
547
|
requiredAtTier: "standard",
|
|
537
|
-
|
|
548
|
+
runPhase: "post-elicitation",
|
|
549
|
+
when: "Always during design lock. Runs only after the adaptive elicitation Q&A loop converges.",
|
|
538
550
|
purpose: "Stress architecture boundaries, dependency graph, critical path, and spec handoff.",
|
|
539
551
|
requiresUserGate: false
|
|
540
552
|
},
|
|
@@ -542,14 +554,16 @@ const STAGE_AUTO_SUBAGENT_DISPATCH = {
|
|
|
542
554
|
agent: "test-author",
|
|
543
555
|
mode: "mandatory",
|
|
544
556
|
requiredAtTier: "standard",
|
|
545
|
-
|
|
557
|
+
runPhase: "post-elicitation",
|
|
558
|
+
when: "Always during design lock. Runs only after the adaptive elicitation Q&A loop converges.",
|
|
546
559
|
purpose: "Check test diagram mapping, RED expressibility, assertion quality, and verification routes before implementation.",
|
|
547
560
|
requiresUserGate: false
|
|
548
561
|
},
|
|
549
562
|
{
|
|
550
563
|
agent: "critic",
|
|
551
564
|
mode: "proactive",
|
|
552
|
-
|
|
565
|
+
runPhase: "post-elicitation",
|
|
566
|
+
when: "When architecture alternatives, coupling, cost, or rollback risk remain debatable, or when security/auth/authz trust boundaries are involved. Runs only after the adaptive elicitation Q&A loop converges.",
|
|
553
567
|
purpose: "Produce a shadow alternative, switch trigger, and cheaper-path challenge for the engineering lock with pre-commitment predictions and validation.",
|
|
554
568
|
requiresUserGate: false,
|
|
555
569
|
skill: "critic-multi-perspective"
|
|
@@ -557,21 +571,24 @@ const STAGE_AUTO_SUBAGENT_DISPATCH = {
|
|
|
557
571
|
{
|
|
558
572
|
agent: "researcher",
|
|
559
573
|
mode: "proactive",
|
|
560
|
-
|
|
574
|
+
runPhase: "post-elicitation",
|
|
575
|
+
when: "When framework/library docs, repo graph context, or reference contracts may change the design. Runs only after the adaptive elicitation Q&A loop converges.",
|
|
561
576
|
purpose: "Run search-before-read context synthesis before architecture locks.",
|
|
562
577
|
requiresUserGate: false
|
|
563
578
|
},
|
|
564
579
|
{
|
|
565
580
|
agent: "security-reviewer",
|
|
566
581
|
mode: "proactive",
|
|
567
|
-
|
|
582
|
+
runPhase: "post-elicitation",
|
|
583
|
+
when: "When trust boundaries, auth, secrets, sensitive data, or external inputs are involved. Runs only after the adaptive elicitation Q&A loop converges.",
|
|
568
584
|
purpose: "Catch design-level security risks before implementation.",
|
|
569
585
|
requiresUserGate: false
|
|
570
586
|
},
|
|
571
587
|
{
|
|
572
588
|
agent: "coherence-reviewer",
|
|
573
589
|
mode: "proactive",
|
|
574
|
-
|
|
590
|
+
runPhase: "post-elicitation",
|
|
591
|
+
when: "When design touches multiple subsystems or includes multiple alternatives sections. Runs only after the adaptive elicitation Q&A loop converges.",
|
|
575
592
|
purpose: "Detect internal contradictions, terminology drift, and broken cross-section references in design docs.",
|
|
576
593
|
requiresUserGate: false,
|
|
577
594
|
skill: "document-coherence-pass"
|
|
@@ -579,7 +596,8 @@ const STAGE_AUTO_SUBAGENT_DISPATCH = {
|
|
|
579
596
|
{
|
|
580
597
|
agent: "feasibility-reviewer",
|
|
581
598
|
mode: "proactive",
|
|
582
|
-
|
|
599
|
+
runPhase: "post-elicitation",
|
|
600
|
+
when: "When design assumes runtime conditions, scaling behavior, or external service availability. Runs only after the adaptive elicitation Q&A loop converges.",
|
|
583
601
|
purpose: "Validate that design assumptions remain feasible in real runtime and rollout constraints.",
|
|
584
602
|
requiresUserGate: false,
|
|
585
603
|
skill: "document-feasibility-pass"
|
|
@@ -36,8 +36,8 @@ export const BRAINSTORM = {
|
|
|
36
36
|
},
|
|
37
37
|
executionModel: {
|
|
38
38
|
checklist: [
|
|
39
|
-
"**
|
|
40
|
-
"**
|
|
39
|
+
"**ADAPTIVE ELICITATION COMES FIRST (no exceptions, no subagent dispatch before).** Load `.cclaw/skills/adaptive-elicitation/SKILL.md`. Walk the brainstorm forcing questions one-at-a-time via the harness-native question tool, append one row to `## Q&A Log` (`Turn | Question | User answer (1-line) | Decision impact`) after each user answer. Continue until all forcing questions are answered/skipped/waived OR user records an explicit stop-signal row. Only then proceed to delegations, drafts, or analysis. The linter `qa_log_below_min` rule will block `stage-complete` if Q&A Log is below floor.",
|
|
40
|
+
"**Explore project context** — after the elicitation loop converges, inspect existing files/docs/recent activity to refine the Discovered context section; capture matching files/patterns/seeds in `Context > Discovered context` so downstream stages don't redo discovery.",
|
|
41
41
|
"**Brainstorm forcing questions (must be covered or explicitly waived)** — what pain are we solving, what is the direct path, what happens if we do nothing, who is the first operator/user affected, and what no-go boundaries are non-negotiable.",
|
|
42
42
|
"**Classify stage depth** — choose `lite` for clear low-risk tasks, `standard` for normal engineering/product changes, or `deep` for ambiguity, architecture, external dependency, security/data risk, or explicit think-bigger requests.",
|
|
43
43
|
"**Write the Problem Decision Record** — pick a free-form `Frame type` label that names how this work is framed (examples: product, technical-maintenance, research-spike, ops-incident, infrastructure), then fill the universal Framing fields: affected user/role/operator, current state/failure mode/opportunity, desired observable outcome, evidence/signal, why now, do-nothing consequence, and non-goals.",
|
|
@@ -52,7 +52,7 @@ export const BRAINSTORM = {
|
|
|
52
52
|
"**Collect reaction before recommending** — ask which option feels closest and what concern remains, then recommend based on that reaction.",
|
|
53
53
|
"**Write the `Not Doing` list** — name 3-5 things this brainstorm explicitly is not committing to (vs. deferred). This protects scope from silent enlargement and the next stage from rework.",
|
|
54
54
|
"**Run early Ralph loop discipline** — after each producer iteration, append a `Critic Pass` JSONL row to `.cclaw/state/early-loop-log.jsonl`, refresh `.cclaw/state/early-loop.json`, and iterate until open concerns clear or convergence guard escalates.",
|
|
55
|
-
"**Embedded Grill (post-pick)** — after `Selected Direction` is named,
|
|
55
|
+
"**Embedded Grill (post-pick, one-at-a-time)** — after `Selected Direction` is named, if grilling triggers fire (irreversibility, security/auth boundary, domain-model ambiguity per `adaptive-elicitation:Conditional Grilling`), continue the elicitation loop with sharper questions **one at a time**, appended to `## Q&A Log` and reflected as rows in `## Embedded Grill`. Do NOT batch the 3-5 grill checks — each one follows the Core Protocol (ask, wait, log, self-eval, ask next).",
|
|
56
56
|
"**Self-review before user approval** — re-read the artifact and patch contradictions, weak trade-offs, placeholders, ambiguity, and weak handoff language. Record the result in `Self-Review Notes` using the calibrated review format: `- Status: Approved` (or `Issues Found`), `- Patches applied:` with inline note or sub-bullets, `- Remaining concerns:` with inline note or sub-bullets. Use `Patches applied: None` and `Remaining concerns: None` when there is nothing to record.",
|
|
57
57
|
"**Request explicit approval to close the stage** — state exactly what direction is being approved after the adaptive elicitation loop converges; do not advance without approval and artifact review.",
|
|
58
58
|
"**Handoff packet** — only after approval, produce a scope handoff packet with selected direction, why rejected options were rejected, explicit non-goals, unresolved questions, risk hints, and explicit drift from the initial ask so scope starts from locked upstream decisions instead of rediscovering intent."
|
|
@@ -40,7 +40,7 @@ export const DESIGN = {
|
|
|
40
40
|
},
|
|
41
41
|
executionModel: {
|
|
42
42
|
checklist: [
|
|
43
|
-
"**
|
|
43
|
+
"**ADAPTIVE ELICITATION COMES FIRST (no exceptions, no subagent dispatch before).** Load `.cclaw/skills/adaptive-elicitation/SKILL.md`. Walk the design forcing questions one-at-a-time via the harness-native question tool, append one row to `## Q&A Log` (`Turn | Question | User answer (1-line) | Decision impact`) after each user answer. Continue until all forcing questions are answered/skipped/waived OR user records an explicit stop-signal row. Only then proceed to research, investigator pass, architecture lock, or any delegations. The linter `qa_log_below_min` rule will block `stage-complete` if Q&A Log is below floor.",
|
|
44
44
|
"**Design forcing questions (must be covered or explicitly waived)** — what is the end-to-end data flow, where are seams/ownership boundaries, which invariants must hold, and what will explicitly NOT be refactored now.",
|
|
45
45
|
"Compact design lock — design does not decide what to build; it decides how the approved scope works. For simple slices, produce a tight lock: upstream handoff, existing fit, architecture boundary, one labeled diagram, data/state flow, critical path, failure/rescue, trust boundaries, test/perf expectations, rollout/rollback, rejected alternative, and spec handoff.",
|
|
46
46
|
"Trivial-Change Escape Hatch — for <=3 files, no new interfaces, and no cross-module data flow, produce a mini-design (rationale, changed files, one risk) and proceed to spec.",
|
|
@@ -68,7 +68,7 @@ export const DESIGN = {
|
|
|
68
68
|
"Classify ambiguity before acting. Only non-critical preference/default assumptions may continue; STOP on uncertainty about scope, architecture, security, data loss, public API, migration, auth/pricing, or required user approval. Design hypotheses must name validation path, rollback trigger, and owner before they can be carried forward.",
|
|
69
69
|
"Before final approval, run the critic pass, reconcile material findings, and bound retries with the review-loop policy.",
|
|
70
70
|
"For baseline approval, present the full design plus exact spec handoff and **STOP** until explicit approval.",
|
|
71
|
-
"**STOP BEFORE ADVANCE.** Mandatory delegation `planner`
|
|
71
|
+
"**STOP BEFORE ADVANCE.** Mandatory delegation `planner` runs **AFTER user approval of the design lock**, not before Q&A. Sequence is: Q&A loop -> draft design lock -> user approval -> `planner` delegation -> `stage-complete`. Legal fulfillment modes for `planner`: (a) **harness-native Task tool** — run the delegation, then record via `node .cclaw/hooks/delegation-record.mjs --stage=design --agent=planner --mode=mandatory --status=completed --span-id=<uuid> --dispatch-surface=cursor-task --agent-definition-path=<agent-md-path> --evidence-ref=<artifact#section>`; (b) **role-switch** — write planner output into the design artifact, then record with `--dispatch-surface=role-switch`; (c) **cclaw subagent helper** with `--dispatch-surface=isolated`. Run `node .cclaw/hooks/stage-complete.mjs design` from the tool layer (do not paste the command into chat); report only the resulting summary."
|
|
72
72
|
],
|
|
73
73
|
process: [
|
|
74
74
|
"Read upstream artifacts and current design docs.",
|
|
@@ -94,7 +94,7 @@ export const DESIGN = {
|
|
|
94
94
|
"Artifact written to `.cclaw/artifacts/03-design-<slug>.md`.",
|
|
95
95
|
"Failure-mode table exists in Method/Exception/Rescue/UserSees format.",
|
|
96
96
|
"Tier-required diagram markers are present: architecture (all tiers). Standard/Deep add-ons (shadow/error) and Deep add-ons (state-machine/rollback/deployment-sequence) are included only when risk warrants them.",
|
|
97
|
-
"Stale diagram audit finding is clear
|
|
97
|
+
"Stale diagram audit finding is clear: no blast-radius file newer than diagram markers without explicit update.",
|
|
98
98
|
"Security & threat model findings are documented with mitigations.",
|
|
99
99
|
"Observability and deployment plans are explicit for critical flows.",
|
|
100
100
|
"Outside-voice findings and dispositions are recorded (accept/reject/defer).",
|
|
@@ -165,7 +165,7 @@ export const DESIGN = {
|
|
|
165
165
|
{ section: "Data-Flow Shadow Paths", required: false, validationRule: "Standard/Deep add-on: include `<!-- diagram: data-flow-shadow-paths -->` marker plus a table for high-risk choices: chosen path, shadow alternative, switch trigger, failure/rescue/degraded behavior, and verification evidence." },
|
|
166
166
|
{ section: "Error Flow Diagram", required: false, validationRule: "Standard/Deep add-on: include `<!-- diagram: error-flow -->` marker and failure-detection -> rescue -> user-visible outcome flow." },
|
|
167
167
|
{ section: "Data Flow", required: false, validationRule: "Must include data/state flow, happy path, nil input, empty input, upstream error paths, plus Interaction Edge Case matrix rows for double-click, nav-away-mid-request, 10K-result dataset, background-job abandonment, zombie connection. Each row declares handled yes/no and deferred item when not handled." },
|
|
168
|
-
{ section: "Stale Diagram Audit", required: false, validationRule: "
|
|
168
|
+
{ section: "Stale Diagram Audit", required: false, validationRule: "Blast-radius files from Codebase Investigation must not be newer than the current design diagram-marker baseline unless explicitly refreshed." },
|
|
169
169
|
{ section: "Failure Mode Table", required: true, validationRule: "Use Method/Exception/Rescue/UserSees columns and treat silent user impact without rescue as critical." },
|
|
170
170
|
{ section: "Pre-mortem", required: false, validationRule: "Recommended: list top failure scenarios, early warning signal, mitigation owner, and containment action before implementation." },
|
|
171
171
|
{ section: "Security & Threat Model", required: true, validationRule: "Must list trust boundaries, abuse/failure scenarios, mitigations, and residual risks." },
|
|
@@ -45,8 +45,8 @@ export const PLAN = {
|
|
|
45
45
|
"Group tasks into dependency batches — batch N+1 cannot start until batch N has verification evidence.",
|
|
46
46
|
"Slice into vertical tasks — each task targets 2-5 minutes, produces one testable outcome, and touches one coherent area.",
|
|
47
47
|
"Task Contract — every task has one coherent outcome, AC mapping, exact verification command/manual step, and expected evidence snippet or pass condition. Avoid vague `run tests` wording.",
|
|
48
|
-
"Annotate slice-review metadata —
|
|
49
|
-
"Map scope Locked Decisions — every
|
|
48
|
+
"Annotate slice-review metadata — task rows may carry `touchCount` (rough number of files expected to change), `touchPaths` (glob hints, e.g. `migrations/**`, `src/auth/**`), and optional `highRisk: true` to force a review pass. These fields feed the TDD stage's Per-Slice Review point.",
|
|
49
|
+
"Map scope Locked Decisions — every D-XX ID from scope is referenced by at least one plan task (or explicitly marked deferred with reason).",
|
|
50
50
|
"Run anti-placeholder + anti-scope-reduction scans — block `TODO/TBD/...` and phrasing like `v1`, `for now`, `later` for locked boundaries.",
|
|
51
51
|
"Define validation points — mark where progress must be checked before continuing, with concrete command and expected evidence.",
|
|
52
52
|
"Define execution posture — record whether execution should be sequential, dependency-batched, parallel-safe, or blocked; include risk triggers and RED/GREEN/REFACTOR checkpoint/commit expectations when the repo workflow supports them. This fulfills the `plan_execution_posture_recorded` gate.",
|
|
@@ -127,7 +127,7 @@ export const PLAN = {
|
|
|
127
127
|
{ section: "Upstream Handoff", required: false, validationRule: "Summarizes spec/design/scope decisions, constraints, open questions, and explicit drift before task breakdown." },
|
|
128
128
|
{ section: "Dependency Graph", required: false, validationRule: "Ordering and parallel opportunities explicit. No circular dependencies." },
|
|
129
129
|
{ section: "Dependency Batches", required: true, validationRule: "Every task belongs to a batch. Each batch has an exit gate and dependency statement." },
|
|
130
|
-
{ section: "Task List", required: true, validationRule: "Each task row includes ID, description, acceptance criterion, exact verification command/manual step, expected evidence/pass condition, and effort estimate (S/M/L). Every task must also carry a minutes estimate within the 2-5 minute budget. When
|
|
130
|
+
{ section: "Task List", required: true, validationRule: "Each task row includes ID, description, acceptance criterion, exact verification command/manual step, expected evidence/pass condition, and effort estimate (S/M/L). Every task must also carry a minutes estimate within the 2-5 minute budget. When present, touchCount/touchPaths/highRisk metadata drives Per-Slice Review escalation in TDD." },
|
|
131
131
|
{ section: "Acceptance Mapping", required: true, validationRule: "Every spec criterion is covered by at least one task." },
|
|
132
132
|
{ section: "Execution Posture", required: true, validationRule: "States sequential/batch/parallel posture, stop conditions, risk triggers, and RED/GREEN/REFACTOR checkpoint or commit expectations for TDD when consistent with the repo workflow." },
|
|
133
133
|
{ section: "Locked Decision Coverage", required: false, validationRule: "Every locked decision ID (D-XX) from scope is listed with linked task IDs or explicit defer rationale." },
|
|
@@ -38,6 +38,15 @@ export interface StageAutoSubagentDispatch {
|
|
|
38
38
|
when: string;
|
|
39
39
|
purpose: string;
|
|
40
40
|
requiresUserGate: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* When this delegation may run relative to the adaptive elicitation Q&A loop.
|
|
43
|
+
* - `pre-elicitation` — run before any user dialogue (rare; only for trivial info-gathering).
|
|
44
|
+
* - `post-elicitation` — run only after the Q&A loop converges (default for brainstorm/scope/design
|
|
45
|
+
* so subagents do not preempt the user dialogue).
|
|
46
|
+
* - `any` — no ordering constraint (default for stages that do not run elicitation:
|
|
47
|
+
* spec/plan/tdd/review/ship).
|
|
48
|
+
*/
|
|
49
|
+
runPhase?: "pre-elicitation" | "post-elicitation" | "any";
|
|
41
50
|
/** Role category used by generated routing tables and lifecycle checks. */
|
|
42
51
|
dispatchClass?: StageSubagentDispatchClass;
|
|
43
52
|
/** Strict status/evidence contract the dispatched agent must return. */
|