create-harness-vibe-coding 0.8.7 → 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 (126) hide show
  1. package/README-CN.md +163 -105
  2. package/README.md +179 -244
  3. package/bin/create-harness-vibe-coding.js +2 -2
  4. package/docs/images/harness-architecture-light.png +0 -0
  5. package/docs/images/harness-architecture.drawio +164 -0
  6. package/docs/images/harness-icon.png +0 -0
  7. package/package.json +47 -44
  8. package/src/generator.js +41 -5
  9. package/src/index.js +86 -13
  10. package/src/prompts.js +37 -37
  11. package/templates/common/.claude/agents/architect-manager.md +45 -45
  12. package/templates/common/.claude/agents/architect.md +31 -31
  13. package/templates/common/.claude/agents/codebase-explorer.md +45 -0
  14. package/templates/common/.claude/agents/context-master.md +75 -75
  15. package/templates/common/.claude/agents/debugger.md +41 -41
  16. package/templates/common/.claude/agents/docs-researcher.md +41 -41
  17. package/templates/common/.claude/agents/explore-manager.md +41 -41
  18. package/templates/common/.claude/agents/implement-manager.md +49 -49
  19. package/templates/common/.claude/agents/implementer.md +40 -40
  20. package/templates/common/.claude/agents/memory-master.md +82 -64
  21. package/templates/common/.claude/agents/planner.md +34 -34
  22. package/templates/common/.claude/agents/researcher.md +41 -41
  23. package/templates/common/.claude/agents/review-manager.md +56 -56
  24. package/templates/common/.claude/agents/reviewer.md +34 -34
  25. package/templates/common/.claude/agents/task-scribe.md +70 -0
  26. package/templates/common/.claude/agents/verifier.md +29 -29
  27. package/templates/common/.claude/commands/wf-help.md +9 -5
  28. package/templates/common/.claude/commands/wf-update.md +24 -0
  29. package/templates/common/.claude/rules/ecc/common.md +57 -44
  30. package/templates/common/.claude/settings.json +13 -0
  31. package/templates/common/.claude/skills/subagent-orchestrator/SKILL.md +8 -4
  32. package/templates/common/.claude/skills/wf/SKILL.md +15 -8
  33. package/templates/common/.claude/skills/wf-auto/SKILL.md +10 -7
  34. package/templates/common/.claude/skills/wf-learn/SKILL.md +9 -2
  35. package/templates/common/.claude/skills/wf-max/SKILL.md +23 -5
  36. package/templates/common/.claude/skills/wf-readme/SKILL.md +49 -49
  37. package/templates/common/.claude/skills/wf-remove/SKILL.md +7 -7
  38. package/templates/common/.claude/skills/wf-update/SKILL.md +15 -2
  39. package/templates/common/.codex/hooks.json +17 -0
  40. package/templates/common/.harness-version +130 -45
  41. package/templates/common/.opencode/agents/architect-manager.md +52 -0
  42. package/templates/common/.opencode/agents/architect.md +35 -0
  43. package/templates/common/.opencode/agents/codebase-explorer.md +45 -0
  44. package/templates/common/.opencode/agents/context-master.md +81 -0
  45. package/templates/common/.opencode/agents/debugger.md +43 -0
  46. package/templates/common/.opencode/agents/docs-researcher.md +42 -0
  47. package/templates/common/.opencode/agents/explore-manager.md +49 -0
  48. package/templates/common/.opencode/agents/implement-manager.md +56 -0
  49. package/templates/common/.opencode/agents/implementer.md +42 -0
  50. package/templates/common/.opencode/agents/memory-master.md +88 -0
  51. package/templates/common/.opencode/agents/planner.md +38 -0
  52. package/templates/common/.opencode/agents/reflector.md +39 -0
  53. package/templates/common/.opencode/agents/researcher.md +42 -0
  54. package/templates/common/.opencode/agents/review-manager.md +63 -0
  55. package/templates/common/.opencode/agents/reviewer.md +37 -0
  56. package/templates/common/.opencode/agents/task-scribe.md +70 -0
  57. package/templates/common/.opencode/agents/tdd-guide.md +83 -0
  58. package/templates/common/.opencode/agents/test-writer.md +54 -0
  59. package/templates/common/.opencode/agents/verifier.md +37 -0
  60. package/templates/common/.opencode/commands/wf-auto-spark.md +15 -0
  61. package/templates/common/.opencode/commands/wf-auto.md +15 -0
  62. package/templates/common/.opencode/commands/wf-help.md +27 -0
  63. package/templates/common/.opencode/commands/wf-learn.md +15 -0
  64. package/templates/common/.opencode/commands/wf-max.md +15 -0
  65. package/templates/common/.opencode/commands/wf-readme.md +15 -0
  66. package/templates/common/.opencode/commands/wf-remove.md +15 -0
  67. package/templates/common/.opencode/commands/wf-review.md +15 -0
  68. package/templates/common/.opencode/commands/wf-update.md +24 -0
  69. package/templates/common/.opencode/commands/wf.md +15 -0
  70. package/templates/common/.opencode/plugins/harness-wf-status.mjs +135 -0
  71. package/templates/common/AGENTS.md +2 -29
  72. package/templates/common/CLAUDE.md +114 -88
  73. package/templates/common/Harness/ACCEPTANCE_PROTOCOL.md +2 -2
  74. package/templates/common/{MEMORY.md → Harness/MEMORY.md} +17 -4
  75. package/templates/common/Harness/MEMORY_PROTOCOL.md +80 -30
  76. package/templates/common/Harness/PROGRESS.md +17 -17
  77. package/templates/common/Harness/README.md +58 -19
  78. package/templates/common/{SETUP.md → Harness/SETUP.md} +278 -276
  79. package/templates/common/Harness/TASK_ARCHIVE.md +56 -0
  80. package/templates/common/Harness/WF-AUTO-ANGLES.md +170 -0
  81. package/templates/common/Harness/WF-AUTO-SPARK.md +10 -19
  82. package/templates/common/Harness/WF-AUTO.md +93 -167
  83. package/templates/common/Harness/WF-KERNEL.md +189 -0
  84. package/templates/common/Harness/WF-MAX.md +60 -328
  85. package/templates/common/Harness/WF-STATE.md +83 -0
  86. package/templates/common/Harness/WF.md +117 -237
  87. package/templates/common/Harness/agent-workflow.md +2 -2
  88. package/templates/common/Harness/architecture.md +124 -124
  89. package/templates/common/Harness/context-loading.md +111 -111
  90. package/templates/common/Harness/dispatch.md +43 -35
  91. package/templates/common/Harness/extension.md +66 -66
  92. package/templates/common/Harness/lifecycle.md +20 -20
  93. package/templates/common/Harness/research/PRD.md +56 -56
  94. package/templates/common/Harness/research/README.md +169 -169
  95. package/templates/common/Harness/research/research-results.md +66 -66
  96. package/templates/common/Harness/scripts/archive-tasks.mjs +239 -0
  97. package/templates/common/{scripts → Harness/scripts}/scan-clean.mjs +443 -416
  98. package/templates/common/{scripts → Harness/scripts}/validate-harness.mjs +691 -452
  99. package/templates/common/Harness/scripts/wf-auto-update-prompt.mjs +258 -0
  100. package/templates/common/{scripts → Harness/scripts}/wf-remove.mjs +56 -39
  101. package/templates/common/{scripts → Harness/scripts}/wf-update-check.mjs +632 -599
  102. package/templates/common/Harness/subagents.md +215 -214
  103. package/templates/common/Harness/tasks/_template/ARTIFACTS.md +2 -2
  104. package/templates/common/Harness/tasks/_template/NOTES.md +2 -2
  105. package/templates/common/Harness/tasks/_template/PLAN.md +5 -0
  106. package/templates/common/Harness/tasks/_template/STATE.json +23 -0
  107. package/templates/common/README.md +37 -37
  108. package/templates/common/memory/agent-lessons-patterns.md +22 -21
  109. package/templates/common/memory/routes.md +43 -0
  110. package/templates/common/memory/startup-hints.md +32 -0
  111. package/templates/common/memory/tool-usage-reflections.md +22 -21
  112. package/templates/common/memory/user-corrections-preferences.md +23 -21
  113. package/templates/common/opencode.json +19 -0
  114. package/templates/optional/catalog.json +49 -33
  115. package/templates/optional/skills/browser-e2e/.claude/skills/browser-e2e/SKILL.md +42 -42
  116. package/templates/optional/skills/browser-e2e/.claude/skills/wf-browser/SKILL.md +193 -193
  117. package/templates/optional/skills/browser-e2e/.opencode/commands/wf-browser.md +15 -0
  118. package/templates/optional/skills/browser-e2e/Harness/workflows/browser-e2e.md +48 -48
  119. package/templates/optional/skills/github-pr-review/.claude/skills/github-pr-review/SKILL.md +40 -40
  120. package/templates/optional/skills/github-pr-review/Harness/workflows/github-pr-review.md +28 -28
  121. package/templates/optional/skills/python-backend/.claude/skills/python-backend/SKILL.md +40 -40
  122. package/templates/optional/skills/python-backend/Harness/workflows/python-backend.md +34 -34
  123. package/templates/optional/skills/ts-react-frontend/.claude/skills/ts-react-frontend/SKILL.md +43 -43
  124. package/templates/optional/skills/ts-react-frontend/Harness/workflows/ts-react-frontend.md +34 -34
  125. package/templates/optional/skills/ui-ux-review/.claude/skills/ui-ux-review/SKILL.md +40 -40
  126. package/templates/optional/skills/ui-ux-review/Harness/workflows/ui-ux-review.md +26 -26
@@ -2,17 +2,17 @@
2
2
 
3
3
  ## Trigger
4
4
 
5
- - Explicit: `/wf-auto`, `wf auto`, `auto mode`
6
- - The user wants continuous improvement that never stops on its own.
7
- - The user is done giving instructions and wants the system to self-direct.
5
+ - Explicit: `/wf-auto`, `$wf-auto`, `/skills wf-auto`
6
+ - The user must type one of these exact tokens to enter WF-AUTO.
7
+ - These phrases are NOT triggers and must NOT auto-enter WF-AUTO: "auto mode", "never stop", "self-improve", "continuous optimize", "unbounded self-directed optimization", "keep going", or any natural-language description of perpetual work. Only explicit command tokens enter.
8
8
 
9
9
  ## Core Principle
10
10
 
11
- **NEVER STOP.** WF-AUTO is a perpetual loop. It does not stop when a task is "done" — it finds the next improvement and continues. The ONLY permitted stop is the 8-Angle Exhaustion Gate: when all 8 independent perspectives agree there is no worthwhile optimization direction left.
11
+ **NEVER STOP.** WF-AUTO is a perpetual loop. It does not stop when a task is "done" — it finds the next improvement and continues. The only permitted stop is the Adaptive Coverage Exhaustion Gate: when the project's dynamic risk obligations are covered, two different confirmation strategies find no worthwhile direction, and unresolved uncertainty is recorded.
12
12
 
13
13
  This fills the gap between:
14
14
  - `/wf` — task-bounded, stops on completion
15
- - `/wf-max` - task-bounded WF strict superset: complete role chain plus maximum parallelism
15
+ - `/wf-max` - task-bounded `/wf` variant on the same WF kernel: maximum safe fan-out, WF-Max-Useful by default, WF-Max-Strict only on explicit strict request
16
16
  - `/wf-auto` — **unbounded, self-directed, perpetual improvement**
17
17
 
18
18
  ## Organization Model
@@ -39,19 +39,15 @@ does not edit production source. Implementation happens only through dispatched
39
39
  workers with explicit write sets, forbidden truth files, and verification
40
40
  commands.
41
41
 
42
- WF-AUTO does not inherit WF-MAX mandatory maximum fan-out unless `/wf-max` is
42
+ WF-AUTO does not inherit WF-MAX fan-out modes (Useful or Strict) unless `/wf-max` is
43
43
  explicitly invoked or the selected change exceeds the auto cycle cap and
44
44
  escalates. Auto mode stays one accepted change per cycle.
45
45
 
46
46
  ```
47
- CEO(1) ──┬── Angle-Agent (correctness)
48
- ├── Angle-Agent (performance)
49
- ├── Angle-Agent (security)
50
- ├── Angle-Agent (maintainability)
51
- ├── Angle-Agent₅ (test-coverage)
52
- ├── Angle-Agent₆ (architecture)
53
- ├── Angle-Agent₇ (ux-dx)
54
- └── Angle-Agent₈ (robustness)
47
+ CEO(1) ──┬── Probe-Agent (selected by risk and evidence)
48
+ ├── Probe-Agent (selected by changed surface)
49
+ ├── Probe-Agent (selected by user goal)
50
+ └── Probe-Agent (selected by evidence gap)
55
51
 
56
52
 
57
53
  CEO synthesizes → picks highest-impact direction
@@ -62,7 +58,7 @@ CEO(1) ──┬── Angle-Agent₁ (correctness)
62
58
 
63
59
  LOOP → W0 (re-sense)
64
60
 
65
- ─── WHEN ALL 8 EXHAUSTED ───
61
+ ─── WHEN ADAPTIVE COVERAGE IS EXHAUSTED ───
66
62
 
67
63
  CEO → Cross-Model Oracle (Codex/Claude)
68
64
 
@@ -70,9 +66,9 @@ CEO(1) ──┬── Angle-Agent₁ (correctness)
70
66
  └── Oracle also empty → Tier 2 confirm rounds → STOP
71
67
  ```
72
68
 
73
- CEO orchestrates the perpetual loop. CEO never writes production code — delegates all implementation. CEO synthesizes angle findings, picks direction, dispatches implement/review/verify, then loops.
69
+ CEO orchestrates the perpetual loop. CEO never writes production code — delegates all implementation. CEO synthesizes probe findings, picks direction, dispatches implement/review/verify, then loops.
74
70
 
75
- When all 8 angles return exhausted, the CEO does NOT immediately enter confirmation it first consults the other AI model (the Cross-Model Oracle) for a fresh perspective. Only when the oracle also finds nothing do confirmation rounds begin.
71
+ When the selected probes return exhausted, the CEO does NOT immediately enter confirmation. It checks dynamic risk obligations and unresolved uncertainty, then consults the other AI model only when a fresh perspective is warranted. Confirmation rounds must use different scan strategies.
76
72
 
77
73
  ### State Machine
78
74
 
@@ -80,7 +76,7 @@ WF-AUTO operates in explicit states. Without a state machine, "auto-degrade", "s
80
76
 
81
77
  ```
82
78
  ┌──────────────────────────────┐
83
- │ auto.internal │ ←── W0-W5 loop (8-angle scan + oracle + spark)
79
+ │ auto.internal │ ←── W0-W5 loop (adaptive probes + oracle + spark)
84
80
  │ (active optimization cycle) │
85
81
  └──────────┬───────────────────┘
86
82
 
@@ -111,38 +107,44 @@ WF-AUTO operates in explicit states. Without a state machine, "auto-degrade", "s
111
107
 
112
108
  | State | Meaning | Entry Condition |
113
109
  |-------|---------|-----------------|
114
- | `auto.internal` | Running W0-W5 with internal 8-angle scan | Default, or return from checkpoint/spark |
115
- | `auto.spark` | Searching external sources for candidates when internal + oracle are empty | All 8 exhausted + oracle empty, OR user requested spark mode |
110
+ | `auto.internal` | Running W0-W5 with dynamically selected probes | Default, or return from checkpoint/spark |
111
+ | `auto.spark` | Searching external sources for candidates when internal + oracle are empty | Selected probes exhausted + oracle empty, OR user requested spark mode |
116
112
  | `auto.checkpoint` | Intent Checkpoint — brief user alignment check | Every N cycles (adaptive: 2→5→10) |
117
- | `auto.exhausted` | A-GATE passed permanently | 3 consecutive all-exhausted rounds + oracle confirmed |
113
+ | `auto.exhausted` | A-GATE passed permanently | Two different confirmation strategies return no actionable finding |
118
114
  | `paused` | User interrupted, waiting for direction | User says "stop" or interrupts at any point |
119
115
 
120
116
  **State transitions are CEO-owned.** The CEO decides which state to enter based on W0 results and checkpoint responses. The state machine is recorded in `Harness/tasks/auto/PROGRESS.md` at each transition.
121
117
 
122
- ## The 8 Angles (Exhaustion Dimensions)
118
+ ## Adaptive coverage instead of a magic angle count
123
119
 
124
- These are the ONLY lenses through which optimization is justified. An angle is "exhausted" when it finds zero actionable improvements.
120
+ The old protocol dispatched a fixed set of eight angles every cycle. That made
121
+ the stop condition easy to explain, but it also spent context on irrelevant
122
+ surfaces and treated every repository as if it had the same risks.
125
123
 
126
- | # | Angle | Focus | Example Signals |
127
- |---|-------|-------|----------------|
128
- | 1 | **Correctness** | Bugs, logic errors, edge cases, null safety, race conditions, state inconsistency | Unhandled error paths, missing null checks, off-by-one, stale cache |
129
- | 2 | **Performance** | Speed, memory, I/O, algorithmic complexity, bundle size, query efficiency | O(n²) where O(n log n) exists, unnecessary allocations, blocking I/O |
130
- | 3 | **Security** | Injection, auth/authz, secret exposure, input validation, dependency CVEs | Unsanitized input, hardcoded keys, missing rate limits, outdated deps |
131
- | 4 | **Maintainability** | Code clarity, DRY violations, coupling, naming, comment accuracy, dead code | Duplicated logic, misleading names, god functions, stale comments |
132
- | 5 | **Test Coverage** | Missing tests, weak assertions, untested edge cases, flaky tests, test speed | Untested error branches, mock-only tests (no integration), slow suites |
133
- | 6 | **Architecture** | Boundary violations, dependency direction, interface stability, layer discipline | Circular deps, leaky abstractions, wrong layer ownership |
134
- | 7 | **UX / DX** | Error messages, API ergonomics, documentation, logging, CLI/API consistency | Cryptic errors, missing docs, inconsistent flags, poor discoverability |
135
- | 8 | **Robustness** | Resilience, retry/backoff, graceful degradation, observability, recovery | Missing retries, no circuit breaker, silent failures, no health checks |
124
+ The current protocol uses a dynamic probe catalog and project obligations:
136
125
 
137
- These 8 angles are comprehensive by design. If ALL 8 return empty, the codebase is genuinely optimized to the point where further changes would be cosmetic or harmful.
126
+ 1. Build a profile from the repository, recent diff, failures, task capsule,
127
+ and user direction.
128
+ 2. Score candidate probes by risk, change relevance, evidence gap, expected
129
+ user value, novelty, and scan cost.
130
+ 3. Always keep Goal / value and Correctness / safety visible; add security,
131
+ recovery, performance, architecture, testing, UX/DX, dependency, or other
132
+ probes only when the evidence triggers them.
133
+ 4. Record selected probes, skipped probes, scan strategy, confidence, surface
134
+ coverage, and findings in the cycle ledger.
135
+ 5. Stop only after dynamic high-risk obligations are covered and two different
136
+ confirmation strategies find no actionable improvement.
137
+
138
+ Read the complete selection algorithm, obligation matrix, scan strategies, and
139
+ ledger schema in [WF-AUTO-ANGLES.md](WF-AUTO-ANGLES.md).
138
140
 
139
141
  ## Perpetual Loop
140
142
 
141
143
  ```text
142
144
  ┌──────────────────────────────────────────────────────────────┐
143
- │ W0: SENSE — 8 angle agents + oracle + spark (all parallel) │
145
+ │ W0: SENSE — adaptive probes + oracle + spark (as triggered) │
144
146
  │ ↓ │
145
- │ A-GATE: Angle Exhaustion Gate
147
+ │ A-GATE: Adaptive Coverage Exhaustion Gate
146
148
  │ ├── Findings exist (any source) → continue to W1 │
147
149
  │ └── ALL sources empty? → CROSS-MODEL ORACLE │
148
150
  │ ├── Oracle finds directions → feed into W1 │
@@ -172,84 +174,71 @@ These 8 angles are comprehensive by design. If ALL 8 return empty, the codebase
172
174
  └──────────────────────────────────────────────────────────────┘
173
175
  ```
174
176
 
175
- ### W0: SENSE (Parallel Angle Scan)
177
+ ### W0: SENSE (Adaptive Probe Selection)
176
178
 
177
- CEO dispatches ALL 8 angle agents in ONE message. Each agent:
179
+ CEO dispatches the selected probe agents in one batch when the runtime allows
180
+ it. The selection comes from [WF-AUTO-ANGLES.md](WF-AUTO-ANGLES.md), not from a
181
+ fixed count. Each probe agent:
178
182
 
179
- - **Role**: Read-only scanner through one angle lens
183
+ - **Role**: Read-only scanner through one selected probe lens
180
184
  - **Read set**: The project source tree (scoped by CEO to relevant paths)
181
- - **Return**: `{angle, findings: [{file, line, severity, description, suggestedFix}], exhausted: boolean, confidence: 0-1}`
185
+ - **Return**: `{probe, findings: [{file, line, severity, description, suggestedFix}], exhausted: boolean, confidence: 0-1, coverage: 0-1, skippedReason?: string}`
182
186
  - **Stop condition**: Returns when scan is complete — does not implement anything
183
187
 
184
- Angle agents are READ-ONLY. They find, they don't fix.
188
+ Probe agents are READ-ONLY. They find, they don't fix.
185
189
 
186
190
  Every cycle starts with a fresh W0 scan. The codebase changed since last cycle (due to W2-W5), so new findings may emerge.
187
191
 
188
- ### A-GATE: Angle Exhaustion Gate (THE ONLY STOP)
192
+ ### A-GATE: Adaptive Coverage Exhaustion Gate (THE ONLY STOP)
189
193
 
190
194
  This is the single most important gate in WF-AUTO. It prevents both premature stopping and infinite busywork.
191
195
 
192
- **Gate Protocol (three-tier):**
196
+ **Gate Protocol:**
193
197
 
194
198
  ```
195
- TIER 1 — All 8 angles return exhausted=true?
196
- ├── NO → Findings exist. Continue to W1. Reset confirmCount to 0.
197
- └── YES → Move to Tier 1.5 (Cross-Model Oracle).
198
-
199
- TIER 1.5CROSS-MODEL ORACLE (fresh eyes before confirming exhaustion)
200
- ├── CEO prepares a context pack: project summary, recent cycle history,
201
- │ architecture overview, and the 8 angle exhaustion reports.
202
- ├── CEO invokes the OTHER CLI (Codex if running as Claude, Claude if
203
- │ running as Codex) same detection rule as /wf-review.
204
- │ Command: `git diff --stat && cat Harness/tasks/auto/PROGRESS.md |
205
- │ codex exec "This project believes it is fully optimized. From 8
206
- │ angles (correctness, performance, security, maintainability, test
207
- │ coverage, architecture, UX/DX, robustness), find ANY optimization
208
- │ direction that was missed. Be adversarial prove us wrong."`
209
- ├── Oracle returns: {findings: [...], empty: boolean}
210
- ├── Oracle finds directions? → Feed into W1 as HIGH priority findings.
211
- │ Reset confirmCount to 0. The oracle's fresh perspective broke the
212
- │ local blind spot. Continue looping.
213
- └── Oracle also empty? → Move to Tier 2. The external model agrees:
214
- this codebase is genuinely optimized.
215
-
216
- TIER 2 — Confirmation round.
217
- ├── confirmCount < 2? → Increment confirmCount. Re-run W0 with
218
- │ DIFFERENT agent seeds/scopes to prevent false negatives.
219
- │ (e.g., if first scan was broad, second scan is deep-dive on
220
- │ recent change areas; if first used file-level, second uses
221
- │ function-level.)
222
- └── confirmCount ≥ 2? → 3 consecutive rounds with all 8 exhausted
223
- AND cross-model oracle confirmed empty. PERMANENT STOP.
224
- Record final exhaustion evidence.
199
+ TIER 1 — Did selected probes cover all dynamic high-risk obligations?
200
+ ├── NO → Select the missing obligation and continue to W0.
201
+ └── YES → Check findings, confidence, coverage, and value threshold.
202
+
203
+ TIER 2Did any selected probe find an actionable direction?
204
+ ├── YES Feed the highest-value finding to W1. Reset confirmCount.
205
+ └── NO Run a confirmation pass with a different scan strategy.
206
+
207
+ TIER 3Is uncertainty still high or coverage borderline?
208
+ ├── YES Re-run only the uncertain probe, or invoke the cross-model oracle.
209
+ └── NO Record an empty confirmation pass.
210
+
211
+ TIER 4 Two different confirmation strategies are empty?
212
+ ├── NO Continue with another strategy or newly triggered obligation.
213
+ └── YES Record exhaustion evidence and stop.
225
214
  ```
226
215
 
227
216
  **Oracle Rules (modeled on /wf-review):**
228
217
 
229
218
  - [ ] CEO detects which CLI is running: `which codex` / `which claude`
230
- - [ ] CEO invokes the OTHER CLI never the same model
231
- - [ ] If neither CLI is available: skip oracle, move directly to Tier 2, record "oracle unavailable" in PROGRESS.md
232
- - [ ] Oracle is invoked at most ONCE per Tier 1 exhaustion event (not re-invoked per confirmation round — the confirmation rounds are local)
219
+ - [ ] CEO invokes the OTHER CLI only when unresolved high-risk uncertainty or borderline coverage justifies it
220
+ - [ ] If neither CLI is available, record "oracle unavailable" in PROGRESS.md and continue with local confirmation
221
+ - [ ] Oracle is invoked at most once per adaptive exhaustion event
233
222
  - [ ] Oracle findings are treated as severity=high by default (external model perspective gets extra weight)
234
223
 
235
224
  **Gate Rules:**
236
225
 
237
- - [ ] All 8 angles returned structured findings (not just "looks good")
238
- - [ ] Each angle scanned ≥80% of its relevant surface area
239
- - [ ] No angle was skipped or timed out
240
- - [ ] Cross-Model Oracle was consulted (or unavailability recorded)
241
- - [ ] confirmCount 2 (three consecutive all-exhausted rounds)
242
- - [ ] CEO reviewed at least 2 angle returns that were borderline (confidence < 0.9)
226
+ - [ ] Dynamic high-risk obligations are covered
227
+ - [ ] Each selected probe returned structured findings, confidence, and surface coverage
228
+ - [ ] Skipped obligations have an evidence-based reason
229
+ - [ ] Cross-Model Oracle was consulted when uncertainty justified it, or unavailability was recorded
230
+ - [ ] Two different confirmation strategies returned no actionable finding
231
+ - [ ] CEO reviewed borderline probe returns (confidence < 0.8 or coverage < 0.8)
243
232
 
244
233
  **Anti-false-exhaustion measures:**
245
- - Angle agents MUST include confidence scores. Low confidence (0.5-0.7) on "exhausted" = CEO re-dispatches that angle with a deeper scope.
246
- - Between confirmation rounds, CEO varies the scan strategy: broaddeep, file-levelfunction-level, recent-changes → full-tree.
247
- - If any angle returns confidence < 0.8 on "exhausted", that angle MUST be re-run with expanded scope before counting toward confirmCount.
248
- - The Cross-Model Oracle is the ultimate blind-spot breaker a different model family with different inductive biases. If it finds anything, the loop continues.
234
+ - Probe agents MUST include confidence and relevant surface coverage. Low confidence or coverage on "exhausted" means the probe is re-run with a deeper scope.
235
+ - Between confirmation rounds, CEO varies the scan strategy: breadthdepth, change-firstfailure-first, or contract-first.
236
+ - Re-run only the uncertain or under-covered probe instead of rescanning irrelevant surfaces.
237
+ - The Cross-Model Oracle breaks blind spots when local evidence is insufficient; if it finds anything, the loop continues.
249
238
 
250
239
  ### W1: PRIORITIZE
251
240
 
252
- CEO takes all angle findings, deduplicates, and ranks:
241
+ CEO takes all probe findings, deduplicates, and ranks:
253
242
 
254
243
  ```
255
244
  priorityScore = severity × impactRadius × reversibility
@@ -271,53 +260,13 @@ Before W2, CEO writes a cycle Mini PRD:
271
260
  - UI/API/state contracts, if touched
272
261
  - Verification commands and evidence expected
273
262
 
274
- ### W2: IMPLEMENT
275
-
276
- Modeled on WF's build loop but scoped to ONE change:
277
-
278
- 1. CEO writes the change spec in `Harness/tasks/auto/PROGRESS.md` (cycle number, angle, finding, planned change, write set ≤3 files)
279
- 2. CEO dispatches `implementer` with the change spec
280
- 3. Implementer changes ONLY the declared write set
281
-
282
- CEO NEVER writes production code — this rule is inherited from WF-MAX (AP1: CEO-as-Worker).
283
-
284
- Acceptance-specific implementation rules:
285
-
286
- - Dispatch `test-writer` when AC IDs need new or updated tests.
287
- - Dispatch `implementer` with forbidden truth files: PRD, AC, UI/API contracts, test plan, and validation report.
288
- - Implementer may not rewrite ACs/contracts to make the implementation pass.
263
+ ### W2-W5: IMPLEMENT → REVIEW → DEBUG → VERIFY
289
264
 
290
- ### W3: REVIEW
265
+ WF-AUTO inherits the standard WF-KERNEL write/review/fix/verify gates per cycle. Each accepted finding follows:
291
266
 
292
- Two-gate review (from WF/subagents.md), then reflection:
267
+ [WF-KERNEL.md](WF-KERNEL.md) write gate (implementer, one file_claim per cycle, ≤3 files, ≤50 lines net), review gate (at least one independent reviewer; two for critical/security), fix gate (debugger on failure, max 2 fix attempts per cycle), and verify gate (test suite, real browser/API check, AC-by-AC evidence).
293
268
 
294
- 1. **Spec review**: Did the change address the finding without introducing extras?
295
- 2. **Code-quality review**: Is the change correct, maintainable, safe?
296
- 3. **Reflector gate**: Does review evidence, verifier evidence, and residual
297
- risk support acceptance?
298
-
299
- At least one `reviewer` subagent. For critical/security findings, dispatch two independent reviewers.
300
- Do not record the cycle as accepted until `reflector` returns PASS.
301
-
302
- ### W4: DEBUG (Recovery)
303
-
304
- If review or verification fails:
305
- 1. `debugger` isolates the smallest failing path
306
- 2. Fix and re-review (max 2 attempts per cycle)
307
- 3. On 3rd failure: record the finding as "attempted, blocked" and move to next finding in W1
308
- 4. Blocked findings are revisited after 3 cycles (the codebase may have changed enough to unblock)
309
-
310
- ### W5: VERIFY
311
-
312
- - Run project test suite (or relevant subset)
313
- - For browser-visible changes: real browser check
314
- - For API changes: real request/response check
315
- - Record evidence in `Harness/tasks/auto/PROGRESS.md`
316
- - Final acceptance still requires cross-review and reflector PASS after
317
- verification. A passing command alone is not acceptance.
318
-
319
- Validation must include AC-by-AC evidence in `Harness/tasks/auto/PROGRESS.md`,
320
- not only a generic pass/fail command result.
269
+ CEO NEVER writes production code (per WF-KERNEL State Ownership). Implementer writes ONLY the declared write set. Production agents never write task state.
321
270
 
322
271
  ### RECORD
323
272
 
@@ -370,7 +319,7 @@ Hard boundaries:
370
319
  - only `/wf-auto` may use a runtime hook
371
320
  - the hook must run one bounded tick, not an unbounded process
372
321
  - the hook must respect `Harness/tasks/auto/STOP`, `state=paused`, user stop,
373
- and the 8-Angle Exhaustion Gate
322
+ and the Adaptive Coverage Exhaustion Gate
374
323
  - the hook must not enforce WF-MAX roles, writeSet, or agent identity
375
324
  - the hook must not inject memory directly; use `MEMORY_PROTOCOL.md` scenario
376
325
  hints through controller/context-master
@@ -411,7 +360,7 @@ CEO presents:
411
360
 
412
361
  ### Spark: External Candidate Provider
413
362
 
414
- Spark is NOT a separate optimization engine. It is a **candidate provider** plugged into W0, alongside the internal 8-angle scan and the cross-model oracle. W1 still owns prioritization across ALL sources.
363
+ Spark is NOT a separate optimization engine. It is a **candidate provider** plugged into W0, alongside the adaptive probe scan and the cross-model oracle. W1 still owns prioritization across ALL sources.
415
364
 
416
365
  **When spark activates:**
417
366
  - W0 internal scan returns empty AND oracle also empty → `auto.spark` state
@@ -448,7 +397,7 @@ Spark is NOT a separate optimization engine. It is a **candidate provider** plug
448
397
  **Spark candidates flow into W1 with `source=spark-<source-name>`:**
449
398
 
450
399
  W1 prioritization now handles three source types:
451
- - `source=internal` — from 8-angle scan
400
+ - `source=internal` — from adaptive probe scan
452
401
  - `source=oracle` — from cross-model review
453
402
  - `source=spark-<name>` — from external inspiration search
454
403
 
@@ -494,36 +443,13 @@ If a spark cycle's measured result is NEGLIGIBLE or REVERTED, increment `weakSpa
494
443
 
495
444
  ## CEO Constraints
496
445
 
497
- The CEO operates under the same strict tool boundary as WF-MAX:
498
-
499
- | CEO Has | CEO MUST NOT Use (on source code) |
500
- |---------|-----------------------------------|
501
- | Task (spawn agents) | Edit (on source files) |
502
- | Read (for scoping) | Write (on source files) |
503
- | Grep/Glob (for scoping) | MultiEdit (on source files) |
504
- | Write (to PROGRESS.md only) | Bash (except final verification) |
505
-
506
- **Exception**: CEO MAY write to `Harness/tasks/auto/PROGRESS.md` and `Harness/tasks/auto/PLAN.md` — these are task-tracking artifacts.
446
+ CEO tool boundaries follow [WF-KERNEL.md](WF-KERNEL.md) State Ownership: CEO plans, dispatches, synthesizes, and writes ONLY the auto task capsule (`Harness/tasks/auto/PROGRESS.md`, `Harness/tasks/auto/PLAN.md`). CEO never writes production source code — all implementation is delegated to Workers.
507
447
 
508
448
  ## Anti-Pattern Catalog
509
449
 
510
- | # | Anti-Pattern | Symptom | Fix |
511
- |---|-------------|---------|-----|
512
- | AP1 | **CEO-as-Worker** | CEO writes production code | Delegate ALL implementation to Workers |
513
- | AP2 | **Premature stop** | CEO decides "good enough" before A-GATE | A-GATE is the ONLY stop. No exceptions. |
514
- | AP3 | **Shallow angle scan** | Angle returns "exhausted" after scanning 1-2 files | Require ≥80% surface coverage per angle |
515
- | AP4 | **Batch implementation** | Multiple unrelated changes in one cycle | ONE finding per cycle. Split if needed. |
516
- | AP5 | **Sequential angle scan** | Angles dispatched one at a time | ALL 8 angles in ONE message, every cycle |
517
- | AP6 | **Skip review** | Implementation → verify without review | Review gate is mandatory, every cycle |
518
- | AP7 | **Scope creep** | A "simple fix" grows to 5+ files | Hard cap: ≤3 files per cycle. Split larger changes across cycles. |
519
- | AP8 | **False exhaustion** | Angle returns exhausted=true with low confidence | Require confidence ≥0.8 on exhausted. Re-dispatch low-confidence angles. |
520
- | AP9 | **Stale angle agents** | Same scan strategy every cycle → blind spots emerge | Vary scan depth and scope between cycles |
521
- | AP10 | **Skip oracle** | All 8 exhausted → CEO goes straight to confirm rounds without consulting other CLI | Oracle is mandatory at Tier 1.5. If CLI unavailable, record it and proceed — but never skip because "it's probably fine." |
522
- | AP11 | **Spark as escape hatch** | Using spark to avoid the discipline of internal scan | Spark activates ONLY when internal + oracle are empty. It augments W0, not replaces it. |
523
- | AP12 | **Fake value scoring** | Inflating Value Gate scores to pass candidates through | CEO must justify each dimension score. Reviewer checks Value Gate scores as part of spec review. |
524
- | AP13 | **Shiny object syndrome** | Implementing every spark candidate without Value Gate filtering | All spark candidates MUST pass the Value Gate (≥18/25, no dimension <3). |
525
- | AP14 | **Inspiration theater** | Spark cycles without evidence ledger → no way to know if they worked | Evidence ledger is mandatory per cycle. Weak spark count tracked. |
526
- | AP15 | **Interrogation checkpoint** | Asking 5+ aggressive questions → user tunes out | Exactly 2 questions: "Still aligned?" + "What should change?" |
450
+ Core anti-patterns AP1 (CEO-as-Worker), AP4 (batch implementation), AP6 (skip review), AP7 (scope creep) are covered by [WF-KERNEL.md](WF-KERNEL.md) State Ownership and Tier-Aware Acceptance Gates.
451
+
452
+ WF-AUTO-specific anti-patterns:
527
453
 
528
454
  ## Safety Controls
529
455
 
@@ -539,7 +465,7 @@ Before W2, CEO checks: does this change delete functionality, change public API,
539
465
 
540
466
  ### Idle Detection
541
467
  - If 5 consecutive cycles produce 0-line changes (all findings rejected at review), trigger IDLE alarm
542
- - IDLE → CEO re-evaluates: are angle agents scoped too narrowly? Is the codebase actually done?
468
+ - IDLE → CEO re-evaluates: are probes scoped too narrowly? Are obligations missing? Is the codebase actually done?
543
469
  - After IDLE alarm + re-scope + 2 more empty cycles → consider A-GATE
544
470
 
545
471
  ### User Interrupt
@@ -552,7 +478,7 @@ Before W2, CEO checks: does this change delete functionality, change public API,
552
478
  - Explicit user task with defined completion criteria → use `/wf` or `/wf-max`
553
479
  - Single known bug → just fix it directly
554
480
  - User wants to review every change before it's made → /wf-auto is autonomous by design
555
- - Codebase is <100 lines → angle scan overhead > benefit
481
+ - Codebase is <100 lines → adaptive scan overhead > benefit
556
482
  - Production hotfix needed urgently → direct fix, not optimization loop
557
483
 
558
484
  ## /wf vs /wf-max vs /wf-auto
@@ -563,14 +489,14 @@ Mini PRD-derived AC IDs in `/wf-auto`.
563
489
  | Dimension | /wf | /wf-max | /wf-auto |
564
490
  |-----------|-----|---------|----------|
565
491
  | Scope | Task-bounded | Task-bounded | Unbounded |
566
- | Stop condition | Task complete | Task complete | 8-angle exhaustion + oracle + spark exhausted + 2 confirm rounds |
492
+ | Stop condition | Task complete | Task complete | Dynamic obligations covered + two different empty confirmation passes |
567
493
  | Direction | User-specified | User-specified | AI-inferred + cross-model oracle + external spark |
568
- | Organization | Flat (CEO + agents) | 3-tier (CEO→Mgr→Worker) | Flat (CEO + angle agents + oracle + spark searchers + build agents) |
494
+ | Organization | Flat (CEO + agents) | 3-tier (CEO→Mgr→Worker) | Flat (CEO + selected probes + oracle + spark searchers + build agents) |
569
495
  | Duration | One task | One task | Perpetual |
570
496
  | User interaction | At key gates | At key gates | Adaptive checkpoint (2→5→10 cycles), 2 questions only |
571
497
  | Cycle count | 1 | 1 (multi-wave) | ∞ (until exhaustion) |
572
498
  | Files/cycle | Per task | Per wave (many) | ≤3 per cycle |
573
- | Exploration | 3-5 agents once | 5-10 agents once | 8 angles + oracle + 8 spark sources EVERY cycle |
499
+ | Exploration | 3-5 agents once | 5-10 agents once | Dynamic probes + triggered spark sources per cycle |
574
500
  | Cross-model check | No (wf-review is separate) | No (wf-review is separate) | Yes — Cross-Model Oracle built into A-GATE Tier 1.5 |
575
501
  | External inspiration | No | No | Yes — Spark candidate provider when internal sources empty |
576
502
  | Evidence tracking | Per task | Per task | Evidence ledger per cycle with measured impact |
@@ -588,7 +514,7 @@ Unlike normal task capsules, this one is never archived — it's the permanent h
588
514
 
589
515
  Closeout happens exactly once, when A-GATE passes permanently:
590
516
 
591
- 1. CEO records final exhaustion evidence from all 8 angles (3 consecutive rounds)
517
+ 1. CEO records final exhaustion evidence: dynamic obligations, selected and skipped probes, coverage, confidence, and two different confirmation strategies
592
518
  2. CEO writes summary: total cycles, files changed, findings addressed, findings rejected, residual risk
593
519
  3. CEO marks `Harness/tasks/auto/PROGRESS.md` as "WF-AUTO EXHAUSTED" with timestamp
594
520
  4. `Harness/PROGRESS.md` is updated with the auto session outcome
@@ -0,0 +1,189 @@
1
+ # WF Kernel — Shared Orchestration Engine
2
+
3
+ The WF Kernel is the shared engine for `/wf`, `/wf-max`, `/wf-auto`, `/wf-auto-spark`, `/wf-review`, and `/wf-browser`. Variants extend the kernel; they do not duplicate the orchestration logic.
4
+
5
+ ## Role / Model Matrix
6
+
7
+ The orchestrator dispatches agents by role, model tier, and task type. No single agent type handles all work.
8
+
9
+ ### Small-Fast (haiku)
10
+
11
+ Chore and scoped read-only work. Dispatch early and often.
12
+
13
+ | Agent | Writes | Purpose |
14
+ |---|---|---|
15
+ | `task-scribe` | Task state only | Heartbeat, dispatch ledger, evidence pointers, compact PLAN/PROGRESS updates |
16
+ | `codebase-explorer` | None | Scoped read-only source exploration, file discovery, symbol tracing |
17
+ | `context-master` | Heartbeat compression line only | Context analysis, compression suggestions |
18
+
19
+ ### Standard (sonnet)
20
+
21
+ Most decision-bound and implementation work.
22
+
23
+ | Agent | Writes | Purpose |
24
+ |---|---|---|
25
+ | `planner` | None (returns PLAN patch) | Task decomposition, dependencies, writeSet, verification commands |
26
+ | `researcher` | None (returns research patch) | Product, market, dependency, ecosystem research |
27
+ | `docs-researcher` | None | Official docs, API, SDK, version, limits |
28
+ | `architect` | None (returns architecture patch) | Boundaries, ports, data flow, state impact, migration risks |
29
+ | `test-writer` / `tdd-guide` | Tests/plan only | AC-linked failing tests, manual verification plans |
30
+ | `implementer` | Assigned writeSet only | Minimal production code changes |
31
+ | `debugger` | Smallest fix path | Root-cause isolation and fix |
32
+ | `verifier` | None | Command execution, AC evidence, validation matrix |
33
+ | `reviewer` | None | Spec/code/security/architecture/test review findings |
34
+ | `reflector` | None | Closeout synthesis, PASS/RETURN_TO_DEBUG/BLOCKED verdict |
35
+ | `memory-master` | Memory files + MEMORY.md index | Durable memory write, dedup, consolidation |
36
+
37
+ ### High-Reasoning (opus)
38
+
39
+ Reserved for architecture conflicts, security/data-loss risk, multi-layer ambiguity, or user explicitly requests.
40
+
41
+ ### WF-MAX Managers (sonnet)
42
+
43
+ | Manager | Spawns | Purpose |
44
+ |---|---|---|
45
+ | `explore-manager` | 5-10 read-only researchers/explorers | W0 exploration fan-out |
46
+ | `architect-manager` | 3 architects | W1 boundary/interface contracts |
47
+ | `implement-manager` | 5-7 implementers (one file_claim each) | W2 parallel implementation |
48
+ | `review-manager` | 3-4 reviewers (spec/code/security/perf) | W2R review fan-out |
49
+
50
+ ## Dynamic Ready-Queue Orchestration
51
+
52
+ `/wf` is NOT a fixed serial pipeline. It uses a dependency-driven ready queue, persisted across sessions via [WF-STATE.md](WF-STATE.md).
53
+
54
+ ```text
55
+ while task not accepted:
56
+ update readyQueue from dependency graph
57
+
58
+ // Phase-independent: dispatch anything ready
59
+ dispatch all ready read-only agents in parallel
60
+ (codebase-explorer, docs-researcher, researcher, planner, architect)
61
+ dispatch task-scribe to maintain state alongside any work
62
+
63
+ // Write gate: only when AC + contracts + test plan exist
64
+ for each independent writeSet:
65
+ dispatch implementer (one file_claim each)
66
+ wait for wave complete
67
+ dispatch verifier on completed wave
68
+
69
+ // Review gate: wave-level, not end-of-task
70
+ when verifier evidence exists for a wave:
71
+ dispatch reviewer(s) on that wave
72
+
73
+ // Fix gate: on-demand only
74
+ if review finding or failed AC:
75
+ dispatch debugger or implementer (smallest fix)
76
+ re-run verifier on the fixed wave
77
+
78
+ // Reflect gate: WF-Full only, or risk-triggered
79
+ if WF-Full or unresolved contradiction or high-risk behavior:
80
+ dispatch reflector before final acceptance
81
+
82
+ // Closeout
83
+ task-scribe records final state
84
+ if durable lesson found:
85
+ dispatch context-master -> memory-master
86
+
87
+ stop on: accepted | blocked | user decision required
88
+ ```
89
+
90
+ ### Concurrency Rules
91
+
92
+ 1. Read-only agents always run in parallel (different readSets = no conflict).
93
+ 2. `task-scribe` runs alongside any wave — task state is its own writeSet, disjoint from source.
94
+ 3. Write agents serial within wave; parallel across waves only when writeSets are disjoint.
95
+ 4. `verifier` launches per-wave as soon as that wave's write agents complete.
96
+ 5. `reviewer` launches per-wave when verifier evidence is ready.
97
+ 6. `debugger` launches on-demand when a specific AC or review finding fails.
98
+ 7. `reflector` launches only in WF-Full, or when risk/contradiction is detected.
99
+ 8. Idle capacity is immediately filled with the next ready item from the queue.
100
+
101
+ ## Dispatch Packet (Extended)
102
+
103
+ Every dispatch MUST carry:
104
+
105
+ ```text
106
+ Role:
107
+ Objective:
108
+ TaskType: ui-browser | api-backend | architecture-migration | docs-readme | dependency-sdk | bug-fix | refactor | chore
109
+ ModelTier: small-fast | standard | high-reasoning
110
+ AgentName:
111
+ Skills: list or none
112
+ ReadSet:
113
+ WriteSet:
114
+ Forbidden:
115
+ AC IDs:
116
+ MaxReturnTokens:
117
+ ReturnSchema:
118
+ ```
119
+
120
+ ## Task Type → Agent/Skill Routing
121
+
122
+ | Task Type | Primary Agents | Skills |
123
+ |---|---|---|
124
+ | UI/browser behavior | test-writer, implementer, verifier, reviewer | browser-e2e, wf-browser |
125
+ | API/backend | docs-researcher, test-writer, implementer, verifier, reviewer (security) | tdd |
126
+ | Architecture/migration | architect, codebase-explorer, planner, reviewer | — |
127
+ | Docs/README | wf-readme, reviewer, task-scribe | wf-readme |
128
+ | Dependency/SDK/API upgrade | docs-researcher, researcher, implementer | — |
129
+ | Bug/failing test | debugger, verifier, implementer, reviewer | tdd |
130
+ | Large refactor | planner, architect, codebase-explorer fan-out, implement-manager, review-manager | — |
131
+ | Task state/log/evidence only | task-scribe (haiku) | — |
132
+ | Source discovery/tracing | codebase-explorer (haiku) fan-out | — |
133
+
134
+ ## Tier-Aware Acceptance Gates
135
+
136
+ Acceptance is tier-dependent. No single gate covers all tiers.
137
+
138
+ ### WF-Light
139
+
140
+ 1-2 files, well-understood, low risk.
141
+ - planner + test-writer + implementer + verifier
142
+ - Task-scribe maintains state throughout
143
+ - Codebase-explorer optional
144
+ - **Acceptance**: verification passes + task state recorded = closeout
145
+ - Cross-review and reflector are NOT mandatory
146
+ - Heartbeat: phase boundaries, failure, closeout
147
+
148
+ ### WF-Standard
149
+
150
+ Multi-file or behavior change.
151
+ - WF-Light baseline + research/docs + at least one independent review lens
152
+ - Parallel: codebase-explorer(s), docs-researcher/researcher, planner, task-scribe
153
+ - **Acceptance**: verifier evidence + one review PASS = closeout
154
+ - Reflector: triggered only by risk, contradiction, or high-impact behavior
155
+ - Heartbeat: wave boundaries, failure, blocker, closeout
156
+
157
+ ### WF-Full
158
+
159
+ High-risk, cross-layer, security/data-loss, browser/API acceptance, ambiguous architecture.
160
+ - Full chain: planner + research/docs + architect + test-writer + implementer + verifier + multi-review + reflector
161
+ - **Acceptance**: cross-review PASS + reflector PASS
162
+ - Maximize parallel reads; serial writes only when writeSets overlap
163
+ - Heartbeat: wave boundaries, gate results, failure, blocker, closeout
164
+
165
+ ### WF-MAX
166
+
167
+ `/wf-max` = `/wf` kernel + maximum safe fan-out. It is NOT a separate workflow.
168
+
169
+ Delta from `/wf`:
170
+ - Tasks are decomposed into smallest safe write-units
171
+ - Each write-unit = one file_claim = one implementer Worker
172
+ - Managers coordinate per-domain fan-out (explore, architect, implement, review)
173
+ - CEO/controller never writes source; delegates all production edits to Workers
174
+ - WF-Max-Useful (default): fan-out only where writeSets are meaningfully independent
175
+ - WF-Max-Strict (explicit `--strict`): unconditional fan-out per span formula
176
+ - Disjoint writeSets → parallel; overlapping → serial wave or worktree isolation
177
+ - task-scribe continuously maintains dispatch ledger and heartbeat
178
+ - `idleWorker -> nextReady` queue: dispatch immediately when a slot opens
179
+ - Write workers return <=250 tokens + evidence/file paths
180
+
181
+ ## State Ownership
182
+
183
+ - **Controller (main agent or CEO)**: owns decisions, decomposition, synthesis, final verification, dispatch
184
+ - **task-scribe**: writes task state (PROGRESS, PLAN, ARTIFACTS, NOTES). Controller or CEO supplies structured updates; task-scribe formats and writes them.
185
+ - **Production source agents (implementer, debugger, test-writer)**: write ONLY their assigned writeSet. Never write task state.
186
+ - **Reviewer, verifier, reflector, architect, planner, researcher**: read-only. Return findings/patches to controller for synthesis.
187
+
188
+ Old rule: "Only main agent writes task PROGRESS/PLAN."
189
+ New rule: "Only controller or task-scribe writes task state. Production source agents never write task state unless explicitly dispatched as task-scribe."