create-harness-vibe-coding 0.8.8 → 0.8.9

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 (80) hide show
  1. package/README-CN.md +7 -1
  2. package/README.md +21 -2
  3. package/docs/images/harness-icon.png +0 -0
  4. package/package.json +2 -1
  5. package/src/generator.js +36 -0
  6. package/src/index.js +72 -4
  7. package/templates/common/.claude/agents/architect.md +31 -31
  8. package/templates/common/.claude/agents/codebase-explorer.md +45 -0
  9. package/templates/common/.claude/agents/docs-researcher.md +41 -41
  10. package/templates/common/.claude/agents/memory-master.md +26 -8
  11. package/templates/common/.claude/agents/reviewer.md +34 -34
  12. package/templates/common/.claude/agents/task-scribe.md +70 -0
  13. package/templates/common/.claude/commands/wf-help.md +8 -4
  14. package/templates/common/.claude/commands/wf-update.md +24 -0
  15. package/templates/common/.claude/rules/ecc/common.md +15 -2
  16. package/templates/common/.claude/settings.json +13 -0
  17. package/templates/common/.claude/skills/subagent-orchestrator/SKILL.md +8 -4
  18. package/templates/common/.claude/skills/wf/SKILL.md +15 -8
  19. package/templates/common/.claude/skills/wf-auto/SKILL.md +3 -2
  20. package/templates/common/.claude/skills/wf-learn/SKILL.md +9 -2
  21. package/templates/common/.claude/skills/wf-max/SKILL.md +23 -5
  22. package/templates/common/.claude/skills/wf-update/SKILL.md +15 -2
  23. package/templates/common/.codex/hooks.json +17 -0
  24. package/templates/common/.harness-version +89 -44
  25. package/templates/common/.opencode/agents/architect.md +24 -24
  26. package/templates/common/.opencode/agents/codebase-explorer.md +45 -0
  27. package/templates/common/.opencode/agents/docs-researcher.md +34 -34
  28. package/templates/common/.opencode/agents/memory-master.md +26 -8
  29. package/templates/common/.opencode/agents/reviewer.md +27 -27
  30. package/templates/common/.opencode/agents/task-scribe.md +70 -0
  31. package/templates/common/.opencode/commands/wf-auto-spark.md +15 -0
  32. package/templates/common/.opencode/commands/wf-auto.md +15 -0
  33. package/templates/common/.opencode/commands/wf-help.md +8 -4
  34. package/templates/common/.opencode/commands/wf-learn.md +15 -0
  35. package/templates/common/.opencode/commands/wf-max.md +15 -0
  36. package/templates/common/.opencode/commands/wf-readme.md +15 -0
  37. package/templates/common/.opencode/commands/wf-remove.md +15 -0
  38. package/templates/common/.opencode/commands/wf-review.md +15 -0
  39. package/templates/common/.opencode/commands/wf-update.md +24 -0
  40. package/templates/common/.opencode/commands/wf.md +15 -0
  41. package/templates/common/.opencode/plugins/harness-wf-status.mjs +135 -0
  42. package/templates/common/AGENTS.md +2 -29
  43. package/templates/common/CLAUDE.md +35 -6
  44. package/templates/common/Harness/ACCEPTANCE_PROTOCOL.md +2 -2
  45. package/templates/common/{MEMORY.md → Harness/MEMORY.md} +16 -3
  46. package/templates/common/Harness/MEMORY_PROTOCOL.md +80 -30
  47. package/templates/common/Harness/README.md +50 -22
  48. package/templates/common/{SETUP.md → Harness/SETUP.md} +278 -276
  49. package/templates/common/Harness/TASK_ARCHIVE.md +56 -0
  50. package/templates/common/Harness/WF-AUTO-SPARK.md +5 -14
  51. package/templates/common/Harness/WF-AUTO.md +13 -76
  52. package/templates/common/Harness/WF-KERNEL.md +189 -0
  53. package/templates/common/Harness/WF-MAX.md +60 -328
  54. package/templates/common/Harness/WF-STATE.md +83 -0
  55. package/templates/common/Harness/WF.md +117 -237
  56. package/templates/common/Harness/agent-workflow.md +2 -2
  57. package/templates/common/Harness/context-loading.md +3 -3
  58. package/templates/common/Harness/dispatch.md +43 -35
  59. package/templates/common/Harness/scripts/archive-tasks.mjs +239 -0
  60. package/templates/common/{scripts → Harness/scripts}/scan-clean.mjs +28 -1
  61. package/templates/common/{scripts → Harness/scripts}/validate-harness.mjs +909 -699
  62. package/templates/common/Harness/scripts/wf-auto-update-prompt.mjs +258 -0
  63. package/templates/common/{scripts → Harness/scripts}/wf-update-check.mjs +40 -7
  64. package/templates/common/Harness/subagents.md +28 -27
  65. package/templates/common/Harness/tasks/_template/PLAN.md +5 -0
  66. package/templates/common/Harness/tasks/_template/STATE.json +23 -0
  67. package/templates/common/README.md +1 -1
  68. package/templates/common/memory/agent-lessons-patterns.md +9 -8
  69. package/templates/common/memory/routes.md +43 -0
  70. package/templates/common/memory/startup-hints.md +32 -0
  71. package/templates/common/memory/tool-usage-reflections.md +9 -8
  72. package/templates/common/memory/user-corrections-preferences.md +11 -9
  73. package/templates/optional/catalog.json +8 -0
  74. package/templates/optional/skills/browser-e2e/.claude/skills/browser-e2e/SKILL.md +42 -42
  75. package/templates/optional/skills/browser-e2e/.opencode/commands/wf-browser.md +15 -0
  76. package/templates/optional/skills/github-pr-review/.claude/skills/github-pr-review/SKILL.md +40 -40
  77. package/templates/optional/skills/python-backend/.claude/skills/python-backend/SKILL.md +40 -40
  78. package/templates/optional/skills/ts-react-frontend/.claude/skills/ts-react-frontend/SKILL.md +43 -43
  79. package/templates/optional/skills/ui-ux-review/.claude/skills/ui-ux-review/SKILL.md +40 -40
  80. /package/templates/common/{scripts → Harness/scripts}/wf-remove.mjs +0 -0
@@ -1,255 +1,135 @@
1
- # WF Mode - Long Task Workflow
1
+ # WF Mode Dynamic Orchestration Kernel
2
2
 
3
- Use this when work is long, difficult, uncertain, multi-file, multi-agent, or
4
- user-triggered with `/wf`, `$wf`, `wf mode`, `workflow mode`, or `wk mode`.
3
+ `/wf` is a **dynamic workflow kernel**, not a fixed serial pipeline. The orchestrator (main agent) makes decisions, dispatches agents, synthesizes returns, and owns final acceptance. It does NOT do bulk source reading, log scraping, or task-state paperwork — those are delegated to appropriate subagents.
5
4
 
6
- This is a Ralph-style harness loop: keep moving through evidence, bounded
7
- exploration, second planning, implementation, review, verification, and recovery
8
- instead of stalling on the first obstacle.
5
+ WF is **explicit only**. Complexity does not auto-trigger WF.
9
6
 
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.
7
+ ## Shared Kernel
8
+
9
+ All WF variants (`/wf`, `/wf-max`, `/wf-auto`, `/wf-auto-spark`, `/wf-review`, `/wf-browser`) share the orchestration engine defined in [WF-KERNEL.md](WF-KERNEL.md). That file is the authoritative source for:
10
+
11
+ - Role / Model Matrix (which agent, which model tier, for which work)
12
+ - Dynamic ready-queue pseudocode
13
+ - Dispatch packet fields
14
+ - Task type → agent/skill routing
15
+ - Tier-aware acceptance gates
16
+ - State ownership rules (controller + task-scribe)
17
+
18
+ Resumable state follows [WF-STATE.md](WF-STATE.md): STATE.json is the machine-readable resume truth; the ready queue is persisted there across sessions.
19
+
20
+ This file defines the `/wf` user contract, tiers, and the standard orchestration loop.
16
21
 
17
22
  ## Trigger
18
23
 
19
- Enter WF mode when any of these are true:
20
-
21
- - The user explicitly says `/wf`, `$wf`, `wf mode`, `workflow mode`, `wk mode`,
22
- or asks for the full workflow.
23
- - The task needs more than one step, more than three files, or more than one
24
- subsystem.
25
- - The task needs research, architecture judgment, browser/API validation, or
26
- migration planning.
27
- - Confidence in intent, architecture, or implementation is below 95%.
28
- - The same command, test, tool, or approach fails twice.
29
- - The user explicitly says `/wf-max [task]`, `$wf-max [task]`, or `wf max` (for
30
- maximum-parallelism mode, see [WF-MAX.md](WF-MAX.md)).
31
-
32
- Two distinct trigger classes; do not conflate them:
33
-
34
- - Explicit invocation (`/wf`, `$wf`, `wf mode`, `workflow mode`, `wk mode`,
35
- `/wf-max`, `$wf-max`): role fan-out is mandatory and unconditional. File
36
- count, task size, and subsystem count are irrelevant. A one-file task invoked
37
- with WF still schedules the complete role chain before closeout.
38
- - Auto-triggering decides whether the harness enters WF mode on its own. It can
39
- only escalate into WF, never downgrade an explicit command out of WF.
40
-
41
- ## Complete Role Chain Requirement
42
-
43
- WF mode requires the complete role chain by default.
44
-
45
- Normative rule: Explicit `/wf`, `$wf`, `wf mode`, `workflow mode`, or `wk mode` MUST cover every mandatory role class before closeout: Plan, Research, Architecture, Test, Implement, Independent Validation, Cross-Review, Reflect, and Final Acceptance.
46
-
47
- - Explicit `/wf`, `$wf`, `wf mode`, `workflow mode`, or `wk mode` MUST schedule
48
- the complete role chain at intake. Use real subagents when the runtime
49
- supports them; otherwise emulate those roles as bounded passes and record the
50
- fallback.
51
- - Mandatory role classes:
52
- - Plan: `planner`
53
- - Research: `researcher` or `docs-researcher`; use both when local and external/current facts matter
54
- - Architecture: `architect`
55
- - Test: `test-writer`
56
- - Implement: `implementer` and `debugger` when needed
57
- - Independent Validation: `verifier` records AC-mapped evidence before cross-review
58
- - Cross-Review: at least two independent review lenses after implementation
59
- - Reflect: `reflector`
60
- - Final Acceptance: controller accepts only after cross-review passes and `reflector` returns PASS
61
- - Runtime mapping:
62
- - Claude Code: prefer subagents from `.claude/agents/`.
63
- - Codex: prefer the available Codex subagent surface; if unavailable, use
64
- bounded passes with the same roles and evidence contract.
65
- - Collaboration decision tree (replaces the old "7:3" heuristic with concrete
66
- conditions):
67
- - Explicit WF/WK mode -> complete role chain, no exceptions.
68
- - 3+ files changed -> complete role chain.
69
- - Cross-layer change -> complete role chain plus separate architecture review.
70
- - Uncertain scope or approach -> complete role chain with both researcher and architect passes.
71
- - 1-2 files, well-understood, not in WF mode -> solo is acceptable.
72
- - Repeated failure on the same task -> stop solo and switch to multi-role.
73
- - Default `/wf` startup records the full chain in the task plan. Dependency-bound
74
- roles run when their phase is ready; they are not optional.
75
-
76
- ## Exploration Gate
77
-
78
- - [ ] Controller has not read source files directly; only Harness docs, root
79
- agent entries, and subagent or bounded-pass returns.
80
- - [ ] Complete role chain is scheduled in the task plan.
81
- - [ ] Plan, Research, and Architecture role passes each have one specific question before second planning.
82
- - [ ] Role passes were dispatched together when the runtime supports parallel
83
- dispatch.
84
- - [ ] Agent count is at least `max(3, ceil(estimated_dirs / 2))`; estimate from
85
- prompt/docs and run a second wave if returns reveal more.
86
- - [ ] Fallbacks are recorded in `Harness/tasks/<task-id>/PLAN.md`.
87
-
88
- For maximum-parallelism mode (write-set coloring, wave dispatch, parallel
89
- reviewers), use `/wf-max [task]` in Claude Code or `$wf-max [task]` in Codex and
90
- see [WF-MAX.md](WF-MAX.md).
91
-
92
- ## WF Loop
24
+ WF is **explicit only**. Enter WF ONLY when the user explicitly types:
25
+ - `/wf`, `$wf`, `/skills wf`
26
+
27
+ These are NOT WF triggers:
28
+ - Multi-step work, multi-file changes, complexity, uncertainty, architecture scope, browser/API behavior, repeated failure
29
+ - Those may need planning, subagents, or tests — but not WF
30
+
31
+ ## Memory Preflight
32
+
33
+ 1. Load `CLAUDE.md`, `Harness/MEMORY.md` index only, then `Harness/README.md`.
34
+ 2. Load `Harness/memory/*` only when `MEMORY_PROTOCOL.md` scenario hints match.
35
+ 3. Record `Memory preflight: done` and `Memory hints: none | <file/path + reason>`.
36
+
37
+ ## Standard Orchestration Loop
38
+
39
+ The `/wf` kernel follows a dependency-driven ready-queue, NOT a fixed serial phase list.
93
40
 
94
41
  ```text
95
42
  Intake
96
- -> confidence gate
97
- -> parallel planner / researcher / docs-researcher / architect roles
98
- -> Mini PRD
99
- -> Acceptance Criteria
100
- -> UI/API contracts
101
- -> test plan
102
- -> second plan
103
- -> test-writer
104
- -> implementer
105
- -> independent validator
106
- -> cross-review: spec/AC reviewer + code/architecture/test reviewer
107
- -> reflector
108
- -> if failed: debugger -> verifier -> cross-review -> reflector -> loop
109
- -> memory closeout with evidence
43
+ -> Understand user goal; ask <=3 blocking decision questions (each with recommendation)
44
+ -> Requirement analysis: scope, non-goals, risks, acceptance direction
45
+ -> Mini PRD (compact, not a large document)
46
+ -> 1-3 ACs (expand only for high-risk triggers)
47
+ -> Plan: task split, dependencies, readSet/writeSet, verification commands, subagent dispatch
48
+
49
+ // Ready-queue dispatch (NOT serial phase)
50
+ while task not accepted:
51
+ update readyQueue from dependency graph
52
+
53
+ // Read-only and chore always parallel when ready
54
+ dispatch codebase-explorer(s) for scoped source reading
55
+ dispatch docs-researcher / researcher as needed
56
+ dispatch planner for decomposition (unless already done)
57
+ dispatch task-scribe alongside any work
58
+
59
+ // Write gate
60
+ for each independent writeSet:
61
+ dispatch implementer (one file_claim each)
62
+ when wave complete: dispatch verifier
63
+
64
+ // Review gate — wave-level, not end-of-task
65
+ when verifier evidence exists for a wave:
66
+ dispatch reviewer(s) on that wave
67
+
68
+ // Fix gate — on-demand
69
+ if review finding or failed AC:
70
+ dispatch debugger or implementer (smallest fix)
71
+ re-run verifier
72
+
73
+ // Reflect gate — WF-Full only or risk-triggered
74
+ if WF-Full or unresolved contradiction:
75
+ dispatch reflector
76
+
77
+ // Closeout
78
+ task-scribe records final state
79
+ if durable lesson: context-master -> memory-master
80
+
81
+ stop on: accepted | blocked | user decision required
110
82
  ```
111
83
 
112
- ## Intake
84
+ ## WF Tiers
113
85
 
114
- 1. Read `CLAUDE.md`, `Harness/MEMORY.md`, `Harness/README.md`,
115
- `Harness/PROGRESS.md`, and the active task capsule if present.
116
- 2. State the goal, non-goals, confidence level, known risks, acceptance truth
117
- files, and write boundaries.
118
- 3. Ask up to three blocking questions only when the next action cannot reach
119
- 95% confidence.
120
- 4. Update `Harness/tasks/<task-id>/PROGRESS.md#Heartbeat` before dispatching
121
- roles or running long commands.
122
- 5. Load `Harness/subagents.md` before coordinating multiple roles.
86
+ ### WF-Light
87
+ 1-2 files, well-understood, low risk.
88
+ - planner + test-writer + implementer + verifier
89
+ - task-scribe maintains state
90
+ - codebase-explorer optional
91
+ - **Acceptance**: verification passes = closeout
92
+ - Cross-review and reflector NOT mandatory
93
+
94
+ ### WF-Standard
95
+ Multi-file or behavior change.
96
+ - WF-Light baseline + research/docs + at least one independent review lens
97
+ - Parallel: codebase-explorer(s), docs-researcher/researcher, planner, task-scribe
98
+ - **Acceptance**: verifier evidence + one review PASS = closeout
99
+ - Reflector: only when risk, contradiction, or high impact triggers
100
+
101
+ ### WF-Full
102
+ High-risk, cross-layer, security/data-loss, browser/API acceptance, ambiguous architecture.
103
+ - Full chain per [WF-KERNEL.md](WF-KERNEL.md) Role/Model Matrix
104
+ - **Acceptance**: cross-review PASS + reflector PASS
105
+
106
+ ## State Ownership
107
+
108
+ Per [WF-KERNEL.md](WF-KERNEL.md):
109
+ - **Controller** (main agent): decisions, decomposition, synthesis, final verification
110
+ - **task-scribe** (haiku): writes task state (PLAN, PROGRESS, ARTIFACTS, NOTES). Controller supplies structured updates; task-scribe formats and writes.
111
+ - **Production source agents**: write ONLY their assigned writeSet. Never write task state.
123
112
 
124
113
  ## Exploration
125
114
 
126
- Use read-only role passes first. For automatic WF triggers, default to 3-5
127
- active agents or bounded passes unless the task is clearly small enough for the
128
- solo exception.
129
-
130
- | Role | Purpose | Writes |
131
- | --- | --- | --- |
132
- | `planner` | map local project facts, commands, app entry points, existing docs, and initial decomposition | none |
133
- | `researcher` | product, ecosystem, dependency, and external context | none unless returning a docs patch |
134
- | `docs-researcher` | official docs, SDK/API versions, browser/tool limits | none unless returning a docs patch |
135
- | `architect` | boundaries, ports, data flow, state impact, migration risks | none unless returning a docs patch |
136
-
137
- Use local files first. Use web search or official docs only when the decision
138
- needs current or external evidence. Record tool choice and limitations in
139
- `Harness/research/research-results.md` or the task plan.
140
-
141
- ## Subagent Orchestration
142
-
143
- Use `Harness/subagents.md` as the orchestration methodology and
144
- `Harness/dispatch.md` as the dispatch table protocol.
145
-
146
- - The main agent is the controller and owns synthesis, integration, and final
147
- verification.
148
- - Subagents are readers and reporters. Only the main agent writes task
149
- `PROGRESS.md` and `PLAN.md`.
150
- - Parallelize read-only exploration; serialize writers unless write sets are
151
- disjoint and isolated.
152
- - Every role gets a dispatch pack with role, goal, mode, read set, write set,
153
- forbidden scope, injected docs, evidence, stop condition, and return format.
154
- - After implementation, run spec review before code-quality or architecture
155
- review.
156
- - If subagents are unavailable, emulate the same roles as bounded passes and
157
- record the fallback.
158
-
159
- ## Second Plan
160
-
161
- After exploration, synthesize facts found, assumptions, risks,
162
- accepted/rejected options, Mini PRD, AC IDs, UI/API contracts, tasks,
163
- read/write sets, verification path, and rollback or recovery plan.
164
-
165
- Write the result to `Harness/tasks/<task-id>/PLAN.md` before implementation.
166
- Update `Harness/tasks/<task-id>/PROGRESS.md#Heartbeat`.
167
-
168
- The second plan must pass:
169
-
170
- - PRD-GATE: goal, scope, non-scope, user flow, and verification commands exist.
171
- - AC-GATE: each behavior has an AC ID and Given/When/Then.
172
- - CONTRACT-GATE: UI/API/state contracts exist when the feature touches UI/API/state.
173
- - TEST-GATE: verification commands and test levels map to AC IDs.
174
- - IMPLEMENT-GATE: implementer forbidden set includes PRD, AC, UI/API contracts, test plan, and validation report unless a Change Request is approved.
175
-
176
- ## Build And Review
177
-
178
- 1. `test-writer` defines failing tests or written manual checks from AC IDs and contracts first.
179
- 2. `implementer` changes only the declared write set and may not edit truth files without Change Request.
180
- 3. `verifier` or independent validator runs AC-mapped checks against running behavior and records an evidence matrix before cross-review.
181
- 4. Cross-review is mandatory: at least two independent review lenses must pass before acceptance.
182
- - Spec/AC review checks request, scope, contracts, and non-goals.
183
- - Code/architecture/test review checks implementation risk, maintainability, security, and verification adequacy.
184
- 5. `reflector` reads verifier evidence and reviewer findings, resolves contradictions with the controller, and returns PASS before final acceptance.
185
- 6. For cross-layer or risky work, run separate reviewers for spec/AC compliance, architecture, security, and test adequacy.
186
-
187
- ## Browser And API Evidence
188
-
189
- For browser-visible changes, typecheck/build/unit tests are not enough. Use
190
- Chrome DevTools, CDP, Playwright, or a documented real-browser run:
191
-
192
- - start the app and record URL/port
193
- - click through the critical flow
194
- - capture frontend console/runtime errors
195
- - capture failed network requests
196
- - collect backend logs when the flow crosses an API
197
- - record screenshot, trace, video, or manual evidence path
198
- - produce an AC-by-AC acceptance result matrix
199
- - for frontend-backend paths, check UI selectors and API behavior against `HARNESS_BRIDGE.md`
200
-
201
- For API changes, run the project API/integration test path or a documented real
202
- request against a local service and record request, response, logs, and failure
203
- behavior.
204
-
205
- ## Recovery Loop
206
-
207
- If verification fails:
208
-
209
- 1. Update `Harness/tasks/<task-id>/PROGRESS.md#Heartbeat` with failure count
210
- and blocker.
211
- 2. Dispatch `debugger` with the failed AC ID, failing command, error output,
212
- trace/screenshot/network evidence, and smallest relevant files.
213
- 3. Classify the failure layer using [DEBUG_PROTOCOL.md](DEBUG_PROTOCOL.md), then fix the smallest reproduced failure.
214
- 4. Run verifier again and record fresh AC-mapped evidence.
215
- 5. Run cross-review again.
216
- 6. Run reflector again.
217
- 7. Repeat until verified or blocked by missing user input/external state.
218
-
219
- Before asking the user after repeated failures, run the context-master then
220
- memory-master learning cycle or use `wf-learn`.
221
-
222
- ## Heartbeat Protocol
223
-
224
- Heartbeat is a lightweight recovery protocol, not a background daemon.
225
- Keep heartbeat entries to one or two lines: phase, blocker/failure, next action,
226
- and evidence pointer. Do not paste command logs or subagent transcripts.
227
-
228
- Update `Harness/tasks/<task-id>/PROGRESS.md#Heartbeat`:
229
-
230
- - before a long command
231
- - after a long command
232
- - before spawning subagents or bounded passes
233
- - after integrating returns
234
- - after each failed verification
235
- - before stopping for user input
236
-
237
- When context approaches about 85% of the window, run context-master or the
238
- equivalent bounded pass to append a compression suggestion to the task heartbeat.
115
+ Controller delegates source reading to subagents. Controller does NOT read source files directly before dispatch.
116
+
117
+ First wave — dispatch in parallel:
118
+ - codebase-explorer(s): scoped source discovery
119
+ - planner: decomposition, dependencies, writeSet
120
+ - researcher / docs-researcher: external context as needed
121
+ - task-scribe: compact heartbeat and dispatch ledger
122
+
123
+ Second wave after synthesis:
124
+ - architect (if cross-layer or architecture risk)
125
+ - test-writer: failing tests from AC IDs
126
+
127
+ ## Browser and API Evidence
128
+
129
+ See [HARNESS_BRIDGE.md](HARNESS_BRIDGE.md) and [WF-KERNEL.md](WF-KERNEL.md) Task Type Routing for UI/browser and API/backend task types.
130
+
131
+ Agents live under `.claude/agents/` and `.opencode/agents/`. Task state lives under `Harness/tasks/<task-id>/`.
239
132
 
240
133
  ## Closeout
241
134
 
242
- Close only when:
243
-
244
- - PRD-GATE, AC-GATE, CONTRACT-GATE, TEST-GATE, VALIDATION-GATE, REVIEW-GATE, and REFLECT-GATE are satisfied
245
- - acceptance criteria are satisfied and reported by AC ID
246
- - cross-review has passed with no unresolved critical/high findings
247
- - reflector verdict is PASS
248
- - test/API/browser evidence is recorded
249
- - affected Harness docs are synced
250
- - context-master has analyzed the session and extracted durable knowledge
251
- - memory-master has consolidated extracted knowledge into `Harness/memory/*`
252
- - current task PROGRESS.md and PLAN.md are archived under `Harness/tasks/<task-id>/`
253
- with Phase set to Verified
254
- - `Harness/PROGRESS.md` task index is updated and Active Task is cleared or set
255
- to the next task
135
+ Closeout is tier-aware. WF-Light: verification + task state update = done. WF-Full: full gate chain per [WF-KERNEL.md](WF-KERNEL.md).
@@ -118,8 +118,8 @@ Use [subagents.md](subagents.md) and [dispatch.md](dispatch.md) for multi-agent
118
118
  | Mode | Agent Count Rule | Source |
119
119
  |------|-----------------|--------|
120
120
  | Default (non-WF) | up to 3 active agents by default | This file |
121
- | `/wf` | complete role chain mandatory before closeout | [WF.md](WF.md) |
122
- | `/wf max` | complete WF role chain plus maximum useful fan-out | [WF-MAX.md](WF-MAX.md) |
121
+ | `/wf` | WF-KERNEL tier selection (Light/Standard/Full) by risk and scope; full role chain only at WF-Full | [WF.md](WF.md) |
122
+ | `/wf-max` | WF kernel plus maximum useful fan-out (WF-Max-Useful default; WF-Max-Strict explicit only) | [WF-MAX.md](WF-MAX.md) |
123
123
 
124
124
  Prefer parallel read-only work first, then serial writes.
125
125
 
@@ -4,7 +4,7 @@ Use when context is growing, subagents are needed, or an agent is unsure which h
4
4
 
5
5
  ## Routing Authority
6
6
 
7
- `Harness/README.md` is the primary router. This file is a secondary context-splitting protocol for subagents and long tasks.
7
+ `CLAUDE.md` is the session entry router. `Harness/README.md` is the primary Harness documentation router. This file is a secondary context-splitting protocol for subagents and long tasks.
8
8
 
9
9
  If this file and `Harness/README.md` disagree, follow `Harness/README.md`, record the assumption in `Harness/tasks/<task-id>/PROGRESS.md`, and update this file later.
10
10
 
@@ -33,8 +33,8 @@ Load other docs only by trigger.
33
33
  | research, competitors, stack choice | `Harness/research/README.md`, `Harness/research/research-results.md` |
34
34
  | task split, owner, write set | `Harness/tasks/<task-id>/PROGRESS.md`, `Harness/tasks/<task-id>/PLAN.md`, `Harness/agent-workflow.md` |
35
35
  | parallel agents, dispatch, worktree decision | `Harness/subagents.md`, `Harness/dispatch.md`, `Harness/tasks/<task-id>/PLAN.md` |
36
- | `/wf` mode, long task, multi-file, multi-agent | `Harness/WF.md`, `Harness/subagents.md`, `Harness/dispatch.md`, `Harness/tasks/<task-id>/PLAN.md` |
37
- | `/wf max`, 5+ disjoint files, maximum parallelism | `Harness/WF-MAX.md`, `Harness/subagents.md`, `Harness/dispatch.md`, `Harness/tasks/<task-id>/PLAN.md` |
36
+ | `/wf` mode (explicit only) | [Harness/WF.md](WF.md), [Harness/subagents.md](subagents.md), [Harness/dispatch.md](dispatch.md), [Harness/tasks/<task-id>/PLAN.md](tasks/<task-id>/PLAN.md) |
37
+ | `/wf-max` (explicit only) | [Harness/WF-MAX.md](WF-MAX.md), [Harness/subagents.md](subagents.md), [Harness/dispatch.md](dispatch.md), [Harness/tasks/<task-id>/PLAN.md](tasks/<task-id>/PLAN.md) |
38
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
39
  | subagent spawn | `Harness/subagents.md`, `Harness/AGENT_ISOLATION.md`, this file plus the role pack below |
40
40
 
@@ -11,13 +11,14 @@ Use when work needs parallel reading, independent review, cross-layer analysis,
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
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
+ - Resumable state is governed by [WF-STATE.md](WF-STATE.md). On session start, the controller reads STATE.json before building a fresh dispatch table.
14
15
  - PRD-derived Acceptance Criteria are the source of truth. Dispatch packets must carry the relevant AC IDs and contracts.
15
- - Agent count: default (non-WF) <=3 active agents; `/wf` requires the complete role chain by default; `/wf max` inherits that chain and removes the Harness default cap through the span formula. Real concurrency is still bounded by runtime thread budget, config, billing, and local resources. Use current runtime subagents first, close completed agents, then cross-CLI overflow. Generated Codex config defaults to `agents.max_threads = 12` and `agents.max_depth = 1`; ask the user before raising `agents.max_threads` above that default. See [WF.md](WF.md) and [WF-MAX.md](WF-MAX.md).
16
+ - Agent count: default (non-WF) <=3 active agents; `/wf` selects a tier dynamically per [WF-KERNEL.md](WF-KERNEL.md) (Light/Standard/Full); `/wf-max` inherits the selected tier and adds maximum safe fan-out (WF-Max-Useful default; WF-Max-Strict explicit only), removing the Harness default cap through the span formula. Real concurrency is still bounded by runtime thread budget, config, billing, and local resources. Use current runtime subagents first, close completed agents, then cross-CLI overflow. Generated Codex config defaults to `agents.max_threads = 12` and `agents.max_depth = 1`; ask the user before raising `agents.max_threads` above that default. See [WF.md](WF.md) and [WF-MAX.md](WF-MAX.md).
16
17
  - Read-only agents may run in parallel.
17
18
  - Writing agents run serially unless write sets are disjoint.
18
19
  - Use a worktree when two agents may touch overlapping files or long-running branches.
19
20
  - Only summaries enter main context. Load named files directly when details are needed.
20
- - Subagents read task files, return findings and PLAN patch suggestions. Only the main agent commits changes to PROGRESS.md and PLAN.md.
21
+ - Only the controller or task-scribe writes task state (PROGRESS.md, PLAN.md). Production source agents (implementer, debugger, test-writer) never write task state unless explicitly dispatched as task-scribe.
21
22
 
22
23
  ## Scope
23
24
 
@@ -25,24 +26,26 @@ Use when work needs parallel reading, independent review, cross-layer analysis,
25
26
 
26
27
  ## Agent Roster
27
28
 
28
- | Agent | Mode | Purpose |
29
- | --- | --- | --- |
30
- | `planner` | Read | split goal into tasks, dependencies, write sets |
31
- | `researcher` | Read | product, market, ecosystem, dependency research |
32
- | `docs-researcher` | Read | official docs, API, SDK, version, limits |
33
- | `architect` | Read | layer boundaries, ports, data flow, state impact |
34
- | `test-writer` | Write | failing test or manual verification plan |
35
- | `implementer` | Write | minimal change inside declared write set |
36
- | `debugger` | Write | smallest fix for a reproduced failure |
37
- | `reviewer` | Read | diff review, risks, missing tests |
38
- | `verifier` | Read | run checks and record evidence |
39
- | `reflector` | Read | synthesize review/evidence and decide acceptance readiness |
40
- | `memory-master` | Write | write/consolidate memory entries |
41
- | `context-master` | Read | analyze context, recommend compression |
42
- | `explore-manager` | Read | WF-MAX W0: spawn researchers, synthesize |
43
- | `architect-manager` | Read | WF-MAX W1: spawn architects, synthesize |
44
- | `implement-manager` | Write | WF-MAX W2: spawn implementers |
45
- | `review-manager` | Read | WF-MAX W2R: spawn reviewers, deduplicate |
29
+ | Agent | Mode | Model Tier | Purpose |
30
+ | --- | --- | --- | --- |
31
+ | `task-scribe` | Write | small-fast | Task state, heartbeat, dispatch ledger, evidence pointers |
32
+ | `codebase-explorer` | Read | small-fast | Scoped read-only source exploration, file discovery |
33
+ | `planner` | Read | standard | Split goal into tasks, dependencies, write sets |
34
+ | `researcher` | Read | standard | Product, market, ecosystem, dependency research |
35
+ | `docs-researcher` | Read | standard | Official docs, API, SDK, version, limits |
36
+ | `architect` | Read | standard | Layer boundaries, ports, data flow, state impact |
37
+ | `test-writer` | Write | standard | Failing test or manual verification plan |
38
+ | `implementer` | Write | standard | Minimal change inside declared write set |
39
+ | `debugger` | Write | standard | Smallest fix for a reproduced failure |
40
+ | `reviewer` | Read | standard | Diff review, risks, missing tests |
41
+ | `verifier` | Read | standard or small-fast | Run checks and record evidence |
42
+ | `reflector` | Read | standard | Synthesize review/evidence and decide acceptance readiness |
43
+ | `memory-master` | Write | standard | Write/consolidate memory entries |
44
+ | `context-master` | Read | small-fast | Analyze context, recommend compression |
45
+ | `explore-manager` | Read | standard | WF-MAX W0: spawn researchers, synthesize |
46
+ | `architect-manager` | Read | standard | WF-MAX W1: spawn architects, synthesize |
47
+ | `implement-manager` | Write | standard | WF-MAX W2: spawn implementers |
48
+ | `review-manager` | Read | standard | WF-MAX W2R: spawn reviewers, deduplicate |
46
49
 
47
50
  ## Dispatch Rules
48
51
 
@@ -51,7 +54,7 @@ Use when work needs parallel reading, independent review, cross-layer analysis,
51
54
  - If two write sets overlap, do not run those agents in parallel.
52
55
  - If an agent returns uncertainty, mark the row `Blocked` or add a follow-up row.
53
56
  - If docs, tests, and code disagree, stop implementation and record the conflict in `Harness/tasks/<task-id>/PROGRESS.md`.
54
- - In /wf max, file claims must respect WF-MAX.md leaf condition: no split below 50 avgLines, no split when files <= span*2.
57
+ - In /wf-max, file claims must respect WF-MAX.md leaf condition: no split below 50 avgLines, no split when files <= span*2.
55
58
 
56
59
  ## Dispatch Input (Controller -> Subagent)
57
60
 
@@ -59,18 +62,23 @@ The controller MUST include these fields in the subagent's dispatch packet.
59
62
  Without them, the subagent has no way to know which rules or contracts to load.
60
63
 
61
64
  ```text
62
- Role: <installed agent name or bounded role, e.g. planner, implementer-fe, reviewer, memory-master>
63
- Task: <one-sentence goal>
64
- ECC: <which ECC rules to load, e.g. web/design-quality.md, python/fastapi.md. See context-loading.md#ecc-rules-per-role>
65
- Skills: <which skills to activate, e.g. react-review, tdd-guide>
66
- PRD: <path or task PLAN section containing Mini PRD>
67
- Acceptance IDs: <AC-001, AC-002, or "none" for non-behavioral work>
68
- UI contract: <path to UI_CONTRACT.md or task PLAN section, if UI task>
69
- API contract: <path to api/openapi.yaml, if frontend<->backend task. Omit if N/A>
70
- Read set: <files and directories the subagent may read>
71
- Write set: <files the subagent may modify. "none" = read-only>
72
- Forbidden: <commands, paths, or patterns the subagent must not touch>
73
- Verification: <commands to run after implementation, e.g. npm test>
65
+ Role: <installed agent name or bounded role, e.g. task-scribe, planner, implementer>
66
+ Objective: <one-sentence goal>
67
+ TaskType: ui-browser | api-backend | architecture-migration | docs-readme | dependency-sdk | bug-fix | refactor | chore
68
+ ModelTier: small-fast | standard | high-reasoning
69
+ AgentName: <the agent file name, e.g. task-scribe, codebase-explorer, implementer>
70
+ Skills: <which skills to activate, e.g. tdd, browser-e2e>
71
+ ECC: <which ECC rules to load, e.g. web/design-quality.md, python/fastapi.md>
72
+ PRD: <path or task PLAN section containing Mini PRD>
73
+ Acceptance IDs: <AC-001, AC-002, or "none" for non-behavioral work>
74
+ UI contract: <path to UI_CONTRACT.md or task PLAN section, if UI task>
75
+ API contract: <path to api/openapi.yaml, if frontend<->backend task. Omit if N/A>
76
+ Read set: <files and directories the subagent may read>
77
+ Write set: <files the subagent may modify. "none" = read-only>
78
+ Forbidden: <commands, paths, or patterns the subagent must not touch>
79
+ Verification: <commands to run after implementation, e.g. npm test>
80
+ MaxReturnTokens: <token budget for return>
81
+ ReturnSchema: <expected fields in return>
74
82
  ```
75
83
 
76
84
  ## Handoff Format (Subagent -> Controller)
@@ -93,8 +101,8 @@ Risks:
93
101
  Next:
94
102
  PLAN patch:
95
103
  Validation matrix: <AC-by-AC pass/fail/block evidence, for validators>
96
- Concurrency group: <wave number - 0=exploration, 1,2,3,...=implementation waves. Optional; only used in /wf max.>
97
- File claim: <list of exact file paths this agent exclusively owns. Optional; only used in /wf max.>
104
+ Concurrency group: <wave number - 0=exploration, 1,2,3,...=implementation waves. Optional; only used in /wf-max.>
105
+ File claim: <list of exact file paths this agent exclusively owns. Optional; only used in /wf-max.>
98
106
  Granularity floor: <50 avgLines -> do NOT spawn. Apply leaf condition from WF-MAX.md.>
99
107
  ```
100
108