create-harness-vibe-coding 0.7.2 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README-CN.md +91 -155
- package/README.md +200 -177
- package/bin/create-harness-vibe-coding.js +2 -2
- package/package.json +45 -43
- package/src/generator.js +115 -77
- package/src/index.js +159 -49
- package/src/prompts.js +95 -27
- package/templates/common/.claude/agents/architect-manager.md +45 -45
- package/templates/common/.claude/agents/context-master.md +77 -77
- package/templates/common/.claude/agents/debugger.md +41 -41
- package/templates/common/.claude/agents/explore-manager.md +41 -41
- package/templates/common/.claude/agents/implement-manager.md +49 -49
- package/templates/common/.claude/agents/implementer.md +40 -40
- package/templates/common/.claude/agents/memory-master.md +66 -66
- package/templates/common/.claude/agents/planner.md +34 -34
- package/templates/common/.claude/agents/researcher.md +41 -41
- package/templates/common/.claude/agents/review-manager.md +56 -56
- package/templates/common/.claude/agents/test-writer.md +38 -38
- package/templates/common/.claude/agents/verifier.md +32 -32
- package/templates/common/.claude/rules/ecc/common.md +45 -45
- package/templates/common/.claude/settings.json +68 -68
- package/templates/common/.claude/skills/subagent-orchestrator/SKILL.md +36 -31
- package/templates/common/.claude/skills/wf/SKILL.md +36 -0
- package/templates/common/.claude/skills/wf-learn/SKILL.md +13 -28
- package/templates/common/.claude/skills/wf-max/SKILL.md +24 -88
- package/templates/common/.claude/skills/wf-readme/SKILL.md +49 -49
- package/templates/common/.claude/skills/wf-remove/SKILL.md +17 -38
- package/templates/common/.claude/skills/wf-review/SKILL.md +19 -69
- package/templates/common/.claude/skills/wf-update/SKILL.md +19 -61
- package/templates/common/.codex/config.toml +2 -2
- package/templates/common/.codex/hooks.json +37 -37
- package/templates/common/.harness-version +53 -51
- package/templates/common/AGENTS.md +30 -30
- package/templates/common/CLAUDE.md +94 -94
- package/templates/common/{docs/harness → Harness}/PROGRESS.md +17 -17
- package/templates/common/{docs → Harness}/README.md +18 -17
- package/templates/common/{docs/harness → Harness}/WF-MAX.md +223 -223
- package/templates/common/Harness/WF.md +217 -0
- package/templates/common/{docs/harness → Harness}/architecture.md +126 -126
- package/templates/common/{docs/harness → Harness}/dispatch.md +99 -99
- package/templates/common/{docs → Harness}/research/research-results.md +66 -66
- package/templates/common/{docs/harness → Harness}/subagents.md +194 -194
- package/templates/common/{docs → Harness}/tasks/_template/ARTIFACTS.md +3 -3
- package/templates/common/{docs → Harness}/tasks/_template/NOTES.md +3 -3
- package/templates/common/{docs → Harness}/tasks/_template/PLAN.md +40 -40
- package/templates/common/{docs → Harness}/tasks/_template/PROGRESS.md +29 -29
- package/templates/common/MEMORY.md +68 -66
- package/templates/common/README.md +44 -37
- package/templates/common/SETUP.md +41 -34
- package/templates/common/memory/agent-lessons-patterns.md +21 -21
- package/templates/common/memory/tool-usage-reflections.md +21 -21
- package/templates/common/memory/user-corrections-preferences.md +21 -21
- package/templates/common/scripts/scan-clean.mjs +450 -449
- package/templates/common/scripts/validate-harness.mjs +56 -34
- package/templates/common/scripts/wf-mode-hook.mjs +318 -318
- package/templates/common/scripts/wf-remove.mjs +400 -384
- package/templates/common/scripts/wf-statusline.ps1 +38 -38
- package/templates/common/scripts/wf-statusline.sh +48 -48
- package/templates/common/scripts/wf-update-check.mjs +389 -389
- package/templates/optional/catalog.json +63 -29
- package/templates/optional/skills/browser-e2e/.claude/skills/wf-browser/SKILL.md +194 -194
- package/templates/optional/skills/browser-e2e/{docs → Harness}/workflows/browser-e2e.md +75 -75
- package/templates/optional/skills/github-pr-review/{docs → Harness}/workflows/github-pr-review.md +28 -28
- package/templates/optional/skills/python-backend/{docs → Harness}/workflows/python-backend.md +34 -34
- package/templates/optional/skills/ts-react-frontend/{docs → Harness}/workflows/ts-react-frontend.md +35 -35
- package/templates/optional/skills/ui-ux-review/{docs → Harness}/workflows/ui-ux-review.md +26 -26
- package/templates/common/.claude/commands/wf-learn.md +0 -17
- package/templates/common/.claude/commands/wf-max.md +0 -49
- package/templates/common/.claude/commands/wf-remove.md +0 -23
- package/templates/common/.claude/commands/wf-review.md +0 -25
- package/templates/common/.claude/commands/wf-update.md +0 -17
- package/templates/common/.claude/commands/wf.md +0 -31
- package/templates/common/commands/wf-max.toml +0 -18
- package/templates/common/commands/wf-review.toml +0 -15
- package/templates/common/docs/harness/WF.md +0 -174
- package/templates/optional/skills/browser-e2e/.claude/commands/wf-browser.md +0 -25
- /package/templates/common/{docs/harness → Harness}/agent-workflow.md +0 -0
- /package/templates/common/{docs/harness → Harness}/context-loading.md +0 -0
- /package/templates/common/{docs/harness → Harness}/extension.md +0 -0
- /package/templates/common/{docs/harness → Harness}/lifecycle.md +0 -0
- /package/templates/common/{docs → Harness}/research/PRD.md +0 -0
- /package/templates/common/{docs → Harness}/research/README.md +0 -0
|
@@ -1,223 +1,223 @@
|
|
|
1
|
-
# WF-MAX — Maximum Parallelism Workflow
|
|
2
|
-
|
|
3
|
-
## Trigger
|
|
4
|
-
|
|
5
|
-
- Explicit: `/wf-max [task]`
|
|
6
|
-
- Auto: WF task with write-set ≥5 files AND clear disjoint boundaries
|
|
7
|
-
- parallelismScore = (files × avgLines × 3 / 800) × independenceFactor
|
|
8
|
-
- spawn ≥2.0 | maybe 1.0-2.0 | skip <1.0 (degrade to /wf)
|
|
9
|
-
|
|
10
|
-
## Explicit Invocation Is an Absolute Fan-Out Mandate
|
|
11
|
-
|
|
12
|
-
When the user types `/wf-max` (or `wf max`), spawning subagents is **mandatory and unconditional**. File count, task size, line count, and overhead estimates DO NOT apply to explicit invocation — they govern ONLY auto-triggering (whether the harness enters wf-max on its own). A 1-file task invoked with `/wf-max` still fans out to parallel subagents.
|
|
13
|
-
|
|
14
|
-
"Degrade to /wf" changes the **organization** (flat vs CEO→Manager→Worker), never the **fact** of fan-out: `/wf` itself requires ≥3 subagents before second planning. There is no path from an explicitly typed command to a solo main-thread pass. If you find yourself reading source files and editing them directly after the user typed `/wf-max`, you have violated this mandate — stop and dispatch.
|
|
15
|
-
|
|
16
|
-
## Companion Docs
|
|
17
|
-
|
|
18
|
-
- [subagents.md](subagents.md) — agent roster, controller role, efficiency ladder
|
|
19
|
-
- [dispatch.md](dispatch.md) — handoff format, File claim, Concurrency group fields
|
|
20
|
-
- [agent-workflow.md](agent-workflow.md) — build/test/review loop, cohesion rule, completion gate
|
|
21
|
-
|
|
22
|
-
## Organization Model
|
|
23
|
-
|
|
24
|
-
```
|
|
25
|
-
CEO(1) ──┬── Manager₁(span) ──┬── Worker₁..ₙ
|
|
26
|
-
│ └── Sub-Manager(span) → Worker₁..ₙ [depth ≥3]
|
|
27
|
-
└── Manager₂(span) ── Worker₁..ₙ
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
- CEO: intent, scope, integration, final verification. Direct reports 3-5 Managers. **CEO never writes code directly** — dispatch Workers for all file changes. CEO only synthesizes results and decides next waves.
|
|
31
|
-
- Manager: domain partition → parallel dispatch → synthesize → report. Serial across domains; parallel within domain. **Manager agents must be defined by the project** (not shipped by the harness) — create them under `.claude/agents/` with the `Agent` tool enabled for nested spawning.
|
|
32
|
-
- Worker: single file per write Worker (implementer, one file_claim). Single dimension/topic per read Worker (reviewer, researcher). File claims must be file-level disjoint. Topic-level splitting within a single file is only allowed for read-only Workers.
|
|
33
|
-
- depth ≥3: Manager spawns Sub-Manager (span ≤7) instead of Worker. Recursive until leaf condition met.
|
|
34
|
-
|
|
35
|
-
## Decomposition Gate (MANDATORY — CEO-level, before ANY Worker dispatch)
|
|
36
|
-
|
|
37
|
-
The Decomposition Gate is a hard stop. No code changes, no Worker spawns until the gate passes. The CEO MUST produce a Dispatch Table artifact and pass the Self-Audit Checklist. This is the single most important enforcement mechanism in WF-MAX — it exists because **models default to "do it myself" rather than "decompose and delegate."**
|
|
38
|
-
|
|
39
|
-
### Gate Artifact: Dispatch Table
|
|
40
|
-
|
|
41
|
-
CEO MUST write this table in the task PLAN.md after W1 architecture defines the write-set and before W2 implementation dispatch:
|
|
42
|
-
|
|
43
|
-
```
|
|
44
|
-
| File | Concern | Worker Type | Worker Label | Read-Only? |
|
|
45
|
-
|------|---------|------------|--------------|------------|
|
|
46
|
-
| src/a.ts | Auth middleware | implementer | impl-auth | No |
|
|
47
|
-
| src/b.ts | DB schema | implementer | impl-db | No |
|
|
48
|
-
| docs/arch.md | Research existing patterns | researcher | res-arch | Yes |
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
### Gate Rules (any violation = gate fail, retry)
|
|
52
|
-
|
|
53
|
-
1. **Every file in the write-set MUST have exactly one write Worker.** Unassigned files = fail. This is the anti-bundling rule — one Worker touching >1 write file = fail. (Read Workers may span multiple files.)
|
|
54
|
-
2. **Manager count MUST ≥ span_min = ceil(sqrt(write_files) / 3).** This is the anti-under-decomposition rule at the domain level. Fewer than the minimum number of Managers means domains are too coarse. "One Manager can handle everything" is NOT valid in WF-MAX — if the task were that simple, degrade to /wf.
|
|
55
|
-
3. **Each Manager MUST have ≥2 Workers and ≤7 Workers.** 0-1 Workers = Phantom Manager → dissolve. >7 Workers → Manager context is overloaded → split the domain and add a Manager.
|
|
56
|
-
4. **CEO MUST NOT appear as a Worker row.** CEO writes no production code — fail.
|
|
57
|
-
|
|
58
|
-
### CEO Tool Boundary
|
|
59
|
-
|
|
60
|
-
The CEO operates under a strict tool restriction model for production code:
|
|
61
|
-
|
|
62
|
-
| CEO Has | CEO MUST NOT Use (on source code) |
|
|
63
|
-
|---------|-----------------------------------|
|
|
64
|
-
| Task (spawn agents) | Edit (on source files) |
|
|
65
|
-
| Read (for scoping) | Write (on source files) |
|
|
66
|
-
| TodoWrite (tracking) | Bash (except final verification) |
|
|
67
|
-
| Grep/Glob (for scoping) | MultiEdit (on source files) |
|
|
68
|
-
|
|
69
|
-
**Exception**: CEO MAY write to `Harness/tasks/<id>/PLAN.md` and `Harness/tasks/<id>/PROGRESS.md` — these are task-tracking artifacts, not production code. The Dispatch Table, Self-Audit Checklist, and synthesis reports are the CEO's primary durable artifacts.
|
|
70
|
-
|
|
71
|
-
If the CEO finds itself reaching for Edit/Write/Bash on source files, it is violating role boundaries. Stop. Delegate to a Worker.
|
|
72
|
-
|
|
73
|
-
### Self-Audit Checklist
|
|
74
|
-
|
|
75
|
-
After producing the Dispatch Table, CEO MUST answer all before proceeding:
|
|
76
|
-
|
|
77
|
-
- [ ] Did I assign myself any source file? (must be **No** — PLAN.md/PROGRESS.md writes are the exception)
|
|
78
|
-
- [ ] Is every file with planned changes assigned to exactly one write Worker? (must be **Yes**)
|
|
79
|
-
- [ ] Does any Worker have >1 write file? (must be **No**)
|
|
80
|
-
- [ ] Is Manager count ≥ ceil(sqrt(write_files) / 3)? (must be **Yes**, or justification written)
|
|
81
|
-
- [ ] Does every Manager have 2-7 Workers? (<2 = Phantom Manager, >7 = overloaded)
|
|
82
|
-
- [ ] Are there files >200 lines or with >1 concern that should be split into separate files?
|
|
83
|
-
- [ ] Could any serial chain be parallelized? (different files with no shared imports = parallelize)
|
|
84
|
-
- [ ] Will all Workers be spawned in ONE message?
|
|
85
|
-
|
|
86
|
-
Gate retries until all checks pass. **CEO may NOT proceed to W1 with a failing gate.**
|
|
87
|
-
|
|
88
|
-
## Anti-Pattern Catalog
|
|
89
|
-
|
|
90
|
-
Before every wave dispatch, CEO MUST scan for these patterns. **Any match = stop and re-decompose.**
|
|
91
|
-
|
|
92
|
-
| # | Anti-Pattern | Symptom | Detection | Fix |
|
|
93
|
-
|---|-------------|---------|-----------|-----|
|
|
94
|
-
| AP1 | **CEO-as-Worker** | CEO assigns itself a file or starts writing code | CEO in Dispatch Table; Edit/Write/Bash used by CEO | Re-delegate to a Worker immediately |
|
|
95
|
-
| AP2 | **Under-decomposition** | Fewer Workers than `ceil(sqrt(files))` | Count check fails; "1-2 agents is enough for this" | Split files by concern, module, or layer |
|
|
96
|
-
| AP3 | **Serialization trap** | "Let me do X first, then I'll know how to dispatch Y" | Sequential plan without parallel candidates | Dispatch X and Y in parallel NOW; Worker-X returns spec that Worker-Y consumes |
|
|
97
|
-
| AP4 | **Fake parallelism** | Multiple Workers assigned same file | Duplicate file path in Dispatch Table | One file = one Writer. Split file into separate modules, or serialize |
|
|
98
|
-
| AP5 | **Phantom Manager** | Manager spawns 0-1 Workers | Manager's sub-table has <2 Workers | Dissolve Manager; CEO or sibling absorbs domain |
|
|
99
|
-
| AP6 | **Sequential spawn** | Workers spawned one-per-turn instead of batched | Only 1 Task() call per message | Batch ALL Task() calls into ONE message |
|
|
100
|
-
| AP7 | **Silent degrade** | CEO switches to /wf without recording reason | No Dispatch Table; flat agent spawns | Explicit decision + justification in PLAN.md; only valid reason is overhead > 0.30 |
|
|
101
|
-
|
|
102
|
-
## Span Formula (Prescriptive Floor)
|
|
103
|
-
|
|
104
|
-
```
|
|
105
|
-
Manager_min = ceil(sqrt(write_files) / 3) # HARD FLOOR — you MUST have ≥ this many Managers
|
|
106
|
-
Manager_max = min(Manager_min × 2, 7) # per-wave; exceed only with written justification
|
|
107
|
-
Worker_max_per_manager = 7 # hard cap; split domain if exceeded
|
|
108
|
-
|
|
109
|
-
Worker count per wave = write_files (one Worker per write file, guaranteed by Gate Rule #1)
|
|
110
|
-
|
|
111
|
-
Domain caps (workers per Manager by type):
|
|
112
|
-
Architecture: cap = 3
|
|
113
|
-
Implementation: cap = 7
|
|
114
|
-
Review: cap = 10
|
|
115
|
-
Research: cap = 12
|
|
116
|
-
```
|
|
117
|
-
|
|
118
|
-
**Manager_min is a floor, not a target.** The span formula prevents domain-level under-decomposition — the real failure mode where one Manager tries to coordinate too many Workers across unrelated concerns. Worker-level under-decomposition is prevented by Gate Rule #1 (one file per Worker).
|
|
119
|
-
|
|
120
|
-
## Total Agents (recursive, scales to 1000)
|
|
121
|
-
|
|
122
|
-
```
|
|
123
|
-
total(depth, span) = Σ span^L for L=0..depth
|
|
124
|
-
```
|
|
125
|
-
|
|
126
|
-
- depth=0: CEO + Workers only (XS)
|
|
127
|
-
- depth=1: CEO + Managers + Workers
|
|
128
|
-
- depth=2: CEO + Managers + Workers
|
|
129
|
-
- depth≥3: CEO + Managers + Sub-Managers + Workers (recursive)
|
|
130
|
-
- no hard agent cap; recursion governed by leaf condition + overhead filter
|
|
131
|
-
|
|
132
|
-
## Sizing Table
|
|
133
|
-
|
|
134
|
-
| Scale | Files | Depth | CEO | Mgrs | Workers | Total |
|
|
135
|
-
|-------|---------|-------|-----|------|---------|-------|
|
|
136
|
-
| XS | 1-4 | 0 | 1 | 0 | 1-3 | 2-4 |
|
|
137
|
-
| S | 5-12 | 1 | 1 | 2 | 6 | 9 |
|
|
138
|
-
| M | 13-30 | 1 | 1 | 3 | 15 | 19 |
|
|
139
|
-
| L | 31-60 | 2 | 1 | 5 | 35 | 41 |
|
|
140
|
-
| XL | 61-200 | 2 | 1 | 7 | 49 | 57 |
|
|
141
|
-
| XXL | 201-500 | 3 | 1 | 7 | 343 | 351 |
|
|
142
|
-
| XXXL | 501-1000| 3 | 1 | 7 | 686 | 694 |
|
|
143
|
-
|
|
144
|
-
- depth≥3: Managers spawn Sub-Managers (span≤7). No mixed Worker+Sub-Manager dispatch in same wave.
|
|
145
|
-
|
|
146
|
-
## Leaf Condition (stop splitting)
|
|
147
|
-
|
|
148
|
-
- files ≤ span×2
|
|
149
|
-
- OR avgLines < 50
|
|
150
|
-
- OR overhead > 0.30 (degrade to /wf)
|
|
151
|
-
|
|
152
|
-
## Manager Types (4)
|
|
153
|
-
|
|
154
|
-
| Type | Trigger | Span | Worker Roles |
|
|
155
|
-
|---------------|-------------------------------|------|---------------------------------------------------------------|
|
|
156
|
-
| Architect-Mgr | cross-file interfaces, new ports | 3 | boundary-researcher, interface-designer, data-flow-mapper |
|
|
157
|
-
| Implement-Mgr | write-set defined | 5-7 | implementer₁..ₙ (1 file_claim each) |
|
|
158
|
-
| Review-Mgr | implementation wave complete | 3-4 | reviewer-spec, reviewer-code, reviewer-security |
|
|
159
|
-
| Explore-Mgr | L+ project, uncertain scope | 5-10 | researcher₁..ₙ, domain-explorer₁..ₙ |
|
|
160
|
-
|
|
161
|
-
## Manager Synthesis Protocol
|
|
162
|
-
|
|
163
|
-
```
|
|
164
|
-
1. COLLECT → await all Worker returns
|
|
165
|
-
2. DEDUPLICATE → dedupe, merge overlap
|
|
166
|
-
3. CONFLICT → flag contradictions (file_claim overlap, interface mismatch); no silent resolve
|
|
167
|
-
4. SYNTHESIZE → single integrated artifact
|
|
168
|
-
5. REPORT → CEO-actionable synthesis + raw Worker returns (audit)
|
|
169
|
-
```
|
|
170
|
-
|
|
171
|
-
- Worker failure: retry 1× → on 2nd failure, Manager absorbs or escalates to CEO for replan.
|
|
172
|
-
|
|
173
|
-
## Wave Orchestration
|
|
174
|
-
|
|
175
|
-
```
|
|
176
|
-
W0: Explore-Mgr → N parallel researchers → synthesize → CEO
|
|
177
|
-
E-GATE: → Exploration Gate: CEO verifies all exploration questions answered, findings synthesized (lightweight; see WF.md Decomposition Gate)
|
|
178
|
-
W1: Architect-Mgr → 3 parallel → boundary decisions + interface contract → CEO approval
|
|
179
|
-
D-GATE: → Write Decomposition Gate: CEO produces Dispatch Table + Self-Audit → GATE PASS/FAIL (MANDATORY, applied to the write-set defined by architecture)
|
|
180
|
-
W2: Implement-Mgr → write-set coloring → wave dispatch: ALL Workers spawned in ONE message → merge → CEO
|
|
181
|
-
W2R: Review-Mgr → 3-4 parallel reviewers → dedupe + severity → CEO assigns fixes
|
|
182
|
-
W3+: Dependent waves (repeat W2 pattern; re-run D-GATE if write-set changed significantly)
|
|
183
|
-
INTEGRATION: CEO → verifier → fail → debugger → loop (cap=3)
|
|
184
|
-
CLOSEOUT: CEO → context-master + memory-master (direct, no Manager)
|
|
185
|
-
```
|
|
186
|
-
|
|
187
|
-
- **E-GATE** (Exploration Gate): read-only agents each had a specific question; all returns are synthesized into PLAN.md. No exploration blind spots.
|
|
188
|
-
- **D-GATE** (Write Decomposition Gate): applies AFTER architecture defines the write-set, BEFORE any implementation Worker spawns. Dispatch Table covers the actual write-set. Gate is non-negotiable.
|
|
189
|
-
- W2 dispatch: ALL Workers for a wave MUST be spawned in a single message — not one per turn. Batching is what makes parallelism real.
|
|
190
|
-
|
|
191
|
-
- Wave scheduling: Managers serial across domains, Workers parallel within domain.
|
|
192
|
-
- CEO validates wave output before starting next wave. No pipelining.
|
|
193
|
-
|
|
194
|
-
## Overhead & Cost Filter
|
|
195
|
-
|
|
196
|
-
```
|
|
197
|
-
overhead(depth) = 0.10 (depth≤2) | 0.20 (depth=3) | 0.35 (depth≥4)
|
|
198
|
-
```
|
|
199
|
-
|
|
200
|
-
- overhead > 0.30 → degrade to /wf
|
|
201
|
-
- independenceFactor: 1.0 (no deps) | 0.3-0.7 (shared imports)
|
|
202
|
-
|
|
203
|
-
## When NOT to use /wf-max
|
|
204
|
-
|
|
205
|
-
These conditions govern **auto-trigger degradation only** (wf-max → /wf). They never apply when the user explicitly types `/wf-max`, and "degrade" always means the flat /wf multi-subagent loop, never a solo pass.
|
|
206
|
-
|
|
207
|
-
- files < 5 → use /wf
|
|
208
|
-
- all changes share single interface → serial dependency
|
|
209
|
-
- import/re-export refactor → global consistency required
|
|
210
|
-
- communication overhead > 30% → degrade
|
|
211
|
-
|
|
212
|
-
## /wf vs /wf-max
|
|
213
|
-
|
|
214
|
-
| Dimension | /wf | /wf-max |
|
|
215
|
-
|------------------|------------------|----------------------------------|
|
|
216
|
-
| Organization | flat | CEO → Mgr → Worker (3-tier) |
|
|
217
|
-
| Exploration | 3-5 serial | Mgr → 10 parallel |
|
|
218
|
-
| Implementation | 1 serial | Mgr → N parallel (span 5-7) |
|
|
219
|
-
| Review | 1-2 serial gate | Mgr → 3-4 parallel dimensions |
|
|
220
|
-
| Span formula | none | sqrt(files) + domain cap |
|
|
221
|
-
| Recursive depth | 0 | 1-3 (scales to 1000 agents) |
|
|
222
|
-
| Context threshold| ~85% | ~70% |
|
|
223
|
-
| Granularity floor| none | <50 lines → no split |
|
|
1
|
+
# WF-MAX — Maximum Parallelism Workflow
|
|
2
|
+
|
|
3
|
+
## Trigger
|
|
4
|
+
|
|
5
|
+
- Explicit: `/wf-max [task]`
|
|
6
|
+
- Auto: WF task with write-set ≥5 files AND clear disjoint boundaries
|
|
7
|
+
- parallelismScore = (files × avgLines × 3 / 800) × independenceFactor
|
|
8
|
+
- spawn ≥2.0 | maybe 1.0-2.0 | skip <1.0 (degrade to /wf)
|
|
9
|
+
|
|
10
|
+
## Explicit Invocation Is an Absolute Fan-Out Mandate
|
|
11
|
+
|
|
12
|
+
When the user types `/wf-max` (or `wf max`), spawning subagents is **mandatory and unconditional**. File count, task size, line count, and overhead estimates DO NOT apply to explicit invocation — they govern ONLY auto-triggering (whether the harness enters wf-max on its own). A 1-file task invoked with `/wf-max` still fans out to parallel subagents.
|
|
13
|
+
|
|
14
|
+
"Degrade to /wf" changes the **organization** (flat vs CEO→Manager→Worker), never the **fact** of fan-out: `/wf` itself requires ≥3 subagents before second planning. There is no path from an explicitly typed command to a solo main-thread pass. If you find yourself reading source files and editing them directly after the user typed `/wf-max`, you have violated this mandate — stop and dispatch.
|
|
15
|
+
|
|
16
|
+
## Companion Docs
|
|
17
|
+
|
|
18
|
+
- [subagents.md](subagents.md) — agent roster, controller role, efficiency ladder
|
|
19
|
+
- [dispatch.md](dispatch.md) — handoff format, File claim, Concurrency group fields
|
|
20
|
+
- [agent-workflow.md](agent-workflow.md) — build/test/review loop, cohesion rule, completion gate
|
|
21
|
+
|
|
22
|
+
## Organization Model
|
|
23
|
+
|
|
24
|
+
```
|
|
25
|
+
CEO(1) ──┬── Manager₁(span) ──┬── Worker₁..ₙ
|
|
26
|
+
│ └── Sub-Manager(span) → Worker₁..ₙ [depth ≥3]
|
|
27
|
+
└── Manager₂(span) ── Worker₁..ₙ
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
- CEO: intent, scope, integration, final verification. Direct reports 3-5 Managers. **CEO never writes code directly** — dispatch Workers for all file changes. CEO only synthesizes results and decides next waves.
|
|
31
|
+
- Manager: domain partition → parallel dispatch → synthesize → report. Serial across domains; parallel within domain. **Manager agents must be defined by the project** (not shipped by the harness) — create them under `.claude/agents/` with the `Agent` tool enabled for nested spawning.
|
|
32
|
+
- Worker: single file per write Worker (implementer, one file_claim). Single dimension/topic per read Worker (reviewer, researcher). File claims must be file-level disjoint. Topic-level splitting within a single file is only allowed for read-only Workers.
|
|
33
|
+
- depth ≥3: Manager spawns Sub-Manager (span ≤7) instead of Worker. Recursive until leaf condition met.
|
|
34
|
+
|
|
35
|
+
## Decomposition Gate (MANDATORY — CEO-level, before ANY Worker dispatch)
|
|
36
|
+
|
|
37
|
+
The Decomposition Gate is a hard stop. No code changes, no Worker spawns until the gate passes. The CEO MUST produce a Dispatch Table artifact and pass the Self-Audit Checklist. This is the single most important enforcement mechanism in WF-MAX — it exists because **models default to "do it myself" rather than "decompose and delegate."**
|
|
38
|
+
|
|
39
|
+
### Gate Artifact: Dispatch Table
|
|
40
|
+
|
|
41
|
+
CEO MUST write this table in the task PLAN.md after W1 architecture defines the write-set and before W2 implementation dispatch:
|
|
42
|
+
|
|
43
|
+
```
|
|
44
|
+
| File | Concern | Worker Type | Worker Label | Read-Only? |
|
|
45
|
+
|------|---------|------------|--------------|------------|
|
|
46
|
+
| src/a.ts | Auth middleware | implementer | impl-auth | No |
|
|
47
|
+
| src/b.ts | DB schema | implementer | impl-db | No |
|
|
48
|
+
| docs/arch.md | Research existing patterns | researcher | res-arch | Yes |
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### Gate Rules (any violation = gate fail, retry)
|
|
52
|
+
|
|
53
|
+
1. **Every file in the write-set MUST have exactly one write Worker.** Unassigned files = fail. This is the anti-bundling rule — one Worker touching >1 write file = fail. (Read Workers may span multiple files.)
|
|
54
|
+
2. **Manager count MUST ≥ span_min = ceil(sqrt(write_files) / 3).** This is the anti-under-decomposition rule at the domain level. Fewer than the minimum number of Managers means domains are too coarse. "One Manager can handle everything" is NOT valid in WF-MAX — if the task were that simple, degrade to /wf.
|
|
55
|
+
3. **Each Manager MUST have ≥2 Workers and ≤7 Workers.** 0-1 Workers = Phantom Manager → dissolve. >7 Workers → Manager context is overloaded → split the domain and add a Manager.
|
|
56
|
+
4. **CEO MUST NOT appear as a Worker row.** CEO writes no production code — fail.
|
|
57
|
+
|
|
58
|
+
### CEO Tool Boundary
|
|
59
|
+
|
|
60
|
+
The CEO operates under a strict tool restriction model for production code:
|
|
61
|
+
|
|
62
|
+
| CEO Has | CEO MUST NOT Use (on source code) |
|
|
63
|
+
|---------|-----------------------------------|
|
|
64
|
+
| Task (spawn agents) | Edit (on source files) |
|
|
65
|
+
| Read (for scoping) | Write (on source files) |
|
|
66
|
+
| TodoWrite (tracking) | Bash (except final verification) |
|
|
67
|
+
| Grep/Glob (for scoping) | MultiEdit (on source files) |
|
|
68
|
+
|
|
69
|
+
**Exception**: CEO MAY write to `Harness/tasks/<id>/PLAN.md` and `Harness/tasks/<id>/PROGRESS.md` — these are task-tracking artifacts, not production code. The Dispatch Table, Self-Audit Checklist, and synthesis reports are the CEO's primary durable artifacts.
|
|
70
|
+
|
|
71
|
+
If the CEO finds itself reaching for Edit/Write/Bash on source files, it is violating role boundaries. Stop. Delegate to a Worker.
|
|
72
|
+
|
|
73
|
+
### Self-Audit Checklist
|
|
74
|
+
|
|
75
|
+
After producing the Dispatch Table, CEO MUST answer all before proceeding:
|
|
76
|
+
|
|
77
|
+
- [ ] Did I assign myself any source file? (must be **No** — PLAN.md/PROGRESS.md writes are the exception)
|
|
78
|
+
- [ ] Is every file with planned changes assigned to exactly one write Worker? (must be **Yes**)
|
|
79
|
+
- [ ] Does any Worker have >1 write file? (must be **No**)
|
|
80
|
+
- [ ] Is Manager count ≥ ceil(sqrt(write_files) / 3)? (must be **Yes**, or justification written)
|
|
81
|
+
- [ ] Does every Manager have 2-7 Workers? (<2 = Phantom Manager, >7 = overloaded)
|
|
82
|
+
- [ ] Are there files >200 lines or with >1 concern that should be split into separate files?
|
|
83
|
+
- [ ] Could any serial chain be parallelized? (different files with no shared imports = parallelize)
|
|
84
|
+
- [ ] Will all Workers be spawned in ONE message?
|
|
85
|
+
|
|
86
|
+
Gate retries until all checks pass. **CEO may NOT proceed to W1 with a failing gate.**
|
|
87
|
+
|
|
88
|
+
## Anti-Pattern Catalog
|
|
89
|
+
|
|
90
|
+
Before every wave dispatch, CEO MUST scan for these patterns. **Any match = stop and re-decompose.**
|
|
91
|
+
|
|
92
|
+
| # | Anti-Pattern | Symptom | Detection | Fix |
|
|
93
|
+
|---|-------------|---------|-----------|-----|
|
|
94
|
+
| AP1 | **CEO-as-Worker** | CEO assigns itself a file or starts writing code | CEO in Dispatch Table; Edit/Write/Bash used by CEO | Re-delegate to a Worker immediately |
|
|
95
|
+
| AP2 | **Under-decomposition** | Fewer Workers than `ceil(sqrt(files))` | Count check fails; "1-2 agents is enough for this" | Split files by concern, module, or layer |
|
|
96
|
+
| AP3 | **Serialization trap** | "Let me do X first, then I'll know how to dispatch Y" | Sequential plan without parallel candidates | Dispatch X and Y in parallel NOW; Worker-X returns spec that Worker-Y consumes |
|
|
97
|
+
| AP4 | **Fake parallelism** | Multiple Workers assigned same file | Duplicate file path in Dispatch Table | One file = one Writer. Split file into separate modules, or serialize |
|
|
98
|
+
| AP5 | **Phantom Manager** | Manager spawns 0-1 Workers | Manager's sub-table has <2 Workers | Dissolve Manager; CEO or sibling absorbs domain |
|
|
99
|
+
| AP6 | **Sequential spawn** | Workers spawned one-per-turn instead of batched | Only 1 Task() call per message | Batch ALL Task() calls into ONE message |
|
|
100
|
+
| AP7 | **Silent degrade** | CEO switches to /wf without recording reason | No Dispatch Table; flat agent spawns | Explicit decision + justification in PLAN.md; only valid reason is overhead > 0.30 |
|
|
101
|
+
|
|
102
|
+
## Span Formula (Prescriptive Floor)
|
|
103
|
+
|
|
104
|
+
```
|
|
105
|
+
Manager_min = ceil(sqrt(write_files) / 3) # HARD FLOOR — you MUST have ≥ this many Managers
|
|
106
|
+
Manager_max = min(Manager_min × 2, 7) # per-wave; exceed only with written justification
|
|
107
|
+
Worker_max_per_manager = 7 # hard cap; split domain if exceeded
|
|
108
|
+
|
|
109
|
+
Worker count per wave = write_files (one Worker per write file, guaranteed by Gate Rule #1)
|
|
110
|
+
|
|
111
|
+
Domain caps (workers per Manager by type):
|
|
112
|
+
Architecture: cap = 3
|
|
113
|
+
Implementation: cap = 7
|
|
114
|
+
Review: cap = 10
|
|
115
|
+
Research: cap = 12
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
**Manager_min is a floor, not a target.** The span formula prevents domain-level under-decomposition — the real failure mode where one Manager tries to coordinate too many Workers across unrelated concerns. Worker-level under-decomposition is prevented by Gate Rule #1 (one file per Worker).
|
|
119
|
+
|
|
120
|
+
## Total Agents (recursive, scales to 1000)
|
|
121
|
+
|
|
122
|
+
```
|
|
123
|
+
total(depth, span) = Σ span^L for L=0..depth
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
- depth=0: CEO + Workers only (XS)
|
|
127
|
+
- depth=1: CEO + Managers + Workers
|
|
128
|
+
- depth=2: CEO + Managers + Workers
|
|
129
|
+
- depth≥3: CEO + Managers + Sub-Managers + Workers (recursive)
|
|
130
|
+
- no hard agent cap; recursion governed by leaf condition + overhead filter
|
|
131
|
+
|
|
132
|
+
## Sizing Table
|
|
133
|
+
|
|
134
|
+
| Scale | Files | Depth | CEO | Mgrs | Workers | Total |
|
|
135
|
+
|-------|---------|-------|-----|------|---------|-------|
|
|
136
|
+
| XS | 1-4 | 0 | 1 | 0 | 1-3 | 2-4 |
|
|
137
|
+
| S | 5-12 | 1 | 1 | 2 | 6 | 9 |
|
|
138
|
+
| M | 13-30 | 1 | 1 | 3 | 15 | 19 |
|
|
139
|
+
| L | 31-60 | 2 | 1 | 5 | 35 | 41 |
|
|
140
|
+
| XL | 61-200 | 2 | 1 | 7 | 49 | 57 |
|
|
141
|
+
| XXL | 201-500 | 3 | 1 | 7 | 343 | 351 |
|
|
142
|
+
| XXXL | 501-1000| 3 | 1 | 7 | 686 | 694 |
|
|
143
|
+
|
|
144
|
+
- depth≥3: Managers spawn Sub-Managers (span≤7). No mixed Worker+Sub-Manager dispatch in same wave.
|
|
145
|
+
|
|
146
|
+
## Leaf Condition (stop splitting)
|
|
147
|
+
|
|
148
|
+
- files ≤ span×2
|
|
149
|
+
- OR avgLines < 50
|
|
150
|
+
- OR overhead > 0.30 (degrade to /wf)
|
|
151
|
+
|
|
152
|
+
## Manager Types (4)
|
|
153
|
+
|
|
154
|
+
| Type | Trigger | Span | Worker Roles |
|
|
155
|
+
|---------------|-------------------------------|------|---------------------------------------------------------------|
|
|
156
|
+
| Architect-Mgr | cross-file interfaces, new ports | 3 | boundary-researcher, interface-designer, data-flow-mapper |
|
|
157
|
+
| Implement-Mgr | write-set defined | 5-7 | implementer₁..ₙ (1 file_claim each) |
|
|
158
|
+
| Review-Mgr | implementation wave complete | 3-4 | reviewer-spec, reviewer-code, reviewer-security |
|
|
159
|
+
| Explore-Mgr | L+ project, uncertain scope | 5-10 | researcher₁..ₙ, domain-explorer₁..ₙ |
|
|
160
|
+
|
|
161
|
+
## Manager Synthesis Protocol
|
|
162
|
+
|
|
163
|
+
```
|
|
164
|
+
1. COLLECT → await all Worker returns
|
|
165
|
+
2. DEDUPLICATE → dedupe, merge overlap
|
|
166
|
+
3. CONFLICT → flag contradictions (file_claim overlap, interface mismatch); no silent resolve
|
|
167
|
+
4. SYNTHESIZE → single integrated artifact
|
|
168
|
+
5. REPORT → CEO-actionable synthesis + raw Worker returns (audit)
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
- Worker failure: retry 1× → on 2nd failure, Manager absorbs or escalates to CEO for replan.
|
|
172
|
+
|
|
173
|
+
## Wave Orchestration
|
|
174
|
+
|
|
175
|
+
```
|
|
176
|
+
W0: Explore-Mgr → N parallel researchers → synthesize → CEO
|
|
177
|
+
E-GATE: → Exploration Gate: CEO verifies all exploration questions answered, findings synthesized (lightweight; see WF.md Decomposition Gate)
|
|
178
|
+
W1: Architect-Mgr → 3 parallel → boundary decisions + interface contract → CEO approval
|
|
179
|
+
D-GATE: → Write Decomposition Gate: CEO produces Dispatch Table + Self-Audit → GATE PASS/FAIL (MANDATORY, applied to the write-set defined by architecture)
|
|
180
|
+
W2: Implement-Mgr → write-set coloring → wave dispatch: ALL Workers spawned in ONE message → merge → CEO
|
|
181
|
+
W2R: Review-Mgr → 3-4 parallel reviewers → dedupe + severity → CEO assigns fixes
|
|
182
|
+
W3+: Dependent waves (repeat W2 pattern; re-run D-GATE if write-set changed significantly)
|
|
183
|
+
INTEGRATION: CEO → verifier → fail → debugger → loop (cap=3)
|
|
184
|
+
CLOSEOUT: CEO → context-master + memory-master (direct, no Manager)
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
- **E-GATE** (Exploration Gate): read-only agents each had a specific question; all returns are synthesized into PLAN.md. No exploration blind spots.
|
|
188
|
+
- **D-GATE** (Write Decomposition Gate): applies AFTER architecture defines the write-set, BEFORE any implementation Worker spawns. Dispatch Table covers the actual write-set. Gate is non-negotiable.
|
|
189
|
+
- W2 dispatch: ALL Workers for a wave MUST be spawned in a single message — not one per turn. Batching is what makes parallelism real.
|
|
190
|
+
|
|
191
|
+
- Wave scheduling: Managers serial across domains, Workers parallel within domain.
|
|
192
|
+
- CEO validates wave output before starting next wave. No pipelining.
|
|
193
|
+
|
|
194
|
+
## Overhead & Cost Filter
|
|
195
|
+
|
|
196
|
+
```
|
|
197
|
+
overhead(depth) = 0.10 (depth≤2) | 0.20 (depth=3) | 0.35 (depth≥4)
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
- overhead > 0.30 → degrade to /wf
|
|
201
|
+
- independenceFactor: 1.0 (no deps) | 0.3-0.7 (shared imports)
|
|
202
|
+
|
|
203
|
+
## When NOT to use /wf-max
|
|
204
|
+
|
|
205
|
+
These conditions govern **auto-trigger degradation only** (wf-max → /wf). They never apply when the user explicitly types `/wf-max`, and "degrade" always means the flat /wf multi-subagent loop, never a solo pass.
|
|
206
|
+
|
|
207
|
+
- files < 5 → use /wf
|
|
208
|
+
- all changes share single interface → serial dependency
|
|
209
|
+
- import/re-export refactor → global consistency required
|
|
210
|
+
- communication overhead > 30% → degrade
|
|
211
|
+
|
|
212
|
+
## /wf vs /wf-max
|
|
213
|
+
|
|
214
|
+
| Dimension | /wf | /wf-max |
|
|
215
|
+
|------------------|------------------|----------------------------------|
|
|
216
|
+
| Organization | flat | CEO → Mgr → Worker (3-tier) |
|
|
217
|
+
| Exploration | 3-5 serial | Mgr → 10 parallel |
|
|
218
|
+
| Implementation | 1 serial | Mgr → N parallel (span 5-7) |
|
|
219
|
+
| Review | 1-2 serial gate | Mgr → 3-4 parallel dimensions |
|
|
220
|
+
| Span formula | none | sqrt(files) + domain cap |
|
|
221
|
+
| Recursive depth | 0 | 1-3 (scales to 1000 agents) |
|
|
222
|
+
| Context threshold| ~85% | ~70% |
|
|
223
|
+
| Granularity floor| none | <50 lines → no split |
|