@jaggerxtrm/specialists 3.17.0 → 3.18.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.
Files changed (255) hide show
  1. package/README.md +268 -134
  2. package/config/mandatory-rules/executor-delivery.md +4 -0
  3. package/config/mandatory-rules/json-only-final-output.md +13 -0
  4. package/config/mandatory-rules/service-skills-diff-scan-mandatory.md +26 -0
  5. package/config/mandatory-rules/service-skills-gitnexus-triage.md +5 -0
  6. package/config/mandatory-rules/test-runner-execution-scope.md +4 -0
  7. package/config/skills/setup-specialists/SKILL.md +556 -0
  8. package/config/skills/specialists-creator/SKILL.md +132 -4
  9. package/config/skills/specialists-creator/scripts/audit-spec-uniformity.mjs +1 -1
  10. package/config/skills/using-specialists-v3/SKILL.md +80 -20
  11. package/config/specialists/bare.specialist.json +3 -3
  12. package/config/specialists/changelog-drafter.specialist.json +5 -4
  13. package/config/specialists/changelog-keeper.specialist.json +7 -6
  14. package/config/specialists/debugger.specialist.json +2 -2
  15. package/config/specialists/executor.specialist.json +2 -2
  16. package/config/specialists/explorer.specialist.json +4 -4
  17. package/config/specialists/memory-processor.specialist.json +3 -3
  18. package/config/specialists/node-coordinator.specialist.json +3 -3
  19. package/config/specialists/obligations-scanner.specialist.json +67 -17
  20. package/config/specialists/overthinker.specialist.json +3 -3
  21. package/config/specialists/planner.specialist.json +4 -4
  22. package/config/specialists/quant-methodologist.specialist.json +145 -0
  23. package/config/specialists/quant-researcher.specialist.json +144 -0
  24. package/config/specialists/researcher.specialist.json +5 -5
  25. package/config/specialists/reviewer.specialist.json +1 -1
  26. package/config/specialists/seconder.specialist.json +2 -2
  27. package/config/specialists/security-auditor.specialist.json +2 -2
  28. package/config/specialists/service-skills-sync.specialist.json +90 -75
  29. package/config/specialists/specialists-creator.specialist.json +4 -4
  30. package/config/specialists/sync-docs.specialist.json +4 -4
  31. package/config/specialists/test-engineer.specialist.json +3 -3
  32. package/config/specialists/test-runner.specialist.json +7 -7
  33. package/config/specialists/transcriber.specialist.json +3 -3
  34. package/config/specialists/xt-merge.specialist.json +4 -4
  35. package/dist/asset-contract.json +22 -3
  36. package/dist/index.js +28711 -18517
  37. package/dist/lib.js +10020 -6150
  38. package/dist/types/cli/console/components.d.ts +83 -0
  39. package/dist/types/cli/console/components.d.ts.map +1 -0
  40. package/dist/types/cli/console/config-source.d.ts +58 -0
  41. package/dist/types/cli/console/config-source.d.ts.map +1 -0
  42. package/dist/types/cli/console/forensic.d.ts +11 -0
  43. package/dist/types/cli/console/forensic.d.ts.map +1 -0
  44. package/dist/types/cli/console/git.d.ts +28 -0
  45. package/dist/types/cli/console/git.d.ts.map +1 -0
  46. package/dist/types/cli/console/help.d.ts +2 -0
  47. package/dist/types/cli/console/help.d.ts.map +1 -0
  48. package/dist/types/cli/console/log.d.ts +13 -0
  49. package/dist/types/cli/console/log.d.ts.map +1 -0
  50. package/dist/types/cli/console/repo-config.d.ts +26 -0
  51. package/dist/types/cli/console/repo-config.d.ts.map +1 -0
  52. package/dist/types/cli/console/repo-discovery.d.ts +12 -0
  53. package/dist/types/cli/console/repo-discovery.d.ts.map +1 -0
  54. package/dist/types/cli/console/runtime.d.ts +12 -0
  55. package/dist/types/cli/console/runtime.d.ts.map +1 -0
  56. package/dist/types/cli/console/subscribe-prototype.d.ts +18 -0
  57. package/dist/types/cli/console/subscribe-prototype.d.ts.map +1 -0
  58. package/dist/types/cli/console/theme.d.ts +91 -0
  59. package/dist/types/cli/console/theme.d.ts.map +1 -0
  60. package/dist/types/cli/console/types.d.ts +231 -0
  61. package/dist/types/cli/console/types.d.ts.map +1 -0
  62. package/dist/types/cli/console/view-model.d.ts +252 -0
  63. package/dist/types/cli/console/view-model.d.ts.map +1 -0
  64. package/dist/types/cli/console.d.ts +2 -0
  65. package/dist/types/cli/console.d.ts.map +1 -0
  66. package/dist/types/cli/db.d.ts.map +1 -1
  67. package/dist/types/cli/doctor.d.ts.map +1 -1
  68. package/dist/types/cli/edit.d.ts.map +1 -1
  69. package/dist/types/cli/epic.d.ts.map +1 -1
  70. package/dist/types/cli/feed.d.ts.map +1 -1
  71. package/dist/types/cli/forensic.d.ts +2 -0
  72. package/dist/types/cli/forensic.d.ts.map +1 -0
  73. package/dist/types/cli/format-helpers.d.ts +4 -2
  74. package/dist/types/cli/format-helpers.d.ts.map +1 -1
  75. package/dist/types/cli/help.d.ts.map +1 -1
  76. package/dist/types/cli/init.d.ts +10 -0
  77. package/dist/types/cli/init.d.ts.map +1 -1
  78. package/dist/types/cli/list.d.ts.map +1 -1
  79. package/dist/types/cli/log.d.ts.map +1 -1
  80. package/dist/types/cli/merge.d.ts.map +1 -1
  81. package/dist/types/cli/metrics.d.ts +2 -0
  82. package/dist/types/cli/metrics.d.ts.map +1 -0
  83. package/dist/types/cli/ps.d.ts.map +1 -1
  84. package/dist/types/cli/result.d.ts.map +1 -1
  85. package/dist/types/cli/run.d.ts +20 -0
  86. package/dist/types/cli/run.d.ts.map +1 -1
  87. package/dist/types/cli/script.d.ts +3 -0
  88. package/dist/types/cli/script.d.ts.map +1 -1
  89. package/dist/types/cli/serve.d.ts.map +1 -1
  90. package/dist/types/cli/setup.d.ts +19 -1
  91. package/dist/types/cli/setup.d.ts.map +1 -1
  92. package/dist/types/cli/status.d.ts.map +1 -1
  93. package/dist/types/cli/version-check.d.ts +1 -0
  94. package/dist/types/cli/version-check.d.ts.map +1 -1
  95. package/dist/types/index.d.ts +1 -1
  96. package/dist/types/pi/session.d.ts +12 -1
  97. package/dist/types/pi/session.d.ts.map +1 -1
  98. package/dist/types/server.d.ts +15 -0
  99. package/dist/types/server.d.ts.map +1 -1
  100. package/dist/types/specialist/benchmarks.d.ts +37 -0
  101. package/dist/types/specialist/benchmarks.d.ts.map +1 -0
  102. package/dist/types/specialist/chain-identity.d.ts +7 -1
  103. package/dist/types/specialist/chain-identity.d.ts.map +1 -1
  104. package/dist/types/specialist/control.d.ts.map +1 -1
  105. package/dist/types/specialist/dead-job-audit.d.ts +20 -0
  106. package/dist/types/specialist/dead-job-audit.d.ts.map +1 -0
  107. package/dist/types/specialist/forensic-events.d.ts +138 -0
  108. package/dist/types/specialist/forensic-events.d.ts.map +1 -0
  109. package/dist/types/specialist/forensic-renderer.d.ts +34 -0
  110. package/dist/types/specialist/forensic-renderer.d.ts.map +1 -0
  111. package/dist/types/specialist/git-diff-evidence.d.ts +28 -0
  112. package/dist/types/specialist/git-diff-evidence.d.ts.map +1 -0
  113. package/dist/types/specialist/global-config.d.ts +389 -0
  114. package/dist/types/specialist/global-config.d.ts.map +1 -0
  115. package/dist/types/specialist/launch.d.ts +9 -0
  116. package/dist/types/specialist/launch.d.ts.map +1 -1
  117. package/dist/types/specialist/live-aggregates.d.ts +46 -0
  118. package/dist/types/specialist/live-aggregates.d.ts.map +1 -0
  119. package/dist/types/specialist/loader.d.ts +50 -1
  120. package/dist/types/specialist/loader.d.ts.map +1 -1
  121. package/dist/types/specialist/model-chain.d.ts +7 -0
  122. package/dist/types/specialist/model-chain.d.ts.map +1 -0
  123. package/dist/types/specialist/model-probes.d.ts +28 -0
  124. package/dist/types/specialist/model-probes.d.ts.map +1 -0
  125. package/dist/types/specialist/node-contract.d.ts +18 -18
  126. package/dist/types/specialist/node-supervisor.d.ts.map +1 -1
  127. package/dist/types/specialist/observability-db.d.ts +1 -1
  128. package/dist/types/specialist/observability-db.d.ts.map +1 -1
  129. package/dist/types/specialist/observability-sqlite.d.ts +101 -0
  130. package/dist/types/specialist/observability-sqlite.d.ts.map +1 -1
  131. package/dist/types/specialist/pr-drift-refresh.d.ts +17 -0
  132. package/dist/types/specialist/pr-drift-refresh.d.ts.map +1 -0
  133. package/dist/types/specialist/preset-resolver.d.ts +56 -0
  134. package/dist/types/specialist/preset-resolver.d.ts.map +1 -0
  135. package/dist/types/specialist/prometheus-projection.d.ts +25 -0
  136. package/dist/types/specialist/prometheus-projection.d.ts.map +1 -0
  137. package/dist/types/specialist/runner.d.ts +29 -1
  138. package/dist/types/specialist/runner.d.ts.map +1 -1
  139. package/dist/types/specialist/schema.d.ts +163 -54
  140. package/dist/types/specialist/schema.d.ts.map +1 -1
  141. package/dist/types/specialist/script-runner.d.ts +5 -1
  142. package/dist/types/specialist/script-runner.d.ts.map +1 -1
  143. package/dist/types/specialist/snapshot-diff.d.ts +8 -0
  144. package/dist/types/specialist/snapshot-diff.d.ts.map +1 -0
  145. package/dist/types/specialist/source-queue.d.ts +13 -0
  146. package/dist/types/specialist/source-queue.d.ts.map +1 -0
  147. package/dist/types/specialist/status-load.d.ts.map +1 -1
  148. package/dist/types/specialist/supervisor.d.ts +25 -1
  149. package/dist/types/specialist/supervisor.d.ts.map +1 -1
  150. package/dist/types/specialist/timeline-events.d.ts +70 -1
  151. package/dist/types/specialist/timeline-events.d.ts.map +1 -1
  152. package/dist/types/tools/specialist/resume_specialist.tool.d.ts +4 -4
  153. package/dist/types/tools/specialist/specialist_status.tool.d.ts +1 -1
  154. package/dist/types/tools/specialist/steer_specialist.tool.d.ts +4 -4
  155. package/dist/types/tools/specialist/use_specialist.tool.d.ts +16 -16
  156. package/docs/ARCHITECTURE.md +1176 -0
  157. package/docs/TODO.md +9 -0
  158. package/docs/architecture.md +11 -0
  159. package/docs/archive/2026-03-13-bd-decision-context-template-plan.md +96 -0
  160. package/docs/archive/AGENT-HANDOFF.md +351 -0
  161. package/docs/archive/PARITY-ANALYSIS.md +296 -0
  162. package/docs/archive/SPECIALISTS_REFACTOR.md.md +30 -0
  163. package/docs/archive/cc-programmatic.md +216 -0
  164. package/docs/archive/claude-agent-sdk.md +594 -0
  165. package/docs/archive/decision-specialist-directory.md +41 -0
  166. package/docs/archive/discoveries.md +148 -0
  167. package/docs/archive/executor-benchmark-protocol.md +198 -0
  168. package/docs/archive/future-features.md +66 -0
  169. package/docs/archive/gzrx-completion-critique.md +183 -0
  170. package/docs/archive/gzrx-research-notes.md +401 -0
  171. package/docs/archive/gzrx-tool-catalog.md +760 -0
  172. package/docs/archive/iron-review-hardening-qa-chain-substrate.md +322 -0
  173. package/docs/archive/iron-review-hardening.html +1004 -0
  174. package/docs/archive/issuetracking.md +312 -0
  175. package/docs/archive/qa-v3.0.2.md +220 -0
  176. package/docs/archive/restructure.md +231 -0
  177. package/docs/archive/script-specialists.md +1254 -0
  178. package/docs/archive/spec-v3.md +792 -0
  179. package/docs/archive/specialist-stats.md +127 -0
  180. package/docs/archive/specialists-friction-audit.md +1347 -0
  181. package/docs/archive/specialists-runtime-critique.md +170 -0
  182. package/docs/archive/specialists-service-evaluation.md +713 -0
  183. package/docs/archive/specialists-substrate-alignment.md +255 -0
  184. package/docs/archive/substrate-review.md +1288 -0
  185. package/docs/archive/test-writer-specialist.md +254 -0
  186. package/docs/archive/using-specialists-v3-improvements-2026-05-09.md +600 -0
  187. package/docs/archive/xtrm-specialists-analysis.md +314 -0
  188. package/docs/authoring.md +701 -0
  189. package/docs/background-jobs.md +203 -0
  190. package/docs/bare-specialists.md +83 -0
  191. package/docs/benchmarks/executor-benchmark-runner.md +66 -0
  192. package/docs/bootstrap.md +161 -0
  193. package/docs/cli-reference.md +1645 -0
  194. package/docs/deploying-alongside.md +155 -0
  195. package/docs/design/README.md +36 -0
  196. package/docs/design/darth-feedor-migration.md +290 -0
  197. package/docs/design/roadmap/README.md +32 -0
  198. package/docs/design/roadmap/chain-templates/README.md +146 -0
  199. package/docs/design/roadmap/chain-templates/code-quick.formula.json +27 -0
  200. package/docs/design/roadmap/chain-templates/code-standard.formula.json +126 -0
  201. package/docs/design/roadmap/chain-templates/code-with-advisors.formula.json +128 -0
  202. package/docs/design/roadmap/chain-templates/code-with-tests.formula.json +76 -0
  203. package/docs/design/roadmap/chain-templates/debug.formula.json +128 -0
  204. package/docs/design/roadmap/chain-templates/doc-sync.formula.json +28 -0
  205. package/docs/design/roadmap/chain-templates/memory-hygiene.formula.json +27 -0
  206. package/docs/design/roadmap/chain-templates/planning.formula.json +27 -0
  207. package/docs/design/roadmap/chain-templates/premortem.formula.json +26 -0
  208. package/docs/design/roadmap/chain-templates/release-prep.formula.json +36 -0
  209. package/docs/design/roadmap/chain-templates/research-only.formula.json +28 -0
  210. package/docs/design/roadmap/chain-templates/restitch.formula.json +125 -0
  211. package/docs/design/roadmap/chain-templates/security-deep.formula.json +161 -0
  212. package/docs/design/roadmap/chain-templates/test-only.formula.json +52 -0
  213. package/docs/design/roadmap/chain-templates/triage.formula.json +35 -0
  214. package/docs/design/roadmap/history/handoff-from-substrate-design.md +87 -0
  215. package/docs/design/roadmap/history/substrate-reconciliation.md +105 -0
  216. package/docs/design/roadmap/specialists-roadmap.md +1261 -0
  217. package/docs/design/sp-console-subscribe-via-materializer.md +231 -0
  218. package/docs/design/sp-console-tui-mock-v2.html +293 -0
  219. package/docs/design/sp-console-tui-mock.html +120 -0
  220. package/docs/design/sp-console-tui.md +340 -0
  221. package/docs/design/specialist-agentops-suite.md +323 -0
  222. package/docs/design/substrate/channels.md +14 -0
  223. package/docs/design/substrate/devops-platform-engineering-prd.md +446 -0
  224. package/docs/design/substrate/html-design-example.md +339 -0
  225. package/docs/design/xtrm-tiers-architecture.svg +132 -0
  226. package/docs/devops/dependency-verdict-materialization.md +46 -0
  227. package/docs/epic-readiness.md +75 -0
  228. package/docs/examples/mercury-atomic-summarizer.specialist.json +26 -0
  229. package/docs/examples/smoke-echo-text-expected-keys.specialist.json +25 -0
  230. package/docs/examples/smoke-echo.specialist.json +25 -0
  231. package/docs/features.md +1577 -0
  232. package/docs/hooks.md +81 -0
  233. package/docs/installation.md +142 -0
  234. package/docs/manifest.md +184 -0
  235. package/docs/mcp-servers.md +73 -0
  236. package/docs/mcp-tools.md +71 -0
  237. package/docs/nodes.md +231 -0
  238. package/docs/observability-metrics.md +152 -0
  239. package/docs/operator/sp-console-v2-walkthrough.md +410 -0
  240. package/docs/overrides-guide.md +306 -0
  241. package/docs/pi-rpc-boundary.md +118 -0
  242. package/docs/pi-session.md +195 -0
  243. package/docs/release.md +22 -0
  244. package/docs/skills.md +132 -0
  245. package/docs/specialists/handoff-schema.md +181 -0
  246. package/docs/specialists-catalog.md +99 -0
  247. package/docs/specialists-service-install.md +226 -0
  248. package/docs/specialists-service.md +363 -0
  249. package/docs/surface-ownership.md +138 -0
  250. package/docs/upgrade-notes/kan-90-global-user-config.md +114 -0
  251. package/docs/upgrade-notes/kan-91-expanded-overrides.md +261 -0
  252. package/docs/workflow.md +114 -0
  253. package/docs/worktree.md +71 -0
  254. package/docs/worktrees.md +309 -0
  255. package/package.json +7 -4
@@ -0,0 +1,1645 @@
1
+ ---
2
+ title: CLI Reference
3
+ scope: cli
4
+ category: reference
5
+ version: 2.9.0
6
+ updated: 2026-06-23
7
+ synced_at: bf6baf7a
8
+ description: Complete command reference for the Specialists CLI, generated from current source.
9
+ source_of_truth_for:
10
+ - src/index.ts
11
+ - src/cli/run.ts
12
+ - src/cli/node.ts
13
+ - src/cli/feed.ts
14
+ - src/cli/result.ts
15
+ - src/cli/status.ts
16
+ - src/cli/chat.ts
17
+ - src/cli/chat/control.ts
18
+ - src/cli/chat/feed.ts
19
+ - src/cli/chat/status.ts
20
+ - src/cli/attach.ts
21
+ - src/cli/resume.ts
22
+ - src/cli/steer.ts
23
+ - src/cli/stop.ts
24
+ - src/cli/list.ts
25
+ - src/cli/models.ts
26
+ - src/cli/edit.ts
27
+ - src/cli/init.ts
28
+ - src/cli/doctor.ts
29
+ - src/cli/validate.ts
30
+ - src/cli/config.ts
31
+ - src/cli/view.ts
32
+ - src/cli/help.ts
33
+ - src/cli/ps.ts
34
+ - src/cli/merge.ts
35
+ ---
36
+
37
+ <!-- INDEX: auto-generated by validate_doc.py — do not edit manually -->
38
+ | Section | Summary |
39
+ |---|---|
40
+ | [`specialists run`](#specialists-run) | `--epic <id>`, `--force-stale-base`: Epic membership, stale-base bypass; `--prompt`, `--bead`, `--worktree`, `--job`, `--context-depth` |
41
+ | [`specialists node`](#specialists-node) | NodeSupervisor control surface: run/list/promote/members/memory/stop |
42
+ | [`specialists epic`](#specialists-epic) | Epic lifecycle: list/status/resolve/merge (canonical publication path) |
43
+ | [`specialists feed`](#specialists-feed) | `--job <id>`: Filter by job ID |
44
+ | [`specialists log`](#specialists-log) | `-f`: Follow full runtime/control/error logs |
45
+ | [`specialists result`](#specialists-result) | `--wait`: Poll until terminal state |
46
+ | [`specialists status`](#specialists-status) | `--json`: Machine-readable status |
47
+ | [`specialists chat`](#specialists-chat) | Interactive TUI launch/control surface |
48
+ | [`specialists attach`](#specialists-attach) | Legacy tmux attach for jobs with `tmux_session` |
49
+ | [`specialists resume`](#specialists-resume) | No flags |
50
+ | [`specialists steer`](#specialists-steer) | No flags |
51
+ | [`specialists stop`](#specialists-stop) | No flags |
52
+ | [`specialists list`](#specialists-list) | `--category <name>`: Filter by category tag |
53
+ | [`specialists models`](#specialists-models) | `--provider <name>`: Provider substring filter |
54
+ | [`specialists view`](#specialists-view) | Pretty-print specialist config; `--section`, `--raw`, `--all` |
55
+ | [`specialists edit`](#specialists-edit) | Dot-path editing, presets, array ops |
56
+ | [`specialists config`](#specialists-config) | **DEPRECATED** — use `specialists edit` |
57
+ | [`specialists init`](#specialists-init) | | Flag | Description | |
58
+ | [`specialists doctor`](#specialists-doctor) | No flags |
59
+ | [`specialists validate`](#specialists-validate) | `--json`: JSON validation output |
60
+ | [`specialists memory`](#specialists-memory) | `sync\|refresh`, `--force`, `--json`: FTS memory cache management |
61
+ | [`specialists ps`](#specialists-ps) | `--json`: Machine-readable output; `--all`: include terminal jobs; `--follow`/`-f`: live refresh; epic grouping |
62
+ | [`specialists merge`](#specialists-merge) | Standalone chain merge (blocked for epic-owned chains) |
63
+ <!-- END INDEX -->
64
+
65
+ # CLI Reference
66
+
67
+ `specialists` has a short alias: `sp`.
68
+
69
+ ---
70
+
71
+ ## `specialists run`
72
+
73
+ ### Synopsis
74
+
75
+ ```bash
76
+ specialists run <name> [--prompt "..."] [--bead <id>] [--worktree] [--job <id>] \
77
+ [--epic <id>] [--force-stale-base] [--context-depth <n>] [--model <provider/model>] [--no-beads] \
78
+ [--keep-alive|--no-keep-alive] [--json | --raw]
79
+ ```
80
+
81
+ ### Flags
82
+
83
+ - `--prompt <text>`: Ad-hoc prompt.
84
+ - `--bead <id>`: Read prompt/context from bead.
85
+ - `--worktree`: Explicitly provision (or reuse) an isolated bd-managed worktree for this run. Requires `--bead`.
86
+ - `--job <id>`: Reuse the workspace from a prior job. Mutually exclusive with `--worktree`. When used without `--bead`, bead_id is automatically inferred from the target job's status.json if available.
87
+ - `--epic <id>`: Explicitly declare epic membership for this job. When `--bead` is used, defaults to `bead.parent`; this flag overrides that default. Useful for prep jobs or chain-root jobs that should belong to a merge-gated epic.
88
+ - `--force-stale-base`: Bypass the stale-base guard when provisioning a worktree. The guard blocks dispatch when epic sibling chains have unmerged substantive commits. Use this flag to force provisioning at the caller's risk (may cause merge conflicts later).
89
+ - `--context-depth <n>`: Completed blocker depth for bead context (default `1`).
90
+ - `--model <provider/model>`: Per-run model override.
91
+ - `--no-beads`: Disable tracking bead creation (does **not** disable bead reading when `--bead` is used).
92
+ - `--keep-alive`: Keep session for follow-up `resume` turns (explicit enable).
93
+ - `--no-keep-alive`: Force one-shot run even if specialist YAML has `execution.interactive: true`.
94
+ - `--json`: NDJSON event stream to stdout.
95
+ - `--raw`: Legacy raw token delta stream.
96
+
97
+ ### Examples
98
+
99
+ ```bash
100
+ specialists run debugger --bead unitAI-55d
101
+ specialists run debugger --bead unitAI-55d --context-depth 2
102
+ specialists run reviewer --prompt "Audit src/cli/run.ts"
103
+ cat brief.md | specialists run planner
104
+ specialists run reviewer --prompt "check logs" --json
105
+ specialists run reviewer --prompt "check logs" --raw
106
+ specialists run executor --worktree --bead hgpu.3
107
+ specialists run executor --job a1b2c3 --bead hgpu.4
108
+ specialists run executor --worktree --bead impl-2 --force-stale-base
109
+ specialists run explorer --bead prep-task.1 --epic unitAI-100
110
+ ```
111
+
112
+ ### Stale-base guard
113
+
114
+ When `--worktree` provisions a new worktree, the stale-base guard checks whether sibling chains in the same epic have unmerged substantive commits. If detected, dispatch is blocked:
115
+
116
+ ```
117
+ Error: Epic 'unitAI-3f7b' has sibling chains with unmerged changes.
118
+ - impl-a: 2 substantive commits on 'feature/unitAI-impl-a-executor'
119
+ - impl-b: 3 substantive commits on 'feature/unitAI-impl-b-executor'
120
+ Merge sibling chains first via 'sp epic merge unitAI-3f7b', or use --force-stale-base to bypass.
121
+ ```
122
+
123
+ **Why this matters**: When parallel chains branch from the same base, Wave B's worktree lacks Wave A's merged changes. If Wave A merges first, Wave B's diff shows reversions. Rebase at merge-time resolves this, but starting from a stale base increases conflict risk.
124
+
125
+ Use `--force-stale-base` to bypass when you knowingly accept merge complexity later.
126
+
127
+ ### Worktree guard
128
+
129
+ Specialists with `permission_required = MEDIUM` or `HIGH` can edit files. For specialists with `requires_worktree=true` (default), `specialists run` now auto-provisions a worktree when `--bead` is provided and `--job` is not used.
130
+
131
+ Additionally, when `--worktree` is used, the pi session enforces a **write-boundary**: edit/write/multiEdit/notebookEdit tool calls are restricted to paths within the worktree root. Read and bash tools are not intercepted. If a write tool attempts an out-of-bounds path, it falls back to a tmp-fs location (writes to a temp directory that is discarded). This prevents accidental modifications to files outside the isolated worktree.
132
+
133
+ ```
134
+ Error: specialist '<name>' has permission_required=<MEDIUM|HIGH> and requires worktree isolation.
135
+ Provide --bead <id> for automatic worktree provisioning, or use --job <id> to reuse an existing worktree.
136
+ ```
137
+
138
+ Specialists with `permission_required = READ_ONLY` (or unset) are **not** affected — the guard only triggers on edit-capable permissions.
139
+
140
+ ### Exit codes
141
+
142
+ - `0`: Run completed.
143
+ - `1`: Invalid args, specialist/bead load failure, runtime failure.
144
+
145
+ Notes:
146
+ - `--prompt` and `--bead` are mutually exclusive.
147
+ - `--worktree` and `--job` are mutually exclusive.
148
+ - `--worktree` requires `--bead <id>` to derive a deterministic branch name.
149
+ - `--epic` can be used standalone or with `--bead`. When used with `--bead`, it overrides the bead's parent epic.
150
+ - `--force-stale-base` bypasses the stale-base guard for worktree provisioning.
151
+ - `--force-job` bypasses the concurrency guard for `--job` reuse.
152
+ - `--no-worktree` was removed.
153
+ - Keep-alive default follows the merged specialist config `execution.interactive` (package / global user.json / repo override; default `false`).
154
+ - Precedence: `--no-keep-alive` > `--keep-alive` > merged `execution.interactive`.
155
+ - `--background` is removed and exits with error.
156
+ - **Auto-bead resolution**: When `--job <id>` is used without `--bead`, bead_id is inferred from the target job's `status.json.bead_id`. Precedence: explicit `--bead` > inferred bead from job > none. A stderr notice indicates when inference occurs.
157
+
158
+ ---
159
+
160
+ ## `specialists node`
161
+
162
+ ### Synopsis
163
+
164
+ ```bash
165
+ specialists node run <node-config-name-or-file> [--inline <json>] [--bead <id>] [--context-depth <n>] [--json]
166
+ specialists node list [--json]
167
+ specialists node promote <node-id> <finding-id> --to-bead <bead-id> [--json]
168
+ specialists node members <node-id> [--json]
169
+ specialists node memory <node-id> [--json]
170
+ specialists node stop <node-id> [--json]
171
+ ```
172
+
173
+ ### Subcommands
174
+
175
+ - `run`: Start a node run from discovered config name, config path, or inline JSON.
176
+ - `list`: List discovered node configs from `config/nodes` then `.specialists/default/nodes` (repo wins on collision).
177
+ - `promote`: Promote one node memory finding into bead notes.
178
+ - `members`: Inspect member generation/status/worktree lineage.
179
+ - `memory`: Inspect node memory entries and aggregate counts.
180
+ - `stop`: SIGTERM coordinator process.
181
+
182
+ Top-level replacements for flattened node operations:
183
+ - `sp ps` / `sp ps --node <id>` for status/snapshots
184
+ - `sp feed --node <id> [--json]` for node event streams
185
+ - `sp steer <coordinator-job-id> <message>` for coordinator steering
186
+ - `sp attach <coordinator-job-id>` for coordinator attach
187
+ - `sp result <node-ref>:<member-key>` for member results
188
+
189
+ Node refs accept any unique prefix (for example: `research`, `research-5eaf`, or full ID).
190
+
191
+ ### Flags
192
+
193
+ Common:
194
+ - `--json`: Machine-readable output.
195
+
196
+ `run`:
197
+ - `--inline <json>`: Inline node config JSON.
198
+ - `--bead <id>`: Build bead_context from bead + completed blockers.
199
+ - `--context-depth <n>`: Bead blocker depth override for node run context injection.
200
+
201
+ `promote`:
202
+ - `--to-bead <id>`: Target bead for promoted finding (required).
203
+
204
+ ### Examples
205
+
206
+ ```bash
207
+ specialists node run research --bead unitAI-3f7b.7 --context-depth 2
208
+ specialists node run ./config/nodes/research.node.json --json
209
+ specialists node members research-abc12345 --json
210
+ specialists node memory research-abc12345
211
+ specialists node stop research-abc12345
212
+ specialists node promote research-abc12345 finding-001 --to-bead unitAI-999
213
+ sp ps --node research-abc12345
214
+ sp feed --node research-abc12345 --json
215
+ sp steer <coordinator-job-id> "focus on fix loop for failing gate"
216
+ sp attach <coordinator-job-id>
217
+ sp result research-abc12345:explorer-1
218
+ ```
219
+
220
+ ### Exit codes
221
+
222
+ - `0`: Success.
223
+ - `1`: Invalid args, missing ids, runtime/control failure, or unavailable coordinator control surface.
224
+
225
+ ### Notes
226
+
227
+ - Coordinator is declarative; NodeSupervisor executes side effects.
228
+ - `--context-depth` on `node run` controls bead dependency context injection for node bootstrap.
229
+ - `node members` and `sp ps --node <id> --json` expose generation/worktree lineage fields used by operator tooling.
230
+
231
+ ---
232
+
233
+ ## `specialists feed`
234
+
235
+ ### Synopsis
236
+
237
+ ```bash
238
+ specialists feed <job-id> [options]
239
+ specialists feed -f [--forever] [options]
240
+ ```
241
+
242
+ ### Flags
243
+
244
+ - `--job <id>`: Filter by job ID.
245
+ - `--specialist <name>`: Filter by specialist.
246
+ - `--since <iso|relative>`: Start time filter (`2026-03-30T10:00:00Z`, `5m`, `1h`, `30s`, `1d`).
247
+ - `--limit <n>`: Max events in snapshot mode (default `100`).
248
+ - `-f`, `--follow`: Live follow mode.
249
+ - `--forever`: In global follow mode, keep following after all jobs complete.
250
+ - `--json`: NDJSON output.
251
+
252
+ ### Examples
253
+
254
+ ```bash
255
+ specialists feed a1b2c3
256
+ specialists feed a1b2c3 --follow
257
+ specialists feed -f
258
+ specialists feed -f --forever
259
+ specialists feed --specialist debugger --since 1h --limit 200
260
+ specialists feed --job a1b2c3 --json
261
+ ```
262
+
263
+ ### Output
264
+
265
+ When a specialist enters the `waiting` state, a **WAIT** banner is displayed:
266
+
267
+ ```
268
+ WAIT <specialist> (<job-id>) is waiting for input. Use: specialists resume <job-id> "..."
269
+ ```
270
+
271
+ For streamed turn output, `TURN+` lines include an 80-character text preview. When context usage crosses warning thresholds, feed prints context warnings at `WARN` and `CRITICAL` levels.
272
+
273
+ **Startup context lines** — on `run_start` events with `startup_snapshot`, feed emits a dimmed inline summary:
274
+
275
+ ```
276
+ ↳ startup job=a1b2c3 specialist=executor bead=unitAI-55d worktree=/repo/.worktrees/... branch=feature/... vars=[bead_context,reviewed_job_id] skills=3
277
+ ```
278
+
279
+ On `meta` events with `memory_injection`, feed emits a memory token accounting line:
280
+
281
+ ```
282
+ ↳ memory static=1200 dynamic=3400 gitnexus=500 total=5100
283
+ ```
284
+
285
+ `feed` reads from SQLite first and falls back to runtime files when SQLite data is unavailable. It is intentionally compact: use `sp log` when debugging stop/crash/resume/steer provenance.
286
+
287
+ ### Exit codes
288
+
289
+ - `0`: Success (including no events found).
290
+ - `1`: Unhandled runtime error.
291
+
292
+ ---
293
+
294
+ ## `specialists log`
295
+
296
+ ### Synopsis
297
+
298
+ ```bash
299
+ specialists log [job-id] [options]
300
+ specialists log -f [--specialist <name>] [--bead <id>]
301
+ ```
302
+
303
+ ### Flags
304
+
305
+ - `--job <id>`: Filter to one job id.
306
+ - `--specialist <name>`: Filter by specialist role.
307
+ - `--bead <id>`: Filter by bead id.
308
+ - `--node <id>`: Filter by node id.
309
+ - `--repo <name>`: In parent/global mode, restrict output to one child repo.
310
+ - `--since <iso|relative>`: Start time filter (`5m`, `1h`, ISO timestamp).
311
+ - `--limit <n>`: Max rows in each snapshot (default `200`).
312
+ - `-f`, `--follow`: Poll continuously for new rows.
313
+ - `--json`: NDJSON rows with the full event payload.
314
+ - `--all-events`, `--verbose`: Include agent-internal feed events (`tool`, `turn`, `message`, `text`, `thinking`, token rows).
315
+
316
+ ### Output
317
+
318
+ `log` is the specialist-runtime/debug stream, not a duplicate of `sp feed`. From a repo root it reads that repo's `.specialists/db/observability.db`; from a parent directory with no local DB it discovers immediate child repos that have `.specialists/db/observability.db` and aggregates them as a global log. Use `--repo <name>` to narrow parent/global output. If exactly one child repo is found, it is used transparently. By default it hides agent-internal turn/tool/text/thinking/token rows and shows only runtime-owned rows such as `run_start`, `run_complete`, `status_change`, `control_signal`, stale warnings, retries, compactions, extension/API errors, and auto-commit events. Human rows use restrained color (including color-coded `status=<state>`) and compact fields: timestamp, event label, job, specialist, bead, one collapsed `worktree=<repo>/<worktree>` field, status, pid, and event detail. Use `--all-events` when you explicitly need the raw feed-like internals.
319
+
320
+ Examples:
321
+
322
+ ```bash
323
+ specialists log a1b2c3
324
+ specialists log --bead unitAI-123 --limit 500
325
+ specialists log --specialist reviewer -f
326
+ specialists log -f --json
327
+ specialists log a1b2c3 --all-events
328
+ ```
329
+
330
+ ### Exit codes
331
+
332
+ - `0`: Success.
333
+ - `1`: Invalid args or missing observability DB.
334
+
335
+ ---
336
+
337
+ ## `specialists result`
338
+
339
+ ### Synopsis
340
+
341
+ ```bash
342
+ specialists result <job-id> [--wait] [--timeout <seconds>]
343
+ ```
344
+
345
+ ### Flags
346
+
347
+ - `--wait`: Poll until terminal state.
348
+ - `--timeout <seconds>`: Wait timeout (positive integer).
349
+
350
+ ### Examples
351
+
352
+ ```bash
353
+ specialists result a1b2c3
354
+ specialists result a1b2c3 --wait
355
+ specialists result a1b2c3 --wait --timeout 120
356
+ specialists result a1b2c3 > output.md
357
+ ```
358
+
359
+ ### Output
360
+
361
+ When a job is in the `waiting` state, an explicit message is shown:
362
+
363
+ ```
364
+ --- Session is waiting for your input. Use: specialists resume <job-id> "..." ---
365
+ ```
366
+
367
+ **Startup context block** — `result` derives a startup snapshot from `status.json.startup_context` merged with `run_start` timeline event and `meta` memory_injection. When present, a human-readable block is prepended before output:
368
+
369
+ ```
370
+ --- startup context ---
371
+ job_id: a1b2c3
372
+ specialist_name: executor
373
+ bead_id: unitAI-55d
374
+ worktree_path: /repo/.worktrees/unitAI-55d/unitAI-55d-executor
375
+ branch: feature/unitAI-55d-executor
376
+ variables_keys: bead_context, reviewed_job_id
377
+ skills.count: 3
378
+ skills.activated: sync-docs, clean-code, using-xtrm
379
+ memory.static_tokens: 1200
380
+ memory.memory_tokens: 3400
381
+ memory.gitnexus_tokens: 500
382
+ memory.total_tokens: 5100
383
+ ---
384
+ ```
385
+
386
+ In `--json` mode, `startup_context` appears both at top-level and inside `job`:
387
+
388
+ ```json
389
+ {
390
+ "job": {
391
+ "id": "a1b2c3",
392
+ "startup_context": { ... }
393
+ },
394
+ "startup_context": { ... },
395
+ "output": "..."
396
+ }
397
+ ```
398
+
399
+ ### Exit codes
400
+
401
+ - `0`: Result printed.
402
+ - `1`: Job missing, still running with no result file, failed job, timeout, or invalid args.
403
+
404
+ `result` reads from SQLite first and falls back to runtime files when SQLite data is unavailable. Failed or cancelled jobs include a `sp log <job-id>` hint so the operator can inspect the full runtime/control trail.
405
+
406
+ ---
407
+
408
+ ## `specialists status`
409
+
410
+ ### Synopsis
411
+
412
+ ```bash
413
+ specialists status [--json] [--job <id> | --job=<id>]
414
+ ```
415
+
416
+ ### Flags
417
+
418
+ - `--json`: Machine-readable status.
419
+ - `--job <id>` / `--job=<id>`: Show one job only.
420
+
421
+ ### Output
422
+
423
+ Waiting jobs are shown in **magenta** with a resume hint:
424
+
425
+ ```
426
+ action specialists resume <job-id> "..."
427
+ ```
428
+
429
+ In the job list, waiting status includes an inline action:
430
+
431
+ ```
432
+ <id> <specialist> waiting <elapsed> resume: specialists resume <id> "..."
433
+ ```
434
+
435
+ Status output also includes context telemetry fields:
436
+ - `context_pct`: current context usage percentage.
437
+ - `context_health`: health classification derived from context usage.
438
+ - `is_dead`: computed liveness flag (PID gone OR tmux session gone). Never persisted — computed at read time to avoid stale state.
439
+
440
+ `status` reads from SQLite first and falls back to runtime files when SQLite data is unavailable.
441
+
442
+ ### Examples
443
+
444
+ ```bash
445
+ specialists status
446
+ specialists status --json
447
+ specialists status --job a1b2c3
448
+ specialists status --job=a1b2c3 --json
449
+ ```
450
+
451
+ ### Exit codes
452
+
453
+ - `0`: Success.
454
+ - `1`: Invalid `--job` usage or unknown job.
455
+
456
+ ---
457
+
458
+ ## `specialists clean`
459
+
460
+ ### Synopsis
461
+
462
+ ```bash
463
+ specialists clean [--all] [--keep <n>] [--processes] [--stale-after <hours>] [--dry-run]
464
+ ```
465
+
466
+ ### Flags
467
+
468
+ - `--all`: Remove every completed job row, regardless of age.
469
+ - `--keep <n>`: Keep N newest completed job rows, remove rest.
470
+ - `--processes`: Cancel stale non-terminal jobs (`running`, `starting`, `waiting`) when PID is dead or `updated_at_ms` is older than `--stale-after`.
471
+ - `--stale-after <hours>`: Staleness threshold for `--processes` mode. Default `24`.
472
+ - `--dry-run`: Show plan only. No DB writes, no directory deletes.
473
+
474
+ ### Behavior
475
+
476
+ - Default mode is DB-first. Completed jobs are read from `observability.db` via `specialist_jobs`.
477
+ - Terminal cleanup still best-effort removes job directories when present.
478
+ - Missing job directories no longer crash clean.
479
+ - Legacy file-mode fallback stays available when `SPECIALISTS_JOB_FILE_OUTPUT=on` and SQLite has no rows.
480
+
481
+ ### Examples
482
+
483
+ ```bash
484
+ specialists clean
485
+ specialists clean --all
486
+ specialists clean --keep 25
487
+ specialists clean --processes
488
+ specialists clean --processes --stale-after 48
489
+ specialists clean --dry-run
490
+ ```
491
+
492
+ ### Exit codes
493
+
494
+ - `0`: Success.
495
+ - `1`: Invalid args or runtime failure.
496
+
497
+ ---
498
+
499
+ ## `specialists chat`
500
+
501
+ ### Synopsis
502
+
503
+ ```bash
504
+ specialists chat <specialist> [prompt...] [--bead <id>] [--prompt <text>] [--context-depth <n>] [--model <provider/model>]
505
+ ```
506
+
507
+ `sp chat` launches a specialist and opens an interactive TUI around that job. It is the single-screen equivalent of starting a run, following `sp feed -f`, checking status, and sending `sp steer` / `sp resume` messages.
508
+
509
+ ### What the TUI shows
510
+
511
+ - **Feed area**: normalized timeline lines rendered with the same formatter as `sp feed -f`; startup preamble and raw `stderr:` rows are suppressed while the TUI owns the terminal.
512
+ - **Deduped turn stream**: repeated streaming `THINK` / `TEXT` updates render once per turn phase instead of continuously repainting the same state. The dedupe resets on each new turn.
513
+ - **Startup context**: run-start, payload, mandatory-rules, and memory/context side-lines are shown when timeline metadata is present.
514
+ - **Final result**: `run_complete.output` is appended to the feed so the last assistant result is visible without leaving chat for `sp result`.
515
+ - **Status row**: pinned to the chat job id and displays the actual specialist name, job id, bead id, state, token count, and model.
516
+ - **Input prompt**: accepts freeform follow-up text and slash commands.
517
+
518
+ ### Input behavior
519
+
520
+ Freeform input is state-aware:
521
+
522
+ | Job state | Input action | FIFO payload | Equivalent CLI |
523
+ |---|---|---|---|
524
+ | `running` / `starting` | steer current turn | `{"type":"steer","message":"..."}` | `sp steer <job-id> "..."` |
525
+ | `waiting` | resume next keep-alive turn | `{"type":"resume","task":"..."}` | `sp resume <job-id> "..."` |
526
+ | terminal (`done`, `error`, `cancelled`) | rejected | none | inspect with `sp result` |
527
+
528
+ Slash commands:
529
+
530
+ | Command | Behavior |
531
+ |---|---|
532
+ | `/quit` | Detach from the TUI and leave the specialist job running/waiting. |
533
+ | `Ctrl+C` | Same as `/quit`: restore the terminal and detach without stopping the job. |
534
+ | `/stop` | Send the normal stop control action for the current job. |
535
+ | `/finalize` | Finalize the current waiting chain/job using the normal finalize path. |
536
+ | `/notes <text>` | Append a note to the current bead. |
537
+ | `/show` | Print current job/bead context in the feed. |
538
+
539
+ ### Examples
540
+
541
+ ```bash
542
+ sp chat explorer "map the release workflow"
543
+ sp chat reviewer --bead unitAI-929wj
544
+ sp chat debugger --prompt "why is sp chat not rendering?" --context-depth 2
545
+ ```
546
+
547
+ ### Relationship to `feed`, `result`, `steer`, and `resume`
548
+
549
+ `sp chat` does not replace the batch/headless commands. Use it when a human wants to stay in a live interactive loop. Use the individual commands for scripts, CI, specialist orchestration, or non-TTY sessions:
550
+
551
+ - `sp feed -f` — global multi-job observability.
552
+ - `sp feed <job-id> --follow` — per-job feed without an input prompt.
553
+ - `sp result <job-id>` — terminal or latest keep-alive output.
554
+ - `sp steer <job-id> "..."` — explicit mid-turn steering.
555
+ - `sp resume <job-id> "..."` — explicit next-turn prompt for a waiting keep-alive job.
556
+
557
+ ### Exit codes
558
+
559
+ - `0`: TUI exited cleanly.
560
+ - `1`: Invalid args, specialist/job startup failure, or terminal setup failure.
561
+
562
+ ---
563
+
564
+ ## `specialists attach`
565
+
566
+ ### Synopsis
567
+
568
+ ```bash
569
+ specialists attach <job-id>
570
+ ```
571
+
572
+ ### Flags
573
+
574
+ No flags.
575
+
576
+ ### Examples
577
+
578
+ ```bash
579
+ specialists attach a1b2c3
580
+ ```
581
+
582
+ ### Exit codes
583
+
584
+ - `0`: Successfully attached (returns when tmux session exits/detaches).
585
+ - `1`: Missing args, job missing, terminal job state, missing tmux session, or tmux unavailable.
586
+
587
+ Notes:
588
+ - `attach` is the legacy tmux attachment path. It requires tmux and a live `tmux_session` recorded in the job `status.json`.
589
+ - It does **not** provide the new chat TUI/feed/input surface. Use `sp chat <specialist> ...` when launching a new interactive TUI session. TUI attach to an existing job is planned separately in bead `unitAI-hx4ln`.
590
+ - For multi-job interactive tmux selection, use `specialists list --live`.
591
+
592
+ ---
593
+
594
+ ## `specialists resume`
595
+
596
+ ### Synopsis
597
+
598
+ ```bash
599
+ specialists resume <job-id> "<task>"
600
+ ```
601
+
602
+ ### Flags
603
+
604
+ No flags.
605
+
606
+ ### Examples
607
+
608
+ ```bash
609
+ specialists resume a1b2c3 "Now write the patch"
610
+ specialists resume a1b2c3 "Focus only on auth"
611
+ ```
612
+
613
+ ### Exit codes
614
+
615
+ - `0`: Resume message sent.
616
+ - `1`: Missing args, missing job, non-waiting status, missing FIFO, or write failure.
617
+
618
+ ---
619
+
620
+ ## `specialists steer`
621
+
622
+ ### Synopsis
623
+
624
+ ```bash
625
+ specialists steer <job-id> "<message>"
626
+ ```
627
+
628
+ ### Flags
629
+
630
+ No flags.
631
+
632
+ ### Notes
633
+
634
+ Works for **all running jobs** (not just keep-alive sessions). Accepts steering messages for jobs in `running`, `starting`, or `waiting` states.
635
+
636
+ ### Examples
637
+
638
+ ```bash
639
+ specialists steer a1b2c3 "focus only on supervisor.ts"
640
+ specialists steer a1b2c3 "skip tests and isolate root cause"
641
+ ```
642
+
643
+ ### Exit codes
644
+
645
+ - `0`: Steer message sent.
646
+ - `1`: Missing args, missing job, terminal job state, missing FIFO, or write failure.
647
+
648
+ ---
649
+
650
+ ## `specialists finalize`
651
+
652
+ Manual fallback for keep-alive chains that reached reviewer PASS but whose auto-finalize did not fire (auto-finalize watches the reviewer's streaming output; PASS delivered via `sp resume` does not stream and won't trigger it).
653
+
654
+ ### Synopsis
655
+
656
+ ```bash
657
+ specialists finalize <any-chain-job-id> [--json]
658
+ ```
659
+
660
+ ### Behavior
661
+
662
+ Accepts any job id from the chain (executor, reviewer, debugger). Looks up the chain via `chain_id`, scans its members for a reviewer with `Verdict: PASS` (matches both plain and markdown-bold formats), then **cascades** — closes EVERY waiting keep-alive member of the chain via `supervisor.finalizeWaitingJob()` so chain readiness, status persistence, and FIFO close are atomic.
663
+
664
+ Refuses if no reviewer in the chain has a PASS verdict, or if all chain members are already terminal.
665
+
666
+ ### Exit codes
667
+
668
+ - `0`: Chain finalized (one or more members transitioned waiting → done).
669
+ - `1`: Chain not eligible (no reviewer with PASS verdict, no waiting members, or job not found).
670
+
671
+ ---
672
+
673
+ ## `specialists stop`
674
+
675
+ ### Synopsis
676
+
677
+ ```bash
678
+ specialists stop <job-id>
679
+ ```
680
+
681
+ ### Flags
682
+
683
+ No flags.
684
+
685
+ ### Behavior
686
+
687
+ Before sending SIGTERM, `sp stop` resolves the terminal status:
688
+
689
+ - If the job has a `run_complete` event in `events.jsonl` → status becomes `done`
690
+ - Otherwise → status becomes `cancelled`
691
+
692
+ This prevents zombie "waiting" jobs after external kills. Status is written to `status.json` and `observability.db` **before** SIGTERM, ensuring the record reflects the actual outcome. `sp stop` also appends `control_signal` timeline events for stop request, signal delivery, tmux kill, and force-escalation paths.
693
+
694
+ ### Examples
695
+
696
+ ```bash
697
+ specialists stop a1b2c3
698
+ ```
699
+
700
+ ### Exit codes
701
+
702
+ - `0`: Signal sent, already terminal, or process already gone (`ESRCH`).
703
+ - `1`: Missing args, missing job, missing PID, or unexpected kill error.
704
+
705
+ ### Notes
706
+
707
+ - `cancelled` is a new terminal status distinct from `done`/`error` — indicates intentional stop without completion.
708
+ - `run_complete` evidence is checked via SQLite first, then `events.jsonl` fallback.
709
+
710
+ ---
711
+
712
+ ## `specialists list`
713
+
714
+ ### Synopsis
715
+
716
+ ```bash
717
+ specialists list [--category <name>] [--scope default|user] [--live] [--json]
718
+ ```
719
+
720
+ ### Flags
721
+
722
+ - `--category <name>`: Filter by category tag.
723
+ - `--scope <default|user>`: Filter by specialist scope.
724
+ - `--live`: Show running/waiting tmux sessions and attach via interactive selector.
725
+ - `--show-dead`: In `--live` mode, include jobs whose PID or tmux session is gone (filtered out by default). Useful for debugging dead sessions.
726
+ - `--json`: JSON output.
727
+
728
+ ### Examples
729
+
730
+ ```bash
731
+ specialists list
732
+ specialists list --category analysis
733
+ specialists list --scope user
734
+ specialists list --live
735
+ specialists list --json
736
+ ```
737
+
738
+ ### Exit codes
739
+
740
+ - `0`: Success.
741
+ - `1`: Invalid `--category`/`--scope` usage.
742
+
743
+ ---
744
+
745
+ ## `specialists models`
746
+
747
+ ### Synopsis
748
+
749
+ ```bash
750
+ specialists models [--provider <name>] [--used]
751
+ ```
752
+
753
+ ### Flags
754
+
755
+ - `--provider <name>`: Provider substring filter.
756
+ - `--used`: Show only models currently referenced by specialists.
757
+
758
+ ### Examples
759
+
760
+ ```bash
761
+ specialists models
762
+ specialists models --provider anthropic
763
+ specialists models --used
764
+ specialists models --provider openai --used
765
+ ```
766
+
767
+ ### Exit codes
768
+
769
+ - `0`: Success.
770
+ - `1`: `pi --list-models` unavailable/failed.
771
+
772
+ ---
773
+
774
+ ## `specialists view`
775
+
776
+ ### Synopsis
777
+
778
+ ```bash
779
+ specialists view [<name>] [--section <section>] [--raw]
780
+ specialists view --all
781
+ ```
782
+
783
+ ### Flags
784
+
785
+ - `--section <section>`: Show one config section only. Supported values: `metadata`, `execution`, `prompt`, `skills`, `capabilities`, `communication`, `validation`, `stall` / `stall-detection`, `beads`.
786
+ - `--raw`: Dump raw JSON to stdout (pipe-friendly).
787
+ - `--all`: Show the full detailed catalog of all specialists without interactive selection.
788
+
789
+ ### Behavior
790
+
791
+ | Invocation | Behavior |
792
+ |---|---|
793
+ | `sp view <name>` | Pretty-print all sections with ANSI color and readable multi-line prompts |
794
+ | `sp view <name> --section <s>` | Print one section only |
795
+ | `sp view <name> --raw` | Dump raw JSON (piping/scripting) |
796
+ | `sp view --all` | Catalog with model, category, permission badge, keep-alive flag |
797
+ | `sp view` (bare, TTY) | Catalog + interactive name prompt to drill into a specialist |
798
+ | `sp view` (bare, non-TTY) | Catalog only, usage hint printed |
799
+
800
+ ### Examples
801
+
802
+ ```bash
803
+ # Full pretty-print
804
+ specialists view explorer
805
+
806
+ # Single section
807
+ specialists view executor --section prompt
808
+ specialists view executor --section execution
809
+ specialists view executor --section stall
810
+
811
+ # Raw JSON for scripting
812
+ specialists view debugger --raw
813
+ specialists view debugger --raw | jq '.specialist.execution'
814
+
815
+ # Full catalog
816
+ specialists view --all
817
+ ```
818
+
819
+ ### Exit codes
820
+
821
+ - `0`: Success.
822
+ - `1`: Specialist not found, unknown `--section` value, unknown flag, or unexpected argument.
823
+
824
+ ---
825
+
826
+ ## `specialists edit`
827
+
828
+ ### Synopsis
829
+
830
+ ```bash
831
+ # Dot-path syntax (full field coverage)
832
+ specialists edit <name> <dot.path> <value> [options]
833
+ specialists edit <name> --set <dot.path> <value> [options]
834
+ specialists edit <name> --get <dot.path> [--scope <default|user>]
835
+
836
+ # Global overrides (machine scope, no file-path argument)
837
+ specialists edit --global <name>.<field.path> <value> [options]
838
+ specialists edit --global --get <name>.<field.path>
839
+ specialists edit --global --set <name>.<field.path> <value>
840
+ specialists edit --global
841
+
842
+ # Bulk operations
843
+ specialists edit --all --set <dot.path> <value> [options]
844
+ specialists edit --all --get <dot.path>
845
+ specialists edit --all
846
+
847
+ # Presets
848
+ specialists edit <name> --preset <preset> [--dry-run]
849
+ specialists edit --list-presets
850
+
851
+ # Array operations
852
+ specialists edit <name> --append <dot.path> <value>
853
+ specialists edit <name> --remove <dot.path> <value>
854
+
855
+ # File-based input (multiline fields)
856
+ specialists edit <name> --file <path> <dot.path>
857
+ ```
858
+
859
+ ### Flags
860
+
861
+ **Dot-path editing** (exactly one field per invocation):
862
+ - Positional: `<dot.path> <value>` or `--set <dot.path> <value>`
863
+ - `--get <dot.path>`: Read a field value
864
+ - `--append <dot.path> <value>`: Append to array field
865
+ - `--remove <dot.path> <value>`: Remove from array field
866
+ - `--file <path>`: Read value from file (for `specialist.prompt.system` or `specialist.prompt.task_template`)
867
+
868
+ **Presets**:
869
+ - `--preset <name>`: Apply a preset bundle of field values
870
+ - `--list-presets`: Show available presets
871
+
872
+ **Options**:
873
+ - `--global`: Target shared machine scope at `~/.config/specialists/user.json` (cannot combine with `--scope`)
874
+ - `--scope <default|user>`: Target scope (default: auto-detect)
875
+ - `--dry-run`: Preview changes without writing
876
+ - `--all`: Apply to all specialists
877
+ - `--fork-from <base-name>`: Create `.specialists/user/<name>.specialist.json` fork from resolved base specialist
878
+
879
+ **Legacy field aliases** (compat only, translated to dot-paths):
880
+ - `--model`, `--fallback-model`, `--description`, `--permission`, `--timeout`, `--tags`
881
+
882
+ ### Dot-Path Syntax
883
+
884
+ All specialist JSON fields are addressable via dot-notation:
885
+
886
+ ```bash
887
+ # Execution settings
888
+ specialists edit executor --set specialist.execution.model openai-codex/gpt-5.4-mini
889
+ specialists edit executor --set specialist.execution.timeout_ms 180000
890
+ specialists edit executor --set specialist.execution.permission_required HIGH
891
+ specialists edit executor --set specialist.execution.thinking_level medium
892
+
893
+ # Metadata
894
+ specialists edit executor --set specialist.metadata.description "High-performance code executor"
895
+ specialists edit executor --append specialist.metadata.tags "[\"production\", \"critical\"]"
896
+
897
+ # Prompt templates
898
+ specialists edit executor --file system.txt specialist.prompt.system
899
+ specialists edit executor --set specialist.prompt.task_template "Review and implement..."
900
+ ```
901
+
902
+ **Array field operations**:
903
+
904
+ ```bash
905
+ # Append tags
906
+ specialists edit executor --append specialist.metadata.tags "security"
907
+
908
+ # Remove tags
909
+ specialists edit executor --remove specialist.metadata.tags "deprecated"
910
+
911
+ # Set full array (JSON syntax)
912
+ specialists edit executor --set specialist.metadata.tags '["analysis", "review"]'
913
+ ```
914
+
915
+ ### Presets
916
+
917
+ Presets are predefined field bundles in `config/presets.json`. Built-in presets:
918
+
919
+ | Preset | Description | Key fields |
920
+ |--------|-------------|------------|
921
+ | `cheap` | Low-cost, fast responses | See `sp edit --list-presets` / `config/presets.json` |
922
+ | `medium` | Balanced cost/quality | See `sp edit --list-presets` / `config/presets.json` |
923
+ | `power` | Maximum capability | See `sp edit --list-presets` / `config/presets.json` |
924
+
925
+ ```bash
926
+ # List available presets
927
+ specialists edit --list-presets
928
+
929
+ # Apply preset to a specialist
930
+ specialists edit executor --preset power --dry-run
931
+ specialists edit executor --preset medium
932
+
933
+ # Apply preset to all specialists
934
+ specialists edit --all --preset cheap --dry-run
935
+ ```
936
+
937
+ ### Examples
938
+
939
+ ```bash
940
+ # Get current value
941
+ specialists edit executor --get specialist.execution.model
942
+
943
+ # Set single field
944
+ specialists edit executor specialist.execution.model openai-codex/gpt-5.5
945
+
946
+ # Global override examples
947
+ specialists edit --global executor.execution.model openai-codex/gpt-5.5
948
+ specialists edit --global --get executor.execution.model
949
+ specialists edit --global --set reviewer.execution.interactive false
950
+ specialists edit --global --set reviewer.stall_detection.waiting_auto_close_ms 3600000
951
+
952
+ # Legacy alias (compat)
953
+ specialists edit executor --model openai-codex/gpt-5.5
954
+
955
+ # Apply preset
956
+ specialists edit reviewer --preset power
957
+
958
+ # Bulk edit all specialists
959
+ specialists edit --all --set specialist.execution.stall_timeout_ms 120000
960
+
961
+ # Append to tags array
962
+ specialists edit debugger --append specialist.metadata.tags "debugging"
963
+
964
+ # Read system prompt from file
965
+ specialists edit executor --file ./prompts/executor-system.txt specialist.prompt.system
966
+
967
+ # Dry-run preview
968
+ specialists edit executor --set specialist.execution.timeout_ms 300000 --dry-run
969
+ ```
970
+
971
+ ### Exit codes
972
+
973
+ - `0`: Success.
974
+ - `1`: Invalid args/values, specialist not found, write failure, preset not found.
975
+
976
+ ### Notes
977
+
978
+ - Specialist configs are **JSON format** (`.specialist.json`).
979
+ - Ownership model for edits:
980
+ - package source in `config/specialists/` is upstream fallback, not repo customization surface
981
+ - `~/.config/specialists/user.json` is machine-wide global override layer (managed by `sp init --global` / `sp edit --global`)
982
+ - `.specialists/default/` is optional pin / compatibility snapshot state; do not hand-edit; prune stale entries with `sp prune-stale-defaults`
983
+ - `.specialists/user/` is repo customization/fork layer
984
+ - `--fork-from` supports both same-name override and new-name fork into `.specialists/user/`.
985
+ - All dot-paths must start with `specialist.` (auto-prefixed if omitted).
986
+ - `--all` without other flags opens all config JSON files in `$EDITOR`.
987
+ - Array operations (`--append`, `--remove`) require valid JSON array element syntax.
988
+
989
+ ---
990
+
991
+ ## `specialists config` {#specialists-config}
992
+
993
+ > **⚠ DEPRECATED** as of 2026-04-06. Use [`specialists edit`](#specialists-edit) instead.
994
+
995
+ The `specialists config` command is a deprecated alias for `specialists edit`. It will be removed in a future version.
996
+
997
+ ### Migration
998
+
999
+ | Old command | New command |
1000
+ |-------------|-------------|
1001
+ | `specialists config get <key> --all` | `specialists edit --all --get <key>` |
1002
+ | `specialists config set <key> <value> --all` | `specialists edit --all --set <key> <value>` |
1003
+ | `specialists config get <key> --name <n>` | `specialists edit <n> --get <key>` |
1004
+ | `specialists config set <key> <value> --name <n>` | `specialists edit <n> --set <key> <value>` |
1005
+
1006
+ The new `edit` command supports full dot-path syntax, presets, array operations, and file-based input.
1007
+
1008
+ ### `specialists config show <name> --resolved` (still canonical)
1009
+
1010
+ While `config get`/`config set` are deprecated aliases of `edit`, the `config show <name> --resolved` subcommand has **no equivalent on `edit`** and remains the only surface for inspecting how a specialist's `--tools` argument is computed at session start.
1011
+
1012
+ Use `--from-source` inside worktrees when you need resolver behavior from local source instead of installed dist:
1013
+
1014
+ ```bash
1015
+ specialists config show <name> --resolved --from-source
1016
+ ```
1017
+
1018
+ `--from-source` shells out through `bunx tsx src/index.ts ...` and does not need a rebuild. If `bunx` or `tsx` is unavailable, command exits with a clear error.
1019
+
1020
+ Output sections (in order):
1021
+
1022
+ | Section | Meaning |
1023
+ |---------|---------|
1024
+ | Resolved JSON | The fully-merged specialist spec with defaults applied |
1025
+ | `layer attribution` | Which layer (`catalog`, `specialist_override`, `runtime_health`) contributed which tools |
1026
+ | `extension availability` | Live health probe per extension (`pi-gitnexus`, `pi-serena-tools`, native): `loaded_healthy` / `not_installed` / `disabled` / `loaded_unhealthy` / `unknown` |
1027
+ | `catalog compatibility` | `ok` if catalog schema version matches |
1028
+ | `denied natives` | Tools removed by the specialist's `permissions[<TIER>]` override block (or `(none)`) |
1029
+ | `deny mode` | `soft` (preference hint only) or `hard` (tool removed) |
1030
+ | `preference signals` | Populated when soft-deny is active |
1031
+ | `downgrade reasons` | Populated when hard-deny had to restore natives because an extension was unhealthy |
1032
+ | `--tools` | The literal comma-joined string passed to `pi --tools` |
1033
+
1034
+ Example for `explorer` (READ_ONLY with hard-deny override on natives):
1035
+
1036
+ ```text
1037
+ layer attribution:
1038
+ - catalog (tool catalogs): read,grep,find,ls
1039
+ - specialist_override (specialist YAML): grep,find,ls
1040
+ extension availability:
1041
+ - native: loaded_healthy [none] built-in
1042
+ - gitnexus: loaded_healthy [none] loaded
1043
+ - serena: loaded_healthy [none] loaded
1044
+ catalog compatibility:
1045
+ - ok
1046
+ denied natives: grep,find,ls
1047
+ deny mode: hard
1048
+ preference signals: (none)
1049
+ downgrade reasons: (none)
1050
+ --tools: read,gitnexus_list_repos,gitnexus_query,gitnexus_context,gitnexus_impact,gitnexus_detect_changes,serena_list_tools,find_symbol,...
1051
+ ```
1052
+
1053
+ Use this command after editing a specialist's `permission_required` tier, its `permissions[<TIER>]` override block, or after installing/uninstalling `pi-gitnexus` or `pi-serena-tools` — to confirm the runtime tool set before dispatching a real specialist run.
1054
+
1055
+ See [manifest.md](manifest.md) for the full resolution semantics.
1056
+
1057
+ ---
1058
+
1059
+ ## `specialists init`
1060
+
1061
+ ### Synopsis
1062
+
1063
+ ```bash
1064
+ specialists init [--global] [--sync-defaults] [--sync-skills] [--no-xtrm-check]
1065
+ ```
1066
+
1067
+ ### Flags
1068
+
1069
+ | Flag | Description |
1070
+ |------|-------------|
1071
+ | `--global` | Initialize/update global override layer at `~/.config/specialists/user.json` for cross-repo defaults, keep-alive defaults, waiting auto-close thresholds, and model fallback edits. |
1072
+ | `--sync-defaults` | Compatibility/operator path: copy canonical Category A assets into `.specialists/default/`. Not the default install model. |
1073
+ | `--sync-skills` | Re-sync skills only through the xtrm-managed skill surface. |
1074
+ | `--no-xtrm-check` | Skip `.xtrm/` / `xt` prerequisite checks for CI or tests. |
1075
+
1076
+ ### Examples
1077
+
1078
+ ```bash
1079
+ sp init # per-repo bootstrap
1080
+ sp init --global # seed/update global user override layer for this machine
1081
+ sp init --sync-defaults # deprecated compatibility snapshot only when deliberately needed
1082
+ sp init --sync-skills # skill-only refresh path
1083
+ ```
1084
+
1085
+ ### Exit codes
1086
+
1087
+ - `0`: Success.
1088
+ - `1`: Unhandled runtime error.
1089
+
1090
+ What it sets up (always):
1091
+ - `.specialists/default/`, `.specialists/user/`
1092
+ - `.specialists/jobs/`, `.specialists/ready/`, `.specialists/db/` runtime dirs
1093
+ - `.specialists/jobs/` remains legacy/operator mirror in normal runtime
1094
+ - `.gitignore` runtime/db entries
1095
+ - `AGENTS.md` Specialists section
1096
+ - `.mcp.json` `mcpServers.specialists`
1097
+ - `.xtrm/hooks/specialists` + `.claude/hooks` symlinks + `.claude/settings.json` hook wiring
1098
+ - `.xtrm/skills/default`, `.xtrm/skills/active`, `.claude/skills` symlink, `.pi/skills` symlink
1099
+
1100
+ With `--sync-defaults` only (deprecated compatibility path):
1101
+ - populate or refresh `.specialists/default/` snapshots for specialists, mandatory-rules, nodes
1102
+ - migrate legacy nested default layout (`default/specialists/*.specialist.json` -> `default/*.specialist.json`)
1103
+
1104
+ Prefer `sp doctor --check-drift` and `sp prune-stale-defaults` for current package-canonical installs.
1105
+
1106
+ ---
1107
+
1108
+ ### Notes
1109
+
1110
+ - Specialist configs are now **JSON format** (`.specialist.json`). YAML files (`.specialist.yaml`) are no longer created.
1111
+ - Existing YAML configs are migrated to JSON on first edit or validation.
1112
+
1113
+ ---
1114
+
1115
+ ## `specialists doctor`
1116
+
1117
+ ### Synopsis
1118
+
1119
+ ```bash
1120
+ specialists doctor [orphans] [--specialists] [--check-drift | --drift]
1121
+ ```
1122
+
1123
+ ### Flags and subcommands
1124
+
1125
+ | Flag / subcommand | Description |
1126
+ |---|---|
1127
+ | `orphans` | Read-only orphan scan for membership, jobs, epics, and worktree pointers. |
1128
+ | `--specialists` / `--check-specialists` | Health check specialist override layers (`sp init --global`, `sp edit --global`, model coverage, blocked-field attempts). |
1129
+ | `--check-drift`, `--drift` | Report stale `.specialists/default/` snapshots against package canonical assets. |
1130
+
1131
+ ### Examples
1132
+
1133
+ ```bash
1134
+ specialists doctor
1135
+ specialists doctor --specialists
1136
+ specialists doctor orphans
1137
+ specialists doctor --check-drift
1138
+ ```
1139
+
1140
+ ### Exit codes
1141
+
1142
+ - `0`: Always (current implementation reports failures in output, not process exit code).
1143
+
1144
+ Checks include:
1145
+ - `pi`, `sp`, `bd`, `xt` availability
1146
+ - hooks presence/wiring
1147
+ - MCP registration
1148
+ - runtime directory health
1149
+ - zombie running-job detection
1150
+
1151
+ ---
1152
+
1153
+ ## `sp prune-stale-defaults`
1154
+
1155
+ ### Synopsis
1156
+
1157
+ ```bash
1158
+ sp prune-stale-defaults [--dry-run] [--root <path>]
1159
+ ```
1160
+
1161
+ ### Flags
1162
+
1163
+ | Flag | Description |
1164
+ |---|---|
1165
+ | `--dry-run` | List stale default snapshots without deleting files. |
1166
+ | `--root <path>` | Repo root to scan; defaults to current repo. |
1167
+
1168
+ Use this after `sp doctor --check-drift` to remove redundant `.specialists/default/` snapshots. Review `diverged` findings before pruning; user-owned overlays belong in `.specialists/user/`.
1169
+
1170
+ ---
1171
+
1172
+ ## xtrm-managed asset commands
1173
+
1174
+ Specialists docs reference these xtrm-tools commands for Category B skills/hooks drift:
1175
+
1176
+ ```bash
1177
+ xt doctor --cwd <repo-or-root> --json
1178
+ xt doctor --cwd <repo-or-root> --check-drift
1179
+ xt update --repo <repo> --apply
1180
+ xt update --root <projects-root> --apply
1181
+ ```
1182
+
1183
+ Omit `--apply` for a dry run. `xt doctor` uses `--cwd`; `xt update` uses `--repo` for one repository or `--root` for many.
1184
+
1185
+ ---
1186
+
1187
+ ## `specialists ps`
1188
+
1189
+ ### Synopsis
1190
+
1191
+ ```bash
1192
+ specialists ps [--json] [--all] [--follow | -f]
1193
+ [--running] [--bead <id>] [--since <duration>]
1194
+ [--mine] [--include-terminal] [--node <id>] [<job-id>]
1195
+ ```
1196
+
1197
+ ### Flags
1198
+
1199
+ - `--json`: Machine-readable JSON output (see [JSON output](#ps-json-output) below).
1200
+ - `--all`: Include terminal (`done`/`error`/`cancelled`) jobs **and** terminal epics (merged/abandoned) in addition to active ones. Default shows only `starting`, `running`, `waiting` jobs and non-terminal epics.
1201
+ - `--follow` / `-f`: Live-refresh mode — updates in place every 1 second using cursor repositioning (no screen flash).
1202
+ - `--running`: Hide jobs not in an active state (`starting`/`running`/`waiting`). Combine with `--all` to broaden the source set, then narrow.
1203
+ - `--bead <id>`: Show only jobs whose `bead_id` matches the given id exactly.
1204
+ - `--since <duration>`: Show only jobs that started within the last duration. Accepts `<n>s`, `<n>m`, `<n>h`, `<n>d` (e.g. `30m`, `2h`, `1d`).
1205
+ - `--mine`: Show only jobs whose linked bead is currently assigned to the current user (resolved via `bd query "assignee=me" --json`). Falls back to no-op if `bd` is unreachable.
1206
+ - `--include-terminal`: Show epics in `merged` or `abandoned` state. Default hides them to keep the view focused on active work. Legacy alias `--include-merged` is preserved (covers both states now).
1207
+ - `--node <id>`: Show only jobs that belong to the given node id.
1208
+ - Positional `<job-id>`: Inspect a single job (full status detail) instead of the snapshot.
1209
+
1210
+ Filter flags compose: `--running --bead unitAI-fyih8 --since 1h` returns only active jobs on that bead started in the last hour.
1211
+
1212
+ ### Description
1213
+
1214
+ `specialists ps` gives a process-oriented snapshot of all active jobs grouped by worktree chain. It uses two complementary views:
1215
+
1216
+ 1. **Flat job list** — every visible job with id, specialist name, context %, elapsed time, bead id + title, and status color.
1217
+ 2. **Worktree trees** — jobs are grouped under their `worktree_owner_job_id`. Within each tree, node-member jobs are collected under labelled `node:<id>` buckets. Reuse chains (`reused_from_job_id`) are rendered as nested sub-trees.
1218
+
1219
+ Sorting: tree roots are ordered by urgency (`waiting > running > starting > done/error`), then by newest start time within each priority tier.
1220
+
1221
+ ### Output columns (human mode)
1222
+
1223
+ ```
1224
+ <job-id> <specialist> <ctx%> <elapsed> <bead-id [title]> <status>
1225
+ ```
1226
+
1227
+ - **ctx%** — context window utilization (read from `context_pct` in `status.json`); `--` when not yet available.
1228
+ - **elapsed** — seconds/minutes since job started; `--` when not available.
1229
+ - **status** is color-coded: cyan=running, magenta=waiting, green=done, red=error, yellow=starting, gray=cancelled.
1230
+
1231
+ Worktree tree section:
1232
+
1233
+ ```
1234
+ <owner-job-id> (branch) /path/to/worktree
1235
+ - <job-id> <specialist> <ctx%> <elapsed> <bead> <status>
1236
+ - <child-job-id> ... ← reuse chain
1237
+ node:<node-id>
1238
+ - <job-id> ...
1239
+ ```
1240
+
1241
+ ### JSON output {#ps-json-output}
1242
+
1243
+ ```bash
1244
+ specialists ps --json
1245
+ specialists ps --all --json
1246
+ ```
1247
+
1248
+ Output schema:
1249
+
1250
+ ```json
1251
+ {
1252
+ "generated_at_ms": 1744123456789,
1253
+ "include_terminal": false,
1254
+ "counts": { "jobs": 3, "trees": 2 },
1255
+ "flat": [
1256
+ {
1257
+ "id": "a1b2c3",
1258
+ "specialist": "executor",
1259
+ "status": "running",
1260
+ "bead_id": "unitAI-55d",
1261
+ "bead_title": "Fix the auth bug",
1262
+ "node_id": null,
1263
+ "worktree_owner_job_id": "a1b2c3",
1264
+ "reused_from_job_id": null,
1265
+ "worktree_path": "/repo/.worktrees/unitAI-55d/unitAI-55d-executor",
1266
+ "branch": "feature/unitAI-55d-executor",
1267
+ "started_at_ms": 1744123000000,
1268
+ "elapsed_s": 456,
1269
+ "context_pct": 34,
1270
+ "context_health": "OK"
1271
+ }
1272
+ ],
1273
+ "trees": [ ... ]
1274
+ }
1275
+ ```
1276
+
1277
+ ### Examples
1278
+
1279
+ ```bash
1280
+ # Active jobs only (default)
1281
+ specialists ps
1282
+
1283
+ # Include finished jobs
1284
+ specialists ps --all
1285
+
1286
+ # Live dashboard — auto-refreshes every 1 second
1287
+ specialists ps --follow
1288
+ specialists ps -f
1289
+
1290
+ # Machine-readable snapshot
1291
+ specialists ps --json
1292
+ specialists ps --all --json
1293
+ ```
1294
+
1295
+ ### Data sources
1296
+
1297
+ `ps` reads from SQLite first (via `ObservabilitySqliteClient.listStatuses()`). Scanning `status.json` files is legacy/operator fallback only.
1298
+
1299
+ ### Exit codes
1300
+
1301
+ - `0`: Always (no jobs is a valid empty result).
1302
+
1303
+ ---
1304
+
1305
+ ## `specialists validate`
1306
+
1307
+ ### Synopsis
1308
+
1309
+ ```bash
1310
+ specialists validate <name> [--json]
1311
+ ```
1312
+
1313
+ ### Flags
1314
+
1315
+ - `--json`: JSON validation output.
1316
+
1317
+ ### Examples
1318
+
1319
+ ```bash
1320
+ specialists validate code-review
1321
+ specialists validate code-review --json
1322
+ ```
1323
+
1324
+ ### Exit codes
1325
+
1326
+ - `0`: Validation passed.
1327
+ - `1`: Not found, read error, schema validation failure, or invalid args.
1328
+
1329
+ ### Notes
1330
+
1331
+ - `validate` resolves specialist by runtime precedence (`user` -> `default-mirror` -> `package-fallback`) and reports file path + source in output.
1332
+
1333
+ ---
1334
+
1335
+ ## `specialists memory`
1336
+
1337
+ ### Synopsis
1338
+
1339
+ ```bash
1340
+ specialists memory <sync|refresh> [--force] [--json]
1341
+ ```
1342
+
1343
+ ### Subcommands
1344
+
1345
+ | Command | Purpose |
1346
+ |---------|--------|
1347
+ | `sync` | Sync `bd memories` into local SQLite FTS cache when stale or mismatched |
1348
+ | `refresh` | Invalidate cache then full rebuild from `bd memories` |
1349
+
1350
+ ### Flags
1351
+
1352
+ - `--force`: Force full rebuild even if cache appears fresh.
1353
+ - `--json`: JSON output.
1354
+
1355
+ ### Examples
1356
+
1357
+ ```bash
1358
+ specialists memory sync
1359
+ specialists memory sync --force
1360
+ specialists memory refresh
1361
+ specialists memory sync --json
1362
+ ```
1363
+
1364
+ ### Exit codes
1365
+
1366
+ - `0`: Success.
1367
+ - `1`: Invalid args or sync failure.
1368
+
1369
+ ### Notes
1370
+
1371
+ - The FTS cache (`specialist_memories_cache` SQLite table) is used by `buildFilteredMemoryInjection()` for keyword-filtered memory retrieval at specialist spawn.
1372
+ - Cache auto-syncs on `specialists init` and via PostToolUse hook (`specialists-memory-cache-sync.mjs`).
1373
+ - Cache max age: 1 hour (`CACHE_MAX_AGE_MS = 3600000`).
1374
+
1375
+ ---
1376
+
1377
+ ## `specialists epic`
1378
+
1379
+ ### Synopsis
1380
+
1381
+ ```bash
1382
+ specialists epic list [--unresolved] [--json]
1383
+ specialists epic status <epic-id> [--json]
1384
+ specialists epic sync <epic-id> [--apply] [--json]
1385
+ specialists epic merge <epic-id> [--pr] [--rebuild] [--json]
1386
+ specialists epic abandon <epic-id> --reason "<text>" [--force] [--json]
1387
+ ```
1388
+
1389
+ ### Subcommands
1390
+
1391
+ | Command | Purpose |
1392
+ |---------|---------|
1393
+ | `list` | Enumerate epics with derived readiness state |
1394
+ | `status` | Show epic state, chains, blockers, and readiness summary |
1395
+ | `sync` | Recompute derived readiness; with `--apply`, repair drift (stale chain refs, dead jobs, redirect markers) |
1396
+ | `merge` | Publish all epic-owned chains (canonical path); auto-runs finalize preflight on PASS chains |
1397
+ | `abandon` | Mark epic as terminal-cancelled (cleanup escape hatch) |
1398
+
1399
+ ### Flags
1400
+
1401
+ - `--unresolved`: (list) Show only non-terminal epics
1402
+ - `--apply`: (sync) Persist drift repairs; without it, sync is read-only
1403
+ - `--pr`: (merge) Create pull request instead of direct merge
1404
+ - `--rebuild`: (merge) Run `bun run build` after all merges complete
1405
+ - `--reason`: (abandon, required) Text recorded in epic transition audit
1406
+ - `--force`: (abandon) Override live-member guard
1407
+ - `--json`: Machine-readable JSON output
1408
+
1409
+ ### Epic Lifecycle (derived model)
1410
+
1411
+ Epic state is **derived live from chain readiness**, not a persisted state machine. Only three persisted states exist as terminal markers: `merged`, `abandoned`, and an audit-only `open` for newly-created epics. Everything else is recomputed each time it's read.
1412
+
1413
+ | Derived state | Meaning | Per-chain merge | Batch merge |
1414
+ |-------|---------|:----------:|:----------:|
1415
+ | `blocked` | Some chain pending or has no reviewer verdict | — | ✗ |
1416
+ | `failed` | At least one chain has a failed reviewer verdict | per-chain only on PASS chains | ✗ |
1417
+ | `merge_ready` | All chains pass and no active jobs | ✓ | ✓ |
1418
+ | `merged` | (persisted) Publication complete | — | terminal |
1419
+ | `abandoned` | (persisted) Cancelled without merge | — | terminal |
1420
+
1421
+ **Per-chain `sp merge <chain>` is allowed for any PASS chain regardless of sibling state** — Loop A from the prior chain-lifecycle deadlock is gone. Use `sp epic merge` only when batching all chains together.
1422
+
1423
+ **Reviewer PASS auto-finalizes the keep-alive executor** via `supervisor.finalizeWaitingJob()` when the verdict appears in the reviewer's streaming output. PASS delivered via `sp resume` (not streamed) does not trigger auto-finalize — use `sp finalize <any-chain-job-id>` to cascade-close the chain in that case.
1424
+
1425
+ **Persisted `failed` is recoverable.** A transient `sp epic merge` failure (rebase conflict, dirty worktree) writes a soft `failed` marker, but the next `sp epic merge` attempt retries fresh once the operator clears the conflict source. Only `merged` and `abandoned` are truly terminal. `validateEpicMergeReadiness` only blocks on those two.
1426
+
1427
+ `sp epic abandon` is the cleanup escape hatch for genuinely-unrecoverable epics. Live members require `--force`.
1428
+
1429
+ ### `sp epic list` Output
1430
+
1431
+ ```bash
1432
+ sp epic list
1433
+ # Output:
1434
+ # epic:unitAI-3f7b state:merge_ready chains:pass=3/3 blockers:[]
1435
+ # epic:unitAI-abc1 state:resolving chains:pass=1/2 blockers:[chain:impl-b]
1436
+ # epic:unitAI-xyz state:open chains:n/a blockers:[needs chains]
1437
+
1438
+ sp epic list --unresolved
1439
+ # Shows only non-terminal epics (open, resolving, merge_ready)
1440
+ ```
1441
+
1442
+ ### `sp epic status` Output
1443
+
1444
+ ```bash
1445
+ sp epic status unitAI-3f7b
1446
+ # Output:
1447
+ # epic_id: unitAI-3f7b
1448
+ # persisted_state: resolving
1449
+ # readiness_state: merge_ready
1450
+ # can_transition: true → merge_ready
1451
+ # prep: done=2/2 running=0 failed=0
1452
+ # chains:
1453
+ # chain:impl-a state:pass reviewer_verdict:pass has_active_jobs:false
1454
+ # chain:impl-b state:pass reviewer_verdict:pass has_active_jobs:false
1455
+ # chain:impl-c state:pass reviewer_verdict:pass has_active_jobs:false
1456
+ # blockers: []
1457
+ # summary: Epic unitAI-3f7b is merge-ready and all chains are terminal.
1458
+ ```
1459
+
1460
+ ### `sp epic merge` Behavior
1461
+
1462
+ 1. Reads epic state from observability SQLite
1463
+ 2. Verifies all chains are terminal (`done`/`error`)
1464
+ 3. Verifies latest reviewer verdict is PASS for each chain
1465
+ 4. Topologically sorts chains by bead dependencies
1466
+ 5. For each chain: **rebase branch onto master** inside worktree (resolves parallel-chain divergence)
1467
+ 6. For each chain: preview merge delta and check worthiness (blocks empty/noise-only)
1468
+ 7. For each chain: `git merge <branch> --no-ff --no-edit`
1469
+ 8. Runs `bunx tsc --noEmit` after each merge
1470
+ 9. Creates PR if `--pr` is set
1471
+ 10. Updates epic state to `merged` on success
1472
+
1473
+ **Pre-merge rebase**: Before merging each chain, the branch is rebased onto master inside its worktree. This ensures parallel chains (branched from the same base) incorporate earlier waves' changes before publication. If rebase fails with conflicts:
1474
+
1475
+ ```
1476
+ Error: Rebase failed for 'feature/unitAI-impl-a-executor' onto 'master' in worktree '/repo/.worktrees/unitAI-impl-a'.
1477
+ Conflicting files:
1478
+ - src/cli/run.ts
1479
+ - src/specialist/supervisor.ts
1480
+ Resolve conflicts manually in that worktree, then re-run merge.
1481
+ ```
1482
+
1483
+ Abort is automatic — no partial rebase state remains.
1484
+
1485
+ **Safety checks**:
1486
+ - Refuses merge if any chain job is non-terminal
1487
+ - Refuses merge if any chain lacks PASS verdict
1488
+ - Refuses merge if epic state is not `merge_ready` (use `--force-resolving` to auto-transition)
1489
+ - Refuses merge if branch has empty delta or noise-only delta (see [Merge-preview worthiness guard](#merge-preview-worthiness-guard))
1490
+
1491
+ **File listing**: Uses `git diff HEAD^1 HEAD` for accurate changed-file reporting (not `git diff-tree`).
1492
+
1493
+ ### Examples
1494
+
1495
+ ```bash
1496
+ # Check epic readiness
1497
+ specialists epic status unitAI-3f7b
1498
+
1499
+ # Publish all chains (canonical path)
1500
+ specialists epic merge unitAI-3f7b
1501
+
1502
+ # PR mode instead of direct merge
1503
+ specialists epic merge unitAI-3f7b --pr
1504
+
1505
+ # Rebuild after merge
1506
+ specialists epic merge unitAI-3f7b --rebuild
1507
+ ```
1508
+
1509
+ ### Exit codes
1510
+
1511
+ - `0`: Success (list/status/resolve/merge completed)
1512
+ - `1`: Invalid args, epic not found, chains non-terminal, missing PASS verdicts, merge conflict, or TypeScript gate failure
1513
+
1514
+ ### Notes
1515
+
1516
+ - **This is the canonical publication path** for wave-bound chains.
1517
+ - `sp merge <chain-root>` is blocked for chains belonging to unresolved epics.
1518
+ - Epic state is persisted in observability SQLite (`epic_runs` table).
1519
+ - Chain readiness is computed from reviewer verdicts in job results.
1520
+
1521
+ ---
1522
+
1523
+ ## `specialists merge`
1524
+
1525
+ ### Synopsis
1526
+
1527
+ ```bash
1528
+ specialists merge <chain-root-bead-id> [--rebuild]
1529
+ ```
1530
+
1531
+ ### Flags
1532
+
1533
+ - `--rebuild`: Run `bun run build` after merge completes.
1534
+
1535
+ ### Arguments
1536
+
1537
+ - `<chain-root-bead-id>`: A **chain-root bead** (single branch merge). **Must NOT belong to an unresolved epic.**
1538
+
1539
+ ### Behavior
1540
+
1541
+ **Standalone chain merge**:
1542
+ 1. Read bead via `bd show --json`
1543
+ 2. Check epic membership via `resolveChainEpicMembership()`
1544
+ 3. If chain belongs to unresolved epic, **refuse merge** with error message
1545
+ 4. Preview merge delta and evaluate worthiness (refuse empty/noise-only)
1546
+ 5. Find the newest terminal job with `worktree_path` and `branch` for that bead
1547
+ 6. **Rebase branch onto master** inside the worktree (resolves parallel-chain divergence)
1548
+ 7. Merge the branch with `--no-ff --no-edit`
1549
+ 8. Run TypeScript gate (`bunx tsc --noEmit`)
1550
+ 9. Print summary with changed files (using `git diff HEAD^1 HEAD`)
1551
+
1552
+ **Epic guard**:
1553
+
1554
+ If the chain belongs to an epic with status `open`, `resolving`, or `merge_ready`, the merge is blocked:
1555
+
1556
+ ```
1557
+ Error: Chain unitAI-impl belongs to unresolved epic unitAI-3f7b (status: resolving).
1558
+ Use 'sp epic merge unitAI-3f7b' to publish all chains together.
1559
+ ```
1560
+
1561
+ This guard ensures wave-bound chains are published atomically via `sp epic merge`.
1562
+
1563
+ ### Examples
1564
+
1565
+ ```bash
1566
+ # Standalone chain merge (epic guard must pass)
1567
+ specialists merge unitAI-55d
1568
+
1569
+ # Rebuild after merge
1570
+ specialists merge unitAI-55d --rebuild
1571
+ ```
1572
+
1573
+ ### Exit codes
1574
+
1575
+ - `0`: Merge succeeded, TypeScript gate passed.
1576
+ - `1`: Invalid args, bead not found, no chain branch found, **chain belongs to unresolved epic**, **empty/noise-only merge delta**, non-terminal job, merge conflict, or TypeScript gate failure.
1577
+
1578
+ ### Notes
1579
+
1580
+ - **Use `sp epic merge <epic-id>` for wave-bound chains.**
1581
+ - This command is only for standalone chains NOT belonging to an epic.
1582
+ - Uses `--no-ff` to preserve branch history.
1583
+ - Source: `src/cli/merge.ts`
1584
+
1585
+ ### Merge-preview worthiness guard
1586
+
1587
+ Both `sp merge` and `sp epic merge` use a preview-based worthiness guard to prevent merging branches with no substantive changes.
1588
+
1589
+ **How it works**:
1590
+
1591
+ 1. `previewBranchMergeDelta()` — performs a trial merge with `--no-commit`, inspects staged delta against HEAD
1592
+ 2. Categorizes files into **substantive** and **noise** based on path prefixes
1593
+ 3. `evaluateMergeWorthiness()` — decides if merge is worth doing
1594
+
1595
+ **Noise paths** (ignored for worthiness):
1596
+
1597
+ - `.xtrm/reports/`
1598
+ - `.wolf/`
1599
+ - `.specialists/jobs/` (legacy/operator mirror, not normal-runtime source of truth)
1600
+
1601
+ **Blocking conditions**:
1602
+
1603
+ | Reason | Meaning | Blocked? |
1604
+ |--------|---------|:--------:|
1605
+ | `empty-delta` | No files changed at all | ✓ Blocked |
1606
+ | `noise-only-delta` | Only noise paths changed | ✓ Blocked |
1607
+ | `ok` | At least one substantive file | ✓ Allowed |
1608
+
1609
+ **Error output** (when blocked):
1610
+
1611
+ ```
1612
+ Error: Refusing merge for 'feature/unitAI-55d': empty merge delta.
1613
+ Diagnostics: beadId=unitAI-55d jobId=a1b2c3 branch=feature/unitAI-55d total=0 substantive=0 noise=0
1614
+
1615
+ Error: Refusing merge for 'feature/unitAI-sync': noise-only merge delta.
1616
+ Diagnostics: beadId=unitAI-sync jobId=d4e5f6 branch=feature/unitAI-sync total=5 substantive=0 noise=5
1617
+ ```
1618
+
1619
+ **Why this matters**:
1620
+
1621
+ - **Old behavior**: hardcoded `src/` check — blocked doc-only merges, config-only merges, skill-only merges
1622
+ - **New behavior**: noise-aware preview — allows docs, config, skills, any substantive content
1623
+
1624
+ This enables doc-sync specialists and workflow-only changes to merge without false positives.
1625
+
1626
+ ## Releases (skill-driven)
1627
+
1628
+ `sp release prepare/publish` remain as deprecated aliases. Releases now flow through
1629
+ `xt release`, which dispatches the `changelog-keeper` MEDIUM specialist via
1630
+ `sp script changelog-keeper`. The specialist:
1631
+
1632
+ 1. Reads relevant xt session reports under `.xtrm/reports/`.
1633
+ 2. Drafts the new section directly into `CHANGELOG.md`.
1634
+ 3. Bumps `package.json` `version`.
1635
+ 4. Runs `npm run build` to refresh `dist/`.
1636
+ 5. Commits with `release: vX.Y.Z`, tags, pushes `--follow-tags`.
1637
+ 6. Optional `gh release create` if requested by the bead.
1638
+
1639
+ Operator gate is a single `git diff --stat HEAD~1 HEAD` after the specialist
1640
+ finishes — must show only `CHANGELOG.md`, `package.json`, `dist/`. Anything
1641
+ else means scope was violated (revert and refile).
1642
+
1643
+ Mandatory rule `changelog-keeper-scope` enforces the edit whitelist at the
1644
+ specialist level. See `config/skills/releasing/SKILL.md` for the bead
1645
+ template and recovery commands.