create-harness-vibe-coding 0.8.8 → 0.8.10

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 (82) hide show
  1. package/README-CN.md +8 -2
  2. package/README.md +22 -3
  3. package/docs/images/harness-icon.png +0 -0
  4. package/package.json +3 -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 +9 -5
  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 +10 -6
  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 +26 -8
  22. package/templates/common/.claude/skills/wf-review/SKILL.md +63 -12
  23. package/templates/common/.claude/skills/wf-update/SKILL.md +15 -2
  24. package/templates/common/.codex/hooks.json +17 -0
  25. package/templates/common/.harness-version +93 -48
  26. package/templates/common/.opencode/agents/architect.md +24 -24
  27. package/templates/common/.opencode/agents/codebase-explorer.md +45 -0
  28. package/templates/common/.opencode/agents/docs-researcher.md +34 -34
  29. package/templates/common/.opencode/agents/memory-master.md +26 -8
  30. package/templates/common/.opencode/agents/reviewer.md +27 -27
  31. package/templates/common/.opencode/agents/task-scribe.md +70 -0
  32. package/templates/common/.opencode/commands/wf-auto-spark.md +15 -0
  33. package/templates/common/.opencode/commands/wf-auto.md +15 -0
  34. package/templates/common/.opencode/commands/wf-help.md +9 -5
  35. package/templates/common/.opencode/commands/wf-learn.md +15 -0
  36. package/templates/common/.opencode/commands/wf-max.md +15 -0
  37. package/templates/common/.opencode/commands/wf-readme.md +15 -0
  38. package/templates/common/.opencode/commands/wf-remove.md +15 -0
  39. package/templates/common/.opencode/commands/wf-review.md +15 -0
  40. package/templates/common/.opencode/commands/wf-update.md +24 -0
  41. package/templates/common/.opencode/commands/wf.md +15 -0
  42. package/templates/common/.opencode/plugins/harness-wf-status.mjs +126 -0
  43. package/templates/common/AGENTS.md +2 -29
  44. package/templates/common/CLAUDE.md +35 -6
  45. package/templates/common/Harness/ACCEPTANCE_PROTOCOL.md +2 -2
  46. package/templates/common/{MEMORY.md → Harness/MEMORY.md} +17 -4
  47. package/templates/common/Harness/MEMORY_PROTOCOL.md +80 -30
  48. package/templates/common/Harness/README.md +53 -25
  49. package/templates/common/{SETUP.md → Harness/SETUP.md} +278 -276
  50. package/templates/common/Harness/TASK_ARCHIVE.md +56 -0
  51. package/templates/common/Harness/WF-AUTO-ANGLES.md +1 -1
  52. package/templates/common/Harness/WF-AUTO-SPARK.md +5 -14
  53. package/templates/common/Harness/WF-AUTO.md +22 -84
  54. package/templates/common/Harness/WF-KERNEL.md +189 -0
  55. package/templates/common/Harness/WF-MAX.md +60 -328
  56. package/templates/common/Harness/WF-STATE.md +83 -0
  57. package/templates/common/Harness/WF.md +117 -237
  58. package/templates/common/Harness/agent-workflow.md +2 -2
  59. package/templates/common/Harness/context-loading.md +3 -3
  60. package/templates/common/Harness/dispatch.md +43 -35
  61. package/templates/common/Harness/scripts/archive-tasks.mjs +239 -0
  62. package/templates/common/{scripts → Harness/scripts}/scan-clean.mjs +29 -1
  63. package/templates/common/{scripts → Harness/scripts}/validate-harness.mjs +921 -699
  64. package/templates/common/Harness/scripts/wf-auto-update-prompt.mjs +258 -0
  65. package/templates/common/{scripts → Harness/scripts}/wf-remove.mjs +1 -0
  66. package/templates/common/{scripts → Harness/scripts}/wf-update-check.mjs +163 -52
  67. package/templates/common/Harness/subagents.md +36 -28
  68. package/templates/common/Harness/tasks/_template/PLAN.md +5 -0
  69. package/templates/common/Harness/tasks/_template/STATE.json +23 -0
  70. package/templates/common/README.md +2 -2
  71. package/templates/common/memory/agent-lessons-patterns.md +9 -8
  72. package/templates/common/memory/routes.md +43 -0
  73. package/templates/common/memory/startup-hints.md +32 -0
  74. package/templates/common/memory/tool-usage-reflections.md +9 -8
  75. package/templates/common/memory/user-corrections-preferences.md +11 -9
  76. package/templates/optional/catalog.json +8 -0
  77. package/templates/optional/skills/browser-e2e/.claude/skills/browser-e2e/SKILL.md +42 -42
  78. package/templates/optional/skills/browser-e2e/.opencode/commands/wf-browser.md +15 -0
  79. package/templates/optional/skills/github-pr-review/.claude/skills/github-pr-review/SKILL.md +40 -40
  80. package/templates/optional/skills/python-backend/.claude/skills/python-backend/SKILL.md +40 -40
  81. package/templates/optional/skills/ts-react-frontend/.claude/skills/ts-react-frontend/SKILL.md +43 -43
  82. package/templates/optional/skills/ui-ux-review/.claude/skills/ui-ux-review/SKILL.md +40 -40
@@ -0,0 +1,56 @@
1
+ # TASK_ARCHIVE — Task Archive Mechanism
2
+
3
+ Purpose: keep `Harness/tasks/` lean by archiving completed/abandoned tasks while preserving all evidence.
4
+
5
+ ## Archive Location
6
+
7
+ Active tasks stay in `Harness/tasks/<task-id>/`.
8
+ Archived tasks move to `Harness/tasks/_archive/YYYY/<task-id>/`.
9
+
10
+ ## What Is Never Archived
11
+
12
+ - `Harness/tasks/_template/` — scaffold template, never moved.
13
+ - `Harness/tasks/auto/` — WF-AUTO permanent state capsule, never moved unless explicitly allowed by WF-AUTO docs.
14
+ - `Harness/tasks/_archive/` — the archive directory itself.
15
+ - Active, blocked, in-progress, or needs-user-decision tasks.
16
+ - Tasks whose STATE.json status is `active`, `blocked`, `in_progress`, `running`, `pending`, or `needs-user-decision`.
17
+
18
+ ## What May Be Archived
19
+
20
+ Tasks whose STATE.json or PROGRESS.md status is: `complete`, `verified`, `archived`, `abandoned`, `obsolete`, `done`, `closed`, or `closeout`.
21
+
22
+ The script reads STATE.json `status`/`phase` first, then falls back to the first `- Phase:`, `Phase:`, or `Current:` marker in the task's PROGRESS.md (first word wins). Ambiguous phases are never auto-archived.
23
+
24
+ ## Archive Process
25
+
26
+ 1. Verify the task is not active/blocked.
27
+ 2. Ensure `Harness/tasks/_archive/YYYY/` exists.
28
+ 3. Move `Harness/tasks/<task-id>/` → `Harness/tasks/_archive/YYYY/<task-id>/`.
29
+ 4. Update the moved STATE.json: `status` → `archived`, `phase` → `archived`.
30
+ 5. Update `Harness/tasks/_archive/INDEX.md`.
31
+ 6. Update `Harness/PROGRESS.md` Task Index — remove or annotate `(archived)`.
32
+
33
+ ## Retention
34
+
35
+ - Archived tasks retain: PLAN, PROGRESS, STATE, ARTIFACTS, NOTES.
36
+ - Do NOT delete historical evidence.
37
+ - `Harness/PROGRESS.md` keeps the last 5 non-archived task entries in the Task Index.
38
+ - When outer task capsules exceed 5 completed/abandoned/obsolete, archive the oldest.
39
+ - The validator (`Harness/scripts/validate-harness.mjs`) warns when `Harness/tasks/` holds more than 5 outer task capsules (excluding `_archive`, `_template`, `auto`) and fails in `--strict` mode.
40
+
41
+ ## Script
42
+
43
+ Use `Harness/scripts/archive-tasks.mjs`:
44
+ - Default: dry-run
45
+ - `--apply` to execute
46
+ - `--keep 5` to set the non-archived task threshold
47
+ - `--task <task-id>` to archive a specific task
48
+ - `--json` for machine-readable output
49
+ - `node Harness/scripts/archive-tasks.mjs --dry-run --json` must always run
50
+
51
+ ## Safety Rules
52
+
53
+ - Windows path safe. Use `path.resolve()` before moving.
54
+ - Confirm target is within `Harness/tasks/` before any move.
55
+ - Do NOT recursively delete.
56
+ - Tasks with `needs-user-decision` status are never auto-archived.
@@ -132,7 +132,7 @@ The A-GATE is evidence-based:
132
132
  5. the CEO records unresolved uncertainty, skipped probes, and why oracle or
133
133
  spark search was or was not needed.
134
134
 
135
- The cross-model oracle is triggered by unresolved high-risk uncertainty or a
135
+ The peer-review oracle is triggered by unresolved high-risk uncertainty or a
136
136
  borderline exhaustion result. Spark search is triggered by a genuine value gap,
137
137
  not merely because a catalog was empty. This prevents both premature stopping
138
138
  and pointless full-tree scanning.
@@ -4,10 +4,12 @@
4
4
 
5
5
  ## Trigger
6
6
 
7
- - User explicitly invokes `/wf-auto-spark` or `$wf-auto-spark`
7
+ - User explicitly invokes `/wf-auto-spark`, `$wf-auto-spark`, or `/skills wf-auto-spark`
8
8
  - Auto-degrade from `/wf-auto` when user can't clarify direction at Re-Anchor Gate
9
9
  - Auto-activate when adaptive internal coverage returns empty for 3+ consecutive cycles AND oracle also empty
10
10
 
11
+ Note: Natural-language phrases like "spark mode", "external inspiration", "discover mode", "never stop" are NOT triggers — only explicit command tokens or documented auto-degrade/auto-activate paths from inside WF-AUTO enter WF-AUTO-SPARK.
12
+
11
13
  ## Core Philosophy
12
14
 
13
15
  **"Inspiration never runs dry, but direction must hold."**
@@ -18,20 +20,9 @@ But perpetual search without direction = drift. The **Roadmap** is the anchor.
18
20
 
19
21
  ## Inherited Execution Chain
20
22
 
21
- WF-AUTO-SPARK inherits WF-AUTO and WF constraints. External spark search replaces discovery only; it does not replace acceptance, implementation, review, verification, reflection, or evidence.
22
-
23
- Every accepted spark candidate must re-enter the same per-cycle chain:
24
-
25
- ```text
26
- spark search -> Value Gate -> deviation check -> Mini PRD -> AC IDs
27
- -> test/validation plan -> implementer -> verifier -> cross-review
28
- -> reflector PASS -> evidence ledger -> next spark cycle
29
- ```
23
+ WF-AUTO-SPARK is a `/wf` variant layered on WF-AUTO: it inherits the WF-KERNEL contract via WF-AUTO and WF constraints, and does not define an independent heavy process. External spark search replaces discovery only; it does not replace acceptance, implementation, review, verification, reflection, or evidence.
30
24
 
31
- Spark searchers are read-only. Any implementation must use the dispatch packet
32
- from `Harness/dispatch.md` with explicit write set, forbidden truth files, AC
33
- IDs, and verification commands. A candidate with no verifier evidence or no
34
- reflector PASS is not accepted, even if the idea is valuable.
25
+ Accepted spark candidates re-enter the standard W2-W5 gates per [WF-KERNEL.md](WF-KERNEL.md): implementer (one file_claim, ≤3 files, ≤50 lines), verifier, reviewer(s), reflector. Spark searchers are read-only. Any implementation must use the dispatch packet from `Harness/dispatch.md` with explicit write set, forbidden truth files, AC IDs, and verification commands. A candidate with no verifier evidence or no reflector PASS is not accepted, even if the idea is valuable.
35
26
 
36
27
  ## Startup: Roadmap Declaration
37
28
 
@@ -2,9 +2,9 @@
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
 
@@ -12,7 +12,7 @@
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,7 +39,7 @@ 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
 
@@ -205,7 +205,7 @@ TIER 2 — Did any selected probe find an actionable direction?
205
205
  └── NO → Run a confirmation pass with a different scan strategy.
206
206
 
207
207
  TIER 3 — Is uncertainty still high or coverage borderline?
208
- ├── YES → Re-run only the uncertain probe, or invoke the cross-model oracle.
208
+ ├── YES → Re-run only the uncertain probe, or invoke the peer-review oracle.
209
209
  └── NO → Record an empty confirmation pass.
210
210
 
211
211
  TIER 4 — Two different confirmation strategies are empty?
@@ -215,9 +215,10 @@ TIER 4 — Two different confirmation strategies are empty?
215
215
 
216
216
  **Oracle Rules (modeled on /wf-review):**
217
217
 
218
- - [ ] CEO detects which CLI is running: `which codex` / `which claude`
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
218
+ - [ ] CEO detects available peer CLIs: `claude`, `codex`, and `opencode`
219
+ - [ ] CEO invokes a peer CLI only when unresolved high-risk uncertainty or borderline coverage justifies it
220
+ - [ ] If no peer CLI is available, dispatch the installed `reviewer` role as an independent subagent context
221
+ - [ ] If neither peer CLI nor subagent surface is available, record "oracle unavailable" in PROGRESS.md and continue with local confirmation
221
222
  - [ ] Oracle is invoked at most once per adaptive exhaustion event
222
223
  - [ ] Oracle findings are treated as severity=high by default (external model perspective gets extra weight)
223
224
 
@@ -260,53 +261,13 @@ Before W2, CEO writes a cycle Mini PRD:
260
261
  - UI/API/state contracts, if touched
261
262
  - Verification commands and evidence expected
262
263
 
263
- ### W2: IMPLEMENT
264
+ ### W2-W5: IMPLEMENT → REVIEW → DEBUG → VERIFY
264
265
 
265
- Modeled on WF's build loop but scoped to ONE change:
266
+ WF-AUTO inherits the standard WF-KERNEL write/review/fix/verify gates per cycle. Each accepted finding follows:
266
267
 
267
- 1. CEO writes the change spec in `Harness/tasks/auto/PROGRESS.md` (cycle number, angle, finding, planned change, write set ≤3 files)
268
- 2. CEO dispatches `implementer` with the change spec
269
- 3. Implementer changes ONLY the declared write set
268
+ [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).
270
269
 
271
- CEO NEVER writes production code this rule is inherited from WF-MAX (AP1: CEO-as-Worker).
272
-
273
- Acceptance-specific implementation rules:
274
-
275
- - Dispatch `test-writer` when AC IDs need new or updated tests.
276
- - Dispatch `implementer` with forbidden truth files: PRD, AC, UI/API contracts, test plan, and validation report.
277
- - Implementer may not rewrite ACs/contracts to make the implementation pass.
278
-
279
- ### W3: REVIEW
280
-
281
- Two-gate review (from WF/subagents.md), then reflection:
282
-
283
- 1. **Spec review**: Did the change address the finding without introducing extras?
284
- 2. **Code-quality review**: Is the change correct, maintainable, safe?
285
- 3. **Reflector gate**: Does review evidence, verifier evidence, and residual
286
- risk support acceptance?
287
-
288
- At least one `reviewer` subagent. For critical/security findings, dispatch two independent reviewers.
289
- Do not record the cycle as accepted until `reflector` returns PASS.
290
-
291
- ### W4: DEBUG (Recovery)
292
-
293
- If review or verification fails:
294
- 1. `debugger` isolates the smallest failing path
295
- 2. Fix and re-review (max 2 attempts per cycle)
296
- 3. On 3rd failure: record the finding as "attempted, blocked" and move to next finding in W1
297
- 4. Blocked findings are revisited after 3 cycles (the codebase may have changed enough to unblock)
298
-
299
- ### W5: VERIFY
300
-
301
- - Run project test suite (or relevant subset)
302
- - For browser-visible changes: real browser check
303
- - For API changes: real request/response check
304
- - Record evidence in `Harness/tasks/auto/PROGRESS.md`
305
- - Final acceptance still requires cross-review and reflector PASS after
306
- verification. A passing command alone is not acceptance.
307
-
308
- Validation must include AC-by-AC evidence in `Harness/tasks/auto/PROGRESS.md`,
309
- not only a generic pass/fail command result.
270
+ CEO NEVER writes production code (per WF-KERNEL State Ownership). Implementer writes ONLY the declared write set. Production agents never write task state.
310
271
 
311
272
  ### RECORD
312
273
 
@@ -400,7 +361,7 @@ CEO presents:
400
361
 
401
362
  ### Spark: External Candidate Provider
402
363
 
403
- 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.
364
+ Spark is NOT a separate optimization engine. It is a **candidate provider** plugged into W0, alongside the adaptive probe scan and the peer-review oracle. W1 still owns prioritization across ALL sources.
404
365
 
405
366
  **When spark activates:**
406
367
  - W0 internal scan returns empty AND oracle also empty → `auto.spark` state
@@ -438,7 +399,7 @@ Spark is NOT a separate optimization engine. It is a **candidate provider** plug
438
399
 
439
400
  W1 prioritization now handles three source types:
440
401
  - `source=internal` — from adaptive probe scan
441
- - `source=oracle` — from cross-model review
402
+ - `source=oracle` — from peer CLI or reviewer-subagent review
442
403
  - `source=spark-<name>` — from external inspiration search
443
404
 
444
405
  Tie-breaking: internal > oracle > spark (local context beats external inspiration).
@@ -483,36 +444,13 @@ If a spark cycle's measured result is NEGLIGIBLE or REVERTED, increment `weakSpa
483
444
 
484
445
  ## CEO Constraints
485
446
 
486
- The CEO operates under the same strict tool boundary as WF-MAX:
487
-
488
- | CEO Has | CEO MUST NOT Use (on source code) |
489
- |---------|-----------------------------------|
490
- | Task (spawn agents) | Edit (on source files) |
491
- | Read (for scoping) | Write (on source files) |
492
- | Grep/Glob (for scoping) | MultiEdit (on source files) |
493
- | Write (to PROGRESS.md only) | Bash (except final verification) |
494
-
495
- **Exception**: CEO MAY write to `Harness/tasks/auto/PROGRESS.md` and `Harness/tasks/auto/PLAN.md` — these are task-tracking artifacts.
447
+ 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.
496
448
 
497
449
  ## Anti-Pattern Catalog
498
450
 
499
- | # | Anti-Pattern | Symptom | Fix |
500
- |---|-------------|---------|-----|
501
- | AP1 | **CEO-as-Worker** | CEO writes production code | Delegate ALL implementation to Workers |
502
- | AP2 | **Premature stop** | CEO decides "good enough" before A-GATE | A-GATE is the ONLY stop. No exceptions. |
503
- | AP3 | **Shallow probe scan** | Probe returns "exhausted" after scanning 1-2 files | Require ≥80% relevant-surface coverage and record the coverage basis |
504
- | AP4 | **Batch implementation** | Multiple unrelated changes in one cycle | ONE finding per cycle. Split if needed. |
505
- | AP5 | **Wasteful probe scan** | Every catalog item is dispatched every cycle | Select probes by risk, relevance, evidence gap, novelty, and scan cost |
506
- | AP6 | **Skip review** | Implementation → verify without review | Review gate is mandatory, every cycle |
507
- | AP7 | **Scope creep** | A "simple fix" grows to 5+ files | Hard cap: ≤3 files per cycle. Split larger changes across cycles. |
508
- | AP8 | **False exhaustion** | Probe returns exhausted=true with low confidence | Require confidence and coverage ≥0.8 on exhausted. Re-dispatch only the uncertain probe. |
509
- | AP9 | **Stale probe strategy** | Same scan strategy every cycle → blind spots emerge | Rotate breadth, depth, change-first, failure-first, and contract-first scans |
510
- | AP10 | **Unjustified oracle** | CEO invokes another CLI on every empty scan | Invoke the oracle only for unresolved high-risk uncertainty or borderline coverage |
511
- | 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. |
512
- | 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. |
513
- | 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). |
514
- | 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. |
515
- | AP15 | **Interrogation checkpoint** | Asking 5+ aggressive questions → user tunes out | Exactly 2 questions: "Still aligned?" + "What should change?" |
451
+ 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.
452
+
453
+ WF-AUTO-specific anti-patterns:
516
454
 
517
455
  ## Safety Controls
518
456
 
@@ -553,14 +491,14 @@ Mini PRD-derived AC IDs in `/wf-auto`.
553
491
  |-----------|-----|---------|----------|
554
492
  | Scope | Task-bounded | Task-bounded | Unbounded |
555
493
  | Stop condition | Task complete | Task complete | Dynamic obligations covered + two different empty confirmation passes |
556
- | Direction | User-specified | User-specified | AI-inferred + cross-model oracle + external spark |
494
+ | Direction | User-specified | User-specified | AI-inferred + peer-review oracle + external spark |
557
495
  | Organization | Flat (CEO + agents) | 3-tier (CEO→Mgr→Worker) | Flat (CEO + selected probes + oracle + spark searchers + build agents) |
558
496
  | Duration | One task | One task | Perpetual |
559
497
  | User interaction | At key gates | At key gates | Adaptive checkpoint (2→5→10 cycles), 2 questions only |
560
498
  | Cycle count | 1 | 1 (multi-wave) | ∞ (until exhaustion) |
561
499
  | Files/cycle | Per task | Per wave (many) | ≤3 per cycle |
562
500
  | Exploration | 3-5 agents once | 5-10 agents once | Dynamic probes + triggered spark sources per cycle |
563
- | Cross-model check | No (wf-review is separate) | No (wf-review is separate) | Yes — Cross-Model Oracle built into A-GATE Tier 1.5 |
501
+ | Peer review check | No (wf-review is separate) | No (wf-review is separate) | Yes — peer-review oracle built into A-GATE Tier 1.5 |
564
502
  | External inspiration | No | No | Yes — Spark candidate provider when internal sources empty |
565
503
  | Evidence tracking | Per task | Per task | Evidence ledger per cycle with measured impact |
566
504
 
@@ -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."