create-harness-vibe-coding 0.8.2 → 0.8.4

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.
Files changed (55) hide show
  1. package/README-CN.md +2 -2
  2. package/README.md +2 -3
  3. package/package.json +1 -2
  4. package/src/generator.js +4 -5
  5. package/templates/common/.claude/agents/context-master.md +3 -2
  6. package/templates/common/.claude/agents/memory-master.md +3 -2
  7. package/templates/common/.claude/agents/tdd-guide.md +45 -19
  8. package/templates/common/.claude/agents/test-writer.md +52 -38
  9. package/templates/common/.claude/commands/wf-help.md +21 -0
  10. package/templates/common/.claude/rules/ecc/common.md +1 -1
  11. package/templates/common/.claude/settings.json +33 -90
  12. package/templates/common/.claude/skills/tdd/SKILL.md +18 -11
  13. package/templates/common/.claude/skills/wf-auto/SKILL.md +1 -1
  14. package/templates/common/.codex/config.toml +0 -2
  15. package/templates/common/.harness-version +55 -37
  16. package/templates/common/AGENTS.md +7 -6
  17. package/templates/common/CLAUDE.md +3 -4
  18. package/templates/common/Harness/ACCEPTANCE_PROTOCOL.md +170 -0
  19. package/templates/common/Harness/AGENT_ISOLATION.md +73 -0
  20. package/templates/common/Harness/DEBUG_PROTOCOL.md +64 -0
  21. package/templates/common/Harness/ECC-GUIDE.md +4 -4
  22. package/templates/common/Harness/HARNESS_BRIDGE.md +128 -0
  23. package/templates/common/Harness/MEMORY_PROTOCOL.md +114 -0
  24. package/templates/common/Harness/README.md +31 -16
  25. package/templates/common/Harness/TDD-GUIDE.md +138 -56
  26. package/templates/common/Harness/WF-AUTO.md +77 -16
  27. package/templates/common/Harness/WF-MAX.md +81 -22
  28. package/templates/common/Harness/WF.md +38 -18
  29. package/templates/common/Harness/agent-workflow.md +47 -22
  30. package/templates/common/Harness/context-loading.md +33 -32
  31. package/templates/common/Harness/dispatch.md +10 -4
  32. package/templates/common/Harness/extension.md +3 -3
  33. package/templates/common/Harness/lifecycle.md +19 -13
  34. package/templates/common/Harness/research/PRD.md +18 -9
  35. package/templates/common/Harness/subagents.md +41 -14
  36. package/templates/common/Harness/tasks/_template/NAMING.md +2 -2
  37. package/templates/common/Harness/tasks/_template/PLAN.md +53 -11
  38. package/templates/common/Harness/templates/ACCEPTANCE.template.md +20 -0
  39. package/templates/common/Harness/templates/API_CONTRACT.template.md +40 -0
  40. package/templates/common/Harness/templates/PLAYWRIGHT_SPEC.template.ts +21 -0
  41. package/templates/common/Harness/templates/PRD.template.md +45 -0
  42. package/templates/common/Harness/templates/TEST_PLAN.template.md +14 -0
  43. package/templates/common/Harness/templates/UI_CONTRACT.template.md +11 -0
  44. package/templates/common/Harness/templates/VALIDATION_REPORT.template.md +20 -0
  45. package/templates/common/MEMORY.md +14 -3
  46. package/templates/common/README.md +1 -1
  47. package/templates/common/SETUP.md +24 -20
  48. package/templates/common/scripts/validate-harness.mjs +134 -41
  49. package/templates/common/scripts/wf-remove.mjs +6 -2
  50. package/templates/optional/skills/browser-e2e/Harness/workflows/browser-e2e.md +11 -3
  51. package/templates/optional/skills/ts-react-frontend/Harness/workflows/ts-react-frontend.md +1 -1
  52. package/templates/common/.codex/hooks.json +0 -59
  53. package/templates/common/scripts/wf-mode-hook.mjs +0 -895
  54. package/templates/common/scripts/wf-statusline.ps1 +0 -62
  55. package/templates/common/scripts/wf-statusline.sh +0 -67
@@ -15,9 +15,15 @@ This fills the gap between:
15
15
  - `/wf-max` — task-bounded, stops on completion, just faster
16
16
  - `/wf-auto` — **unbounded, self-directed, perpetual improvement**
17
17
 
18
- ## Organization Model
19
-
20
- ```
18
+ ## Organization Model
19
+
20
+ WF-AUTO uses the same acceptance-driven mother flow per cycle. Each selected
21
+ optimization becomes a Mini PRD with AC IDs, a test/validation plan, bounded
22
+ implementation, independent validation, review, debug if needed, and memory.
23
+ Autonomy changes who chooses the next improvement; it does not make
24
+ implementation or tests the source of truth.
25
+
26
+ ```
21
27
  CEO(1) ──┬── Angle-Agent₁ (correctness)
22
28
  ├── Angle-Agent₂ (performance)
23
29
  ├── Angle-Agent₃ (security)
@@ -235,9 +241,17 @@ reversibility: easy-to-revert=1.2, hard-to-revert=0.5
235
241
 
236
242
  CEO picks the SINGLE highest-scoring finding. One change per cycle keeps each iteration bounded and reviewable.
237
243
 
238
- If multiple findings tie, prefer: correctness > security > robustness > performance > architecture > maintainability > test-coverage > ux-dx.
239
-
240
- ### W2: IMPLEMENT
244
+ If multiple findings tie, prefer: correctness > security > robustness > performance > architecture > maintainability > test-coverage > ux-dx.
245
+
246
+ Before W2, CEO writes a cycle Mini PRD:
247
+
248
+ - Goal
249
+ - Scope and non-scope
250
+ - AC IDs
251
+ - UI/API/state contracts, if touched
252
+ - Verification commands and evidence expected
253
+
254
+ ### W2: IMPLEMENT
241
255
 
242
256
  Modeled on WF's build loop but scoped to ONE change:
243
257
 
@@ -247,7 +261,13 @@ Modeled on WF's build loop but scoped to ONE change:
247
261
 
248
262
  CEO NEVER writes production code — this rule is inherited from WF-MAX (AP1: CEO-as-Worker).
249
263
 
250
- ### W3: REVIEW
264
+ Acceptance-specific implementation rules:
265
+
266
+ - Dispatch `test-writer` when AC IDs need new or updated tests.
267
+ - Dispatch `implementer` with forbidden truth files: PRD, AC, UI/API contracts, test plan, and validation report.
268
+ - Implementer may not rewrite ACs/contracts to make the implementation pass.
269
+
270
+ ### W3: REVIEW
251
271
 
252
272
  Two-gate review (from WF/subagents.md):
253
273
 
@@ -271,7 +291,10 @@ If review or verification fails:
271
291
  - For API changes: real request/response check
272
292
  - Record evidence in `Harness/tasks/auto/PROGRESS.md`
273
293
 
274
- ### RECORD
294
+ Validation must include AC-by-AC evidence in `Harness/tasks/auto/PROGRESS.md`,
295
+ not only a generic pass/fail command result.
296
+
297
+ ### RECORD
275
298
 
276
299
  Every cycle writes one entry to `Harness/tasks/auto/PROGRESS.md`:
277
300
 
@@ -293,11 +316,46 @@ Every cycle writes one entry to `Harness/tasks/auto/PROGRESS.md`:
293
316
  - Residual risk: none
294
317
  ```
295
318
 
296
- ### LOOP → W0
297
-
298
- IMMEDIATELY return to W0. No pause between cycles — the only breaks are the adaptive Intent Checkpoint and the A-GATE.
299
-
300
- ### Intent Checkpoint (adaptive re-anchoring)
319
+ ### LOOP → W0
320
+
321
+ IMMEDIATELY return to W0. No pause between cycles — the only breaks are the adaptive Intent Checkpoint and the A-GATE.
322
+
323
+ ### WF-AUTO Hook Exception
324
+
325
+ Runtime hooks are disabled by default across the Harness scaffold. The only
326
+ allowed exception is an explicitly enabled `/wf-auto` tick hook for long-running
327
+ auto-optimization.
328
+
329
+ The hook is not a role-enforcement mechanism, not a memory injection mechanism,
330
+ and not WF-MAX state. It is only a bounded tick trigger:
331
+
332
+ ```text
333
+ wf-auto hook event
334
+ -> confirm /wf-auto is active in Harness/tasks/auto/
335
+ -> check STOP/paused/user-interrupt state
336
+ -> request exactly one W0-W5 tick or one Intent Checkpoint
337
+ -> append heartbeat/evidence to Harness/tasks/auto/PROGRESS.md
338
+ -> exit
339
+ ```
340
+
341
+ Hard boundaries:
342
+
343
+ - no hook is installed or registered by default
344
+ - only `/wf-auto` may use a runtime hook
345
+ - the hook must run one bounded tick, not an unbounded process
346
+ - the hook must respect `Harness/tasks/auto/STOP`, `state=paused`, user stop,
347
+ and the 8-Angle Exhaustion Gate
348
+ - the hook must not enforce WF-MAX roles, writeSet, or agent identity
349
+ - the hook must not inject memory directly; use `MEMORY_PROTOCOL.md` scenario
350
+ hints through controller/context-master
351
+ - the hook must not write production files outside the normal W0-W5 gated flow
352
+ - repeated hook failures must pause auto mode and record evidence, not keep
353
+ retrying silently
354
+
355
+ Perpetual behavior comes from repeated bounded ticks with durable evidence, not
356
+ from a single runaway hook process.
357
+
358
+ ### Intent Checkpoint (adaptive re-anchoring)
301
359
 
302
360
  WF-AUTO is autonomous but not blind. Every N cycles, the CEO pauses briefly to verify alignment. This is NOT a hard stop — it's a lightweight drift check.
303
361
 
@@ -471,9 +529,12 @@ Before W2, CEO checks: does this change delete functionality, change public API,
471
529
  - Codebase is <100 lines → angle scan overhead > benefit
472
530
  - Production hotfix needed urgently → direct fix, not optimization loop
473
531
 
474
- ## /wf vs /wf-max vs /wf-auto
475
-
476
- | Dimension | /wf | /wf-max | /wf-auto |
532
+ ## /wf vs /wf-max vs /wf-auto
533
+
534
+ Acceptance source is PRD-derived AC IDs in `/wf` and `/wf-max`, and cycle
535
+ Mini PRD-derived AC IDs in `/wf-auto`.
536
+
537
+ | Dimension | /wf | /wf-max | /wf-auto |
477
538
  |-----------|-----|---------|----------|
478
539
  | Scope | Task-bounded | Task-bounded | Unbounded |
479
540
  | Stop condition | Task complete | Task complete | 8-angle exhaustion + oracle + spark exhausted + 2 confirm rounds |
@@ -24,7 +24,15 @@ Managers: scope, coordinate. No source edits. Reviewers: read only.
24
24
  If tempted to Read/Edit/Bash a source file → STOP. Spawn a Worker.
25
25
  ```
26
26
 
27
- ## Trigger
27
+ WF-MAX is the maximum-parallelism version of the same acceptance-driven flow used
28
+ by `/wf`: Mini PRD -> Acceptance Criteria -> UI/API Contracts -> Test Plan ->
29
+ Implementation Dispatch -> Independent Validation -> Review -> Debug -> Memory.
30
+ The hierarchy changes; the source of truth does not. PRD-derived AC IDs govern
31
+ every worker dispatch, test, review, validation result, debug handoff, and memory
32
+ entry. See [ACCEPTANCE_PROTOCOL.md](ACCEPTANCE_PROTOCOL.md),
33
+ [AGENT_ISOLATION.md](AGENT_ISOLATION.md), and [HARNESS_BRIDGE.md](HARNESS_BRIDGE.md).
34
+
35
+ ## Trigger
28
36
 
29
37
  - Explicit: `/wf-max [task]`
30
38
  - Auto: WF task with write-set ≥5 files AND clear disjoint boundaries
@@ -60,19 +68,46 @@ CEO(1) ──┬── Manager₁(span) ──┬── Worker₁..ₙ
60
68
 
61
69
  The Decomposition Gate is a hard stop. No code changes, no Worker spawns until the gate passes. The CEO MUST produce a Dispatch Table artifact and pass the Self-Audit Checklist. This is the single most important enforcement mechanism in WF-MAX — it exists because **models default to "do it myself" rather than "decompose and delegate."**
62
70
 
63
- ### Gate Artifact: Dispatch Table
64
-
65
- CEO MUST write this table in the task PLAN.md after W1 architecture defines the write-set and before W2 implementation dispatch:
66
-
67
- ```
68
- | File | Concern | Worker Type | Worker Label | Read-Only? |
69
- |------|---------|------------|--------------|------------|
70
- | src/a.ts | Auth middleware | implementer | impl-auth | No |
71
- | src/b.ts | DB schema | implementer | impl-db | No |
72
- | docs/arch.md | Research existing patterns | researcher | res-arch | Yes |
73
- ```
74
-
75
- ### Gate Rules (any violation = gate fail, retry)
71
+ ### Gate Artifact: Dispatch Table
72
+
73
+ WF-MAX gate order:
74
+
75
+ ```text
76
+ PRD-GATE
77
+ -> AC-GATE
78
+ -> CONTRACT-GATE
79
+ -> TEST-GATE
80
+ -> D-GATE
81
+ -> IMPLEMENT-GATE
82
+ -> VALIDATION-GATE
83
+ -> REVIEW-GATE
84
+ ```
85
+
86
+ D-GATE answers "who may change which file." The earlier gates answer "what must
87
+ be accepted, how it will be tested, and which truth files are forbidden to
88
+ implementers." The Dispatch Table must map each write Worker to the AC IDs it
89
+ implements.
90
+
91
+ CEO MUST write this table in the task PLAN.md after W1 architecture defines the write-set and before W2 implementation dispatch:
92
+
93
+ ```
94
+ | File | Concern | Worker Type | Worker Label | Read-Only? |
95
+ |------|---------|------------|--------------|------------|
96
+ | src/a.ts | Auth middleware | implementer | impl-auth | No |
97
+ | src/b.ts | DB schema | implementer | impl-db | No |
98
+ | docs/arch.md | Research existing patterns | researcher | res-arch | Yes |
99
+ ```
100
+
101
+ For acceptance-driven work, add an `AC IDs` column to this table and list every
102
+ criterion the Worker is allowed to satisfy.
103
+
104
+ ### Gate Rules (any violation = gate fail, retry)
105
+
106
+ Acceptance-specific gate rules:
107
+
108
+ 1. PRD, AC, UI/API contracts, and test plan must exist before implementation dispatch.
109
+ 2. Every write Worker row must cite AC IDs.
110
+ 3. Implementer forbidden set must include PRD, AC, UI/API contracts, test plan, and validation report unless an approved Change Request is recorded.
76
111
 
77
112
  1. **Every file in the write-set MUST have exactly one write Worker.** Unassigned files = fail. This is the anti-bundling rule — one Worker touching >1 write file = fail. (Read Workers may span multiple files.)
78
113
  2. **Manager count MUST ≥ span_min = ceil(sqrt(write_files) / 3).** This is the anti-under-decomposition rule at the domain level. Fewer than the minimum number of Managers means domains are too coarse. "One Manager can handle everything" is NOT valid in WF-MAX — if the task were that simple, degrade to /wf.
@@ -96,7 +131,11 @@ If the CEO finds itself reaching for Edit/Write/Bash on source files, it is viol
96
131
 
97
132
  ### Self-Audit Checklist
98
133
 
99
- After producing the Dispatch Table, CEO MUST answer all before proceeding:
134
+ After producing the Dispatch Table, CEO MUST answer all before proceeding:
135
+
136
+ - [ ] Do PRD, AC, contracts, and test plan exist before implementation dispatch?
137
+ - [ ] Does every implementation Worker row cite AC IDs?
138
+ - [ ] Are truth files excluded from implementer write sets unless Change Request is approved?
100
139
 
101
140
  - [ ] Did I assign myself any source file? (must be **No** — PLAN.md/PROGRESS.md writes are the exception)
102
141
  - [ ] Is every file with planned changes assigned to exactly one write Worker? (must be **Yes**)
@@ -194,9 +233,25 @@ total(depth, span) = Σ span^L for L=0..depth
194
233
 
195
234
  - Worker failure: retry 1× → on 2nd failure, Manager absorbs or escalates to CEO for replan.
196
235
 
197
- ## Wave Orchestration
198
-
199
- ```
236
+ ## Wave Orchestration
237
+
238
+ WF-MAX expands `/wf` by turning each acceptance phase into a manager/worker
239
+ wave when useful:
240
+
241
+ ```text
242
+ Product Manager Group -> PRD-GATE
243
+ Acceptance Manager -> AC-GATE
244
+ Contract Manager -> CONTRACT-GATE
245
+ Test Manager -> TEST-GATE
246
+ Architecture Manager -> boundary/interface contract
247
+ Implementation Manager -> AC-mapped D-GATE and write-set coloring
248
+ Validation Manager -> E2E/screenshot/trace/contract validation matrix
249
+ Review Manager -> spec/code/test/UX/security review
250
+ Debug Manager -> AC failure root-cause loop
251
+ Memory Master -> durable lessons
252
+ ```
253
+
254
+ ```
200
255
  W0: Explore-Mgr → N parallel researchers → synthesize → CEO
201
256
  E-GATE: → Exploration Gate: CEO verifies all exploration questions answered, findings synthesized (lightweight; see WF.md Decomposition Gate)
202
257
  W1: Architect-Mgr → 3 parallel → boundary decisions + interface contract → CEO approval
@@ -212,7 +267,8 @@ CLOSEOUT: CEO → context-master + memory-master (direct, no Manager)
212
267
  - **D-GATE** (Write Decomposition Gate): applies AFTER architecture defines the write-set, BEFORE any implementation Worker spawns. Dispatch Table covers the actual write-set. Gate is non-negotiable.
213
268
  - W2 dispatch: ALL Workers for a wave MUST be spawned in a single message — not one per turn. Batching is what makes parallelism real.
214
269
 
215
- - Wave scheduling: Managers serial across domains, Workers parallel within domain.
270
+ - Acceptance gates apply before D-GATE. D-GATE decomposes the write set; it does not define the acceptance truth.
271
+ - Wave scheduling: Managers serial across domains, Workers parallel within domain.
216
272
  - CEO validates wave output before starting next wave. No pipelining.
217
273
 
218
274
  ## Overhead & Cost Filter
@@ -233,9 +289,12 @@ These conditions govern **auto-trigger degradation only** (wf-max → /wf). They
233
289
  - import/re-export refactor → global consistency required
234
290
  - communication overhead > 30% → degrade
235
291
 
236
- ## /wf vs /wf-max
237
-
238
- | Dimension | /wf | /wf-max |
292
+ ## /wf vs /wf-max
293
+
294
+ Both modes use the same acceptance-driven mother flow. `/wf-max` changes the
295
+ organization and amount of parallelism, not the PRD-derived source of truth.
296
+
297
+ | Dimension | /wf | /wf-max |
239
298
  |------------------|------------------|----------------------------------|
240
299
  | Organization | flat | CEO → Mgr → Worker (3-tier) |
241
300
  | Exploration | 3-5 serial | Mgr → 10 parallel |
@@ -7,6 +7,13 @@ This is a Ralph-style harness loop: keep moving through evidence, bounded
7
7
  exploration, second planning, implementation, review, verification, and recovery
8
8
  instead of stalling on the first obstacle.
9
9
 
10
+ WF is acceptance-driven. The source of truth is not the implementation, not the
11
+ tests, and not the agent's summary. The source of truth is the PRD-derived
12
+ Acceptance Criteria. Code, tests, review, validation, debug, and memory must
13
+ trace to AC IDs. Load [ACCEPTANCE_PROTOCOL.md](ACCEPTANCE_PROTOCOL.md) for the
14
+ gate contract, [AGENT_ISOLATION.md](AGENT_ISOLATION.md) for role separation, and
15
+ [HARNESS_BRIDGE.md](HARNESS_BRIDGE.md) for UI/API/browser evidence.
16
+
10
17
  ## Trigger
11
18
 
12
19
  Enter WF mode when any of these are true:
@@ -78,22 +85,25 @@ see [WF-MAX.md](WF-MAX.md).
78
85
  Intake
79
86
  -> confidence gate
80
87
  -> parallel planner / researcher / docs-researcher / architect roles
81
- -> synthesis
88
+ -> Mini PRD
89
+ -> Acceptance Criteria
90
+ -> UI/API contracts
91
+ -> test plan
82
92
  -> second plan
83
93
  -> test-writer
84
94
  -> implementer
95
+ -> independent validator
85
96
  -> reviewers
86
- -> verifier
87
- -> if failed: debugger -> review -> e2e/API verification -> loop
88
- -> close with evidence
97
+ -> if failed: debugger -> review -> e2e/API validation -> loop
98
+ -> memory closeout with evidence
89
99
  ```
90
100
 
91
101
  ## Intake
92
102
 
93
103
  1. Read `CLAUDE.md`, `Harness/MEMORY.md`, `Harness/README.md`,
94
104
  `Harness/PROGRESS.md`, and the active task capsule if present.
95
- 2. State the goal, non-goals, confidence level, known risks, and write
96
- boundaries.
105
+ 2. State the goal, non-goals, confidence level, known risks, acceptance truth
106
+ files, and write boundaries.
97
107
  3. Ask up to three blocking questions only when the next action cannot reach
98
108
  95% confidence.
99
109
  4. Update `Harness/tasks/<task-id>/PROGRESS.md#Heartbeat` before dispatching
@@ -138,20 +148,27 @@ Use `Harness/subagents.md` as the orchestration methodology and
138
148
  ## Second Plan
139
149
 
140
150
  After exploration, synthesize facts found, assumptions, risks,
141
- accepted/rejected options, tasks, read/write sets, verification path, and
142
- rollback or recovery plan.
151
+ accepted/rejected options, Mini PRD, AC IDs, UI/API contracts, tasks,
152
+ read/write sets, verification path, and rollback or recovery plan.
143
153
 
144
154
  Write the result to `Harness/tasks/<task-id>/PLAN.md` before implementation.
145
155
  Update `Harness/tasks/<task-id>/PROGRESS.md#Heartbeat`.
146
156
 
157
+ The second plan must pass:
158
+
159
+ - PRD-GATE: goal, scope, non-scope, user flow, and verification commands exist.
160
+ - AC-GATE: each behavior has an AC ID and Given/When/Then.
161
+ - CONTRACT-GATE: UI/API/state contracts exist when the feature touches UI/API/state.
162
+ - TEST-GATE: verification commands and test levels map to AC IDs.
163
+ - IMPLEMENT-GATE: implementer forbidden set includes PRD, AC, UI/API contracts, test plan, and validation report unless a Change Request is approved.
164
+
147
165
  ## Build And Review
148
166
 
149
- 1. `test-writer` defines a failing test or written manual check first.
150
- 2. `implementer` changes only the declared write set.
151
- 3. At least one `reviewer` checks diff, architecture, risks, and missing tests.
152
- 4. For cross-layer or risky work, run separate reviewers for architecture and
153
- test adequacy.
154
- 5. `verifier` runs the declared checks and records exact evidence.
167
+ 1. `test-writer` defines failing tests or written manual checks from AC IDs and contracts first.
168
+ 2. `implementer` changes only the declared write set and may not edit truth files without Change Request.
169
+ 3. `verifier` or independent validator runs AC-mapped checks against running behavior and records an acceptance result matrix.
170
+ 4. At least one `reviewer` checks diff, architecture, risks, missing tests, and AC traceability.
171
+ 5. For cross-layer or risky work, run separate reviewers for spec/AC compliance, architecture, and test adequacy.
155
172
 
156
173
  ## Browser And API Evidence
157
174
 
@@ -164,6 +181,8 @@ Chrome DevTools, CDP, Playwright, or a documented real-browser run:
164
181
  - capture failed network requests
165
182
  - collect backend logs when the flow crosses an API
166
183
  - record screenshot, trace, video, or manual evidence path
184
+ - produce an AC-by-AC acceptance result matrix
185
+ - for frontend-backend paths, check UI selectors and API behavior against `HARNESS_BRIDGE.md`
167
186
 
168
187
  For API changes, run the project API/integration test path or a documented real
169
188
  request against a local service and record request, response, logs, and failure
@@ -175,9 +194,9 @@ If verification fails:
175
194
 
176
195
  1. Update `Harness/tasks/<task-id>/PROGRESS.md#Heartbeat` with failure count
177
196
  and blocker.
178
- 2. Dispatch `debugger` with the failing command, error output, and smallest
179
- relevant files.
180
- 3. Fix the smallest reproduced failure.
197
+ 2. Dispatch `debugger` with the failed AC ID, failing command, error output,
198
+ trace/screenshot/network evidence, and smallest relevant files.
199
+ 3. Classify the failure layer using [DEBUG_PROTOCOL.md](DEBUG_PROTOCOL.md), then fix the smallest reproduced failure.
181
200
  4. Run reviewer again.
182
201
  5. Run verifier again.
183
202
  6. Repeat until verified or blocked by missing user input/external state.
@@ -205,7 +224,8 @@ equivalent bounded pass to append a compression suggestion to the task heartbeat
205
224
 
206
225
  Close only when:
207
226
 
208
- - acceptance criteria are satisfied
227
+ - PRD-GATE, AC-GATE, CONTRACT-GATE, TEST-GATE, VALIDATION-GATE, and REVIEW-GATE are satisfied
228
+ - acceptance criteria are satisfied and reported by AC ID
209
229
  - reviewer has no unresolved critical/high findings
210
230
  - test/API/browser evidence is recorded
211
231
  - affected Harness docs are synced
@@ -1,6 +1,13 @@
1
1
  # Agent Workflow
2
2
 
3
- Use when implementing, reviewing, debugging, or coordinating subagents.
3
+ Use when implementing, reviewing, debugging, or coordinating subagents.
4
+
5
+ This workflow is acceptance-driven. PRD-derived Acceptance Criteria are the
6
+ source of truth; implementation, tests, review, validation, debug, and memory
7
+ must trace to AC IDs. Load [ACCEPTANCE_PROTOCOL.md](ACCEPTANCE_PROTOCOL.md) for
8
+ gate rules, [TDD-GUIDE.md](TDD-GUIDE.md) for AC-linked RED tests,
9
+ [HARNESS_BRIDGE.md](HARNESS_BRIDGE.md) for UI/API/browser evidence, and
10
+ [AGENT_ISOLATION.md](AGENT_ISOLATION.md) before role splits.
4
11
 
5
12
  ## ReAct Loop
6
13
 
@@ -12,8 +19,8 @@ If context grows, load [context-loading.md](context-loading.md) and split the wo
12
19
 
13
20
  ## Feature Packet
14
21
 
15
- Every PRD scope item must be covered by a task plan at `Harness/tasks/<task-id>/PLAN.md`
16
- created from `Harness/tasks/_template/PLAN.md` (the primary work tracking system).
22
+ Every PRD scope item must be covered by AC IDs and a task plan at `Harness/tasks/<task-id>/PLAN.md`
23
+ created from `Harness/tasks/_template/PLAN.md` (the primary work tracking system).
17
24
  **Cohesion rule**: if multiple PRD scope items share the same write set, the same
18
25
  test/verification path, and the same review boundary, group them into a single
19
26
  feature doc. The PRD owns scope decomposition; the feature doc owns the
@@ -28,17 +35,32 @@ For single-file fixes with no behavior change, a brief note in `PROGRESS.md` is
28
35
  task capsule and append to its `PROGRESS.md`. Only create a new task capsule when the
29
36
  scope is substantially different. When unsure, ask.
30
37
 
31
- ## Standard Build Loop
32
-
33
- ```text
34
- PRD/task plan
35
- -> failing test or manual check
36
- -> minimal implementation
37
- -> verification
38
- -> review
39
- -> docs sync
40
- -> close or iterate
41
- ```
38
+ ## Acceptance-Driven Build Loop
39
+
40
+ ```text
41
+ Mini PRD
42
+ -> Acceptance Criteria
43
+ -> UI/API contracts
44
+ -> test plan
45
+ -> failing test or manual check
46
+ -> minimal implementation
47
+ -> independent validation
48
+ -> review
49
+ -> debug if needed
50
+ -> docs sync
51
+ -> memory
52
+ -> close or iterate
53
+ ```
54
+
55
+ Rules:
56
+
57
+ - No PRD, no implementation.
58
+ - No acceptance criteria, no tests.
59
+ - No acceptance criteria, no code.
60
+ - Browser-visible behavior must have a real user-path test or documented browser validation; syntax-only checks are not acceptance.
61
+ - Frontend-backend behavior must include network/API assertions against the contract.
62
+ - Implementer cannot modify PRD, acceptance criteria, UI/API contracts, test plan, or validation report unless a Change Request is recorded.
63
+ - Validator must be independent from implementer and must produce an AC-by-AC result matrix.
42
64
 
43
65
  ## Subagent Use
44
66
 
@@ -60,11 +82,13 @@ Rules:
60
82
  - Explorer Pass, Reviewer, and Verifier are read-only.
61
83
  - Researcher and Docs Researcher are read-only unless explicitly asked to return a docs patch.
62
84
  - Planner and Architect are read-only unless explicitly asked to return a docs patch.
63
- - Test Writer writes tests before Implementer writes production code.
64
- - Implementer only writes inside its declared write set.
65
- - Writing agents run serially unless write sets are disjoint.
66
- - Debugger fixes the smallest failing path, not adjacent design.
67
- - Main agent integrates summaries, resolves conflicts, and runs final verification.
85
+ - Test Writer writes tests before Implementer writes production code.
86
+ - Implementer only writes inside its declared write set.
87
+ - Implementer forbidden set includes PRD, acceptance criteria, UI/API contracts, test plan, and validation report by default.
88
+ - Writing agents run serially unless write sets are disjoint.
89
+ - Debugger fixes the smallest failing path, not adjacent design.
90
+ - Debugger receives failed AC IDs, evidence, and failing layer hypothesis before editing.
91
+ - Main agent integrates summaries, resolves conflicts, and runs final verification.
68
92
 
69
93
  ## Parallel Dispatch
70
94
 
@@ -74,7 +98,7 @@ Every dispatched agent returns the handoff format defined in [dispatch.md](dispa
74
98
 
75
99
  ## Conflict Rule
76
100
 
77
- If PRD, task PLAN.md, architecture, ports, tests, or code disagree:
101
+ If PRD, acceptance criteria, UI/API contracts, task PLAN.md, architecture, ports, tests, or code disagree:
78
102
 
79
103
  1. stop implementation
80
104
  2. record the conflict in `Harness/tasks/<task-id>/PROGRESS.md` or the feature doc
@@ -85,8 +109,9 @@ If PRD, task PLAN.md, architecture, ports, tests, or code disagree:
85
109
 
86
110
  Close only when:
87
111
 
88
- - acceptance criteria are satisfied
89
- - verification evidence is recorded
112
+ - acceptance criteria are satisfied by AC ID
113
+ - validation result matrix exists for user-visible behavior
114
+ - verification evidence is recorded
90
115
  - architecture docs are synced if affected
91
116
  - no unresolved critical/high review findings remain
92
117
  - any optimistic UI mutation has a declared and verified rollback path
@@ -28,14 +28,15 @@ Load other docs only by trigger.
28
28
 
29
29
  | Trigger | Load |
30
30
  | --- | --- |
31
- | idea, scope, MVP | `Harness/lifecycle.md`, `Harness/research/PRD.md` |
32
- | research, competitors, stack choice | `Harness/research/README.md`, `Harness/research/research-results.md` |
31
+ | idea, scope, MVP | `Harness/lifecycle.md`, `Harness/research/PRD.md`, `Harness/ACCEPTANCE_PROTOCOL.md` |
32
+ | acceptance, AC, criteria, contract, validation matrix | `Harness/ACCEPTANCE_PROTOCOL.md`, `Harness/AGENT_ISOLATION.md`, `Harness/HARNESS_BRIDGE.md` as needed |
33
+ | research, competitors, stack choice | `Harness/research/README.md`, `Harness/research/research-results.md` |
33
34
  | task split, owner, write set | `Harness/tasks/<task-id>/PROGRESS.md`, `Harness/tasks/<task-id>/PLAN.md`, `Harness/agent-workflow.md` |
34
35
  | parallel agents, dispatch, worktree decision | `Harness/subagents.md`, `Harness/dispatch.md`, `Harness/tasks/<task-id>/PLAN.md` |
35
36
  | `/wf` mode, long task, multi-file, multi-agent | `Harness/WF.md`, `Harness/subagents.md`, `Harness/dispatch.md`, `Harness/tasks/<task-id>/PLAN.md` |
36
37
  | `/wf max`, 5+ disjoint files, maximum parallelism | `Harness/WF-MAX.md`, `Harness/subagents.md`, `Harness/dispatch.md`, `Harness/tasks/<task-id>/PLAN.md` |
37
- | memory, repeated tool failure, repeated user correction, reusable lesson | `Harness/MEMORY.md`, the relevant `Harness/memory/*.md` file |
38
- | subagent spawn | `Harness/subagents.md`, this file plus the role pack below |
38
+ | memory, scenario memory, repeated tool failure, repeated user correction, reusable lesson | `Harness/MEMORY.md`, `Harness/MEMORY_PROTOCOL.md`, the relevant `Harness/memory/*.md` file |
39
+ | subagent spawn | `Harness/subagents.md`, `Harness/AGENT_ISOLATION.md`, this file plus the role pack below |
39
40
 
40
41
  ## ECC Rules Per Role
41
42
 
@@ -51,7 +52,7 @@ Each subagent role loads a specific ECC rule subset. The dispatcher MUST include
51
52
  | **Implementer (BE)** | N/A | `common/patterns.md`, `python/fastapi.md` or `golang/patterns.md` | Backend subset |
52
53
  | **Test Writer** | `web/testing.md`, `typescript/testing.md` | Stack testing rules | Both |
53
54
  | **Reviewer** | `web/design-quality.md`, `web/security.md`, `web/performance.md` | Stack security + testing rules | All |
54
- | **Debugger** | Stack-specific hooks + coding-style | Stack-specific hooks + coding-style | Context-dependent |
55
+ | **Debugger** | Stack-specific coding-style + patterns | Stack-specific coding-style + patterns | Context-dependent |
55
56
  | **Verifier** | `web/testing.md` | Stack testing rules | Both |
56
57
 
57
58
  ## Subagent Packs
@@ -64,11 +65,11 @@ Explorer Pass:
64
65
  - forbid: writes
65
66
  - return: files found, facts, risks, suggested tests
66
67
 
67
- Planner:
68
- - ecc: `common/patterns.md` + `common/development-workflow.md`
69
- - inject: user goal, lifecycle phase, PRD or PLAN section, dispatch constraints
70
- - forbid: production code
71
- - return: tasks, dependencies, read/write sets, dispatch table, gates, open questions
68
+ Planner:
69
+ - ecc: `common/patterns.md` + `common/development-workflow.md`
70
+ - inject: user goal, lifecycle phase, PRD or PLAN section, acceptance gate status, dispatch constraints
71
+ - forbid: production code
72
+ - return: tasks, dependencies, read/write sets, dispatch table, gates, open questions
72
73
 
73
74
  Researcher:
74
75
  - ecc: none (uses WebSearch/WebFetch, not code rules)
@@ -88,11 +89,11 @@ Architect:
88
89
  - forbid: implementation
89
90
  - return: boundary decision, affected docs, risks
90
91
 
91
- Test Writer:
92
- - ecc: `common/testing.md` + stack-specific testing rules
93
- - inject: acceptance criteria, feature doc, test write set
94
- - forbid: production code
95
- - return: failing tests and test intent
92
+ Test Writer:
93
+ - ecc: `common/testing.md` + stack-specific testing rules
94
+ - inject: acceptance criteria, UI/API contracts, feature doc, test write set
95
+ - forbid: production code
96
+ - return: failing tests, AC ID mapping, and test intent
96
97
 
97
98
  Implementer (Frontend):
98
99
  - ecc: `web/design-quality.md`, `web/patterns.md`, `web/performance.md`, `typescript/patterns.md`
@@ -106,23 +107,23 @@ Implementer (Backend):
106
107
  - forbid: unrelated refactor and test loosening
107
108
  - return: changed files and implementation notes
108
109
 
109
- Reviewer:
110
- - ecc: `web/design-quality.md` (FE), `web/security.md` (FE), `common/security.md`, stack security
111
- - inject: diff, acceptance criteria, architecture docs
112
- - forbid: writes
113
- - return: findings by severity, missing tests, boundary issues
114
-
115
- Debugger:
116
- - ecc: stack-specific coding-style + hooks rules
117
- - inject: failing command, error output, related files
118
- - forbid: broad rewrites
119
- - return: root cause, fix, proof
120
-
121
- Verifier:
122
- - ecc: stack-specific testing rules
123
- - inject: verification commands and acceptance criteria
124
- - forbid: code changes
125
- - return: commands run, results, residual risk
110
+ Reviewer:
111
+ - ecc: `web/design-quality.md` (FE), `web/security.md` (FE), `common/security.md`, stack security
112
+ - inject: PRD, acceptance criteria, UI/API contracts, diff, test/validation evidence, architecture docs
113
+ - forbid: writes
114
+ - return: findings by severity, AC traceability, missing tests, boundary issues
115
+
116
+ Debugger:
117
+ - ecc: stack-specific coding-style + patterns
118
+ - inject: failed AC ID, failing command, error output, trace/screenshot/network evidence, related files
119
+ - forbid: broad rewrites
120
+ - return: failure layer, root cause, fix, proof
121
+
122
+ Verifier:
123
+ - ecc: stack-specific testing rules
124
+ - inject: verification commands, acceptance criteria, UI/API contracts, running app/API endpoint
125
+ - forbid: code changes
126
+ - return: commands run, AC-by-AC validation matrix, evidence paths, residual risk
126
127
 
127
128
  Memory Master:
128
129
  - inject: trigger reason, current failure/user-correction/closeout context, task PROGRESS.md section
@@ -10,7 +10,8 @@ Use when work needs parallel reading, independent review, cross-layer analysis,
10
10
 
11
11
  - Main agent owns the final decision, integration, and verification.
12
12
  - project files are the only durable communication channel; chat/subagent transcript state is non-authoritative.
13
- - Important assumptions, decisions, blockers, evidence, and handoffs must be written to `Harness/tasks/<task-id>/PROGRESS.md` and `Harness/tasks/<task-id>/PLAN.md`, the current feature doc, `Harness/MEMORY.md`, or `Harness/memory/*` as appropriate.
13
+ - Important assumptions, decisions, blockers, evidence, and handoffs must be written to `Harness/tasks/<task-id>/PROGRESS.md` and `Harness/tasks/<task-id>/PLAN.md`, the current feature doc, `Harness/MEMORY.md`, or `Harness/memory/*` as appropriate.
14
+ - PRD-derived Acceptance Criteria are the source of truth. Dispatch packets must carry the relevant AC IDs and contracts.
14
15
  - Agent count: default (non-WF) ≤3 active agents; `/wf` requires ≥3 distinct subagents from `.claude/agents/` before second plan; `/wf max` removes the cap entirely (governed by span formula in WF-MAX.md). See [WF.md](WF.md) and [WF-MAX.md](WF-MAX.md) for the authoritative rules.
15
16
  - Read-only agents may run in parallel.
16
17
  - Writing agents run serially unless write sets are disjoint.
@@ -60,7 +61,10 @@ Without them, the subagent has no way to know which rules or contracts to load.
60
61
  Role: <installed agent name or bounded role, e.g. planner, implementer-fe, reviewer, memory-master>
61
62
  Task: <one-sentence goal>
62
63
  ECC: <which ECC rules to load, e.g. web/design-quality.md, python/fastapi.md. See context-loading.md#ecc-rules-per-role>
63
- Skills: <which skills to activate, e.g. react-review, tdd-guide>
64
+ Skills: <which skills to activate, e.g. react-review, tdd-guide>
65
+ PRD: <path or task PLAN section containing Mini PRD>
66
+ Acceptance IDs: <AC-001, AC-002, or "none" for non-behavioral work>
67
+ UI contract: <path to UI_CONTRACT.md or task PLAN section, if UI task>
64
68
  API contract: <path to api/openapi.yaml, if frontend↔backend task. Omit if N/A>
65
69
  Read set: <files and directories the subagent may read>
66
70
  Write set: <files the subagent may modify. "none" = read-only>
@@ -79,13 +83,15 @@ Mode:
79
83
  ECC loaded: <which ECC rule files were actually loaded. Should match dispatch ECC field.>
80
84
  Skills active: <which skills were active. Should match dispatch Skills field.>
81
85
  API contract: <path to contract file used, if applicable>
82
- Files read:
86
+ Acceptance IDs: <AC IDs handled or validated>
87
+ Files read:
83
88
  Files changed:
84
89
  Findings:
85
90
  Evidence:
86
91
  Risks:
87
92
  Next:
88
- PLAN patch:
93
+ PLAN patch:
94
+ Validation matrix: <AC-by-AC pass/fail/block evidence, for validators>
89
95
  Concurrency group: <wave number — 0=exploration, 1,2,3,...=implementation waves. Optional; only used in /wf max.>
90
96
  File claim: <list of exact file paths this agent exclusively owns. Optional; only used in /wf max.>
91
97
  Granularity floor: <50 avgLines → do NOT spawn. Apply leaf condition from WF-MAX.md.>