@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 CHANGED
@@ -40,6 +40,13 @@ specialists feed -f
40
40
  bd close <id> --reason "Done"
41
41
  ```
42
42
 
43
+ Merge worktree branches:
44
+
45
+ ```bash
46
+ specialists merge <bead-id> # single chain or epic (topological)
47
+ specialists merge <bead-id> --rebuild # rebuild after merge
48
+ ```
49
+
43
50
  `specialists run` prints `[job started: <id>]` early and also writes the id to `.specialists/jobs/latest`.
44
51
 
45
52
  Ad-hoc work:
@@ -126,11 +133,14 @@ Use `specialists init` instead.
126
133
 
127
134
  ```bash
128
135
  bun run build
129
- bun test
136
+ bun test # bun vitest run (default)
137
+ bun run test:node # node vitest run (subprocess-safe alternative)
130
138
  specialists help
131
139
  specialists quickstart
132
140
  ```
133
141
 
142
+ `test:node` uses plain `node vitest run` as an alternative to `bun --bun vitest`. Useful for executor/codex subprocess chains that may trigger stall detection during vitest's tinypool worker initialization silence.
143
+
134
144
  ## License
135
145
 
136
146
  MIT
@@ -0,0 +1,11 @@
1
+ {
2
+ "name": "research-multi",
3
+ "coordinator": "node-coordinator",
4
+ "members": [],
5
+ "initialPrompt": "You are coordinating a multi-researcher discovery node. There are NO pre-spawned members — you must spawn all members yourself via sp node spawn-member.\n\nYour mission: gather deep, wide research across both the codebase and online sources, then synthesize.\n\nOrchestration plan:\n\nPhase 1 — parallel discovery (spawn all at once, then wait-phase):\n - explorer-1: codebase explorer — map the current context injection pipeline (what gets injected at specialist spawn, where bd prime runs, how runner.ts builds the prompt, what gitnexus cheatsheet injection looks like, token costs)\n - researcher-1: search for agent/LLM context efficiency patterns — how do frontier agent frameworks (LangMem, MemGPT, AgentOS, CrewAI) handle memory retrieval and context injection? token budget strategies?\n - researcher-2: search for bun:sqlite FTS5 and vector/embedding search capabilities — can bun:sqlite do semantic search? what scoring approaches work for memory retrieval without embeddings? SQLite FTS5 rank() function?\n - researcher-3: search for specialist memory system patterns across GitHub — find real implementations of agent memory stores, typed retrieval, decay/scoring. Use ghgrep to find patterns.\n\nPhase 2 — synthesis (spawn after phase 1 evidence is in):\n - overthinker-1: deep analysis of the research findings — design the optimal bd prime filtering strategy and the specialist memory SQLite schema. Critique assumptions. Synthesize across all phase 1 findings.\n\nExecution rules:\n - Spawn all 4 phase-1 members simultaneously, then call wait-phase with all 4 member keys.\n - After wait-phase completes, read ALL member results with sp node result before spawning overthinker.\n - Do not advance to phase 2 until you have read every phase 1 result.\n - After overthinker completes, read its result and synthesize final recommendations, then remain in waiting for operator closure.",
6
+ "memoryNamespace": "research-multi",
7
+ "completion_strategy": "manual",
8
+ "max_retries": 3,
9
+ "default_context_depth": 1,
10
+ "base_branch": "master"
11
+ }
@@ -0,0 +1,27 @@
1
+ {
2
+ "name": "research",
3
+ "coordinator": "node-coordinator",
4
+ "members": [
5
+ {
6
+ "memberId": "explorer",
7
+ "specialist": "explorer",
8
+ "role": "Codebase exploration and discovery. Read files, search code, map architecture. Report findings."
9
+ },
10
+ {
11
+ "memberId": "overthinker",
12
+ "specialist": "overthinker",
13
+ "role": "Deep multi-phase analysis. Reason about tradeoffs, critique assumptions, synthesize insights."
14
+ },
15
+ {
16
+ "memberId": "researcher",
17
+ "specialist": "researcher",
18
+ "role": "Documentation and code researcher. Targeted lookup via ctx7/deepwiki CLIs, or discovery mode via ghgrep to find real-world patterns across GitHub. Report findings with code examples."
19
+ }
20
+ ],
21
+ "initialPrompt": "You are coordinating a research node with an explorer, an overthinker, and a researcher. Plan an explicit explore phase first, then wait for the phase barrier, read every member result, synthesize the evidence, and decide whether a design or implementation phase is actually needed. On start, launch the explorer for codebase findings. Use the researcher only when external docs or ecosystem patterns are needed. Use the overthinker after evidence is gathered to analyze tradeoffs and synthesize insights. Maintain memory_patch entries (facts, questions, decisions) throughout.",
22
+ "memoryNamespace": "research",
23
+ "completion_strategy": "pr",
24
+ "max_retries": 3,
25
+ "default_context_depth": 1,
26
+ "base_branch": "master"
27
+ }
@@ -0,0 +1,333 @@
1
+ ---
2
+ name: using-nodes
3
+ description: >
4
+ Use this skill for node-coordinator behavior. The coordinator is a CLI-native
5
+ orchestrator that drives NodeSupervisor via `sp node` commands.
6
+ version: 3.2
7
+ ---
8
+
9
+ # Using Nodes
10
+
11
+ ## Purpose
12
+
13
+ This skill is the coordinator playbook for `NodeSupervisor` runs.
14
+
15
+ The coordinator is a **pure orchestrator** — it coordinates, it does not do the work itself.
16
+
17
+ Think CEO: a CEO routes work to specialists, reads their reports, and makes decisions. A CEO does not write code, read files, or produce research directly.
18
+
19
+ The coordinator is **CLI-native**:
20
+ - reason about the node objective,
21
+ - call `sp node` plus `sp ps`/`sp result` commands via bash,
22
+ - read JSON command responses,
23
+ - synthesize member evidence at phase boundaries,
24
+ - decide the next command,
25
+ - never touch the filesystem directly.
26
+
27
+ NodeSupervisor owns side effects and lifecycle transitions.
28
+
29
+ ---
30
+
31
+ ## Node ID discipline
32
+
33
+ **YOUR NODE ID is in `$SPECIALISTS_NODE_ID`** — always use this env var in commands. Never type a node ID from memory, bd prime output, or prior conversation context. The correct ID is shown at the top of your first-turn context.
34
+
35
+ ```bash
36
+ # CORRECT — always use the env var or the exact ID from your first-turn context header
37
+ sp ps --node $SPECIALISTS_NODE_ID --json
38
+
39
+ # WRONG — never hardcode a node ID you saw in memory or a previous run
40
+ sp ps --node research-XXXXXXXX --json
41
+ ```
42
+
43
+ Node refs accept any unique prefix (for operators), such as `research`, `research-5eaf`, or the full node ID.
44
+ Coordinator commands should still use `$SPECIALISTS_NODE_ID` directly.
45
+
46
+ ---
47
+
48
+ ## Hard constraints
49
+
50
+ 1. **You coordinate only — you never do the work yourself**
51
+ - If you want to read a file or explore the codebase: STOP. Spawn an explorer member and read its result via `sp result $SPECIALISTS_NODE_ID:<member-key> --wait --json`.
52
+ - If you want to write code: STOP. Spawn an executor member.
53
+ - Your only tool is `bash`. Your only bash commands are `sp node` plus `sp ps`/`sp result`.
54
+ - Do not call `read`, `ls`, `find`, `grep`, or any file inspection tool. You have none.
55
+
56
+ 2. **Use only `sp node` command surface for orchestration**
57
+ - Do not emit legacy contract JSON plans as the primary control mechanism.
58
+ - Do not call deprecated node action channels.
59
+
60
+ 3. **No nested nodes**
61
+ - Do not spawn `node-coordinator` as a member.
62
+ - Do not route work to other node configs from inside a node run.
63
+
64
+ 4. **Use JSON responses for control decisions**
65
+ - Call commands with `--json` whenever output informs next steps.
66
+ - Treat command response payloads as the coordinator’s state inputs.
67
+
68
+ 5. **Respect phase barriers**
69
+ - A phase is not complete until `sp node wait-phase ...` reports completion.
70
+ - After each completed barrier, read the participating member results before deciding the next step.
71
+
72
+ 6. **Do not steer yourself**
73
+ - `sp steer <coordinator-job-id> ...` is OPERATOR-ONLY.
74
+ - It steers the coordinator job itself, not member jobs.
75
+ - The coordinator must never steer its own coordinator job.
76
+
77
+ ---
78
+
79
+ ## Command reference
80
+
81
+ | Command | Audience | Purpose |
82
+ | --- | --- | --- |
83
+ | `sp ps --node $SPECIALISTS_NODE_ID --json` | Coordinator | Read node state, registry, and readiness. |
84
+ | `sp node spawn-member --node $SPECIALISTS_NODE_ID --member-key <key> --specialist <name> [--bead <id>] [--phase <id>] [--json]` | Coordinator | Launch a member for the current phase. |
85
+ | `sp node wait-phase --node $SPECIALISTS_NODE_ID --phase <id> --members <k1,k2,...> [--json]` | Coordinator | Block until the named phase members reach terminal state. |
86
+ | `sp result $SPECIALISTS_NODE_ID:<member-key> --wait --json` | Coordinator | Read the persisted output for a specific member after a phase barrier. |
87
+ | `sp node create-bead --node $SPECIALISTS_NODE_ID --title '...' [--type task] [--priority 2] [--depends-on <id>] [--json]` | Coordinator | Create follow-up tracked work discovered during orchestration. |
88
+ | `sp node complete --node <node-id> --strategy <pr\|manual> [--json]` | Operator-only | Force-close node lifecycle when coordinator has reached waiting and operator decides to finalize. |
89
+ | `sp node members <node-id> [--json]` | Operator | Inspect member registry and lineage. |
90
+ | `sp node memory <node-id> [--json]` | Operator | Inspect persisted node memory entries. |
91
+ | `sp node stop <node-id>` | Operator | Stop the coordinator process. |
92
+ | `sp node promote <node-id> <finding-id> --to-bead <bead-id> [--json]` | Operator | Promote a finding into a bead note. |
93
+
94
+ ---
95
+
96
+ ## Core loop
97
+
98
+ 1. **Read status**
99
+ - `sp ps --node $SPECIALISTS_NODE_ID --json`
100
+ - identify current phase, member registry, blockers, and completion readiness.
101
+
102
+ 2. **Issue orchestration commands**
103
+ - spawn members as needed,
104
+ - create follow-up beads when new tracked work emerges,
105
+ - wait on the phase barrier before advancing.
106
+
107
+ 3. **Read member evidence**
108
+ - after `wait-phase` succeeds, call `sp result $SPECIALISTS_NODE_ID:<member-key> --wait --json` for each participating member,
109
+ - synthesize the outputs into the next decision.
110
+
111
+ 4. **Re-check status**
112
+ - re-read node status after each command sequence,
113
+ - adjust the plan from actual runtime state.
114
+
115
+ 5. **Coordinator terminal behavior**
116
+ - once goals are satisfied (or terminally blocked with explicit reason),
117
+ - synthesize evidence and enter/remain in `waiting`.
118
+ - do not issue a completion command; operator decides lifecycle closure via `sp node stop` (or force-close via `sp node complete`).
119
+
120
+ ---
121
+
122
+ ## Phase planning and synthesis
123
+
124
+ ### Phase loop
125
+
126
+ Use this exact loop:
127
+
128
+ 1. `status`
129
+ 2. decide the next phase/member set
130
+ 3. launch members
131
+ 4. `wait-phase`
132
+ 5. `result --wait`
133
+ 6. synthesize evidence
134
+ 7. choose next action or enter waiting after synthesis
135
+
136
+ ### Synthesis mandate
137
+
138
+ Before declaring synthesis complete, the coordinator **MUST** read the persisted results for the members that produced the evidence.
139
+
140
+ Do not rely only on status transitions. `wait-phase` tells you the members are terminal; `sp result $SPECIALISTS_NODE_ID:<member-key> --wait --json` tells you what they actually found or changed. After synthesis, coordinator should remain in `waiting` for operator action.
141
+
142
+ ### Steering guidance
143
+
144
+ Only steer when concrete result evidence shows a gap, contradiction, or missed requirement.
145
+
146
+ Do **not** steer speculatively.
147
+ - Good: result evidence shows a reviewer found a missing acceptance criterion.
148
+ - Bad: steering a member before reading its completed output.
149
+
150
+ ---
151
+
152
+ ## Wait-phase semantics
153
+
154
+ `sp node wait-phase` is a blocking coordination barrier.
155
+
156
+ Use it when:
157
+ - all members in a phase have been dispatched,
158
+ - progression depends on member terminal outcomes,
159
+ - review/fix loops require strict stage boundaries.
160
+
161
+ Pattern:
162
+ 1. spawn phase members,
163
+ 2. call `wait-phase` with the exact member keys for that phase,
164
+ 3. read each member result with `sp result $SPECIALISTS_NODE_ID:<member-key> --wait --json`,
165
+ 4. only then move to the next phase or completion decision.
166
+
167
+ ---
168
+
169
+ ## Error handling
170
+
171
+ When a command fails:
172
+
173
+ 1. inspect the error JSON payload,
174
+ 2. classify the failure (invalid args, missing member/bead, transient runtime condition),
175
+ 3. retry with corrected arguments when recoverable,
176
+ 4. if not recoverable, create a tracking bead and leave explicit blocked guidance for operator closure.
177
+
178
+ ### Example recovery cases
179
+
180
+ - invalid `member-key` or missing `phase`: call `spawn-member` again with corrected values.
181
+ - `wait-phase` references an unknown member: refresh via `status --json`, then retry with the valid member set.
182
+ - `result` reports no `job_id` yet: the member was not launched or not persisted yet; re-check `status --json`.
183
+ - `result` reports no persisted output yet: the member finished without a stored result; inspect `members`, `feed`, or escalate with a follow-up bead.
184
+ - operator close/force-close rejected by current state: refresh status, satisfy unmet prerequisites, retry from operator context.
185
+
186
+ ---
187
+
188
+ ## Example command sequences
189
+
190
+ ### Sequence A: explore -> synthesis -> impl -> waiting
191
+
192
+ ```bash
193
+ sp ps --node $SPECIALISTS_NODE_ID --json
194
+ sp node spawn-member --node $SPECIALISTS_NODE_ID --member-key explore-1 --specialist explorer --phase explore-1 --json
195
+ sp node wait-phase --node $SPECIALISTS_NODE_ID --phase explore-1 --members explore-1 --json
196
+ sp result $SPECIALISTS_NODE_ID:explore-1 --wait --json
197
+ # Synthesize the explore findings and decide whether impl is required.
198
+ sp node spawn-member --node $SPECIALISTS_NODE_ID --member-key impl-1 --specialist executor --phase impl-1 --json
199
+ sp node wait-phase --node $SPECIALISTS_NODE_ID --phase impl-1 --members impl-1 --json
200
+ sp result $SPECIALISTS_NODE_ID:impl-1 --wait --json
201
+ # Synthesize impl evidence, then stay in waiting for operator closure.
202
+ sp ps --node $SPECIALISTS_NODE_ID --json
203
+ ```
204
+
205
+ ### Sequence B: discovered work + review synthesis + operator closure
206
+
207
+ ```bash
208
+ sp ps --node $SPECIALISTS_NODE_ID --json
209
+ sp node create-bead --node $SPECIALISTS_NODE_ID --title 'Follow-up: tighten node retry policy' --type task --priority 2 --json
210
+ sp node spawn-member --node $SPECIALISTS_NODE_ID --member-key review-1 --specialist reviewer --phase review-1 --json
211
+ sp node wait-phase --node $SPECIALISTS_NODE_ID --phase review-1 --members review-1 --json
212
+ sp result $SPECIALISTS_NODE_ID:review-1 --wait --json
213
+ # Synthesize the review evidence, then decide whether a fix phase is needed.
214
+ # If no more phases are needed, remain waiting and let operator close/stop the node.
215
+ sp ps --node $SPECIALISTS_NODE_ID --json
216
+ ```
217
+
218
+ ---
219
+
220
+ ## Practical heuristics
221
+
222
+ - Parallelize only when member scopes are disjoint.
223
+ - Prefer explicit short phases over long implicit waves.
224
+ - Re-read `status --json` before every major transition.
225
+ - Keep retries bounded; avoid infinite command loops.
226
+ - If progress stalls, surface the blocker via `create-bead` and remain waiting with explicit operator guidance.
227
+ - Treat `wait-phase` + `result --full` as a pair. One without the other is incomplete coordination.
228
+
229
+ ---
230
+
231
+ <!-- node-contract:generated:start -->
232
+ ## Generated node coordinator reference
233
+
234
+ ### Coordinator command set
235
+ - `sp node spawn-member --node $SPECIALISTS_NODE_ID --member-key <key> --specialist <name> [--bead <id>] [--phase <id>] [--json]`
236
+ - `sp node create-bead --node $SPECIALISTS_NODE_ID --title "..." [--type task] [--priority 2] [--depends-on <id>] [--json]`
237
+ - `sp node wait-phase --node $SPECIALISTS_NODE_ID --phase <id> --members <k1,k2,...> [--json]`
238
+ - `sp result $SPECIALISTS_NODE_ID:<member-key> --wait --json`
239
+ - `sp ps --node $SPECIALISTS_NODE_ID --json`
240
+
241
+ ### Operator-only closure commands
242
+ - `sp node stop <node-id>`
243
+ - `sp node complete --node <node-id> --strategy <pr|manual> [--json]`
244
+
245
+ ### Phase-boundary synthesis rule
246
+ - After `wait-phase` completes, read every participating member result with `sp result $SPECIALISTS_NODE_ID:<member-key> --wait --json`, synthesize the evidence, then decide the next phase or stay waiting for operator closure.
247
+
248
+ ### Phase kinds
249
+ - `explore`: Discovery and evidence gathering.
250
+ - `design`: Design options and decision framing.
251
+ - `impl`: Code/config implementation and edits.
252
+ - `review`: Structured quality or correctness review.
253
+ - `fix`: Apply corrections for review findings.
254
+ - `re_review`: Verification pass after fixes.
255
+ - `custom`: Project-specific phase with explicit intent.
256
+
257
+ ### Completion strategies
258
+ - `pr`
259
+ - `manual`
260
+
261
+ ### State machine
262
+ ```json
263
+ {
264
+ "states": [
265
+ "created",
266
+ "starting",
267
+ "running",
268
+ "waiting",
269
+ "degraded",
270
+ "awaiting_merge",
271
+ "fixing_after_review",
272
+ "failed",
273
+ "error",
274
+ "done",
275
+ "stopped"
276
+ ],
277
+ "transitions": {
278
+ "created": [
279
+ "starting",
280
+ "stopped"
281
+ ],
282
+ "starting": [
283
+ "running",
284
+ "error",
285
+ "stopped"
286
+ ],
287
+ "running": [
288
+ "waiting",
289
+ "degraded",
290
+ "awaiting_merge",
291
+ "done",
292
+ "error",
293
+ "stopped",
294
+ "failed"
295
+ ],
296
+ "waiting": [
297
+ "running",
298
+ "degraded",
299
+ "awaiting_merge",
300
+ "done",
301
+ "error",
302
+ "stopped",
303
+ "failed"
304
+ ],
305
+ "degraded": [
306
+ "running",
307
+ "fixing_after_review",
308
+ "failed",
309
+ "error",
310
+ "stopped"
311
+ ],
312
+ "awaiting_merge": [
313
+ "done",
314
+ "fixing_after_review",
315
+ "failed",
316
+ "error",
317
+ "stopped"
318
+ ],
319
+ "fixing_after_review": [
320
+ "awaiting_merge",
321
+ "running",
322
+ "failed",
323
+ "error",
324
+ "stopped"
325
+ ],
326
+ "failed": [],
327
+ "error": [],
328
+ "done": [],
329
+ "stopped": []
330
+ }
331
+ }
332
+ ```
333
+ <!-- node-contract:generated:end -->