@jaggerxtrm/specialists 3.5.1 → 3.6.1
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.md +11 -1
- package/config/nodes/research-multi.node.json +11 -0
- package/config/nodes/research.node.json +27 -0
- package/config/skills/using-nodes/SKILL.md +333 -0
- package/config/skills/using-specialists/SKILL.md +376 -148
- package/config/specialists/debugger.specialist.json +1 -1
- package/config/specialists/memory-processor.specialist.json +1 -0
- package/config/specialists/node-coordinator.specialist.json +16 -267
- package/config/specialists/planner.specialist.json +1 -1
- package/config/specialists/researcher.specialist.json +3 -2
- package/config/specialists/reviewer.specialist.json +1 -1
- package/config/specialists/sync-docs.specialist.json +1 -1
- package/dist/index.js +10431 -6071
- package/package.json +2 -1
|
@@ -4,12 +4,13 @@ description: >
|
|
|
4
4
|
Use this skill whenever you're about to start a substantial task — pause first and
|
|
5
5
|
route the work through specialists instead of doing discovery or implementation
|
|
6
6
|
yourself. Consult before any: code review, security audit, deep bug investigation,
|
|
7
|
-
test generation, multi-file refactor, architecture analysis, or multi-
|
|
7
|
+
test generation, multi-file refactor, architecture analysis, or multi-chain
|
|
8
8
|
specialist orchestration. Also use for the mechanics of delegation: --bead
|
|
9
9
|
workflow, --context-depth, background jobs, MCP tool (`use_specialist`),
|
|
10
10
|
or specialists doctor. Don't wait for the user to say
|
|
11
11
|
"use a specialist" — proactively evaluate whether delegation makes sense.
|
|
12
|
-
version: 4.
|
|
12
|
+
version: 4.6
|
|
13
|
+
synced_at: zz22-docs
|
|
13
14
|
---
|
|
14
15
|
|
|
15
16
|
# Specialists Usage
|
|
@@ -35,10 +36,11 @@ Specialists are autonomous AI agents that run independently — fresh context, d
|
|
|
35
36
|
3. **Run explorer before executor when context is lacking.** If the bead already has clear scope — files, symbols, approach — send executor directly. Only run explorer first when the issue lacks a clear track.
|
|
36
37
|
4. **For tracked work, the bead is the prompt.** The bead description, notes, and parent context are the instruction surface.
|
|
37
38
|
5. **`--bead` and `--prompt` are mutually exclusive.** If you need to refine instructions, update the bead notes; do not add `--prompt`.
|
|
38
|
-
6. **
|
|
39
|
-
7. **Merge
|
|
39
|
+
6. **Chains belong to epics.** A chain is a worktree lineage (executor → reviewer → fix). An epic is the merge-gated identity that owns chains. Use `sp epic merge <epic>` to publish — never merge individual chains that belong to an unresolved epic.
|
|
40
|
+
7. **Merge through epics, not manual git.** Use `sp epic merge <epic-id>` for wave-bound chains or `sp merge <chain-root-bead>` for standalone chains. Never use manual `git merge` for specialist work.
|
|
40
41
|
8. **No destructive operations by specialists.** No `rm -rf`, no force pushes, no database drops, no credential rotation, no mass deletes, no history rewrites. Surface destructive requirements to the user.
|
|
41
42
|
9. **Executor does not run tests.** Executor runs lint + tsc only. Tests are the reviewer's and test-runner's responsibility in the chained pipeline.
|
|
43
|
+
10. **Keep specialists alive through the review cycle.** Never `sp stop` an executor or debugger before the reviewer delivers its verdict. The specialist stays in `waiting` so you can `resume` it — to commit changes, apply fixes from reviewer feedback, or continue work. Only stop after final reviewer PASS and confirmed commit.
|
|
42
44
|
|
|
43
45
|
---
|
|
44
46
|
|
|
@@ -69,18 +71,31 @@ specialists run <name> --bead <id> # foreground run (streams output)
|
|
|
69
71
|
specialists run <name> --bead <id> --background # background run
|
|
70
72
|
specialists run <name> --bead <id> --worktree # isolated worktree (edit-capable specialists)
|
|
71
73
|
specialists run <name> --bead <id> --job <job-id> # reuse another job's worktree
|
|
74
|
+
specialists run <name> --bead <id> --epic <epic-id> # explicitly declare epic membership
|
|
72
75
|
specialists run <name> --prompt "..." # ad-hoc (no bead tracking)
|
|
73
76
|
specialists run <name> --bead <id> --keep-alive # keep session alive after first turn
|
|
74
77
|
specialists run <name> --bead <id> --context-depth 2 # inject parent bead context
|
|
75
78
|
|
|
76
79
|
# Monitoring
|
|
77
|
-
specialists ps # list all jobs (status, specialist, elapsed, bead)
|
|
80
|
+
specialists ps # list all jobs (status, specialist, elapsed, bead, epic)
|
|
78
81
|
specialists ps <job-id> # inspect single job (full detail + ctx% badge)
|
|
79
82
|
specialists feed -f # tail merged feed (all jobs) — shows [ctx%] context window usage
|
|
80
83
|
specialists feed <job-id> # events for a specific job
|
|
81
84
|
specialists result <job-id> # final output text
|
|
82
85
|
specialists status --job <job-id> # single-job detail view (legacy — prefer `sp ps <id>`)
|
|
83
86
|
|
|
87
|
+
# Epic lifecycle (canonical publication path)
|
|
88
|
+
specialists epic list [--unresolved] # list epics with lifecycle state
|
|
89
|
+
specialists epic status <epic-id> # show chains, blockers, readiness
|
|
90
|
+
specialists epic resolve <epic-id> # transition open -> resolving
|
|
91
|
+
specialists epic merge <epic-id> [--pr] # publish all epic-owned chains
|
|
92
|
+
|
|
93
|
+
# Merge (for standalone chains only)
|
|
94
|
+
specialists merge <chain-root-bead> [--rebuild] # publish ONE standalone chain
|
|
95
|
+
|
|
96
|
+
# Session close (chain-aware, epic-aware)
|
|
97
|
+
specialists end [--pr] # close session, publish via merge or PR
|
|
98
|
+
|
|
84
99
|
# Interaction
|
|
85
100
|
specialists steer <job-id> "new direction" # redirect ANY running job mid-run
|
|
86
101
|
specialists resume <job-id> "next task" # resume a waiting keep-alive job
|
|
@@ -96,6 +111,62 @@ specialists init --no-xtrm-check # skip xtrm prerequisite check (CI
|
|
|
96
111
|
|
|
97
112
|
---
|
|
98
113
|
|
|
114
|
+
## Taxonomy: Job | Chain | Epic
|
|
115
|
+
|
|
116
|
+
The specialists orchestration model uses three levels:
|
|
117
|
+
|
|
118
|
+
| Term | Definition | Persisted? | Merge scope |
|
|
119
|
+
|------|------------|:----------:|:-----------:|
|
|
120
|
+
| **Job** | One specialist run (atomic execution unit) | Yes (SQLite + files) | — |
|
|
121
|
+
| **Chain** | Worktree lineage: executor → reviewer → fix → re-review (seeded by edit-capable specialist) | Yes (`worktree_owner_job_id`) | `sp merge <chain-root>` |
|
|
122
|
+
| **Epic** | Top merge-gated identity that owns chains across stages | Yes (`epic_runs` table) | `sp epic merge <epic>` |
|
|
123
|
+
| **Wave** | Human shorthand for dispatch batches ("Wave 1", "Wave 2b") — **speech only, NOT persisted** | No | — |
|
|
124
|
+
|
|
125
|
+
### Key relationships
|
|
126
|
+
|
|
127
|
+
- **Chains belong to epics**: When `--bead` is used, the chain defaults to the bead's parent epic. Override with `--epic <id>`.
|
|
128
|
+
- **Jobs belong to chains**: Jobs sharing a `worktree_owner_job_id` form one chain.
|
|
129
|
+
- **Merge through epics**: `sp epic merge <epic-id>` is the **canonical publication path** for wave-bound chains.
|
|
130
|
+
- **Standalone chains**: `sp merge <chain-root-bead>` works only for chains NOT belonging to an unresolved epic.
|
|
131
|
+
|
|
132
|
+
### Epic lifecycle
|
|
133
|
+
|
|
134
|
+
```
|
|
135
|
+
open → resolving → merge_ready → merged
|
|
136
|
+
↘ failed
|
|
137
|
+
↘ abandoned
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
| State | Meaning | Chains mergeable? |
|
|
141
|
+
|-------|---------|:-----------------:|
|
|
142
|
+
| `open` | Epic created, chains not yet running | — |
|
|
143
|
+
| `resolving` | Chains are actively running | ✗ |
|
|
144
|
+
| `merge_ready` | All chains terminal, reviewer PASS | ✓ (via `sp epic merge`) |
|
|
145
|
+
| `merged` | Publication complete | — |
|
|
146
|
+
| `failed` | One or more chains failed | — |
|
|
147
|
+
| `abandoned` | Cancelled without merge | — |
|
|
148
|
+
|
|
149
|
+
### Migration from "waves" vocabulary
|
|
150
|
+
|
|
151
|
+
**Old terminology → New terminology:**
|
|
152
|
+
|
|
153
|
+
| Old | New | Notes |
|
|
154
|
+
|-----|-----|-------|
|
|
155
|
+
| "Wave 1" | Stage 1 / Prep phase | Speech shorthand still works — just not persisted |
|
|
156
|
+
| "Wave 2" | Implementation chains | Chains are the operative unit, grouped by epic |
|
|
157
|
+
| "Between waves merge" | `sp epic merge` | Epic is the merge-gated identity |
|
|
158
|
+
| "Parallel in wave" | Parallel chains under epic | Use `--epic` to declare membership explicitly |
|
|
159
|
+
|
|
160
|
+
**Why this change?**
|
|
161
|
+
|
|
162
|
+
1. **Waves had no identity**: "Wave 2" was just speech — no code could track it.
|
|
163
|
+
2. **Merge gates were implicit**: Operators had to remember which chains to merge together.
|
|
164
|
+
3. **Epics are explicit**: An epic bead ID persists, enabling `sp epic status` and `sp epic merge`.
|
|
165
|
+
|
|
166
|
+
**Backward compatibility**: All existing workflows work unchanged. The new vocabulary is additive — you can still think in waves, but the system tracks epics.
|
|
167
|
+
|
|
168
|
+
---
|
|
169
|
+
|
|
99
170
|
## Chained Bead Pipeline
|
|
100
171
|
|
|
101
172
|
This is the **standard for ALL tracked work**. Every specialist run gets its own child bead.
|
|
@@ -145,7 +216,8 @@ specialists run explorer --bead abc-exp --context-depth 2 --background
|
|
|
145
216
|
# Explorer output auto-appends to abc-exp notes (READ_ONLY behavior)
|
|
146
217
|
specialists result e1f2g3
|
|
147
218
|
|
|
148
|
-
# 4. [MERGE] Merge any worktree branches from Wave 1 into master
|
|
219
|
+
# 4. [MERGE] Merge any worktree branches from Wave 1 into master
|
|
220
|
+
# READ_ONLY waves have no worktrees to merge
|
|
149
221
|
|
|
150
222
|
# 5. Wave 2 — Executor
|
|
151
223
|
specialists run executor --worktree --bead abc-impl --context-depth 2 --background
|
|
@@ -153,7 +225,8 @@ specialists run executor --worktree --bead abc-impl --context-depth 2 --backgrou
|
|
|
153
225
|
# Executor sees: abc-impl + abc-exp (with explorer notes) + abc via context-depth
|
|
154
226
|
# Executor self-appends output to abc-impl notes, closes abc-impl on completion
|
|
155
227
|
|
|
156
|
-
# 6. [MERGE] Merge
|
|
228
|
+
# 6. [MERGE] Merge impl worktree branch into master
|
|
229
|
+
sp merge abc-impl --rebuild
|
|
157
230
|
|
|
158
231
|
# 7. Wave 3 — Reviewer (no separate bead — uses --job + --prompt to enter executor's worktree)
|
|
159
232
|
specialists run reviewer --job a1b2c3 --keep-alive --background --prompt "Review the token refresh fix"
|
|
@@ -185,18 +258,34 @@ bd close abc --reason "Fixed: token refresh retries on 401. Reviewer PASS."
|
|
|
185
258
|
|
|
186
259
|
---
|
|
187
260
|
|
|
188
|
-
## --job and --
|
|
261
|
+
## --job, --worktree, and --epic Semantics
|
|
189
262
|
|
|
190
|
-
These flags control **workspace isolation**. Executors run in isolated git worktrees so
|
|
191
|
-
concurrent jobs don't corrupt shared files.
|
|
263
|
+
These flags control **workspace isolation** and **epic membership**. Executors run in isolated git worktrees so concurrent jobs don't corrupt shared files. Chains declare epic membership to enable merge-gated publication.
|
|
192
264
|
|
|
193
|
-
| Flag | Semantics | Creates worktree? |
|
|
194
|
-
|
|
195
|
-
| `--worktree` | Provision a new isolated workspace; requires `--bead` | Yes |
|
|
196
|
-
| `--job <id>` | Reuse the workspace of an existing job | No |
|
|
265
|
+
| Flag | Semantics | Creates worktree? | Sets epic? |
|
|
266
|
+
|------|-----------|:----------------:|:----------:|
|
|
267
|
+
| `--worktree` | Provision a new isolated workspace; requires `--bead` | Yes | Inherited from bead.parent |
|
|
268
|
+
| `--job <id>` | Reuse the workspace of an existing job | No | Inherited from target job |
|
|
269
|
+
| `--epic <id>` | Explicitly declare epic membership | No | Yes (overrides default) |
|
|
197
270
|
|
|
198
271
|
`--worktree` and `--job` are **mutually exclusive**. Specifying both exits with an error.
|
|
199
272
|
|
|
273
|
+
### Epic membership
|
|
274
|
+
|
|
275
|
+
When `--bead` is used, the chain defaults to the bead's parent epic (if parent is an epic-type bead). Override this with `--epic <id>`:
|
|
276
|
+
|
|
277
|
+
```bash
|
|
278
|
+
# Chain inherits bead.parent as epic
|
|
279
|
+
specialists run executor --worktree --bead unitAI-impl
|
|
280
|
+
# → epic_id = bead.parent (if epic-type)
|
|
281
|
+
|
|
282
|
+
# Explicit epic declaration (e.g., prep job with non-epic parent)
|
|
283
|
+
specialists run explorer --bead prep-task.1 --epic unitAI-3f7b
|
|
284
|
+
# → epic_id = unitAI-3f7b (explicit override)
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
**Why explicit --epic?** Prep jobs (explorer, planner, overthinker) often have non-epic parents but need to belong to the epic for `sp ps` grouping and `sp epic status` visibility.
|
|
288
|
+
|
|
200
289
|
### `--worktree`
|
|
201
290
|
|
|
202
291
|
Provisions a new git worktree + branch for the specialist run. Branch name is derived
|
|
@@ -222,9 +311,25 @@ specialists run reviewer --job 49adda --keep-alive --background
|
|
|
222
311
|
specialists run executor --bead hgpu.3-fix --job 49adda --context-depth 2 --background
|
|
223
312
|
```
|
|
224
313
|
|
|
225
|
-
**Concurrency guard:**
|
|
226
|
-
|
|
227
|
-
|
|
314
|
+
**Concurrency guard (MEDIUM/HIGH specialists):**
|
|
315
|
+
|
|
316
|
+
Blocked from entering while target job is `starting` or `running` — prevents concurrent file corruption.
|
|
317
|
+
|
|
318
|
+
| Target status | MEDIUM/HIGH | READ_ONLY/LOW |
|
|
319
|
+
|---------------|:-----------:|:-------------:|
|
|
320
|
+
| `starting` | ✗ Blocked | ✓ Allowed |
|
|
321
|
+
| `running` | ✗ Blocked | ✓ Allowed |
|
|
322
|
+
| `waiting` | ✓ Allowed | ✓ Allowed |
|
|
323
|
+
| `done`/`error`/`cancelled` | ✓ Allowed | ✓ Allowed |
|
|
324
|
+
| Unknown | ✗ Blocked (conservative) | ✓ Allowed |
|
|
325
|
+
|
|
326
|
+
**Bypass with `--force-job`:**
|
|
327
|
+
|
|
328
|
+
```bash
|
|
329
|
+
specialists run executor --job 49adda --force-job --bead fix-123
|
|
330
|
+
```
|
|
331
|
+
|
|
332
|
+
Use when the caller explicitly accepts concurrent write risk (e.g., target job known to be stalled but not yet terminal, emergency fix entry).
|
|
228
333
|
|
|
229
334
|
### When to use each flag
|
|
230
335
|
|
|
@@ -233,11 +338,29 @@ specialists run executor --bead hgpu.3-fix --job 49adda --context-depth 2 --back
|
|
|
233
338
|
| First executor run for a task | `--worktree --bead <impl-bead>` |
|
|
234
339
|
| Reviewer on executor's output | `--job <exec-job-id>` (no `--worktree`) |
|
|
235
340
|
| Fix executor after reviewer PARTIAL | `--bead <fix-bead> --job <exec-job-id>` |
|
|
341
|
+
| Force entry to blocked worktree | `--bead <fix-bead> --job <exec-job-id> --force-job` |
|
|
342
|
+
| Prep job belonging to epic (non-epic parent) | `--bead <prep-bead> --epic <epic-id>` |
|
|
236
343
|
| Explorer (READ_ONLY) | Neither — explorers don't need worktrees |
|
|
237
344
|
| Overthinker, planner, debugger | Neither — read-only and interactive specialists |
|
|
238
345
|
|
|
239
346
|
---
|
|
240
347
|
|
|
348
|
+
### Worktree write-boundary enforcement
|
|
349
|
+
|
|
350
|
+
Specialists running in worktrees are **prevented from writing outside their boundary**. The session generates a Pi extension that hooks `tool_call` events and blocks `edit`/`write`/`multiEdit`/`notebookEdit` tools with absolute paths outside the worktree.
|
|
351
|
+
|
|
352
|
+
**What's blocked:**
|
|
353
|
+
- `edit` with `/absolute/path/outside/worktree/file.ts`
|
|
354
|
+
- `write` with `/absolute/path/outside/worktree/new-file.ts`
|
|
355
|
+
|
|
356
|
+
**What's allowed:**
|
|
357
|
+
- Relative paths (`src/file.ts`) — resolve within worktree cwd
|
|
358
|
+
- Absolute paths inside the worktree boundary
|
|
359
|
+
|
|
360
|
+
This enforcement is automatic when `--worktree` is used. No configuration required. If the extension fails to generate (tmpdir permissions), a warning is logged and the session proceeds without protection.
|
|
361
|
+
|
|
362
|
+
---
|
|
363
|
+
|
|
241
364
|
## Dependency Mapping
|
|
242
365
|
|
|
243
366
|
Map bead dependencies to match the execution pipeline. The dep graph IS the wave plan.
|
|
@@ -274,20 +397,19 @@ epic
|
|
|
274
397
|
├── child-2 → explore-2 → impl-2 (reviewer via --job impl-2-job)
|
|
275
398
|
└── child-N → explore-N → impl-N (reviewer via --job impl-N-job)
|
|
276
399
|
```
|
|
277
|
-
Children within the same
|
|
400
|
+
Children (chains) within the same epic can run **in parallel** if they own disjoint files.
|
|
278
401
|
|
|
279
|
-
### Parallel
|
|
280
|
-
|
|
281
|
-
output (same parent), not on each other.
|
|
402
|
+
### Parallel chains (same stage)
|
|
403
|
+
Chains in the same stage share no intra-stage dependencies. They depend on the previous stage's output (same epic parent), not on each other.
|
|
282
404
|
```
|
|
283
|
-
#
|
|
405
|
+
# Stage 2 parallel executors (after shared Stage 1 explorer):
|
|
284
406
|
bd dep add impl-a explore # impl-a depends on explore, NOT on impl-b
|
|
285
407
|
bd dep add impl-b explore # impl-b depends on explore, NOT on impl-a
|
|
286
408
|
```
|
|
287
|
-
Each runs in its own `--worktree`. Merge
|
|
409
|
+
Each runs in its own `--worktree`. Merge via `sp epic merge <epic>` before Stage 3.
|
|
288
410
|
|
|
289
411
|
### Test beads (batched)
|
|
290
|
-
Tests are **batched** — one test bead covers all impls in a
|
|
412
|
+
Tests are **batched** — one test bead covers all impls in a stage, not per-impl.
|
|
291
413
|
The test bead depends on **all** impl beads it covers.
|
|
292
414
|
```
|
|
293
415
|
bd dep add tests impl-a
|
|
@@ -305,21 +427,27 @@ The review → fix loop is the mechanism for iterative quality improvement withi
|
|
|
305
427
|
### Standard loop
|
|
306
428
|
|
|
307
429
|
```
|
|
308
|
-
1. Executor
|
|
309
|
-
-> Job: exec-job
|
|
430
|
+
1. Executor provisions --worktree, implements, enters waiting.
|
|
431
|
+
-> Job: exec-job (KEEP ALIVE — do not stop)
|
|
310
432
|
|
|
311
433
|
2. Reviewer enters same worktree via --job exec-job.
|
|
312
|
-
->
|
|
434
|
+
-> sp ps shows the chain:
|
|
435
|
+
feature/unitAI-impl-executor · unitAI-impl
|
|
436
|
+
◐ exec-job executor waiting
|
|
437
|
+
└ ◐ rev-job reviewer starting
|
|
313
438
|
-> Auto-appends verdict (PASS/PARTIAL/FAIL) to bead notes.
|
|
314
439
|
|
|
315
|
-
3a. PASS:
|
|
440
|
+
3a. PASS:
|
|
441
|
+
-> Resume executor: "Reviewer PASS. Commit your changes."
|
|
442
|
+
-> Verify commit landed on branch (git log)
|
|
443
|
+
-> Stop reviewer, then stop executor
|
|
444
|
+
-> Merge via sp merge
|
|
316
445
|
|
|
317
446
|
3b. PARTIAL/FAIL:
|
|
318
|
-
->
|
|
319
|
-
->
|
|
320
|
-
->
|
|
321
|
-
->
|
|
322
|
-
-> Return to step 2 (reviewer on same job).
|
|
447
|
+
-> Resume the SAME executor: "Reviewer PARTIAL. Fix: <specific findings>"
|
|
448
|
+
-> Executor retains full conversation context — no re-dispatch needed
|
|
449
|
+
-> Executor applies fixes, enters waiting again
|
|
450
|
+
-> Return to step 2 (new reviewer on same --job)
|
|
323
451
|
|
|
324
452
|
4. Repeat until PASS.
|
|
325
453
|
```
|
|
@@ -327,42 +455,110 @@ The review → fix loop is the mechanism for iterative quality improvement withi
|
|
|
327
455
|
### Commands
|
|
328
456
|
|
|
329
457
|
```bash
|
|
330
|
-
# Step 1 — Executor with worktree
|
|
458
|
+
# Step 1 — Executor with worktree (enters waiting after first turn)
|
|
331
459
|
specialists run executor --worktree --bead unitAI-impl --context-depth 2 --background
|
|
332
460
|
# -> Job started: exec-job (e.g. 49adda)
|
|
461
|
+
# DO NOT sp stop — executor stays alive for the entire review cycle
|
|
333
462
|
|
|
334
|
-
# Step 2 — Reviewer enters same worktree
|
|
463
|
+
# Step 2 — Reviewer enters same worktree
|
|
335
464
|
specialists run reviewer --job 49adda --keep-alive --background --prompt "Review impl changes"
|
|
336
465
|
# -> Job started: rev-job
|
|
337
466
|
specialists result rev-job
|
|
338
|
-
# PARTIAL → go to step 3b
|
|
339
467
|
|
|
340
|
-
# Step
|
|
341
|
-
|
|
342
|
-
#
|
|
343
|
-
|
|
344
|
-
specialists
|
|
345
|
-
|
|
346
|
-
|
|
468
|
+
# Step 3a — PASS: resume executor to commit, then stop both
|
|
469
|
+
specialists resume 49adda "Reviewer PASS. Git add and commit your changes."
|
|
470
|
+
# Wait for commit, verify with: git log feature/unitAI-impl-executor --oneline -1
|
|
471
|
+
specialists stop rev-job
|
|
472
|
+
specialists stop 49adda
|
|
473
|
+
sp merge unitAI-impl --rebuild
|
|
474
|
+
|
|
475
|
+
# Step 3b — PARTIAL: resume executor with fix instructions (same session, full context)
|
|
476
|
+
specialists resume 49adda "Reviewer PARTIAL. Fix: <paste specific findings here>"
|
|
477
|
+
# Executor applies fixes, enters waiting again
|
|
478
|
+
# Dispatch new reviewer:
|
|
347
479
|
specialists run reviewer --job 49adda --keep-alive --background --prompt "Re-review after fix"
|
|
348
|
-
#
|
|
480
|
+
# Repeat until PASS
|
|
481
|
+
|
|
482
|
+
# After final PASS + commit + stop:
|
|
349
483
|
bd close unitAI-task --reason "Reviewer PASS. All findings addressed."
|
|
350
484
|
```
|
|
351
485
|
|
|
486
|
+
### Why resume instead of re-dispatch
|
|
487
|
+
|
|
488
|
+
Resuming the original executor/debugger is **always preferred** over dispatching a new fix executor:
|
|
489
|
+
|
|
490
|
+
- **Full context**: the specialist remembers what it changed and why — no re-discovery
|
|
491
|
+
- **No new bead needed**: no fix bead creation, no dep wiring overhead
|
|
492
|
+
- **Same worktree**: no `--job` coordination needed, it's already there
|
|
493
|
+
- **Cheaper**: one resumed turn vs a full new specialist session with context injection
|
|
494
|
+
|
|
495
|
+
Only dispatch a new fix executor when the original specialist is dead (crashed, stopped prematurely, or context exhausted at >80%).
|
|
496
|
+
|
|
352
497
|
### Key invariants
|
|
353
|
-
-
|
|
354
|
-
-
|
|
355
|
-
-
|
|
356
|
-
- Multiple reviewer →
|
|
498
|
+
- **Never stop the executor/debugger before reviewer verdict.** The specialist stays in `waiting` throughout the review cycle. Stopping prematurely kills the resume path and risks uncommitted changes.
|
|
499
|
+
- **Executors do not auto-commit.** After reviewer PASS, you must resume the executor with explicit commit instructions. Verify the commit landed before stopping.
|
|
500
|
+
- Each fix iteration uses `resume` on the same specialist — not a new child bead or new executor.
|
|
501
|
+
- Multiple reviewer → resume → re-review cycles are expected. The worktree and specialist session are stable across all cycles.
|
|
502
|
+
- Only stop after: (1) reviewer PASS, (2) executor committed, (3) commit verified on branch.
|
|
357
503
|
|
|
358
504
|
---
|
|
359
505
|
|
|
360
|
-
## Merge Protocol —
|
|
506
|
+
## Merge Protocol — Epic Publication
|
|
507
|
+
|
|
508
|
+
The orchestrator owns merge timing, but **no longer performs manual git merges**. Use `sp epic merge` or `sp merge` instead.
|
|
509
|
+
|
|
510
|
+
### The canonical path: `sp epic merge <epic-id>`
|
|
511
|
+
|
|
512
|
+
**This is the ONLY legal publication path for wave-bound chains.**
|
|
513
|
+
|
|
514
|
+
An epic is merge-gated: all chains must be terminal with reviewer PASS before publication. Use `sp epic merge` for:
|
|
515
|
+
|
|
516
|
+
- Publishing multiple chains under one epic (topological order)
|
|
517
|
+
- Ensuring merge gates are satisfied (no running jobs)
|
|
518
|
+
- PR mode (`--pr`) for staged publication
|
|
519
|
+
|
|
520
|
+
```bash
|
|
521
|
+
# Check epic readiness
|
|
522
|
+
sp epic status unitAI-3f7b
|
|
523
|
+
# Shows: chains, blockers, readiness state, reviewer verdicts
|
|
524
|
+
|
|
525
|
+
# Publish all epic-owned chains
|
|
526
|
+
sp epic merge unitAI-3f7b
|
|
527
|
+
# → merges in topological order, tsc gate after each
|
|
528
|
+
|
|
529
|
+
# PR mode (creates PR instead of direct merge)
|
|
530
|
+
sp epic merge unitAI-3f7b --pr
|
|
531
|
+
```
|
|
532
|
+
|
|
533
|
+
**What `sp epic merge` does:**
|
|
534
|
+
|
|
535
|
+
1. Reads epic state from observability SQLite
|
|
536
|
+
2. Checks all chains are terminal (`done`/`error`)
|
|
537
|
+
3. Verifies latest reviewer verdict is PASS
|
|
538
|
+
4. Topologically sorts chains by bead dependencies
|
|
539
|
+
5. For each chain: `git merge <branch> --no-ff --no-edit`
|
|
540
|
+
6. Runs `bunx tsc --noEmit` after each merge
|
|
541
|
+
7. Optionally creates PR with `--pr` flag
|
|
542
|
+
8. Updates epic state to `merged` on success
|
|
543
|
+
|
|
544
|
+
### When NOT to merge: `sp merge <chain-root>` is blocked
|
|
545
|
+
|
|
546
|
+
**Standalone chains only.** `sp merge <chain-root-bead>` works ONLY for chains NOT belonging to an unresolved epic:
|
|
547
|
+
|
|
548
|
+
```bash
|
|
549
|
+
# This FAILS if chain belongs to epic with status=open/resolving/merge_ready
|
|
550
|
+
sp merge unitAI-impl
|
|
551
|
+
# Error: Chain unitAI-impl belongs to unresolved epic unitAI-3f7b (status: resolving).
|
|
552
|
+
# Use 'sp epic merge unitAI-3f7b' to publish all chains together.
|
|
553
|
+
```
|
|
554
|
+
|
|
555
|
+
**Why this guard exists:**
|
|
361
556
|
|
|
362
|
-
|
|
363
|
-
|
|
557
|
+
1. **Merge gates are per-epic**: Publishing one chain without its siblings breaks the wave model.
|
|
558
|
+
2. **Topological order matters**: Chain A may depend on Chain B — merging A first breaks deps.
|
|
559
|
+
3. **Epics are explicit**: The epic bead ID is tracked in SQLite, enabling the guard.
|
|
364
560
|
|
|
365
|
-
### When to merge
|
|
561
|
+
### When to merge within a chain vs NOT
|
|
366
562
|
|
|
367
563
|
**Do NOT merge within a chain.** A chain is a sequence of specialists sharing one worktree:
|
|
368
564
|
executor → reviewer → fix → re-review. The worktree stays live throughout. No merge until
|
|
@@ -373,68 +569,49 @@ executor --worktree --bead impl ← creates worktree
|
|
|
373
569
|
reviewer --job <exec-job> ← enters same worktree (no merge)
|
|
374
570
|
executor --bead fix --job <exec-job> ← re-enters same worktree (no merge)
|
|
375
571
|
reviewer --job <exec-job> ← re-enters same worktree (no merge)
|
|
376
|
-
PASS → NOW
|
|
572
|
+
PASS → NOW run sp epic merge <epic>
|
|
377
573
|
```
|
|
378
574
|
|
|
379
|
-
**DO merge between
|
|
380
|
-
on master, you must merge first. The dep graph tells you: beads connected by `--job` are
|
|
381
|
-
one chain (same worktree, no merge). Beads connected by `bd dep add` across different
|
|
382
|
-
file scopes are separate waves (different worktrees, merge between them).
|
|
575
|
+
**DO merge between stages (via epic).** When the next stage's chains depend on this stage's code existing on master, merge the epic first. The dep graph tells you: beads connected by `--job` are one chain (same worktree, no merge). Beads connected by `bd dep add` across different file scopes are separate chains under the same epic.
|
|
383
576
|
|
|
384
577
|
### Planning context upfront
|
|
385
578
|
|
|
386
|
-
Before dispatching any
|
|
387
|
-
- **
|
|
388
|
-
- **
|
|
389
|
-
- **
|
|
579
|
+
Before dispatching any chains, identify:
|
|
580
|
+
- **Epics** — the top merge-gated identity (create epic-type bead first)
|
|
581
|
+
- **Chains** — worktree lineages that belong to the epic (use `--epic` for prep jobs)
|
|
582
|
+
- **Stages** — batches of independent chains ("Stage 1" / "Stage 2" are orchestrator speech)
|
|
390
583
|
|
|
391
|
-
The dep graph encodes this. If bead B depends on bead A and they touch different files,
|
|
392
|
-
they're separate waves with a merge point between them.
|
|
584
|
+
The dep graph encodes this. If bead B depends on bead A and they touch different files, they're separate chains under the same epic with a merge point between stages.
|
|
393
585
|
|
|
394
|
-
###
|
|
395
|
-
|
|
396
|
-
Merge in **dependency order** (first dep first), not completion order.
|
|
397
|
-
Parallel beads (disjoint files) can merge in any order within their wave.
|
|
586
|
+
### Epic lifecycle commands
|
|
398
587
|
|
|
399
588
|
```bash
|
|
400
|
-
#
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
cd /path/to/main/repo
|
|
404
|
-
|
|
405
|
-
# 2. Merge in dependency order
|
|
406
|
-
git merge feature/bead-a-executor # first dep in chain
|
|
407
|
-
npm run lint && npx tsc --noEmit # verify after each merge
|
|
408
|
-
git merge feature/bead-b-executor # second dep (parallel, disjoint files)
|
|
409
|
-
npm run lint && npx tsc --noEmit
|
|
589
|
+
# List epics with state
|
|
590
|
+
sp epic list
|
|
591
|
+
sp epic list --unresolved # show non-terminal epics
|
|
410
592
|
|
|
411
|
-
#
|
|
412
|
-
|
|
413
|
-
#
|
|
414
|
-
# → Keep the version from the earlier dep, discard the duplicate
|
|
415
|
-
# → Re-run lint + tsc after resolution
|
|
593
|
+
# Inspect one epic
|
|
594
|
+
sp epic status unitAI-3f7b
|
|
595
|
+
# Shows: persisted_state, readiness_state, chains[], blockers[], summary
|
|
416
596
|
|
|
417
|
-
#
|
|
418
|
-
|
|
597
|
+
# Transition states (manual)
|
|
598
|
+
sp epic resolve unitAI-3f7b # open → resolving
|
|
419
599
|
|
|
420
|
-
#
|
|
600
|
+
# Publish
|
|
601
|
+
sp epic merge unitAI-3f7b # merge_ready → merged
|
|
602
|
+
sp epic merge unitAI-3f7b --pr # PR mode
|
|
421
603
|
```
|
|
422
604
|
|
|
423
|
-
|
|
424
|
-
- Bead A blocks bead B → A's code must land in master before B's worktree branches from it
|
|
425
|
-
- Merging B before A: broken imports, missing symbols, silent type errors
|
|
426
|
-
- Parallel beads (disjoint files): order doesn't matter within the wave, but ALL must merge before the next wave
|
|
605
|
+
### Conflict handling
|
|
427
606
|
|
|
428
|
-
|
|
429
|
-
utility file (e.g. `job-root.ts`). This is expected — implementations should be identical.
|
|
430
|
-
Keep one, delete the duplicate during conflict resolution.
|
|
607
|
+
If merge hits a conflict:
|
|
431
608
|
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
609
|
+
1. Command fails with list of conflicting files
|
|
610
|
+
2. Resolve conflicts manually in your editor
|
|
611
|
+
3. Run `bunx tsc --noEmit` to verify
|
|
612
|
+
4. Continue with next chain (or re-run `sp epic merge <epic>` to resume)
|
|
613
|
+
|
|
614
|
+
**Common conflict pattern:** Parallel chains in the same stage may both create the same utility file (e.g. `job-root.ts`). This is expected — implementations should be identical. Keep one, delete the duplicate during conflict resolution.
|
|
438
615
|
|
|
439
616
|
---
|
|
440
617
|
|
|
@@ -446,6 +623,13 @@ The specialist reads:
|
|
|
446
623
|
- bead notes (including output appended by previous specialists in the chain)
|
|
447
624
|
- parent/ancestor bead context (controlled by `--context-depth`)
|
|
448
625
|
|
|
626
|
+
**Automatic context injection**: Runner injects ~3800 tokens of project memory at spawn:
|
|
627
|
+
- `.xtrm/memory.md` (SSOT: Do Not Repeat, How This Project Works, Active Context)
|
|
628
|
+
- `bd prime` output (workflow rules + all bd memories dump)
|
|
629
|
+
- GitNexus cheatsheet (when `.gitnexus/meta.json` exists — ~100 tokens)
|
|
630
|
+
|
|
631
|
+
This prevents specialists from rediscovering known gotchas on every run.
|
|
632
|
+
|
|
449
633
|
`--prompt` and `--bead` cannot be combined. When you need to give a specialist
|
|
450
634
|
specific instructions beyond what's in the bead description, update the bead notes first:
|
|
451
635
|
|
|
@@ -462,6 +646,9 @@ own bead + the immediate predecessor's output + one more level of context.
|
|
|
462
646
|
|
|
463
647
|
**`--no-beads`** — skip creating an auto-tracking sub-bead, but still reads the `--bead` input.
|
|
464
648
|
|
|
649
|
+
**Edit gate access**: Specialists with `--bead` automatically set `bead-claim:<id>` KV key,
|
|
650
|
+
enabling write access in worktrees without session-scoped claims. Cleared on run completion.
|
|
651
|
+
|
|
465
652
|
---
|
|
466
653
|
|
|
467
654
|
## Choosing the Right Specialist
|
|
@@ -486,7 +673,7 @@ Run `specialists list` to see what's available. Match by task type:
|
|
|
486
673
|
### Specialist selection notes
|
|
487
674
|
|
|
488
675
|
- **executor does not run tests** — it runs `lint + tsc` only. Tests belong to the reviewer or test-runner phase.
|
|
489
|
-
- **executor enters `waiting` after first turn** — `interactive: true` is now default.
|
|
676
|
+
- **executor enters `waiting` after first turn** — `interactive: true` is now default. **Never stop the executor before reviewer verdict.** Keep it alive so you can: (1) resume with fix instructions if reviewer says PARTIAL, (2) resume with "commit your changes" after reviewer PASS. Executors do not auto-commit — you must explicitly resume them to commit. Only `sp stop` after the commit is verified on the branch.
|
|
490
677
|
- **explorer** is READ_ONLY — its output auto-appends to the input bead's notes. No implementation.
|
|
491
678
|
- **reviewer** is best dispatched via `--job <exec-job> --prompt "..."` — it enters the same worktree to see exactly what was written. `--job` alone is not enough; `--prompt` or `--bead` is always required.
|
|
492
679
|
- **debugger** over **explorer** when you need root cause analysis — GitNexus call-chain tracing, ranked hypotheses, evidence-backed remediation.
|
|
@@ -538,7 +725,7 @@ specialists stop <job-id> # when satisfied
|
|
|
538
725
|
specialists run executor --worktree --bead unitAI-impl --context-depth 2 --background
|
|
539
726
|
```
|
|
540
727
|
|
|
541
|
-
### Monitoring with `sp ps`
|
|
728
|
+
### Monitoring with `sp ps` and `sp list --live`
|
|
542
729
|
|
|
543
730
|
Use `specialists ps` (alias `sp ps`) for job monitoring instead of manual JSON polling:
|
|
544
731
|
|
|
@@ -558,6 +745,23 @@ specialists ps <job-id>
|
|
|
558
745
|
# - >80% = CRITICAL (▲ indicator shown)
|
|
559
746
|
```
|
|
560
747
|
|
|
748
|
+
**Live tmux session selector (`sp list --live`):**
|
|
749
|
+
|
|
750
|
+
```bash
|
|
751
|
+
# Interactive selector for running/waiting tmux sessions
|
|
752
|
+
specialists list --live
|
|
753
|
+
# Shows: tmux session name, specialist, elapsed, status
|
|
754
|
+
# Arrow keys to select, Enter to attach
|
|
755
|
+
|
|
756
|
+
# Include dead sessions (PID or tmux gone)
|
|
757
|
+
specialists list --live --show-dead
|
|
758
|
+
# Dead sessions shown with 'dead' status instead of filtered out
|
|
759
|
+
```
|
|
760
|
+
|
|
761
|
+
Dead job detection (`is_dead`) is computed at read time — never persisted to avoid stale state. A job is dead when:
|
|
762
|
+
- PID no longer exists (`kill -0 <pid>` fails)
|
|
763
|
+
- tmux session gone (`tmux has-session -t <name>` fails or times out)
|
|
764
|
+
|
|
561
765
|
---
|
|
562
766
|
|
|
563
767
|
### Pi extensions and packages
|
|
@@ -596,109 +800,133 @@ specialists steer a1b2c3 "Do NOT audit. Write the actual file to disk now."
|
|
|
596
800
|
|
|
597
801
|
| Specialist | Enters `waiting` after | What to send via `resume` |
|
|
598
802
|
|-----------|----------------------|--------------------------|
|
|
599
|
-
| **executor** | First turn completion (may be partial if bailed early) | "proceed, this is additive", "
|
|
803
|
+
| **executor** | First turn completion (may be partial if bailed early) | "proceed, this is additive", "Reviewer PARTIAL. Fix: <findings>", or "Reviewer PASS. Git add and commit your changes." |
|
|
600
804
|
| **researcher** | Delivering research findings | Follow-up question, new angle, or "done, thanks" |
|
|
601
805
|
| **reviewer** | Delivering verdict (PASS/PARTIAL/FAIL) | Your response, clarification, or "accepted, close out" |
|
|
602
806
|
| **overthinker** | Phase 4 conclusion | Follow-up question, counter-argument, or "done, thanks" |
|
|
603
|
-
| **debugger** | Phase 3 fix attempt or Phase 4 verify result | Follow-up fix, "try different approach", or "done" |
|
|
807
|
+
| **debugger** | Phase 3 fix attempt or Phase 4 verify result | Follow-up fix, "try different approach", "Reviewer PASS. Git add and commit your changes.", or "done" |
|
|
604
808
|
| **sync-docs** | Audit report or targeted update result | "approve", "deny", or specific instructions |
|
|
605
809
|
|
|
606
810
|
> **Warning:** A job in `waiting` looks identical to a stalled job. **Always check with `sp ps`
|
|
607
811
|
> before killing a keep-alive job.**
|
|
608
812
|
|
|
813
|
+
> **Critical:** Never stop an executor or debugger before the reviewer delivers its verdict.
|
|
814
|
+
> Stopping prematurely: (1) kills the resume path for fix loops, (2) risks uncommitted changes
|
|
815
|
+
> (executors don't auto-commit), and (3) forces dispatching a new specialist instead of resuming.
|
|
816
|
+
|
|
609
817
|
```bash
|
|
610
818
|
# Check before stopping
|
|
611
819
|
specialists ps d4e5f6
|
|
612
820
|
# -> status: waiting ← healthy, expecting input
|
|
613
821
|
|
|
614
822
|
specialists resume d4e5f6 "What about backward compatibility?"
|
|
615
|
-
specialists stop d4e5f6 # only when truly done iterating
|
|
823
|
+
specialists stop d4e5f6 # only when truly done iterating — after reviewer PASS + commit verified
|
|
616
824
|
```
|
|
617
825
|
|
|
618
826
|
---
|
|
619
827
|
|
|
620
|
-
##
|
|
828
|
+
## Chain and Epic Orchestration
|
|
621
829
|
|
|
622
|
-
For multi-step work, dispatch
|
|
830
|
+
For multi-step work, dispatch chains under an **epic**.
|
|
623
831
|
|
|
624
|
-
A **
|
|
625
|
-
Waves are strictly sequential: **never start wave N+1 before wave N completes AND is merged**.
|
|
832
|
+
A **chain** is a worktree lineage (executor → reviewer → fix → re-review). Chains within the same epic may run in parallel **only if they are independent** (disjoint file scopes). Stages are strictly sequential: **never start Stage N+1 before Stage N completes AND is merged via `sp epic merge`**.
|
|
626
833
|
|
|
627
|
-
###
|
|
834
|
+
### Chain rules
|
|
628
835
|
|
|
629
|
-
1. **Sequence between
|
|
630
|
-
2. **Parallelize only within a
|
|
631
|
-
3. **Do not overlap
|
|
632
|
-
4. **Bead deps encode the pipeline.** The dependency graph should match
|
|
836
|
+
1. **Sequence between stages.** Prep (explorer/planner) → implementation chains → review → tests → doc sync.
|
|
837
|
+
2. **Parallelize only within a stage.** Chains that don't depend on each other may run together.
|
|
838
|
+
3. **Do not overlap stages.** Wait for every chain job, read results, update beads, merge epic.
|
|
839
|
+
4. **Bead deps encode the pipeline.** The dependency graph should match stage order.
|
|
633
840
|
5. **`--context-depth 2` for all chained runs.** Each specialist sees parent + predecessor.
|
|
634
|
-
6. **Merge
|
|
841
|
+
6. **Merge via `sp epic merge` is mandatory.** See Merge Protocol above.
|
|
635
842
|
|
|
636
|
-
### Polling
|
|
843
|
+
### Polling chains
|
|
637
844
|
|
|
638
845
|
```bash
|
|
639
|
-
specialists ps # list all jobs — shows
|
|
846
|
+
specialists ps # list all jobs — shows epic grouping, status, elapsed
|
|
640
847
|
specialists ps abc123 # inspect specific job (full detail)
|
|
641
|
-
specialists ps
|
|
848
|
+
specialists ps --follow # live dashboard with epic grouping
|
|
642
849
|
```
|
|
643
850
|
|
|
644
|
-
|
|
851
|
+
`sp ps` shows epic-level grouping:
|
|
852
|
+
|
|
853
|
+
```
|
|
854
|
+
◆ epic:unitAI-3f7b · merge_ready · state:resolving · prep done=2/2 · chains pass=3/3
|
|
855
|
+
prep:exp-1 · done
|
|
856
|
+
prep:plan-2 · done
|
|
857
|
+
chain:impl-a (reviewer PASS) · branch:feature/unitAI-impl-a-executor
|
|
858
|
+
chain:impl-b (reviewer PASS) · branch:feature/unitAI-impl-b-executor
|
|
859
|
+
chain:impl-c (reviewer PASS) · branch:feature/unitAI-impl-c-executor
|
|
860
|
+
```
|
|
861
|
+
|
|
862
|
+
A stage is complete when every chain is terminal AND you have:
|
|
645
863
|
1. Read results: `specialists result <job-id>` for each
|
|
646
864
|
2. Updated/closed beads as needed
|
|
647
|
-
3.
|
|
865
|
+
3. Published via `sp epic merge <epic-id>`
|
|
648
866
|
|
|
649
|
-
### Canonical multi-
|
|
867
|
+
### Canonical multi-stage example
|
|
650
868
|
|
|
651
869
|
```bash
|
|
652
|
-
# 0.
|
|
653
|
-
bd create --title "Add worktree isolation to executor" --type
|
|
654
|
-
# -> unitAI-
|
|
870
|
+
# 0. Create epic bead (top merge-gated identity)
|
|
871
|
+
bd create --title "Add worktree isolation to executor" --type epic --priority 1
|
|
872
|
+
# -> unitAI-3f7b
|
|
655
873
|
|
|
656
|
-
# 1.
|
|
874
|
+
# 1. Create prep and impl beads as children of the epic
|
|
657
875
|
bd create --title "Explore: map job run architecture" --type task --priority 2 # -> unitAI-exp
|
|
658
|
-
bd dep add exp
|
|
876
|
+
bd dep add exp 3f7b
|
|
659
877
|
bd create --title "Implement: worktree isolation" --type task --priority 2 # -> unitAI-impl
|
|
660
878
|
bd dep add impl exp
|
|
661
|
-
# Note: reviewer runs via --job,
|
|
879
|
+
# Note: reviewer runs via --job, inherits epic from impl bead.parent
|
|
662
880
|
|
|
663
|
-
#
|
|
664
|
-
specialists run explorer --bead unitAI-exp --context-depth 2 --background
|
|
881
|
+
# Stage 1 — Explorer (prep job, declares epic explicitly)
|
|
882
|
+
specialists run explorer --bead unitAI-exp --epic unitAI-3f7b --context-depth 2 --background
|
|
665
883
|
# -> Job started: job1
|
|
666
884
|
specialists result job1
|
|
667
885
|
|
|
668
|
-
# [MERGE]
|
|
886
|
+
# [NO MERGE] Prep stage has no worktrees to merge
|
|
669
887
|
|
|
670
|
-
#
|
|
888
|
+
# Stage 2 — Executor (chain inherits epic from bead.parent)
|
|
671
889
|
specialists run executor --worktree --bead unitAI-impl --context-depth 2 --background
|
|
672
890
|
# -> Job started: job2 (worktree: .worktrees/unitAI-impl/unitAI-impl-executor)
|
|
891
|
+
# epic_id = bead.parent (unitAI-3f7b)
|
|
673
892
|
specialists result job2
|
|
674
893
|
|
|
675
|
-
#
|
|
676
|
-
|
|
677
|
-
npm run lint && npx tsc --noEmit && npm run build
|
|
678
|
-
|
|
679
|
-
# Wave 3 — Reviewer (no bead, uses --job)
|
|
680
|
-
specialists run reviewer --job job2 --keep-alive --background
|
|
894
|
+
# Stage 3 — Reviewer (uses --job, same worktree)
|
|
895
|
+
specialists run reviewer --job job2 --keep-alive --background --prompt "Review implementation"
|
|
681
896
|
# -> Job started: job3
|
|
682
897
|
specialists result job3
|
|
683
|
-
# PASS →
|
|
898
|
+
# PASS → ready for epic merge. PARTIAL → fix loop.
|
|
684
899
|
|
|
685
|
-
#
|
|
686
|
-
bd create --title "
|
|
687
|
-
bd dep add
|
|
688
|
-
specialists run
|
|
900
|
+
# Stage 4 — Fix loop (if PARTIAL)
|
|
901
|
+
bd create --title "Fix: reviewer gaps on impl" --type bug --priority 1 # -> unitAI-fix1
|
|
902
|
+
bd dep add fix1 impl
|
|
903
|
+
specialists run executor --bead fix1 --job job2 --context-depth 2 --background
|
|
904
|
+
# Re-review
|
|
905
|
+
specialists run reviewer --job job2 --keep-alive --background --prompt "Re-review after fix"
|
|
906
|
+
|
|
907
|
+
# [MERGE] Publish epic
|
|
908
|
+
sp epic status unitAI-3f7b # verify readiness: merge_ready, all chains PASS
|
|
909
|
+
sp epic merge unitAI-3f7b --rebuild
|
|
689
910
|
|
|
690
911
|
# Close
|
|
691
|
-
bd close
|
|
912
|
+
bd close 3f7b --reason "Worktree isolation implemented. Reviewer PASS. Epic merged."
|
|
692
913
|
```
|
|
693
914
|
|
|
694
|
-
### Within-
|
|
915
|
+
### Within-stage parallelism (multiple chains)
|
|
695
916
|
|
|
696
917
|
```bash
|
|
697
|
-
# Parallel executors — disjoint files, same parent
|
|
918
|
+
# Parallel executors — disjoint files, same parent epic
|
|
919
|
+
bd create --title "Implement: component A" --type task --priority 2 # -> unitAI-impl-a
|
|
920
|
+
bd dep add impl-a exp
|
|
921
|
+
bd create --title "Implement: component B" --type task --priority 2 # -> unitAI-impl-b
|
|
922
|
+
bd dep add impl-b exp
|
|
923
|
+
|
|
698
924
|
specialists run executor --worktree --bead unitAI-impl-a --context-depth 2 --background
|
|
699
925
|
specialists run executor --worktree --bead unitAI-impl-b --context-depth 2 --background
|
|
700
|
-
# Each runs in its own worktree.
|
|
701
|
-
|
|
926
|
+
# Each runs in its own worktree, both belong to unitAI-3f7b (via bead.parent)
|
|
927
|
+
|
|
928
|
+
# Do NOT start next stage until BOTH complete AND epic is merged
|
|
929
|
+
sp epic merge unitAI-3f7b
|
|
702
930
|
```
|
|
703
931
|
|
|
704
932
|
---
|
|
@@ -708,7 +936,7 @@ specialists run executor --worktree --bead unitAI-impl-b --context-depth 2 --bac
|
|
|
708
936
|
### 1. Route work — don't explore or implement yourself
|
|
709
937
|
Discovery goes to **explorer** first; implementation goes to **executor** only after discovery is done.
|
|
710
938
|
|
|
711
|
-
### 2. Validate combined output after each
|
|
939
|
+
### 2. Validate combined output after each stage
|
|
712
940
|
```bash
|
|
713
941
|
npm run lint # project quality gate
|
|
714
942
|
npx tsc --noEmit # type check
|
|
@@ -726,8 +954,8 @@ Options when a specialist fails:
|
|
|
726
954
|
- **Switch**: e.g. sync-docs stalls → try executor
|
|
727
955
|
- **Stop and report** to the user before doing it yourself
|
|
728
956
|
|
|
729
|
-
### 4. Merge
|
|
730
|
-
See Merge Protocol above.
|
|
957
|
+
### 4. Merge via epic (CRITICAL)
|
|
958
|
+
See Merge Protocol above. Use `sp epic merge <epic-id>` — no exceptions.
|
|
731
959
|
|
|
732
960
|
### 5. Run drift detection after doc-heavy sessions
|
|
733
961
|
```bash
|