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
|
@@ -45,7 +45,7 @@ export const SCOPE = {
|
|
|
45
45
|
},
|
|
46
46
|
executionModel: {
|
|
47
47
|
checklist: [
|
|
48
|
-
"**
|
|
48
|
+
"**ADAPTIVE ELICITATION COMES FIRST (no exceptions, no subagent dispatch before).** Load `.cclaw/skills/adaptive-elicitation/SKILL.md`. Walk the scope 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 propose the scope contract draft, recommend a mode, or dispatch any delegations. The linter `qa_log_below_min` rule will block `stage-complete` if Q&A Log is below floor.",
|
|
49
49
|
"**Scope forcing questions (must be covered or explicitly waived)** — what is definitely in/out, which upstream decisions are locked, and what rollback path protects users if scope assumptions fail.",
|
|
50
50
|
"**Scope contract first** — read brainstorm handoff, name upstream decisions used, explicit drift, confidence, unresolved questions, and next-stage risk hints; draft the in-scope/out-of-scope/deferred/discretion contract before any design choice.",
|
|
51
51
|
"**Premise and leverage check** — answer in the artifact: *Right problem? Direct path? What if nothing? Where can we leverage existing code? What is the reversibility cost?* Take a position; do not hedge.",
|
|
@@ -63,7 +63,7 @@ export const SCOPE = {
|
|
|
63
63
|
"\"Strong success criteria let you loop independently. Weak criteria require constant clarification.\"",
|
|
64
64
|
decisionProtocolInstruction("scope mode selection", "present expand/selective/hold/reduce as labeled options with trade-offs and mark one as (recommended)", "recommend the option that best covers the prime-directive failure modes, four data-flow paths, observability, and deferred handling for the in-scope set with the smallest blast radius. Base your recommendation on default heuristics: greenfield -> expand, enhancement -> selective, bugfix/hotfix/refactor -> hold, broad blast radius -> reduce"),
|
|
65
65
|
"Run the shared adaptive elicitation cycle from `.cclaw/skills/adaptive-elicitation/SKILL.md`, including stop-signal handling (RU/EN/UA), smart-skip, conditional grilling triggers, and append-only `## Q&A Log` updates.",
|
|
66
|
-
"
|
|
66
|
+
"**Lead with adaptive elicitation, not with a proposed contract.** First walk scope forcing questions one-at-a-time per `adaptive-elicitation` skill. Only AFTER the Q&A loop converges (forcing-Qs answered/waived OR user stop-signal row recorded) propose the scope contract draft for approval. Lite-tier may compress: ask the smallest forcing-Q set (>= linter floor for `lightweight`/`scope`), then propose contract.",
|
|
67
67
|
"For low-risk concrete asks, keep the proposal compact but still explicit: recommend (do not auto-select) one mode, show exact in/out/deferred boundaries, and request explicit approval before finalizing the artifact or completing the stage.",
|
|
68
68
|
"Challenge premise first, take a firm position, and name one concrete condition that would change it.",
|
|
69
69
|
"Push back on weak framing: vague scope needs a specific user/problem, platform vision needs a narrow wedge, social proof needs behavioral evidence.",
|
|
@@ -71,10 +71,10 @@ export const SCOPE = {
|
|
|
71
71
|
"If the user says no but cannot name the change, offer concrete moves: keep scope, add one obvious adjacent capability, reduce to wedge, or re-open stack/product direction.",
|
|
72
72
|
"Before final approval, record outside-voice findings and a `## Scope Outside Voice Loop` table per the Scope Outside Voice Loop policy above.",
|
|
73
73
|
"**STOP.** Wait for explicit user approval of the scope mode and scope contract before writing final approval language or advancing.",
|
|
74
|
-
"**STOP BEFORE ADVANCE.** Mandatory delegation `planner`
|
|
74
|
+
"**STOP BEFORE ADVANCE.** Mandatory delegation `planner` runs **AFTER user approval of the scope contract**, not before Q&A. Sequence is: Q&A loop -> propose contract -> user approval -> `planner` delegation -> `stage-complete`. If you delegate `planner` before the Q&A loop converges, you violate the elicitation contract and the linter will block stage-complete via `qa_log_below_min`. Legal fulfillment modes for `planner`: (a) **harness-native Task tool** — run the delegation, then record the lifecycle row via `node .cclaw/hooks/delegation-record.mjs --stage=scope --agent=planner --mode=mandatory --status=completed --span-id=<uuid> --dispatch-surface=cursor-task --agent-definition-path=<agent-md-path> --evidence-ref=<artifact#section>` (the helper sets `fulfillmentMode: \"generic-dispatch\"` automatically); (b) **role-switch** — announce `## cclaw role-switch: scope/planner (mandatory)`, write the planner output/evidence into the scope artifact, then record the row with `--dispatch-surface=role-switch --agent-definition-path=<artifact-anchor>` (helper sets `fulfillmentMode: \"role-switch\"` automatically); (c) **cclaw subagent helper** if available, with `--dispatch-surface=isolated`. Run `node .cclaw/hooks/stage-complete.mjs scope` from the tool layer (do not paste the command into chat); report only the resulting summary."
|
|
75
75
|
],
|
|
76
76
|
process: [
|
|
77
|
-
"Run
|
|
77
|
+
"Run pre-scope audit before premise challenge.",
|
|
78
78
|
"Run the scope pass scaled to risk: default to job-to-be-done plus explicit scope contract; add premise challenge, 10-star upside, smallest useful wedge, and change conditions only for deep/high-risk scope.",
|
|
79
79
|
"Compare minimum viable, product-grade, and ideal architecture scope alternatives with explicit reuse/effort/risk.",
|
|
80
80
|
"Recommend a scope mode with explicit rationale, then ask for user opt-in before treating it as selected.",
|
|
@@ -89,7 +89,7 @@ export const SCOPE = {
|
|
|
89
89
|
],
|
|
90
90
|
requiredEvidence: [
|
|
91
91
|
"Artifact written to `.cclaw/artifacts/02-scope-<slug>.md`.",
|
|
92
|
-
"
|
|
92
|
+
"Pre-Scope System Audit findings are captured (git log/diff/stash/debt markers).",
|
|
93
93
|
"In-scope and out-of-scope lists are explicit.",
|
|
94
94
|
"Discretion areas are explicit (or marked as `None`).",
|
|
95
95
|
"Selected mode and rationale are documented using HOLD SCOPE, SELECTIVE EXPANSION, SCOPE EXPANSION, or SCOPE REDUCTION.",
|
|
@@ -97,7 +97,7 @@ export const SCOPE = {
|
|
|
97
97
|
"Scope Contract captures requirements, locked decisions, discretion areas, accepted/rejected/deferred reference ideas from the Reference Pattern Registry, success definition, and design handoff.",
|
|
98
98
|
"Decision Drivers section records weighted criteria and per-option scores used to choose mode and boundary moves.",
|
|
99
99
|
"Scope Completeness Score is recorded (0.00-1.00) with the explicit blocker list for any remaining uncertainty.",
|
|
100
|
-
"Locked Decisions section lists stable
|
|
100
|
+
"Locked Decisions section lists stable D-XX IDs for non-negotiable boundaries.",
|
|
101
101
|
"Premise challenge findings documented.",
|
|
102
102
|
"Outside Voice findings and dispositions are recorded (accept/reject/defer with rationale) before final approval.",
|
|
103
103
|
"Scope outside-voice loop summary includes a table with columns Iteration, Quality Score, Findings, plus Stop reason, Target score, Max iterations, and unresolved concerns. This is outside-voice evidence only; it does not satisfy user approval.",
|
|
@@ -148,7 +148,7 @@ export const SCOPE = {
|
|
|
148
148
|
},
|
|
149
149
|
artifactValidation: [
|
|
150
150
|
{ section: "Upstream Handoff", required: false, validationRule: "Summarizes brainstorm/idea decisions, constraints, open questions, and explicit drift before scope decisions." },
|
|
151
|
-
{ section: "Pre-Scope System Audit", required:
|
|
151
|
+
{ section: "Pre-Scope System Audit", required: true, validationRule: "Must capture git log -30, git diff --stat, git stash list, and debt-marker scan (TODO/FIXME/XXX/HACK) before premise challenge." },
|
|
152
152
|
{ section: "Prime Directives", required: false, validationRule: "For each scoped capability: named failure modes, explicit error surface, four data-flow paths, interaction edge cases, observability expectations, and deferred-item handling." },
|
|
153
153
|
{ section: "Premise Challenge", required: false, validationRule: "Must list at least 3 question/answer rows in a markdown table or bullet list (gstack default trio: right problem? direct path? what if we do nothing? — extend with leverage and reversibility for richer scope). The linter enforces structure, not English wording — answers may be in any language." },
|
|
154
154
|
{ section: "Scope Contract", required: true, validationRule: "Canonical contract: selected mode, in scope, out of scope, requirements, locked decisions, discretion areas, deferred ideas, accepted/rejected reference ideas, success definition, and design handoff." },
|
|
@@ -161,7 +161,7 @@ export const SCOPE = {
|
|
|
161
161
|
{ section: "Ambitious Alternatives", required: false, validationRule: "Optional evidence heading for SCOPE EXPANSION/SELECTIVE: list larger alternatives considered and their disposition." },
|
|
162
162
|
{ section: "Ruthless Minimum Slice", required: false, validationRule: "Optional evidence heading for SCOPE REDUCTION or high-risk scope: define the smallest useful wedge and what it proves." },
|
|
163
163
|
{ section: "Requirements", required: false, validationRule: "Table of stable requirement IDs (R1, R2, R3…) one per row with observable outcome, priority, and source. IDs are assigned once and never renumbered across scope/design/spec/plan/review; dropped requirements stay with Priority `DROPPED`." },
|
|
164
|
-
{ section: "Locked Decisions
|
|
164
|
+
{ section: "Locked Decisions", required: false, validationRule: "List of stable locked decisions, each with a unique `D-XX` ID. IDs are stable across edits so downstream stages can reference them; renumbering or duplicating IDs breaks the cross-stage traceability check." },
|
|
165
165
|
{ section: "Implementation Alternatives", required: false, validationRule: "2-3 options with Name, Summary, Effort, Risk, Pros, Cons, and Reuses. Must include minimal viable and ideal architecture options." },
|
|
166
166
|
{ section: "Scope Mode", required: true, validationRule: "Must state selected mode and rationale with default heuristic justification." },
|
|
167
167
|
{ section: "Mode-Specific Analysis", required: false, validationRule: "Default path: one selected-mode row with rationale. Deep/complex scope only: document the expanded analysis matching the selected mode." },
|
|
@@ -41,7 +41,7 @@ export const TDD = {
|
|
|
41
41
|
"Map to acceptance criterion — identify the specific spec criterion this test proves.",
|
|
42
42
|
"Discover the test surface — inspect existing tests, fixtures, helpers, test commands, and nearby assertions before authoring RED. Reuse the local test style unless the slice genuinely needs a new pattern.",
|
|
43
43
|
"Run a system-wide impact check — name callbacks, state transitions, interfaces, schemas, CLI/config/API contracts, persistence, or event boundaries that this slice can affect. Add RED coverage for each affected public contract or record why it is out of scope.",
|
|
44
|
-
"Source/test preflight — before production edits, classify planned paths using
|
|
44
|
+
"Source/test preflight — before production edits, classify planned paths using test-path patterns; verify the RED touches a test path and the GREEN touches only source paths needed for the failing behavior.",
|
|
45
45
|
"Set execution posture — record whether this slice is sequential, batch-safe, or blocked; when the existing git workflow permits small commits, checkpoint after RED, GREEN, and REFACTOR (or record why commits are deferred).",
|
|
46
46
|
"Use the mandatory `test-author` delegation for RED — after discovery and impact check, produce failing behavior tests and RED evidence only (no production edits). Set `CCLAW_ACTIVE_AGENT=tdd-red` when the harness supports phase labels.",
|
|
47
47
|
"RED: Capture failure output — copy the exact failure output as RED evidence. Record in artifact.",
|
|
@@ -52,7 +52,7 @@ export const TDD = {
|
|
|
52
52
|
"REFACTOR: continue the `test-author` evidence cycle (or a dedicated refactor mode when available) to improve code quality without behavior changes. Set `CCLAW_ACTIVE_AGENT=tdd-refactor` when the harness supports phase labels.",
|
|
53
53
|
"Record evidence — capture test discovery, system-wide impact check, RED failure, GREEN output, and REFACTOR notes in the TDD artifact. When logging a `green` row, attach the closed acceptance-criterion IDs in `acIds` so Ralph Loop status counts them.",
|
|
54
54
|
"Annotate traceability — link to the active track's source: plan task ID + spec criterion on standard/medium, or spec acceptance item / bug reproduction slice on quick.",
|
|
55
|
-
"Per-Slice Review (conditional) — if
|
|
55
|
+
"Per-Slice Review (conditional) — if the slice meets any trigger (touchCount >= filesChangedThreshold, touchPaths match touchTriggers, or highRisk=true), append a `## Per-Slice Review` entry for this slice before moving on (see the dedicated section below).",
|
|
56
56
|
"Repeat for each slice — return to step 1 for the next plan slice."
|
|
57
57
|
],
|
|
58
58
|
interactionProtocol: [
|
|
@@ -70,7 +70,7 @@ export const TDD = {
|
|
|
70
70
|
"Use incremental RED/GREEN/REFACTOR commits when the repository workflow and working tree make that appropriate; otherwise record the checkpoint boundaries in the artifact.",
|
|
71
71
|
"Stop if regressions appear and fix before proceeding.",
|
|
72
72
|
"If a test passes unexpectedly, investigate: does the behavior already exist, or is the test wrong?",
|
|
73
|
-
"**Per-Slice Review point (conditional
|
|
73
|
+
"**Per-Slice Review point (conditional).** Check every slice against the triggers before declaring it DONE. Triggers: `touchCount >= filesChangedThreshold`, any `touchPaths` match a `touchTriggers` glob, or the plan row declares `highRisk: true`. On a trigger, run two passes on the slice alone — (1) Spec-Compliance: trace RED/GREEN/REFACTOR evidence back to its plan task + spec criterion, noting edge cases the tests skip; (2) Quality: diff-scan for naming, error handling, dead code, simpler alternatives. Record both under `## Per-Slice Review` in `06-tdd.md`, naming the trigger that fired. Dispatch the `reviewer` subagent natively when available (log `fulfillmentMode: \"isolated\"`); otherwise fulfil via in-session role switch (`fulfillmentMode: \"role-switch\"`). Never fabricate an isolated pass from memory."
|
|
74
74
|
],
|
|
75
75
|
process: [
|
|
76
76
|
"Select one vertical slice and map it to acceptance criterion(s).",
|
|
@@ -81,10 +81,10 @@ export const TDD = {
|
|
|
81
81
|
"Run tests and capture failure output.",
|
|
82
82
|
"Use `test-author` in GREEN intent and implement the smallest change needed for GREEN.",
|
|
83
83
|
"Run full tests and build checks.",
|
|
84
|
-
"Run a fresh verification-before-completion check and capture command + PASS/FAIL plus a commit SHA when
|
|
84
|
+
"Run a fresh verification-before-completion check and capture command + PASS/FAIL plus a commit SHA when `.git` is present; otherwise record explicit no-vcs reason plus content/artifact hash.",
|
|
85
85
|
"Run the REFACTOR intent preserving behavior.",
|
|
86
86
|
"Record RED, GREEN, and REFACTOR evidence in artifact.",
|
|
87
|
-
"Annotate traceability to plan task and spec criterion; on
|
|
87
|
+
"Annotate traceability to plan task and spec criterion; on per-slice triggers, append a Per-Slice Review entry before closing the slice."
|
|
88
88
|
],
|
|
89
89
|
requiredGates: [
|
|
90
90
|
{ id: "tdd_test_discovery_complete", description: "Relevant existing tests, fixtures, helpers, and runnable commands were discovered before RED tests were written." },
|
|
@@ -92,7 +92,7 @@ export const TDD = {
|
|
|
92
92
|
{ id: "tdd_red_test_written", description: "Failing tests exist before implementation changes." },
|
|
93
93
|
{ id: "tdd_green_full_suite", description: "Full relevant suite passes in GREEN state." },
|
|
94
94
|
{ id: "tdd_refactor_completed", description: "Refactor pass completed with behavior preservation verified." },
|
|
95
|
-
{ id: "tdd_verified_before_complete", description: "Fresh verification evidence includes test command, explicit pass/fail status, and a
|
|
95
|
+
{ id: "tdd_verified_before_complete", description: "Fresh verification evidence includes test command, explicit pass/fail status, and a durable ref: commit SHA when `.git` is present or explicit no-VCS attestation + hash when not." },
|
|
96
96
|
{ id: "tdd_iron_law_acknowledged", description: "Iron Law acknowledgement is explicit (`Acknowledged: yes`) before implementation proceeds." },
|
|
97
97
|
{ id: "tdd_watched_red_observed", description: "Watched-RED Proof records at least one observed failing test with ISO timestamp evidence." },
|
|
98
98
|
{ id: "tdd_slice_cycle_complete", description: "Vertical Slice Cycle records RED, GREEN, and REFACTOR phases per active slice." },
|
|
@@ -106,7 +106,7 @@ export const TDD = {
|
|
|
106
106
|
"Execution posture and vertical-slice RED/GREEN/REFACTOR checkpoint plan recorded, including commit boundaries when the repo workflow supports them.",
|
|
107
107
|
"Failing command output captured (RED).",
|
|
108
108
|
"Full test/build output recorded (GREEN).",
|
|
109
|
-
"Fresh verification evidence recorded with command, PASS/FAIL status, and
|
|
109
|
+
"Fresh verification evidence recorded with command, PASS/FAIL status, and commit SHA or no-VCS reason plus content/artifact hash before completion.",
|
|
110
110
|
"Iron Law Acknowledgement section explicitly states `Acknowledged: yes`.",
|
|
111
111
|
"Watched-RED Proof includes at least one populated row with an ISO timestamp.",
|
|
112
112
|
"Vertical Slice Cycle records RED, GREEN, and REFACTOR per active slice.",
|
|
@@ -125,7 +125,7 @@ export const TDD = {
|
|
|
125
125
|
"behavior changed during refactor",
|
|
126
126
|
"no evidence recorded",
|
|
127
127
|
"RED/GREEN blocked — classify with the managed taxonomy `NO_SOURCE_CONTEXT`, `NO_TEST_SURFACE`, `NO_IMPLEMENTABLE_SLICE`, `RED_NOT_EXPRESSIBLE`, or `NO_VCS_MODE` and capture blockedBecause, missingInputs, recommendedRoute, nextCommand, resumeCriteria, and the repair path: RED needs a failing test surface, GREEN needs full-suite pass evidence, REFACTOR needs behavior-preservation evidence.",
|
|
128
|
-
"no-VCS workspace without explicit
|
|
128
|
+
"no-VCS workspace without explicit no-vcs reason and content/artifact hash"
|
|
129
129
|
],
|
|
130
130
|
exitCriteria: [
|
|
131
131
|
"test discovery and system-wide impact check are recorded",
|
|
@@ -170,7 +170,7 @@ export const TDD = {
|
|
|
170
170
|
{ section: "Test Pyramid Shape", required: false, validationRule: "If present: per-slice count of Small/Medium/Large tests added, to let reviewers verify the suite is not drifting top-heavy." },
|
|
171
171
|
{ section: "Mock Preference Order", required: false, validationRule: "When mocks/spies appear in Test Discovery or RED Evidence, prefer Real > Fake > Stub > Mock. Mock-heavy slices should include explicit boundary justification (for example network/fs/time/external trust boundaries)." },
|
|
172
172
|
{ section: "Prove-It Reproduction", required: false, validationRule: "Required for bug-fix slices: original failing reproduction test (RED without fix), passing output with fix (GREEN), and a note confirming the test fails again if the fix is reverted." },
|
|
173
|
-
{ section: "Per-Slice Review", required: false, validationRule: "
|
|
173
|
+
{ section: "Per-Slice Review", required: false, validationRule: "Per triggered slice, a two-part record — Spec-Compliance (slice <-> plan task <-> spec criterion trace plus edge-case notes) and Quality (diff-focused review of naming, error handling, dead code, simpler alternatives). Each entry names the trigger (touchCount, touchPaths glob, or highRisk) and the delegation fulfillmentMode (`isolated` when a reviewer subagent was dispatched natively; `role-switch` when fulfilled in-session). Slices that did not meet any trigger may list `not triggered` instead of a full pass." }
|
|
174
174
|
]
|
|
175
175
|
},
|
|
176
176
|
reviewLens: {
|
|
@@ -224,9 +224,9 @@ export const TDD = {
|
|
|
224
224
|
{
|
|
225
225
|
title: "Per-Slice Review Audit (conditional)",
|
|
226
226
|
evaluationPoints: [
|
|
227
|
-
"
|
|
227
|
+
"Does every triggered slice (touchCount >= threshold, touchPaths match, or highRisk=true) carry a Per-Slice Review entry with BOTH a Spec-Compliance pass (plan task <-> spec criterion + edge-case notes) AND a Quality pass (diff-level naming/errors/dead code/simpler alternatives)?",
|
|
228
228
|
"Is the delegation `fulfillmentMode` recorded (`isolated` for a dispatched reviewer subagent, `role-switch` for an in-session pass) and does it match an entry in `.cclaw/state/delegation-log.json`?",
|
|
229
|
-
"
|
|
229
|
+
"Are there zero missed triggered slices when triggers fired?"
|
|
230
230
|
],
|
|
231
231
|
stopGate: false
|
|
232
232
|
},
|
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
export declare const ARTIFACT_TEMPLATES: Record<string, string>;
|
|
2
2
|
export declare const RULEBOOK_MARKDOWN = "# Cclaw Rulebook\n\n## MUST_ALWAYS\n- Follow flow order: brainstorm -> scope -> design -> spec -> plan -> tdd -> review -> ship\n- Require explicit user confirmation after plan before TDD\n- Keep evidence artifacts in `.cclaw/artifacts/`\n- Enforce RED before GREEN in TDD\n- Run two-layer review (spec_compliance and code_quality) before ship\n- Validate all inputs before processing \u2014 never trust external data without sanitization\n- Prefer immutable data patterns and pure functions where the language supports them\n- Follow existing repo conventions, patterns, and directory structure \u2014 match the codebase\n- Verify claims with fresh evidence: \"tests pass\" requires running tests in this message\n- Use conventional commits: `type(scope): description` (feat, fix, refactor, test, docs, chore)\n\n## MUST_NEVER\n- Skip RED phase and jump directly to GREEN in TDD\n- Ship with critical review findings\n- Start implementation during /brainstorm\n- Modify generated cclaw files manually when CLI can regenerate them\n- Commit `.cclaw/` or generated shim files\n- Expose secrets, tokens, API keys, or absolute system paths in agent output\n- Duplicate existing functionality without explicit justification \u2014 search before building\n- Bypass security checks, linting hooks, or type checking to \"move faster\"\n- Claim success (\"Done,\" \"All good,\" \"Tests pass\") without running verification in this message\n- Make changes outside the blast radius of the current task without user consent\n\n## DELEGATION\nWhen a task requires specialist knowledge (security audit, performance profiling, database review),\ndelegate to a specialized agent or skill if the harness supports it. The primary agent should:\n1. Identify the specialist domain\n2. Provide focused context (relevant files, the specific concern)\n3. Evaluate the specialist output before acting on it \u2014 do not blindly apply recommendations\n";
|
|
3
|
-
|
|
3
|
+
/**
|
|
4
|
+
* Always-on baseline rule materialized at `.cursor/rules/cclaw-guidelines.mdc`.
|
|
5
|
+
* Independent of skill activation — kicks in even when the agent skips
|
|
6
|
+
* loading skills. Three hard rules cover the most common Wave 22 regressions
|
|
7
|
+
* (premature draft, premature subagent dispatch, command-line echo to chat).
|
|
8
|
+
*/
|
|
9
|
+
export declare const CURSOR_GUIDELINES_RULE_MDC = "---\ndescription: cclaw zero-install behavior baseline (always-on)\nglobs:\n - \"**/*\"\nalwaysApply: true\n---\n\n<!-- cclaw-managed-cursor-guidelines-rule -->\n\n# Cclaw Baseline Guidelines\n\nThese three rules apply to every Cursor agent session in this project,\nregardless of whether stage skills loaded.\n\n## 1. Q&A floor before drafting (brainstorm/scope/design)\n\nBefore drafting any `.cclaw/artifacts/01-brainstorm-*.md`,\n`02-scope-*.md`, or `03-design-*.md`, verify that the artifact's\n`## Q&A Log` table contains at least the floor count for the active track\n(see `questionBudgetHint(track, stage).min`). Walk the stage forcing\nquestions one at a time via the `AskQuestion` tool. If you find yourself\nproposing a draft after 1-2 questions, STOP and continue the loop.\n\nThe `qa_log_below_min` linter rule will block `stage-complete` when below\nfloor unless an explicit user stop-signal row is recorded.\n\n## 2. Mandatory subagents run after Q&A approval\n\nFor brainstorm / scope / design, mandatory subagents (\n`product-discovery`, `critic`, `planner`, `architect`,\n`test-author`) run **only AFTER the user approves the elicitation\noutcome**, never before the Q&A loop converges. Dispatching them early\npreempts the user dialogue and violates the elicitation contract \u2014 the\nlinter will block stage-complete.\n\nSee each stage's \"Run Phase: post-elicitation\" rows in the materialized\nAutomatic Subagent Dispatch table.\n\n## 3. Never echo cclaw command lines to chat\n\nThe user does not run cclaw helpers (`node .cclaw/hooks/...`) manually.\nNEVER paste full command lines, `--evidence-json '{...}'` payloads,\n`--waive-delegation=...`, or shell hash commands (`shasum`,\n`sha256sum`, `Get-FileHash`, `certutil`, etc.) into chat. Run the\nhelper via the tool layer and report only the resulting summary. On\nfailure, report a compact human-readable summary plus the helper JSON in\na single fenced `json` block.\n";
|
|
10
|
+
export declare const CURSOR_WORKFLOW_RULE_MDC = "---\ndescription: cclaw workflow guardrails for Cursor agent sessions\nglobs:\n - \"**/*\"\nalwaysApply: true\n---\n\n<!-- cclaw-managed-cursor-workflow-rule -->\n\n# Cclaw Workflow Guardrails\n\n## Activation Rule\n\nBefore responding to coding work:\n1. Read `.cclaw/state/flow-state.json`.\n2. Start with `/cc` or continue with `/cc`.\n3. If no software-stage flow applies, respond normally.\n\n## Stage Order\n\n`brainstorm -> scope -> design -> spec -> plan -> tdd -> review -> ship`\n\nTrack-specific skips are allowed only when `flow-state.track` + `skippedStages` explicitly say so.\n\n## Task Classification\n\n| Class | Route |\n|---|---|\n| non-trivial software work | `/cc <idea>` |\n| trivial software fix | `/cc <idea>` (quick track) |\n| bugfix with repro | `/cc <idea>` and enforce RED-first in tdd |\n| pure question / non-software | direct answer (no stage flow) |\n\n## Command Surface\n\n- `/cc` = entry and resume.\n- `/cc` = only progression path.\n- Knowledge capture and recall use the `learnings` skill when requested.\n\n## Verification Discipline\n\n- No completion claim without fresh command evidence in this turn.\n- Do not mark gates passed from memory.\n- Keep evidence in `.cclaw/artifacts/`; archive through closeout via `/cc` or cancel early via `node .cclaw/hooks/cancel-run.mjs`.\n\n## Delegation And Approvals\n\n- Machine-only checks in design/plan/tdd/review/ship should auto-dispatch when tooling supports it.\n- **For brainstorm / scope / design stages**: ask user input continuously via adaptive elicitation (one question per turn through the harness-native question tool \u2014 `AskQuestion` in Cursor). Walk the stage forcing-questions list one-by-one. Do NOT batch and do NOT defer to a single approval gate at the end. The `qa_log_below_min` linter rule will block `stage-complete` when below floor.\n- **For other stages** (spec/plan/tdd/build/review/ship): ask user input only at explicit approval gates (scope mode, plan approval, challenge resolution, ship finalization), not for routine progress updates.\n- If you find yourself proposing a draft after 1-2 questions in brainstorm/scope/design, STOP \u2014 go back to the forcing-questions list and continue.\n- Mandatory subagents in brainstorm/scope/design run only AFTER the user approves the elicitation outcome (see each stage's \"Run Phase: post-elicitation\" rows). Dispatching them before the Q&A loop converges violates the contract.\n- Never echo cclaw command lines (`node .cclaw/hooks/...`, `--evidence-json '{...}'`) to chat \u2014 the user does not run cclaw manually. Run helpers via the tool layer; report only the resulting summary.\n- If harness capabilities are partial, record waiver reasons in delegation logs.\n\n## Routing Source Of Truth\n\n- Primary router: `.cclaw/skills/using-cclaw/SKILL.md`.\n- Stage behavior: current stage skill plus `.cclaw/state/flow-state.json`.\n- Preamble budget: keep role/status announcements brief and avoid repeating\n them unless the stage or role changes.\n";
|
|
4
11
|
export declare function buildRulesJson(): Record<string, unknown>;
|
|
@@ -307,14 +307,18 @@ RECOMMENDATION: <option letter — one-line rationale tying back to premise chal
|
|
|
307
307
|
> is later dropped, keep the row and mark Priority \`DROPPED\`; if a new one is
|
|
308
308
|
> added mid-flow, append with the next free R-number — do NOT reuse numbers.
|
|
309
309
|
|
|
310
|
-
## Locked Decisions
|
|
311
|
-
|
|
|
310
|
+
## Locked Decisions
|
|
311
|
+
| ID | Decision | Why locked now | Downstream impact |
|
|
312
312
|
|---|---|---|---|
|
|
313
|
-
|
|
|
313
|
+
| D-1 | | | |
|
|
314
314
|
|
|
315
|
-
> Decision
|
|
316
|
-
>
|
|
317
|
-
>
|
|
315
|
+
> Decision IDs are stable \`D-XX\` numbers. Assign once and never renumber across
|
|
316
|
+
> scope/design/spec/plan/review/ship; downstream artifacts reference these IDs
|
|
317
|
+
> verbatim. If a decision is later dropped, keep the row and mark it
|
|
318
|
+
> \`(superseded by D-Y)\`; if a new one is added mid-flow, append with the next
|
|
319
|
+
> free D-number. Wave 22 (v4.0.0) removed the legacy LD#<sha8> hash anchor —
|
|
320
|
+
> existing artifacts with LD# anchors remain valid markdown but the linter only
|
|
321
|
+
> tracks D-XX IDs.
|
|
318
322
|
|
|
319
323
|
## In Scope / Out of Scope
|
|
320
324
|
|
|
@@ -478,7 +482,7 @@ ${MARKDOWN_CODE_FENCE}
|
|
|
478
482
|
> Default path: compact inline synthesis here. Deep/high-risk work may also write \`.cclaw/artifacts/02a-research.md\`.
|
|
479
483
|
|
|
480
484
|
## Architecture Boundaries
|
|
481
|
-
| Component | Responsibility | Requirement Refs (R#) | Decision Refs (
|
|
485
|
+
| Component | Responsibility | Requirement Refs (R#) | Decision Refs (D-XX) | Owner |
|
|
482
486
|
|---|---|---|---|---|
|
|
483
487
|
| | | | | |
|
|
484
488
|
|
|
@@ -540,11 +544,11 @@ ${MARKDOWN_CODE_FENCE}
|
|
|
540
544
|
### Interaction Edge Case Matrix
|
|
541
545
|
| Edge case | Handled? | Design response | Deferred item (if not handled) |
|
|
542
546
|
|---|---|---|---|
|
|
543
|
-
| double-click | yes/no | | None /
|
|
544
|
-
| nav-away-mid-request | yes/no | | None /
|
|
545
|
-
| 10K-result dataset | yes/no | | None /
|
|
546
|
-
| background-job abandonment | yes/no | | None /
|
|
547
|
-
| zombie connection | yes/no | | None /
|
|
547
|
+
| double-click | yes/no | | None / D-XX |
|
|
548
|
+
| nav-away-mid-request | yes/no | | None / D-XX |
|
|
549
|
+
| 10K-result dataset | yes/no | | None / D-XX |
|
|
550
|
+
| background-job abandonment | yes/no | | None / D-XX |
|
|
551
|
+
| zombie connection | yes/no | | None / D-XX |
|
|
548
552
|
|
|
549
553
|
## Security & Threat Model
|
|
550
554
|
| Boundary | Threat | Mitigation | Owner |
|
|
@@ -699,7 +703,7 @@ ${MARKDOWN_CODE_FENCE}
|
|
|
699
703
|
- Drift from upstream (or \`None\`):
|
|
700
704
|
|
|
701
705
|
## Acceptance Criteria
|
|
702
|
-
| ID | Requirement Ref (R#) | Criterion (observable/measurable/falsifiable) | Design Decision Ref (
|
|
706
|
+
| ID | Requirement Ref (R#) | Criterion (observable/measurable/falsifiable) | Design Decision Ref (D-XX) |
|
|
703
707
|
|---|---|---|---|
|
|
704
708
|
| AC-1 | R1 | | |
|
|
705
709
|
|
|
@@ -845,9 +849,9 @@ Execution rule: complete and verify each batch before starting the next batch.
|
|
|
845
849
|
- TDD checkpoint plan: RED commit/checkpoint -> GREEN commit/checkpoint -> REFACTOR commit/checkpoint (or deferred because: )
|
|
846
850
|
|
|
847
851
|
## Locked Decision Coverage
|
|
848
|
-
| Decision Ref (
|
|
852
|
+
| Decision Ref (D-XX) | Source section | Plan tasks implementing decision | Status |
|
|
849
853
|
|---|---|---|---|
|
|
850
|
-
|
|
|
854
|
+
| D-1 | 02-scope.md > Locked Decisions | T-1 | covered |
|
|
851
855
|
|
|
852
856
|
## Risk Assessment
|
|
853
857
|
| Task/Batch | Risk | Likelihood | Impact | Mitigation |
|
|
@@ -870,7 +874,7 @@ Execution rule: complete and verify each batch before starting the next batch.
|
|
|
870
874
|
- Create:
|
|
871
875
|
- Modify:
|
|
872
876
|
- Test:
|
|
873
|
-
- **Approach:** (1-3 sentences; cite design decision DD-# or
|
|
877
|
+
- **Approach:** (1-3 sentences; cite design decision DD-# or scope D-XX)
|
|
874
878
|
- **Patterns to follow:** (link existing files/modules to mirror, or \`- None applicable.\`)
|
|
875
879
|
- **Test scenarios:**
|
|
876
880
|
- Happy:
|
|
@@ -908,7 +912,7 @@ Execution rule: complete and verify each batch before starting the next batch.
|
|
|
908
912
|
- Hits: 0 (required for WAIT_FOR_CONFIRM to resolve).
|
|
909
913
|
- Scope reduction language scan:
|
|
910
914
|
- Scanned phrases: \`v1\`, \`for now\`, \`later\`, \`temporary\`, \`placeholder\`, \`mock for now\`, \`hardcoded for now\`, \`will improve later\`.
|
|
911
|
-
- Hits: 0 (required when Locked Decisions section is non-empty;
|
|
915
|
+
- Hits: 0 (required when Locked Decisions section is non-empty; reference D-XX IDs from scope).
|
|
912
916
|
|
|
913
917
|
## WAIT_FOR_CONFIRM
|
|
914
918
|
- Status: pending
|
|
@@ -1449,6 +1453,60 @@ delegate to a specialized agent or skill if the harness supports it. The primary
|
|
|
1449
1453
|
2. Provide focused context (relevant files, the specific concern)
|
|
1450
1454
|
3. Evaluate the specialist output before acting on it — do not blindly apply recommendations
|
|
1451
1455
|
`;
|
|
1456
|
+
/**
|
|
1457
|
+
* Always-on baseline rule materialized at `.cursor/rules/cclaw-guidelines.mdc`.
|
|
1458
|
+
* Independent of skill activation — kicks in even when the agent skips
|
|
1459
|
+
* loading skills. Three hard rules cover the most common Wave 22 regressions
|
|
1460
|
+
* (premature draft, premature subagent dispatch, command-line echo to chat).
|
|
1461
|
+
*/
|
|
1462
|
+
export const CURSOR_GUIDELINES_RULE_MDC = `---
|
|
1463
|
+
description: cclaw zero-install behavior baseline (always-on)
|
|
1464
|
+
globs:
|
|
1465
|
+
- "**/*"
|
|
1466
|
+
alwaysApply: true
|
|
1467
|
+
---
|
|
1468
|
+
|
|
1469
|
+
<!-- cclaw-managed-cursor-guidelines-rule -->
|
|
1470
|
+
|
|
1471
|
+
# Cclaw Baseline Guidelines
|
|
1472
|
+
|
|
1473
|
+
These three rules apply to every Cursor agent session in this project,
|
|
1474
|
+
regardless of whether stage skills loaded.
|
|
1475
|
+
|
|
1476
|
+
## 1. Q&A floor before drafting (brainstorm/scope/design)
|
|
1477
|
+
|
|
1478
|
+
Before drafting any \`.cclaw/artifacts/01-brainstorm-*.md\`,
|
|
1479
|
+
\`02-scope-*.md\`, or \`03-design-*.md\`, verify that the artifact's
|
|
1480
|
+
\`## Q&A Log\` table contains at least the floor count for the active track
|
|
1481
|
+
(see \`questionBudgetHint(track, stage).min\`). Walk the stage forcing
|
|
1482
|
+
questions one at a time via the \`AskQuestion\` tool. If you find yourself
|
|
1483
|
+
proposing a draft after 1-2 questions, STOP and continue the loop.
|
|
1484
|
+
|
|
1485
|
+
The \`qa_log_below_min\` linter rule will block \`stage-complete\` when below
|
|
1486
|
+
floor unless an explicit user stop-signal row is recorded.
|
|
1487
|
+
|
|
1488
|
+
## 2. Mandatory subagents run after Q&A approval
|
|
1489
|
+
|
|
1490
|
+
For brainstorm / scope / design, mandatory subagents (
|
|
1491
|
+
\`product-discovery\`, \`critic\`, \`planner\`, \`architect\`,
|
|
1492
|
+
\`test-author\`) run **only AFTER the user approves the elicitation
|
|
1493
|
+
outcome**, never before the Q&A loop converges. Dispatching them early
|
|
1494
|
+
preempts the user dialogue and violates the elicitation contract — the
|
|
1495
|
+
linter will block stage-complete.
|
|
1496
|
+
|
|
1497
|
+
See each stage's "Run Phase: post-elicitation" rows in the materialized
|
|
1498
|
+
Automatic Subagent Dispatch table.
|
|
1499
|
+
|
|
1500
|
+
## 3. Never echo cclaw command lines to chat
|
|
1501
|
+
|
|
1502
|
+
The user does not run cclaw helpers (\`node .cclaw/hooks/...\`) manually.
|
|
1503
|
+
NEVER paste full command lines, \`--evidence-json '{...}'\` payloads,
|
|
1504
|
+
\`--waive-delegation=...\`, or shell hash commands (\`shasum\`,
|
|
1505
|
+
\`sha256sum\`, \`Get-FileHash\`, \`certutil\`, etc.) into chat. Run the
|
|
1506
|
+
helper via the tool layer and report only the resulting summary. On
|
|
1507
|
+
failure, report a compact human-readable summary plus the helper JSON in
|
|
1508
|
+
a single fenced \`json\` block.
|
|
1509
|
+
`;
|
|
1452
1510
|
export const CURSOR_WORKFLOW_RULE_MDC = `---
|
|
1453
1511
|
description: cclaw workflow guardrails for Cursor agent sessions
|
|
1454
1512
|
globs:
|
|
@@ -1497,7 +1555,11 @@ Track-specific skips are allowed only when \`flow-state.track\` + \`skippedStage
|
|
|
1497
1555
|
## Delegation And Approvals
|
|
1498
1556
|
|
|
1499
1557
|
- Machine-only checks in design/plan/tdd/review/ship should auto-dispatch when tooling supports it.
|
|
1500
|
-
-
|
|
1558
|
+
- **For brainstorm / scope / design stages**: ask user input continuously via adaptive elicitation (one question per turn through the harness-native question tool — \`AskQuestion\` in Cursor). Walk the stage forcing-questions list one-by-one. Do NOT batch and do NOT defer to a single approval gate at the end. The \`qa_log_below_min\` linter rule will block \`stage-complete\` when below floor.
|
|
1559
|
+
- **For other stages** (spec/plan/tdd/build/review/ship): ask user input only at explicit approval gates (scope mode, plan approval, challenge resolution, ship finalization), not for routine progress updates.
|
|
1560
|
+
- If you find yourself proposing a draft after 1-2 questions in brainstorm/scope/design, STOP — go back to the forcing-questions list and continue.
|
|
1561
|
+
- Mandatory subagents in brainstorm/scope/design run only AFTER the user approves the elicitation outcome (see each stage's "Run Phase: post-elicitation" rows). Dispatching them before the Q&A loop converges violates the contract.
|
|
1562
|
+
- Never echo cclaw command lines (\`node .cclaw/hooks/...\`, \`--evidence-json '{...}'\`) to chat — the user does not run cclaw manually. Run helpers via the tool layer; report only the resulting summary.
|
|
1501
1563
|
- If harness capabilities are partial, record waiver reasons in delegation logs.
|
|
1502
1564
|
|
|
1503
1565
|
## Routing Source Of Truth
|
package/dist/gate-evidence.d.ts
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
import type { FlowState, StageGateState } from "./flow-state.js";
|
|
2
2
|
import { type FlowStage } from "./types.js";
|
|
3
|
+
/**
|
|
4
|
+
* Structured signal for the harness UI describing the adaptive
|
|
5
|
+
* elicitation Q&A floor for the current stage. Always present on
|
|
6
|
+
* brainstorm/scope/design verifications; null on other stages.
|
|
7
|
+
*
|
|
8
|
+
* Mirrors the `evaluateQaLogFloor` linter helper. Harness can render
|
|
9
|
+
* `count / min` progress, surface stop-signal/skip-questions hints, and
|
|
10
|
+
* differentiate between blocking and advisory.
|
|
11
|
+
*/
|
|
12
|
+
export interface QaLogFloorSignal {
|
|
13
|
+
ok: boolean;
|
|
14
|
+
count: number;
|
|
15
|
+
min: number;
|
|
16
|
+
hasStopSignal: boolean;
|
|
17
|
+
liteShortCircuit: boolean;
|
|
18
|
+
skipQuestionsAdvisory: boolean;
|
|
19
|
+
blocking: boolean;
|
|
20
|
+
}
|
|
3
21
|
export interface GateEvidenceCheckResult {
|
|
4
22
|
ok: boolean;
|
|
5
23
|
stage: FlowStage;
|
|
@@ -18,6 +36,8 @@ export interface GateEvidenceCheckResult {
|
|
|
18
36
|
missingRecommended: string[];
|
|
19
37
|
/** Triggered conditional gates that are not yet passed. */
|
|
20
38
|
missingTriggeredConditional: string[];
|
|
39
|
+
/** Q&A floor signal for adaptive elicitation stages, null otherwise. */
|
|
40
|
+
qaLogFloor: QaLogFloorSignal | null;
|
|
21
41
|
}
|
|
22
42
|
export interface CompletedStagesClosureResult {
|
|
23
43
|
ok: boolean;
|
|
@@ -29,7 +49,11 @@ export interface CompletedStagesClosureResult {
|
|
|
29
49
|
blocked: string[];
|
|
30
50
|
}>;
|
|
31
51
|
}
|
|
32
|
-
export
|
|
52
|
+
export interface VerifyCurrentStageGateEvidenceOptions {
|
|
53
|
+
/** Extra stage flags propagated from the in-flight CLI args (e.g. `--skip-questions`). */
|
|
54
|
+
extraStageFlags?: string[];
|
|
55
|
+
}
|
|
56
|
+
export declare function verifyCurrentStageGateEvidence(projectRoot: string, flowState: FlowState, options?: VerifyCurrentStageGateEvidenceOptions): Promise<GateEvidenceCheckResult>;
|
|
33
57
|
export declare function verifyCompletedStagesGateClosure(flowState: FlowState): CompletedStagesClosureResult;
|
|
34
58
|
export interface GateReconciliationResult {
|
|
35
59
|
stage: FlowStage;
|
package/dist/gate-evidence.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import fs from "node:fs/promises";
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import { checkReviewSecurityNoChangeAttestation, checkReviewVerdictConsistency, extractMarkdownSectionBody, lintArtifact, validateReviewArmy } from "./artifact-linter.js";
|
|
4
|
+
import { ELICITATION_STAGES, evaluateQaLogFloor } from "./artifact-linter/shared.js";
|
|
4
5
|
import { resolveArtifactPath } from "./artifact-paths.js";
|
|
5
|
-
import { readConfig } from "./config.js";
|
|
6
6
|
import { RUNTIME_ROOT } from "./constants.js";
|
|
7
7
|
import { stageSchema } from "./content/stage-schema.js";
|
|
8
8
|
import { readDelegationLedger } from "./delegation.js";
|
|
@@ -179,10 +179,7 @@ async function readEarlyLoopGateSnapshot(projectRoot, flowState) {
|
|
|
179
179
|
return { snapshot: onDisk };
|
|
180
180
|
}
|
|
181
181
|
try {
|
|
182
|
-
const
|
|
183
|
-
const computed = await computeEarlyLoopStatus(flowState.currentStage, flowState.activeRunId, path.join(stateDir, "early-loop-log.jsonl"), {
|
|
184
|
-
maxIterations: config.earlyLoop?.maxIterations
|
|
185
|
-
});
|
|
182
|
+
const computed = await computeEarlyLoopStatus(flowState.currentStage, flowState.activeRunId, path.join(stateDir, "early-loop-log.jsonl"));
|
|
186
183
|
return {
|
|
187
184
|
snapshot: {
|
|
188
185
|
stage: computed.stage,
|
|
@@ -211,7 +208,7 @@ const DESIGN_RESEARCH_REQUIRED_SECTIONS = [
|
|
|
211
208
|
"Pitfalls & Risks",
|
|
212
209
|
"Synthesis"
|
|
213
210
|
];
|
|
214
|
-
export async function verifyCurrentStageGateEvidence(projectRoot, flowState) {
|
|
211
|
+
export async function verifyCurrentStageGateEvidence(projectRoot, flowState, options = {}) {
|
|
215
212
|
const stage = flowState.currentStage;
|
|
216
213
|
const schema = stageSchema(stage, flowState.track);
|
|
217
214
|
const catalog = flowState.stageGateCatalog[stage];
|
|
@@ -287,7 +284,9 @@ export async function verifyCurrentStageGateEvidence(projectRoot, flowState) {
|
|
|
287
284
|
const artifactPresent = await currentStageArtifactExists(projectRoot, stage, flowState.track);
|
|
288
285
|
const shouldValidateArtifact = artifactPresent || catalog.passed.length > 0 || flowState.completedStages.includes(stage);
|
|
289
286
|
if (shouldValidateArtifact) {
|
|
290
|
-
const lint = await lintArtifact(projectRoot, stage, flowState.track
|
|
287
|
+
const lint = await lintArtifact(projectRoot, stage, flowState.track, {
|
|
288
|
+
extraStageFlags: options.extraStageFlags
|
|
289
|
+
});
|
|
291
290
|
if (!lint.passed) {
|
|
292
291
|
const failedRequiredFindings = lint.findings
|
|
293
292
|
.filter((finding) => finding.required && !finding.found);
|
|
@@ -448,6 +447,33 @@ export async function verifyCurrentStageGateEvidence(projectRoot, flowState) {
|
|
|
448
447
|
issues.push(`stage "${stage}" is marked completed but has blocking blocked gates: ${blockingBlocked.join(", ")}.`);
|
|
449
448
|
}
|
|
450
449
|
}
|
|
450
|
+
let qaLogFloor = null;
|
|
451
|
+
if (ELICITATION_STAGES.has(stage)) {
|
|
452
|
+
let qaLogBody = null;
|
|
453
|
+
try {
|
|
454
|
+
const stageMd = await readStageArtifactMarkdown(projectRoot, stage, flowState.track);
|
|
455
|
+
qaLogBody = stageMd
|
|
456
|
+
? extractMarkdownSectionBody(stageMd, "Q&A Log")
|
|
457
|
+
: null;
|
|
458
|
+
}
|
|
459
|
+
catch {
|
|
460
|
+
qaLogBody = null;
|
|
461
|
+
}
|
|
462
|
+
const skipQuestionsHint = flowState.interactionHints?.[stage]?.skipQuestions === true ||
|
|
463
|
+
(options.extraStageFlags ?? []).includes("--skip-questions");
|
|
464
|
+
const floor = evaluateQaLogFloor(qaLogBody, flowState.track, stage, {
|
|
465
|
+
skipQuestions: skipQuestionsHint
|
|
466
|
+
});
|
|
467
|
+
qaLogFloor = {
|
|
468
|
+
ok: floor.ok,
|
|
469
|
+
count: floor.count,
|
|
470
|
+
min: floor.min,
|
|
471
|
+
hasStopSignal: floor.hasStopSignal,
|
|
472
|
+
liteShortCircuit: floor.liteShortCircuit,
|
|
473
|
+
skipQuestionsAdvisory: floor.skipQuestionsAdvisory,
|
|
474
|
+
blocking: !floor.ok && !floor.skipQuestionsAdvisory
|
|
475
|
+
};
|
|
476
|
+
}
|
|
451
477
|
return {
|
|
452
478
|
ok: issues.length === 0,
|
|
453
479
|
stage,
|
|
@@ -461,7 +487,8 @@ export async function verifyCurrentStageGateEvidence(projectRoot, flowState) {
|
|
|
461
487
|
complete,
|
|
462
488
|
missingRequired,
|
|
463
489
|
missingRecommended,
|
|
464
|
-
missingTriggeredConditional
|
|
490
|
+
missingTriggeredConditional,
|
|
491
|
+
qaLogFloor
|
|
465
492
|
};
|
|
466
493
|
}
|
|
467
494
|
export function verifyCompletedStagesGateClosure(flowState) {
|
package/dist/harness-adapters.js
CHANGED
|
@@ -345,6 +345,14 @@ Before responding to a coding request:
|
|
|
345
345
|
2. Use \`/cc\` to start, resume, or continue the flow.
|
|
346
346
|
3. If no stage applies, respond normally.
|
|
347
347
|
|
|
348
|
+
### Cclaw Baseline (always-on)
|
|
349
|
+
|
|
350
|
+
Three rules apply to every cclaw stage in this project, regardless of which skills loaded:
|
|
351
|
+
|
|
352
|
+
1. **Q&A floor before drafting** — for brainstorm / scope / design, walk the stage forcing questions one at a time via the harness-native question tool (Claude \`AskUserQuestion\`, Cursor \`AskQuestion\`, Codex \`request_user_input\`, Gemini \`ask_user\`). The \`qa_log_below_min\` linter rule will block \`stage-complete\` when the artifact's \`## Q&A Log\` is below \`questionBudgetHint(track, stage).min\` unless an explicit user stop-signal row is recorded.
|
|
353
|
+
2. **Subagents run after Q&A approval** — mandatory subagents in brainstorm / scope / design (\`product-discovery\`, \`critic\`, \`planner\`, \`architect\`, \`test-author\`) run only AFTER the user approves the elicitation outcome. See each stage's "Run Phase: post-elicitation" rows in the materialized Automatic Subagent Dispatch table.
|
|
354
|
+
3. **No command-line echo to chat** — the user does not run cclaw helpers manually. Never paste \`node .cclaw/hooks/...\` invocations, \`--evidence-json '{...}'\` payloads, or shell hash commands (\`shasum\`, \`sha256sum\`, \`Get-FileHash\`, \`certutil\`, etc.) into chat. Run helpers via the tool layer; report only the resulting summary.
|
|
355
|
+
|
|
348
356
|
${ironLawsAgentsMdBlock()}
|
|
349
357
|
|
|
350
358
|
### Task Classification (before \`/cc\`)
|
package/dist/hook-schema.js
CHANGED
|
@@ -68,6 +68,9 @@ function validateClaudeLikeEvent(eventName, eventEntries, errors) {
|
|
|
68
68
|
if (hook.timeout !== undefined && !isPositiveNumber(hook.timeout)) {
|
|
69
69
|
errors.push(`hooks.${eventName}[${index}].hooks[${hookIndex}].timeout must be a positive number when present`);
|
|
70
70
|
}
|
|
71
|
+
if (hook.statusMessage !== undefined && !isNonEmptyString(hook.statusMessage)) {
|
|
72
|
+
errors.push(`hooks.${eventName}[${index}].hooks[${hookIndex}].statusMessage must be a non-empty string when present`);
|
|
73
|
+
}
|
|
71
74
|
}
|
|
72
75
|
}
|
|
73
76
|
}
|
package/dist/install.d.ts
CHANGED
|
@@ -11,13 +11,8 @@ export declare function initCclaw(options: InitOptions): Promise<void>;
|
|
|
11
11
|
export declare function syncCclaw(projectRoot: string, options?: SyncOptions): Promise<void>;
|
|
12
12
|
/**
|
|
13
13
|
* Refresh generated files in `.cclaw/` without touching user-authored
|
|
14
|
-
* artifacts
|
|
15
|
-
* stamps
|
|
16
|
-
*
|
|
17
|
-
* Shape preservation: if the user previously hand-authored advanced keys
|
|
18
|
-
* (e.g. `tdd`, `compound`, `trackHeuristics`, `sliceReview`), those stay in
|
|
19
|
-
* the yaml. If their existing config is minimal, the upgrade keeps it
|
|
20
|
-
* minimal — advanced knobs are never silently added.
|
|
14
|
+
* artifacts or state. Config remains harness-only with managed version
|
|
15
|
+
* stamps.
|
|
21
16
|
*/
|
|
22
17
|
export declare function upgradeCclaw(projectRoot: string): Promise<void>;
|
|
23
18
|
export declare function uninstallCclaw(projectRoot: string): Promise<void>;
|