@jaggerxtrm/specialists 3.5.1 → 3.6.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.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 +319 -120
- 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 +10203 -5881
- 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.5
|
|
13
|
+
synced_at: zz22-docs
|
|
13
14
|
---
|
|
14
15
|
|
|
15
16
|
# Specialists Usage
|
|
@@ -35,8 +36,8 @@ 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.
|
|
42
43
|
|
|
@@ -69,18 +70,31 @@ specialists run <name> --bead <id> # foreground run (streams output)
|
|
|
69
70
|
specialists run <name> --bead <id> --background # background run
|
|
70
71
|
specialists run <name> --bead <id> --worktree # isolated worktree (edit-capable specialists)
|
|
71
72
|
specialists run <name> --bead <id> --job <job-id> # reuse another job's worktree
|
|
73
|
+
specialists run <name> --bead <id> --epic <epic-id> # explicitly declare epic membership
|
|
72
74
|
specialists run <name> --prompt "..." # ad-hoc (no bead tracking)
|
|
73
75
|
specialists run <name> --bead <id> --keep-alive # keep session alive after first turn
|
|
74
76
|
specialists run <name> --bead <id> --context-depth 2 # inject parent bead context
|
|
75
77
|
|
|
76
78
|
# Monitoring
|
|
77
|
-
specialists ps # list all jobs (status, specialist, elapsed, bead)
|
|
79
|
+
specialists ps # list all jobs (status, specialist, elapsed, bead, epic)
|
|
78
80
|
specialists ps <job-id> # inspect single job (full detail + ctx% badge)
|
|
79
81
|
specialists feed -f # tail merged feed (all jobs) — shows [ctx%] context window usage
|
|
80
82
|
specialists feed <job-id> # events for a specific job
|
|
81
83
|
specialists result <job-id> # final output text
|
|
82
84
|
specialists status --job <job-id> # single-job detail view (legacy — prefer `sp ps <id>`)
|
|
83
85
|
|
|
86
|
+
# Epic lifecycle (canonical publication path)
|
|
87
|
+
specialists epic list [--unresolved] # list epics with lifecycle state
|
|
88
|
+
specialists epic status <epic-id> # show chains, blockers, readiness
|
|
89
|
+
specialists epic resolve <epic-id> # transition open -> resolving
|
|
90
|
+
specialists epic merge <epic-id> [--pr] # publish all epic-owned chains
|
|
91
|
+
|
|
92
|
+
# Merge (for standalone chains only)
|
|
93
|
+
specialists merge <chain-root-bead> [--rebuild] # publish ONE standalone chain
|
|
94
|
+
|
|
95
|
+
# Session close (chain-aware, epic-aware)
|
|
96
|
+
specialists end [--pr] # close session, publish via merge or PR
|
|
97
|
+
|
|
84
98
|
# Interaction
|
|
85
99
|
specialists steer <job-id> "new direction" # redirect ANY running job mid-run
|
|
86
100
|
specialists resume <job-id> "next task" # resume a waiting keep-alive job
|
|
@@ -96,6 +110,62 @@ specialists init --no-xtrm-check # skip xtrm prerequisite check (CI
|
|
|
96
110
|
|
|
97
111
|
---
|
|
98
112
|
|
|
113
|
+
## Taxonomy: Job | Chain | Epic
|
|
114
|
+
|
|
115
|
+
The specialists orchestration model uses three levels:
|
|
116
|
+
|
|
117
|
+
| Term | Definition | Persisted? | Merge scope |
|
|
118
|
+
|------|------------|:----------:|:-----------:|
|
|
119
|
+
| **Job** | One specialist run (atomic execution unit) | Yes (SQLite + files) | — |
|
|
120
|
+
| **Chain** | Worktree lineage: executor → reviewer → fix → re-review (seeded by edit-capable specialist) | Yes (`worktree_owner_job_id`) | `sp merge <chain-root>` |
|
|
121
|
+
| **Epic** | Top merge-gated identity that owns chains across stages | Yes (`epic_runs` table) | `sp epic merge <epic>` |
|
|
122
|
+
| **Wave** | Human shorthand for dispatch batches ("Wave 1", "Wave 2b") — **speech only, NOT persisted** | No | — |
|
|
123
|
+
|
|
124
|
+
### Key relationships
|
|
125
|
+
|
|
126
|
+
- **Chains belong to epics**: When `--bead` is used, the chain defaults to the bead's parent epic. Override with `--epic <id>`.
|
|
127
|
+
- **Jobs belong to chains**: Jobs sharing a `worktree_owner_job_id` form one chain.
|
|
128
|
+
- **Merge through epics**: `sp epic merge <epic-id>` is the **canonical publication path** for wave-bound chains.
|
|
129
|
+
- **Standalone chains**: `sp merge <chain-root-bead>` works only for chains NOT belonging to an unresolved epic.
|
|
130
|
+
|
|
131
|
+
### Epic lifecycle
|
|
132
|
+
|
|
133
|
+
```
|
|
134
|
+
open → resolving → merge_ready → merged
|
|
135
|
+
↘ failed
|
|
136
|
+
↘ abandoned
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
| State | Meaning | Chains mergeable? |
|
|
140
|
+
|-------|---------|:-----------------:|
|
|
141
|
+
| `open` | Epic created, chains not yet running | — |
|
|
142
|
+
| `resolving` | Chains are actively running | ✗ |
|
|
143
|
+
| `merge_ready` | All chains terminal, reviewer PASS | ✓ (via `sp epic merge`) |
|
|
144
|
+
| `merged` | Publication complete | — |
|
|
145
|
+
| `failed` | One or more chains failed | — |
|
|
146
|
+
| `abandoned` | Cancelled without merge | — |
|
|
147
|
+
|
|
148
|
+
### Migration from "waves" vocabulary
|
|
149
|
+
|
|
150
|
+
**Old terminology → New terminology:**
|
|
151
|
+
|
|
152
|
+
| Old | New | Notes |
|
|
153
|
+
|-----|-----|-------|
|
|
154
|
+
| "Wave 1" | Stage 1 / Prep phase | Speech shorthand still works — just not persisted |
|
|
155
|
+
| "Wave 2" | Implementation chains | Chains are the operative unit, grouped by epic |
|
|
156
|
+
| "Between waves merge" | `sp epic merge` | Epic is the merge-gated identity |
|
|
157
|
+
| "Parallel in wave" | Parallel chains under epic | Use `--epic` to declare membership explicitly |
|
|
158
|
+
|
|
159
|
+
**Why this change?**
|
|
160
|
+
|
|
161
|
+
1. **Waves had no identity**: "Wave 2" was just speech — no code could track it.
|
|
162
|
+
2. **Merge gates were implicit**: Operators had to remember which chains to merge together.
|
|
163
|
+
3. **Epics are explicit**: An epic bead ID persists, enabling `sp epic status` and `sp epic merge`.
|
|
164
|
+
|
|
165
|
+
**Backward compatibility**: All existing workflows work unchanged. The new vocabulary is additive — you can still think in waves, but the system tracks epics.
|
|
166
|
+
|
|
167
|
+
---
|
|
168
|
+
|
|
99
169
|
## Chained Bead Pipeline
|
|
100
170
|
|
|
101
171
|
This is the **standard for ALL tracked work**. Every specialist run gets its own child bead.
|
|
@@ -145,7 +215,8 @@ specialists run explorer --bead abc-exp --context-depth 2 --background
|
|
|
145
215
|
# Explorer output auto-appends to abc-exp notes (READ_ONLY behavior)
|
|
146
216
|
specialists result e1f2g3
|
|
147
217
|
|
|
148
|
-
# 4. [MERGE] Merge any worktree branches from Wave 1 into master
|
|
218
|
+
# 4. [MERGE] Merge any worktree branches from Wave 1 into master
|
|
219
|
+
# READ_ONLY waves have no worktrees to merge
|
|
149
220
|
|
|
150
221
|
# 5. Wave 2 — Executor
|
|
151
222
|
specialists run executor --worktree --bead abc-impl --context-depth 2 --background
|
|
@@ -153,7 +224,8 @@ specialists run executor --worktree --bead abc-impl --context-depth 2 --backgrou
|
|
|
153
224
|
# Executor sees: abc-impl + abc-exp (with explorer notes) + abc via context-depth
|
|
154
225
|
# Executor self-appends output to abc-impl notes, closes abc-impl on completion
|
|
155
226
|
|
|
156
|
-
# 6. [MERGE] Merge
|
|
227
|
+
# 6. [MERGE] Merge impl worktree branch into master
|
|
228
|
+
sp merge abc-impl --rebuild
|
|
157
229
|
|
|
158
230
|
# 7. Wave 3 — Reviewer (no separate bead — uses --job + --prompt to enter executor's worktree)
|
|
159
231
|
specialists run reviewer --job a1b2c3 --keep-alive --background --prompt "Review the token refresh fix"
|
|
@@ -185,18 +257,34 @@ bd close abc --reason "Fixed: token refresh retries on 401. Reviewer PASS."
|
|
|
185
257
|
|
|
186
258
|
---
|
|
187
259
|
|
|
188
|
-
## --job and --
|
|
260
|
+
## --job, --worktree, and --epic Semantics
|
|
189
261
|
|
|
190
|
-
These flags control **workspace isolation**. Executors run in isolated git worktrees so
|
|
191
|
-
concurrent jobs don't corrupt shared files.
|
|
262
|
+
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
263
|
|
|
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 |
|
|
264
|
+
| Flag | Semantics | Creates worktree? | Sets epic? |
|
|
265
|
+
|------|-----------|:----------------:|:----------:|
|
|
266
|
+
| `--worktree` | Provision a new isolated workspace; requires `--bead` | Yes | Inherited from bead.parent |
|
|
267
|
+
| `--job <id>` | Reuse the workspace of an existing job | No | Inherited from target job |
|
|
268
|
+
| `--epic <id>` | Explicitly declare epic membership | No | Yes (overrides default) |
|
|
197
269
|
|
|
198
270
|
`--worktree` and `--job` are **mutually exclusive**. Specifying both exits with an error.
|
|
199
271
|
|
|
272
|
+
### Epic membership
|
|
273
|
+
|
|
274
|
+
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>`:
|
|
275
|
+
|
|
276
|
+
```bash
|
|
277
|
+
# Chain inherits bead.parent as epic
|
|
278
|
+
specialists run executor --worktree --bead unitAI-impl
|
|
279
|
+
# → epic_id = bead.parent (if epic-type)
|
|
280
|
+
|
|
281
|
+
# Explicit epic declaration (e.g., prep job with non-epic parent)
|
|
282
|
+
specialists run explorer --bead prep-task.1 --epic unitAI-3f7b
|
|
283
|
+
# → epic_id = unitAI-3f7b (explicit override)
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
**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.
|
|
287
|
+
|
|
200
288
|
### `--worktree`
|
|
201
289
|
|
|
202
290
|
Provisions a new git worktree + branch for the specialist run. Branch name is derived
|
|
@@ -222,9 +310,25 @@ specialists run reviewer --job 49adda --keep-alive --background
|
|
|
222
310
|
specialists run executor --bead hgpu.3-fix --job 49adda --context-depth 2 --background
|
|
223
311
|
```
|
|
224
312
|
|
|
225
|
-
**Concurrency guard:**
|
|
226
|
-
|
|
227
|
-
|
|
313
|
+
**Concurrency guard (MEDIUM/HIGH specialists):**
|
|
314
|
+
|
|
315
|
+
Blocked from entering while target job is `starting` or `running` — prevents concurrent file corruption.
|
|
316
|
+
|
|
317
|
+
| Target status | MEDIUM/HIGH | READ_ONLY/LOW |
|
|
318
|
+
|---------------|:-----------:|:-------------:|
|
|
319
|
+
| `starting` | ✗ Blocked | ✓ Allowed |
|
|
320
|
+
| `running` | ✗ Blocked | ✓ Allowed |
|
|
321
|
+
| `waiting` | ✓ Allowed | ✓ Allowed |
|
|
322
|
+
| `done`/`error`/`cancelled` | ✓ Allowed | ✓ Allowed |
|
|
323
|
+
| Unknown | ✗ Blocked (conservative) | ✓ Allowed |
|
|
324
|
+
|
|
325
|
+
**Bypass with `--force-job`:**
|
|
326
|
+
|
|
327
|
+
```bash
|
|
328
|
+
specialists run executor --job 49adda --force-job --bead fix-123
|
|
329
|
+
```
|
|
330
|
+
|
|
331
|
+
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
332
|
|
|
229
333
|
### When to use each flag
|
|
230
334
|
|
|
@@ -233,11 +337,29 @@ specialists run executor --bead hgpu.3-fix --job 49adda --context-depth 2 --back
|
|
|
233
337
|
| First executor run for a task | `--worktree --bead <impl-bead>` |
|
|
234
338
|
| Reviewer on executor's output | `--job <exec-job-id>` (no `--worktree`) |
|
|
235
339
|
| Fix executor after reviewer PARTIAL | `--bead <fix-bead> --job <exec-job-id>` |
|
|
340
|
+
| Force entry to blocked worktree | `--bead <fix-bead> --job <exec-job-id> --force-job` |
|
|
341
|
+
| Prep job belonging to epic (non-epic parent) | `--bead <prep-bead> --epic <epic-id>` |
|
|
236
342
|
| Explorer (READ_ONLY) | Neither — explorers don't need worktrees |
|
|
237
343
|
| Overthinker, planner, debugger | Neither — read-only and interactive specialists |
|
|
238
344
|
|
|
239
345
|
---
|
|
240
346
|
|
|
347
|
+
### Worktree write-boundary enforcement
|
|
348
|
+
|
|
349
|
+
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.
|
|
350
|
+
|
|
351
|
+
**What's blocked:**
|
|
352
|
+
- `edit` with `/absolute/path/outside/worktree/file.ts`
|
|
353
|
+
- `write` with `/absolute/path/outside/worktree/new-file.ts`
|
|
354
|
+
|
|
355
|
+
**What's allowed:**
|
|
356
|
+
- Relative paths (`src/file.ts`) — resolve within worktree cwd
|
|
357
|
+
- Absolute paths inside the worktree boundary
|
|
358
|
+
|
|
359
|
+
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.
|
|
360
|
+
|
|
361
|
+
---
|
|
362
|
+
|
|
241
363
|
## Dependency Mapping
|
|
242
364
|
|
|
243
365
|
Map bead dependencies to match the execution pipeline. The dep graph IS the wave plan.
|
|
@@ -274,20 +396,19 @@ epic
|
|
|
274
396
|
├── child-2 → explore-2 → impl-2 (reviewer via --job impl-2-job)
|
|
275
397
|
└── child-N → explore-N → impl-N (reviewer via --job impl-N-job)
|
|
276
398
|
```
|
|
277
|
-
Children within the same
|
|
399
|
+
Children (chains) within the same epic can run **in parallel** if they own disjoint files.
|
|
278
400
|
|
|
279
|
-
### Parallel
|
|
280
|
-
|
|
281
|
-
output (same parent), not on each other.
|
|
401
|
+
### Parallel chains (same stage)
|
|
402
|
+
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
403
|
```
|
|
283
|
-
#
|
|
404
|
+
# Stage 2 parallel executors (after shared Stage 1 explorer):
|
|
284
405
|
bd dep add impl-a explore # impl-a depends on explore, NOT on impl-b
|
|
285
406
|
bd dep add impl-b explore # impl-b depends on explore, NOT on impl-a
|
|
286
407
|
```
|
|
287
|
-
Each runs in its own `--worktree`. Merge
|
|
408
|
+
Each runs in its own `--worktree`. Merge via `sp epic merge <epic>` before Stage 3.
|
|
288
409
|
|
|
289
410
|
### Test beads (batched)
|
|
290
|
-
Tests are **batched** — one test bead covers all impls in a
|
|
411
|
+
Tests are **batched** — one test bead covers all impls in a stage, not per-impl.
|
|
291
412
|
The test bead depends on **all** impl beads it covers.
|
|
292
413
|
```
|
|
293
414
|
bd dep add tests impl-a
|
|
@@ -357,12 +478,62 @@ bd close unitAI-task --reason "Reviewer PASS. All findings addressed."
|
|
|
357
478
|
|
|
358
479
|
---
|
|
359
480
|
|
|
360
|
-
## Merge Protocol —
|
|
481
|
+
## Merge Protocol — Epic Publication
|
|
482
|
+
|
|
483
|
+
The orchestrator owns merge timing, but **no longer performs manual git merges**. Use `sp epic merge` or `sp merge` instead.
|
|
361
484
|
|
|
362
|
-
The
|
|
363
|
-
time means downstream specialists branch from stale master and miss upstream code.
|
|
485
|
+
### The canonical path: `sp epic merge <epic-id>`
|
|
364
486
|
|
|
365
|
-
|
|
487
|
+
**This is the ONLY legal publication path for wave-bound chains.**
|
|
488
|
+
|
|
489
|
+
An epic is merge-gated: all chains must be terminal with reviewer PASS before publication. Use `sp epic merge` for:
|
|
490
|
+
|
|
491
|
+
- Publishing multiple chains under one epic (topological order)
|
|
492
|
+
- Ensuring merge gates are satisfied (no running jobs)
|
|
493
|
+
- PR mode (`--pr`) for staged publication
|
|
494
|
+
|
|
495
|
+
```bash
|
|
496
|
+
# Check epic readiness
|
|
497
|
+
sp epic status unitAI-3f7b
|
|
498
|
+
# Shows: chains, blockers, readiness state, reviewer verdicts
|
|
499
|
+
|
|
500
|
+
# Publish all epic-owned chains
|
|
501
|
+
sp epic merge unitAI-3f7b
|
|
502
|
+
# → merges in topological order, tsc gate after each
|
|
503
|
+
|
|
504
|
+
# PR mode (creates PR instead of direct merge)
|
|
505
|
+
sp epic merge unitAI-3f7b --pr
|
|
506
|
+
```
|
|
507
|
+
|
|
508
|
+
**What `sp epic merge` does:**
|
|
509
|
+
|
|
510
|
+
1. Reads epic state from observability SQLite
|
|
511
|
+
2. Checks all chains are terminal (`done`/`error`)
|
|
512
|
+
3. Verifies latest reviewer verdict is PASS
|
|
513
|
+
4. Topologically sorts chains by bead dependencies
|
|
514
|
+
5. For each chain: `git merge <branch> --no-ff --no-edit`
|
|
515
|
+
6. Runs `bunx tsc --noEmit` after each merge
|
|
516
|
+
7. Optionally creates PR with `--pr` flag
|
|
517
|
+
8. Updates epic state to `merged` on success
|
|
518
|
+
|
|
519
|
+
### When NOT to merge: `sp merge <chain-root>` is blocked
|
|
520
|
+
|
|
521
|
+
**Standalone chains only.** `sp merge <chain-root-bead>` works ONLY for chains NOT belonging to an unresolved epic:
|
|
522
|
+
|
|
523
|
+
```bash
|
|
524
|
+
# This FAILS if chain belongs to epic with status=open/resolving/merge_ready
|
|
525
|
+
sp merge unitAI-impl
|
|
526
|
+
# Error: Chain unitAI-impl belongs to unresolved epic unitAI-3f7b (status: resolving).
|
|
527
|
+
# Use 'sp epic merge unitAI-3f7b' to publish all chains together.
|
|
528
|
+
```
|
|
529
|
+
|
|
530
|
+
**Why this guard exists:**
|
|
531
|
+
|
|
532
|
+
1. **Merge gates are per-epic**: Publishing one chain without its siblings breaks the wave model.
|
|
533
|
+
2. **Topological order matters**: Chain A may depend on Chain B — merging A first breaks deps.
|
|
534
|
+
3. **Epics are explicit**: The epic bead ID is tracked in SQLite, enabling the guard.
|
|
535
|
+
|
|
536
|
+
### When to merge within a chain vs NOT
|
|
366
537
|
|
|
367
538
|
**Do NOT merge within a chain.** A chain is a sequence of specialists sharing one worktree:
|
|
368
539
|
executor → reviewer → fix → re-review. The worktree stays live throughout. No merge until
|
|
@@ -373,68 +544,49 @@ executor --worktree --bead impl ← creates worktree
|
|
|
373
544
|
reviewer --job <exec-job> ← enters same worktree (no merge)
|
|
374
545
|
executor --bead fix --job <exec-job> ← re-enters same worktree (no merge)
|
|
375
546
|
reviewer --job <exec-job> ← re-enters same worktree (no merge)
|
|
376
|
-
PASS → NOW
|
|
547
|
+
PASS → NOW run sp epic merge <epic>
|
|
377
548
|
```
|
|
378
549
|
|
|
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).
|
|
550
|
+
**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
551
|
|
|
384
552
|
### Planning context upfront
|
|
385
553
|
|
|
386
|
-
Before dispatching any
|
|
387
|
-
- **
|
|
388
|
-
- **
|
|
389
|
-
- **
|
|
390
|
-
|
|
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.
|
|
554
|
+
Before dispatching any chains, identify:
|
|
555
|
+
- **Epics** — the top merge-gated identity (create epic-type bead first)
|
|
556
|
+
- **Chains** — worktree lineages that belong to the epic (use `--epic` for prep jobs)
|
|
557
|
+
- **Stages** — batches of independent chains ("Stage 1" / "Stage 2" are orchestrator speech)
|
|
393
558
|
|
|
394
|
-
|
|
559
|
+
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.
|
|
395
560
|
|
|
396
|
-
|
|
397
|
-
Parallel beads (disjoint files) can merge in any order within their wave.
|
|
561
|
+
### Epic lifecycle commands
|
|
398
562
|
|
|
399
563
|
```bash
|
|
400
|
-
#
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
cd /path/to/main/repo
|
|
564
|
+
# List epics with state
|
|
565
|
+
sp epic list
|
|
566
|
+
sp epic list --unresolved # show non-terminal epics
|
|
404
567
|
|
|
405
|
-
#
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
git merge feature/bead-b-executor # second dep (parallel, disjoint files)
|
|
409
|
-
npm run lint && npx tsc --noEmit
|
|
568
|
+
# Inspect one epic
|
|
569
|
+
sp epic status unitAI-3f7b
|
|
570
|
+
# Shows: persisted_state, readiness_state, chains[], blockers[], summary
|
|
410
571
|
|
|
411
|
-
#
|
|
412
|
-
|
|
413
|
-
# (e.g. job-root.ts created by two parallel beads)
|
|
414
|
-
# → Keep the version from the earlier dep, discard the duplicate
|
|
415
|
-
# → Re-run lint + tsc after resolution
|
|
572
|
+
# Transition states (manual)
|
|
573
|
+
sp epic resolve unitAI-3f7b # open → resolving
|
|
416
574
|
|
|
417
|
-
#
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
# 5. Start Wave N+1
|
|
575
|
+
# Publish
|
|
576
|
+
sp epic merge unitAI-3f7b # merge_ready → merged
|
|
577
|
+
sp epic merge unitAI-3f7b --pr # PR mode
|
|
421
578
|
```
|
|
422
579
|
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
- Parallel beads (disjoint files): order doesn't matter within the wave, but ALL must merge before the next wave
|
|
580
|
+
### Conflict handling
|
|
581
|
+
|
|
582
|
+
If merge hits a conflict:
|
|
427
583
|
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
584
|
+
1. Command fails with list of conflicting files
|
|
585
|
+
2. Resolve conflicts manually in your editor
|
|
586
|
+
3. Run `bunx tsc --noEmit` to verify
|
|
587
|
+
4. Continue with next chain (or re-run `sp epic merge <epic>` to resume)
|
|
431
588
|
|
|
432
|
-
**
|
|
433
|
-
`init.ts`), their worktree branches will conflict on merge. Either sequence them as separate
|
|
434
|
-
waves, or accept manual conflict resolution. When resolving: copy the incoming version from
|
|
435
|
-
the worktree (`cat /path/to/.worktrees/.../file > main/file`), then re-apply missing changes
|
|
436
|
-
from the other branch. **Always verify your cwd is the main repo** — shell state can drift
|
|
437
|
-
into a worktree directory after merge operations.
|
|
589
|
+
**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
590
|
|
|
439
591
|
---
|
|
440
592
|
|
|
@@ -446,6 +598,13 @@ The specialist reads:
|
|
|
446
598
|
- bead notes (including output appended by previous specialists in the chain)
|
|
447
599
|
- parent/ancestor bead context (controlled by `--context-depth`)
|
|
448
600
|
|
|
601
|
+
**Automatic context injection**: Runner injects ~3800 tokens of project memory at spawn:
|
|
602
|
+
- `.xtrm/memory.md` (SSOT: Do Not Repeat, How This Project Works, Active Context)
|
|
603
|
+
- `bd prime` output (workflow rules + all bd memories dump)
|
|
604
|
+
- GitNexus cheatsheet (when `.gitnexus/meta.json` exists — ~100 tokens)
|
|
605
|
+
|
|
606
|
+
This prevents specialists from rediscovering known gotchas on every run.
|
|
607
|
+
|
|
449
608
|
`--prompt` and `--bead` cannot be combined. When you need to give a specialist
|
|
450
609
|
specific instructions beyond what's in the bead description, update the bead notes first:
|
|
451
610
|
|
|
@@ -462,6 +621,9 @@ own bead + the immediate predecessor's output + one more level of context.
|
|
|
462
621
|
|
|
463
622
|
**`--no-beads`** — skip creating an auto-tracking sub-bead, but still reads the `--bead` input.
|
|
464
623
|
|
|
624
|
+
**Edit gate access**: Specialists with `--bead` automatically set `bead-claim:<id>` KV key,
|
|
625
|
+
enabling write access in worktrees without session-scoped claims. Cleared on run completion.
|
|
626
|
+
|
|
465
627
|
---
|
|
466
628
|
|
|
467
629
|
## Choosing the Right Specialist
|
|
@@ -538,7 +700,7 @@ specialists stop <job-id> # when satisfied
|
|
|
538
700
|
specialists run executor --worktree --bead unitAI-impl --context-depth 2 --background
|
|
539
701
|
```
|
|
540
702
|
|
|
541
|
-
### Monitoring with `sp ps`
|
|
703
|
+
### Monitoring with `sp ps` and `sp list --live`
|
|
542
704
|
|
|
543
705
|
Use `specialists ps` (alias `sp ps`) for job monitoring instead of manual JSON polling:
|
|
544
706
|
|
|
@@ -558,6 +720,23 @@ specialists ps <job-id>
|
|
|
558
720
|
# - >80% = CRITICAL (▲ indicator shown)
|
|
559
721
|
```
|
|
560
722
|
|
|
723
|
+
**Live tmux session selector (`sp list --live`):**
|
|
724
|
+
|
|
725
|
+
```bash
|
|
726
|
+
# Interactive selector for running/waiting tmux sessions
|
|
727
|
+
specialists list --live
|
|
728
|
+
# Shows: tmux session name, specialist, elapsed, status
|
|
729
|
+
# Arrow keys to select, Enter to attach
|
|
730
|
+
|
|
731
|
+
# Include dead sessions (PID or tmux gone)
|
|
732
|
+
specialists list --live --show-dead
|
|
733
|
+
# Dead sessions shown with 'dead' status instead of filtered out
|
|
734
|
+
```
|
|
735
|
+
|
|
736
|
+
Dead job detection (`is_dead`) is computed at read time — never persisted to avoid stale state. A job is dead when:
|
|
737
|
+
- PID no longer exists (`kill -0 <pid>` fails)
|
|
738
|
+
- tmux session gone (`tmux has-session -t <name>` fails or times out)
|
|
739
|
+
|
|
561
740
|
---
|
|
562
741
|
|
|
563
742
|
### Pi extensions and packages
|
|
@@ -617,88 +796,108 @@ specialists stop d4e5f6 # only when truly done iterating
|
|
|
617
796
|
|
|
618
797
|
---
|
|
619
798
|
|
|
620
|
-
##
|
|
799
|
+
## Chain and Epic Orchestration
|
|
621
800
|
|
|
622
|
-
For multi-step work, dispatch
|
|
801
|
+
For multi-step work, dispatch chains under an **epic**.
|
|
623
802
|
|
|
624
|
-
A **
|
|
625
|
-
Waves are strictly sequential: **never start wave N+1 before wave N completes AND is merged**.
|
|
803
|
+
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
804
|
|
|
627
|
-
###
|
|
805
|
+
### Chain rules
|
|
628
806
|
|
|
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
|
|
807
|
+
1. **Sequence between stages.** Prep (explorer/planner) → implementation chains → review → tests → doc sync.
|
|
808
|
+
2. **Parallelize only within a stage.** Chains that don't depend on each other may run together.
|
|
809
|
+
3. **Do not overlap stages.** Wait for every chain job, read results, update beads, merge epic.
|
|
810
|
+
4. **Bead deps encode the pipeline.** The dependency graph should match stage order.
|
|
633
811
|
5. **`--context-depth 2` for all chained runs.** Each specialist sees parent + predecessor.
|
|
634
|
-
6. **Merge
|
|
812
|
+
6. **Merge via `sp epic merge` is mandatory.** See Merge Protocol above.
|
|
635
813
|
|
|
636
|
-
### Polling
|
|
814
|
+
### Polling chains
|
|
637
815
|
|
|
638
816
|
```bash
|
|
639
|
-
specialists ps # list all jobs — shows
|
|
817
|
+
specialists ps # list all jobs — shows epic grouping, status, elapsed
|
|
640
818
|
specialists ps abc123 # inspect specific job (full detail)
|
|
641
|
-
specialists ps
|
|
819
|
+
specialists ps --follow # live dashboard with epic grouping
|
|
642
820
|
```
|
|
643
821
|
|
|
644
|
-
|
|
822
|
+
`sp ps` shows epic-level grouping:
|
|
823
|
+
|
|
824
|
+
```
|
|
825
|
+
◆ epic:unitAI-3f7b · merge_ready · state:resolving · prep done=2/2 · chains pass=3/3
|
|
826
|
+
prep:exp-1 · done
|
|
827
|
+
prep:plan-2 · done
|
|
828
|
+
chain:impl-a (reviewer PASS) · branch:feature/unitAI-impl-a-executor
|
|
829
|
+
chain:impl-b (reviewer PASS) · branch:feature/unitAI-impl-b-executor
|
|
830
|
+
chain:impl-c (reviewer PASS) · branch:feature/unitAI-impl-c-executor
|
|
831
|
+
```
|
|
832
|
+
|
|
833
|
+
A stage is complete when every chain is terminal AND you have:
|
|
645
834
|
1. Read results: `specialists result <job-id>` for each
|
|
646
835
|
2. Updated/closed beads as needed
|
|
647
|
-
3.
|
|
836
|
+
3. Published via `sp epic merge <epic-id>`
|
|
648
837
|
|
|
649
|
-
### Canonical multi-
|
|
838
|
+
### Canonical multi-stage example
|
|
650
839
|
|
|
651
840
|
```bash
|
|
652
|
-
# 0.
|
|
653
|
-
bd create --title "Add worktree isolation to executor" --type
|
|
654
|
-
# -> unitAI-
|
|
841
|
+
# 0. Create epic bead (top merge-gated identity)
|
|
842
|
+
bd create --title "Add worktree isolation to executor" --type epic --priority 1
|
|
843
|
+
# -> unitAI-3f7b
|
|
655
844
|
|
|
656
|
-
# 1.
|
|
845
|
+
# 1. Create prep and impl beads as children of the epic
|
|
657
846
|
bd create --title "Explore: map job run architecture" --type task --priority 2 # -> unitAI-exp
|
|
658
|
-
bd dep add exp
|
|
847
|
+
bd dep add exp 3f7b
|
|
659
848
|
bd create --title "Implement: worktree isolation" --type task --priority 2 # -> unitAI-impl
|
|
660
849
|
bd dep add impl exp
|
|
661
|
-
# Note: reviewer runs via --job,
|
|
850
|
+
# Note: reviewer runs via --job, inherits epic from impl bead.parent
|
|
662
851
|
|
|
663
|
-
#
|
|
664
|
-
specialists run explorer --bead unitAI-exp --context-depth 2 --background
|
|
852
|
+
# Stage 1 — Explorer (prep job, declares epic explicitly)
|
|
853
|
+
specialists run explorer --bead unitAI-exp --epic unitAI-3f7b --context-depth 2 --background
|
|
665
854
|
# -> Job started: job1
|
|
666
855
|
specialists result job1
|
|
667
856
|
|
|
668
|
-
# [MERGE]
|
|
857
|
+
# [NO MERGE] Prep stage has no worktrees to merge
|
|
669
858
|
|
|
670
|
-
#
|
|
859
|
+
# Stage 2 — Executor (chain inherits epic from bead.parent)
|
|
671
860
|
specialists run executor --worktree --bead unitAI-impl --context-depth 2 --background
|
|
672
861
|
# -> Job started: job2 (worktree: .worktrees/unitAI-impl/unitAI-impl-executor)
|
|
862
|
+
# epic_id = bead.parent (unitAI-3f7b)
|
|
673
863
|
specialists result job2
|
|
674
864
|
|
|
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
|
|
865
|
+
# Stage 3 — Reviewer (uses --job, same worktree)
|
|
866
|
+
specialists run reviewer --job job2 --keep-alive --background --prompt "Review implementation"
|
|
681
867
|
# -> Job started: job3
|
|
682
868
|
specialists result job3
|
|
683
|
-
# PASS →
|
|
869
|
+
# PASS → ready for epic merge. PARTIAL → fix loop.
|
|
684
870
|
|
|
685
|
-
#
|
|
686
|
-
bd create --title "
|
|
687
|
-
bd dep add
|
|
688
|
-
specialists run
|
|
871
|
+
# Stage 4 — Fix loop (if PARTIAL)
|
|
872
|
+
bd create --title "Fix: reviewer gaps on impl" --type bug --priority 1 # -> unitAI-fix1
|
|
873
|
+
bd dep add fix1 impl
|
|
874
|
+
specialists run executor --bead fix1 --job job2 --context-depth 2 --background
|
|
875
|
+
# Re-review
|
|
876
|
+
specialists run reviewer --job job2 --keep-alive --background --prompt "Re-review after fix"
|
|
877
|
+
|
|
878
|
+
# [MERGE] Publish epic
|
|
879
|
+
sp epic status unitAI-3f7b # verify readiness: merge_ready, all chains PASS
|
|
880
|
+
sp epic merge unitAI-3f7b --rebuild
|
|
689
881
|
|
|
690
882
|
# Close
|
|
691
|
-
bd close
|
|
883
|
+
bd close 3f7b --reason "Worktree isolation implemented. Reviewer PASS. Epic merged."
|
|
692
884
|
```
|
|
693
885
|
|
|
694
|
-
### Within-
|
|
886
|
+
### Within-stage parallelism (multiple chains)
|
|
695
887
|
|
|
696
888
|
```bash
|
|
697
|
-
# Parallel executors — disjoint files, same parent
|
|
889
|
+
# Parallel executors — disjoint files, same parent epic
|
|
890
|
+
bd create --title "Implement: component A" --type task --priority 2 # -> unitAI-impl-a
|
|
891
|
+
bd dep add impl-a exp
|
|
892
|
+
bd create --title "Implement: component B" --type task --priority 2 # -> unitAI-impl-b
|
|
893
|
+
bd dep add impl-b exp
|
|
894
|
+
|
|
698
895
|
specialists run executor --worktree --bead unitAI-impl-a --context-depth 2 --background
|
|
699
896
|
specialists run executor --worktree --bead unitAI-impl-b --context-depth 2 --background
|
|
700
|
-
# Each runs in its own worktree.
|
|
701
|
-
|
|
897
|
+
# Each runs in its own worktree, both belong to unitAI-3f7b (via bead.parent)
|
|
898
|
+
|
|
899
|
+
# Do NOT start next stage until BOTH complete AND epic is merged
|
|
900
|
+
sp epic merge unitAI-3f7b
|
|
702
901
|
```
|
|
703
902
|
|
|
704
903
|
---
|
|
@@ -708,7 +907,7 @@ specialists run executor --worktree --bead unitAI-impl-b --context-depth 2 --bac
|
|
|
708
907
|
### 1. Route work — don't explore or implement yourself
|
|
709
908
|
Discovery goes to **explorer** first; implementation goes to **executor** only after discovery is done.
|
|
710
909
|
|
|
711
|
-
### 2. Validate combined output after each
|
|
910
|
+
### 2. Validate combined output after each stage
|
|
712
911
|
```bash
|
|
713
912
|
npm run lint # project quality gate
|
|
714
913
|
npx tsc --noEmit # type check
|
|
@@ -726,8 +925,8 @@ Options when a specialist fails:
|
|
|
726
925
|
- **Switch**: e.g. sync-docs stalls → try executor
|
|
727
926
|
- **Stop and report** to the user before doing it yourself
|
|
728
927
|
|
|
729
|
-
### 4. Merge
|
|
730
|
-
See Merge Protocol above.
|
|
928
|
+
### 4. Merge via epic (CRITICAL)
|
|
929
|
+
See Merge Protocol above. Use `sp epic merge <epic-id>` — no exceptions.
|
|
731
930
|
|
|
732
931
|
### 5. Run drift detection after doc-heavy sessions
|
|
733
932
|
```bash
|