@jaggerxtrm/specialists 3.17.0 → 3.18.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.
Files changed (246) hide show
  1. package/README.md +268 -134
  2. package/config/mandatory-rules/json-only-final-output.md +13 -0
  3. package/config/mandatory-rules/service-skills-diff-scan-mandatory.md +26 -0
  4. package/config/mandatory-rules/service-skills-gitnexus-triage.md +5 -0
  5. package/config/skills/setup-specialists/SKILL.md +556 -0
  6. package/config/skills/specialists-creator/SKILL.md +132 -4
  7. package/config/skills/specialists-creator/scripts/audit-spec-uniformity.mjs +1 -1
  8. package/config/specialists/bare.specialist.json +3 -3
  9. package/config/specialists/changelog-drafter.specialist.json +5 -4
  10. package/config/specialists/changelog-keeper.specialist.json +7 -6
  11. package/config/specialists/debugger.specialist.json +2 -2
  12. package/config/specialists/executor.specialist.json +2 -2
  13. package/config/specialists/explorer.specialist.json +4 -4
  14. package/config/specialists/memory-processor.specialist.json +3 -3
  15. package/config/specialists/node-coordinator.specialist.json +3 -3
  16. package/config/specialists/obligations-scanner.specialist.json +67 -17
  17. package/config/specialists/overthinker.specialist.json +3 -3
  18. package/config/specialists/planner.specialist.json +4 -4
  19. package/config/specialists/quant-methodologist.specialist.json +145 -0
  20. package/config/specialists/quant-researcher.specialist.json +144 -0
  21. package/config/specialists/researcher.specialist.json +5 -5
  22. package/config/specialists/reviewer.specialist.json +1 -1
  23. package/config/specialists/seconder.specialist.json +2 -2
  24. package/config/specialists/security-auditor.specialist.json +2 -2
  25. package/config/specialists/service-skills-sync.specialist.json +90 -75
  26. package/config/specialists/specialists-creator.specialist.json +4 -4
  27. package/config/specialists/sync-docs.specialist.json +4 -4
  28. package/config/specialists/test-engineer.specialist.json +3 -3
  29. package/config/specialists/test-runner.specialist.json +7 -7
  30. package/config/specialists/transcriber.specialist.json +3 -3
  31. package/config/specialists/xt-merge.specialist.json +4 -4
  32. package/dist/asset-contract.json +21 -2
  33. package/dist/index.js +25704 -16376
  34. package/dist/lib.js +9849 -6147
  35. package/dist/types/cli/console/components.d.ts +83 -0
  36. package/dist/types/cli/console/components.d.ts.map +1 -0
  37. package/dist/types/cli/console/config-source.d.ts +58 -0
  38. package/dist/types/cli/console/config-source.d.ts.map +1 -0
  39. package/dist/types/cli/console/forensic.d.ts +11 -0
  40. package/dist/types/cli/console/forensic.d.ts.map +1 -0
  41. package/dist/types/cli/console/git.d.ts +28 -0
  42. package/dist/types/cli/console/git.d.ts.map +1 -0
  43. package/dist/types/cli/console/help.d.ts +2 -0
  44. package/dist/types/cli/console/help.d.ts.map +1 -0
  45. package/dist/types/cli/console/log.d.ts +13 -0
  46. package/dist/types/cli/console/log.d.ts.map +1 -0
  47. package/dist/types/cli/console/repo-config.d.ts +26 -0
  48. package/dist/types/cli/console/repo-config.d.ts.map +1 -0
  49. package/dist/types/cli/console/repo-discovery.d.ts +12 -0
  50. package/dist/types/cli/console/repo-discovery.d.ts.map +1 -0
  51. package/dist/types/cli/console/runtime.d.ts +12 -0
  52. package/dist/types/cli/console/runtime.d.ts.map +1 -0
  53. package/dist/types/cli/console/subscribe-prototype.d.ts +18 -0
  54. package/dist/types/cli/console/subscribe-prototype.d.ts.map +1 -0
  55. package/dist/types/cli/console/theme.d.ts +91 -0
  56. package/dist/types/cli/console/theme.d.ts.map +1 -0
  57. package/dist/types/cli/console/types.d.ts +231 -0
  58. package/dist/types/cli/console/types.d.ts.map +1 -0
  59. package/dist/types/cli/console/view-model.d.ts +252 -0
  60. package/dist/types/cli/console/view-model.d.ts.map +1 -0
  61. package/dist/types/cli/console.d.ts +2 -0
  62. package/dist/types/cli/console.d.ts.map +1 -0
  63. package/dist/types/cli/db.d.ts.map +1 -1
  64. package/dist/types/cli/doctor.d.ts.map +1 -1
  65. package/dist/types/cli/edit.d.ts.map +1 -1
  66. package/dist/types/cli/epic.d.ts.map +1 -1
  67. package/dist/types/cli/feed.d.ts.map +1 -1
  68. package/dist/types/cli/forensic.d.ts +2 -0
  69. package/dist/types/cli/forensic.d.ts.map +1 -0
  70. package/dist/types/cli/format-helpers.d.ts +4 -2
  71. package/dist/types/cli/format-helpers.d.ts.map +1 -1
  72. package/dist/types/cli/help.d.ts.map +1 -1
  73. package/dist/types/cli/init.d.ts +10 -0
  74. package/dist/types/cli/init.d.ts.map +1 -1
  75. package/dist/types/cli/list.d.ts.map +1 -1
  76. package/dist/types/cli/log.d.ts.map +1 -1
  77. package/dist/types/cli/metrics.d.ts +2 -0
  78. package/dist/types/cli/metrics.d.ts.map +1 -0
  79. package/dist/types/cli/ps.d.ts.map +1 -1
  80. package/dist/types/cli/result.d.ts.map +1 -1
  81. package/dist/types/cli/run.d.ts +1 -0
  82. package/dist/types/cli/run.d.ts.map +1 -1
  83. package/dist/types/cli/script.d.ts +3 -0
  84. package/dist/types/cli/script.d.ts.map +1 -1
  85. package/dist/types/cli/serve.d.ts.map +1 -1
  86. package/dist/types/cli/setup.d.ts +19 -1
  87. package/dist/types/cli/setup.d.ts.map +1 -1
  88. package/dist/types/cli/status.d.ts.map +1 -1
  89. package/dist/types/cli/version-check.d.ts +1 -0
  90. package/dist/types/cli/version-check.d.ts.map +1 -1
  91. package/dist/types/index.d.ts +1 -1
  92. package/dist/types/pi/session.d.ts +11 -1
  93. package/dist/types/pi/session.d.ts.map +1 -1
  94. package/dist/types/server.d.ts +15 -0
  95. package/dist/types/server.d.ts.map +1 -1
  96. package/dist/types/specialist/benchmarks.d.ts +37 -0
  97. package/dist/types/specialist/benchmarks.d.ts.map +1 -0
  98. package/dist/types/specialist/chain-identity.d.ts +7 -1
  99. package/dist/types/specialist/chain-identity.d.ts.map +1 -1
  100. package/dist/types/specialist/control.d.ts.map +1 -1
  101. package/dist/types/specialist/forensic-events.d.ts +138 -0
  102. package/dist/types/specialist/forensic-events.d.ts.map +1 -0
  103. package/dist/types/specialist/forensic-renderer.d.ts +34 -0
  104. package/dist/types/specialist/forensic-renderer.d.ts.map +1 -0
  105. package/dist/types/specialist/git-diff-evidence.d.ts +28 -0
  106. package/dist/types/specialist/git-diff-evidence.d.ts.map +1 -0
  107. package/dist/types/specialist/global-config.d.ts +389 -0
  108. package/dist/types/specialist/global-config.d.ts.map +1 -0
  109. package/dist/types/specialist/launch.d.ts +1 -0
  110. package/dist/types/specialist/launch.d.ts.map +1 -1
  111. package/dist/types/specialist/live-aggregates.d.ts +46 -0
  112. package/dist/types/specialist/live-aggregates.d.ts.map +1 -0
  113. package/dist/types/specialist/loader.d.ts +50 -1
  114. package/dist/types/specialist/loader.d.ts.map +1 -1
  115. package/dist/types/specialist/model-chain.d.ts +7 -0
  116. package/dist/types/specialist/model-chain.d.ts.map +1 -0
  117. package/dist/types/specialist/model-probes.d.ts +28 -0
  118. package/dist/types/specialist/model-probes.d.ts.map +1 -0
  119. package/dist/types/specialist/node-contract.d.ts +18 -18
  120. package/dist/types/specialist/node-supervisor.d.ts.map +1 -1
  121. package/dist/types/specialist/observability-db.d.ts +1 -1
  122. package/dist/types/specialist/observability-db.d.ts.map +1 -1
  123. package/dist/types/specialist/observability-sqlite.d.ts +25 -0
  124. package/dist/types/specialist/observability-sqlite.d.ts.map +1 -1
  125. package/dist/types/specialist/preset-resolver.d.ts +56 -0
  126. package/dist/types/specialist/preset-resolver.d.ts.map +1 -0
  127. package/dist/types/specialist/prometheus-projection.d.ts +25 -0
  128. package/dist/types/specialist/prometheus-projection.d.ts.map +1 -0
  129. package/dist/types/specialist/runner.d.ts +26 -1
  130. package/dist/types/specialist/runner.d.ts.map +1 -1
  131. package/dist/types/specialist/schema.d.ts +163 -54
  132. package/dist/types/specialist/schema.d.ts.map +1 -1
  133. package/dist/types/specialist/script-runner.d.ts +5 -1
  134. package/dist/types/specialist/script-runner.d.ts.map +1 -1
  135. package/dist/types/specialist/snapshot-diff.d.ts +8 -0
  136. package/dist/types/specialist/snapshot-diff.d.ts.map +1 -0
  137. package/dist/types/specialist/source-queue.d.ts +13 -0
  138. package/dist/types/specialist/source-queue.d.ts.map +1 -0
  139. package/dist/types/specialist/supervisor.d.ts +15 -1
  140. package/dist/types/specialist/supervisor.d.ts.map +1 -1
  141. package/dist/types/specialist/timeline-events.d.ts +68 -1
  142. package/dist/types/specialist/timeline-events.d.ts.map +1 -1
  143. package/dist/types/tools/specialist/resume_specialist.tool.d.ts +4 -4
  144. package/dist/types/tools/specialist/specialist_status.tool.d.ts +1 -1
  145. package/dist/types/tools/specialist/steer_specialist.tool.d.ts +4 -4
  146. package/dist/types/tools/specialist/use_specialist.tool.d.ts +16 -16
  147. package/docs/ARCHITECTURE.md +1176 -0
  148. package/docs/TODO.md +9 -0
  149. package/docs/architecture.md +11 -0
  150. package/docs/archive/2026-03-13-bd-decision-context-template-plan.md +96 -0
  151. package/docs/archive/AGENT-HANDOFF.md +351 -0
  152. package/docs/archive/PARITY-ANALYSIS.md +296 -0
  153. package/docs/archive/SPECIALISTS_REFACTOR.md.md +30 -0
  154. package/docs/archive/cc-programmatic.md +216 -0
  155. package/docs/archive/claude-agent-sdk.md +594 -0
  156. package/docs/archive/decision-specialist-directory.md +41 -0
  157. package/docs/archive/discoveries.md +148 -0
  158. package/docs/archive/executor-benchmark-protocol.md +198 -0
  159. package/docs/archive/future-features.md +66 -0
  160. package/docs/archive/gzrx-completion-critique.md +183 -0
  161. package/docs/archive/gzrx-research-notes.md +401 -0
  162. package/docs/archive/gzrx-tool-catalog.md +760 -0
  163. package/docs/archive/iron-review-hardening-qa-chain-substrate.md +322 -0
  164. package/docs/archive/iron-review-hardening.html +1004 -0
  165. package/docs/archive/issuetracking.md +312 -0
  166. package/docs/archive/qa-v3.0.2.md +220 -0
  167. package/docs/archive/restructure.md +231 -0
  168. package/docs/archive/script-specialists.md +1254 -0
  169. package/docs/archive/spec-v3.md +792 -0
  170. package/docs/archive/specialist-stats.md +127 -0
  171. package/docs/archive/specialists-friction-audit.md +1347 -0
  172. package/docs/archive/specialists-runtime-critique.md +170 -0
  173. package/docs/archive/specialists-service-evaluation.md +713 -0
  174. package/docs/archive/specialists-substrate-alignment.md +255 -0
  175. package/docs/archive/substrate-review.md +1288 -0
  176. package/docs/archive/test-writer-specialist.md +254 -0
  177. package/docs/archive/using-specialists-v3-improvements-2026-05-09.md +600 -0
  178. package/docs/archive/xtrm-specialists-analysis.md +314 -0
  179. package/docs/authoring.md +701 -0
  180. package/docs/background-jobs.md +203 -0
  181. package/docs/bare-specialists.md +83 -0
  182. package/docs/benchmarks/executor-benchmark-runner.md +66 -0
  183. package/docs/bootstrap.md +161 -0
  184. package/docs/cli-reference.md +1645 -0
  185. package/docs/deploying-alongside.md +155 -0
  186. package/docs/design/README.md +36 -0
  187. package/docs/design/darth-feedor-migration.md +290 -0
  188. package/docs/design/roadmap/README.md +32 -0
  189. package/docs/design/roadmap/chain-templates/README.md +146 -0
  190. package/docs/design/roadmap/chain-templates/code-quick.formula.json +27 -0
  191. package/docs/design/roadmap/chain-templates/code-standard.formula.json +126 -0
  192. package/docs/design/roadmap/chain-templates/code-with-advisors.formula.json +128 -0
  193. package/docs/design/roadmap/chain-templates/code-with-tests.formula.json +76 -0
  194. package/docs/design/roadmap/chain-templates/debug.formula.json +128 -0
  195. package/docs/design/roadmap/chain-templates/doc-sync.formula.json +28 -0
  196. package/docs/design/roadmap/chain-templates/memory-hygiene.formula.json +27 -0
  197. package/docs/design/roadmap/chain-templates/planning.formula.json +27 -0
  198. package/docs/design/roadmap/chain-templates/premortem.formula.json +26 -0
  199. package/docs/design/roadmap/chain-templates/release-prep.formula.json +36 -0
  200. package/docs/design/roadmap/chain-templates/research-only.formula.json +28 -0
  201. package/docs/design/roadmap/chain-templates/restitch.formula.json +125 -0
  202. package/docs/design/roadmap/chain-templates/security-deep.formula.json +161 -0
  203. package/docs/design/roadmap/chain-templates/test-only.formula.json +52 -0
  204. package/docs/design/roadmap/chain-templates/triage.formula.json +35 -0
  205. package/docs/design/roadmap/history/handoff-from-substrate-design.md +87 -0
  206. package/docs/design/roadmap/history/substrate-reconciliation.md +105 -0
  207. package/docs/design/roadmap/specialists-roadmap.md +1193 -0
  208. package/docs/design/sp-console-subscribe-via-materializer.md +231 -0
  209. package/docs/design/sp-console-tui-mock-v2.html +293 -0
  210. package/docs/design/sp-console-tui-mock.html +120 -0
  211. package/docs/design/sp-console-tui.md +340 -0
  212. package/docs/design/specialist-agentops-suite.md +323 -0
  213. package/docs/design/substrate/channels.md +14 -0
  214. package/docs/design/substrate/devops-platform-engineering-prd.md +446 -0
  215. package/docs/design/substrate/html-design-example.md +339 -0
  216. package/docs/design/xtrm-tiers-architecture.svg +132 -0
  217. package/docs/devops/dependency-verdict-materialization.md +46 -0
  218. package/docs/epic-readiness.md +75 -0
  219. package/docs/examples/mercury-atomic-summarizer.specialist.json +26 -0
  220. package/docs/examples/smoke-echo-text-expected-keys.specialist.json +25 -0
  221. package/docs/examples/smoke-echo.specialist.json +25 -0
  222. package/docs/features.md +1577 -0
  223. package/docs/hooks.md +81 -0
  224. package/docs/installation.md +142 -0
  225. package/docs/manifest.md +184 -0
  226. package/docs/mcp-servers.md +73 -0
  227. package/docs/mcp-tools.md +71 -0
  228. package/docs/nodes.md +231 -0
  229. package/docs/observability-metrics.md +152 -0
  230. package/docs/operator/sp-console-v2-walkthrough.md +410 -0
  231. package/docs/overrides-guide.md +306 -0
  232. package/docs/pi-rpc-boundary.md +118 -0
  233. package/docs/pi-session.md +195 -0
  234. package/docs/release.md +22 -0
  235. package/docs/skills.md +132 -0
  236. package/docs/specialists/handoff-schema.md +181 -0
  237. package/docs/specialists-catalog.md +99 -0
  238. package/docs/specialists-service-install.md +226 -0
  239. package/docs/specialists-service.md +363 -0
  240. package/docs/surface-ownership.md +138 -0
  241. package/docs/upgrade-notes/kan-90-global-user-config.md +114 -0
  242. package/docs/upgrade-notes/kan-91-expanded-overrides.md +261 -0
  243. package/docs/workflow.md +114 -0
  244. package/docs/worktree.md +71 -0
  245. package/docs/worktrees.md +309 -0
  246. package/package.json +6 -3
@@ -0,0 +1,309 @@
1
+ ---
2
+ title: Worktree Isolation
3
+ scope: worktrees
4
+ category: reference
5
+ version: 1.4.1
6
+ updated: 2026-05-15
7
+ synced_at: bf6baf7a
8
+ description: Technical reference for worktree-per-executor isolation — CLI flags, job registry, GC, and chained bead patterns.
9
+ source_of_truth_for:
10
+ - "src/specialist/job-root.ts"
11
+ - "src/specialist/worktree.ts"
12
+ - "src/specialist/worktree-gc.ts"
13
+ - "src/cli/run.ts"
14
+ - "src/specialist/supervisor.ts"
15
+ domain:
16
+ - worktrees
17
+ - jobs
18
+ - isolation
19
+ ---
20
+
21
+ # Worktree Isolation
22
+
23
+ Each edit-permission specialist runs in an isolated git worktree (branch). This prevents concurrent file corruption when multiple executors modify overlapping paths, and produces a clean per-task branch that the orchestrator merges in dependency order.
24
+
25
+ > Design decisions: overthinker bead `abb9`. Implementation: `hgpu.1–hgpu.5`.
26
+
27
+ ---
28
+
29
+ ## CLI flags
30
+
31
+ ```
32
+ specialists run <name> [--worktree] [--job <id>] [--force-stale-base]
33
+ ```
34
+
35
+ | Flag | Semantics | Creates worktree? |
36
+ |------|-----------|:-:|
37
+ | `--worktree` | Explicitly provision a new isolated workspace; requires `--bead` | Yes |
38
+ | `--job <id>` | Reuse the workspace of an existing job | No |
39
+ | `--force-stale-base` | Bypass stale-base guard when provisioning worktree | Yes (if `--worktree`) |
40
+
41
+ `--worktree` and `--job` are **mutually exclusive**. Specifying both exits with an error.
42
+
43
+ `--force-stale-base` is only meaningful with `--worktree` — it forces provisioning even when sibling epic chains have unmerged substantive commits.
44
+
45
+ ---
46
+
47
+ ## Isolation guard for edit-capable specialists
48
+
49
+ Specialists with `permission_required = MEDIUM` or `HIGH` can modify files. Launching them in the main checkout creates last-writer-wins races when multiple specialists run concurrently. The **worktree guard** (`unitAI-fdvt`) blocks these runs unless an isolation option is supplied.
50
+
51
+ ### Trigger condition
52
+
53
+ Automatic worktree provisioning triggers when **all** of the following are true:
54
+
55
+ 1. `specialist.execution.permission_required` is `MEDIUM` or `HIGH`.
56
+ 2. `specialist.execution.requires_worktree` is not set to `false`.
57
+ 3. `--job <id>` was not passed.
58
+ 4. `--bead <id>` is available (required for deterministic branch naming).
59
+
60
+ ### Error message
61
+
62
+ If automatic provisioning is required but no `--bead` was supplied:
63
+
64
+ ```
65
+ Error: specialist '<name>' has permission_required=<MEDIUM|HIGH> and requires worktree isolation.
66
+ Provide --bead <id> for automatic worktree provisioning, or use --job <id> to reuse an existing worktree.
67
+ ```
68
+
69
+ The process exits with code `1`.
70
+
71
+ `READ_ONLY` specialists are **never** gated — the requirement only applies to edit-capable specialists with `requires_worktree=true`.
72
+
73
+ ### Stale-base guard
74
+
75
+ 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:
76
+
77
+ ```
78
+ Error: Epic 'unitAI-3f7b' has sibling chains with unmerged changes.
79
+ - impl-a: 2 substantive commits on 'feature/unitAI-impl-a-executor'
80
+ - impl-b: 3 substantive commits on 'feature/unitAI-impl-b-executor'
81
+ Merge sibling chains first via 'sp epic merge unitAI-3f7b', or use --force-stale-base to bypass.
82
+ ```
83
+
84
+ **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.
85
+
86
+ Use `--force-stale-base` to bypass when you knowingly accept merge complexity later.
87
+
88
+ ### `--worktree`
89
+
90
+ Optional explicit flag. MEDIUM/HIGH specialists that require isolation now auto-provision without this flag when `--bead` is present.
91
+
92
+ Requires `--bead <id>` — the bead id drives the deterministic branch name.
93
+
94
+ ```bash
95
+ specialists run executor --worktree --bead hgpu.3
96
+ # stderr: [worktree created: /repo/.worktrees/hgpu.3/hgpu.3-executor branch: feature/hgpu.3-executor]
97
+ ```
98
+
99
+ If a worktree for that branch already exists (e.g. from a prior interrupted run) it is reused:
100
+
101
+ ```bash
102
+ # stderr: [worktree reused: /repo/.worktrees/hgpu.3/hgpu.3-executor branch: feature/hgpu.3-executor]
103
+ ```
104
+
105
+ ### `--job <id>`
106
+
107
+ Resolves the target job's `worktree_path` from the DB-first runtime state, falling back to legacy `status.json` mirrors when enabled, and uses that directory as `cwd`. The **caller's** `--bead` remains authoritative — only the workspace is borrowed.
108
+
109
+ ```bash
110
+ specialists run reviewer --job 49adda --bead hgpu.3-review
111
+ # stderr: [workspace reused from job 49adda: /repo/.worktrees/hgpu.3/hgpu.3-executor]
112
+ ```
113
+
114
+ Hard fail conditions (both exit 1):
115
+ - `status.json` missing or unreadable for the given job id.
116
+ - `worktree_path` absent — the target job was not started with `--worktree`.
117
+
118
+ **Concurrency guard:** READ_ONLY and LOW specialists may run against an active worktree; MEDIUM/HIGH specialists are blocked until the owning job reaches a terminal state. Use `--force-job` to bypass.
119
+
120
+ ---
121
+
122
+ ## How it works
123
+
124
+ ### Branch naming
125
+
126
+ `provisionWorktree()` in `worktree.ts` derives deterministic names:
127
+
128
+ | Artifact | Convention | Example |
129
+ |----------|-----------|---------|
130
+ | Git branch | `feature/<beadId>-<slug>` | `feature/hgpu.3-executor` |
131
+ | Worktree dir | `<beadId>-<slug>` | `hgpu.3-executor` |
132
+ | Parent dir | `<git-common-root>/.worktrees/<beadId>/` | `.worktrees/hgpu.3/` |
133
+
134
+ `<slug>` is the specialist name lowercased with non-alphanumeric runs collapsed to `-`.
135
+
136
+ ### Worktree creation
137
+
138
+ `bd worktree create <path> --branch <branch>` is the **only** creation path. There is no silent `git worktree add` fallback — failure throws immediately with the bd stderr included in the message.
139
+
140
+ Reuse detection runs first via `git worktree list --porcelain`; creation is skipped if the branch is already checked out.
141
+
142
+ ### Central job registry
143
+
144
+ `resolveJobsDir()` in `job-root.ts` anchors `.specialists/jobs/` to the git **common root** using `git rev-parse --git-common-dir`. From any worktree, `dirname(resolve(cwd, gitCommonDir))` resolves to the main checkout root — all worktrees converge on the same jobs directory.
145
+
146
+ ```
147
+ /repo/.git/ ← common git dir
148
+ /repo/.specialists/jobs/ ← shared job registry (all worktrees read/write here)
149
+ /repo/.worktrees/hgpu.3/hgpu.3-executor/ ← isolated cwd for that run
150
+ ```
151
+
152
+ ### Persisted metadata
153
+
154
+ `Supervisor` persists `worktree_path` and `branch` in canonical runtime state and, when legacy file mirrors are enabled, also writes them to `status.json` immediately on job start:
155
+
156
+ ```json
157
+ {
158
+ "id": "49adda",
159
+ "specialist": "executor",
160
+ "status": "running",
161
+ "worktree_path": "/repo/.worktrees/hgpu.3/hgpu.3-executor",
162
+ "branch": "feature/hgpu.3-executor"
163
+ }
164
+ ```
165
+
166
+ `--job` resolution uses persisted job metadata — no git scanning required.
167
+
168
+ ### Status / steer / resume
169
+
170
+ `status`, `steer`, and `resume` commands all call `resolveJobsDir()` with their local `cwd`, which returns the common-root path regardless of whether they are invoked from a worktree or the main checkout. The job record is always found.
171
+
172
+ ### Pi bootstrap
173
+
174
+ Pi extensions are global (`~/.pi/`). No per-worktree bootstrap step is required.
175
+
176
+ ---
177
+
178
+ ## Worktree GC
179
+
180
+ ```bash
181
+ specialists clean # prunes job dirs AND terminal worktrees
182
+ specialists clean --dry-run # preview removals without deleting
183
+ ```
184
+
185
+ GC runs automatically as part of `specialists clean`. Candidates must satisfy **all** conditions:
186
+
187
+ 1. Job status is `done` or `error` (terminal).
188
+ 2. `worktree_path` is recorded in `status.json`.
189
+ 3. The directory still exists on disk.
190
+ 4. Job status is **not** `starting`, `running`, or `waiting` (active guard runs first, unconditionally).
191
+
192
+ Removal uses `git worktree remove --force` so both the directory and the git registry entry are cleaned atomically. Failures are skipped silently — missing cleanup is preferred over data loss.
193
+
194
+ ---
195
+
196
+ ## Session close: `sp end`
197
+
198
+ `specialists end` closes a worktree session with epic-aware publication.
199
+
200
+ ### Synopsis
201
+
202
+ ```bash
203
+ sp end [--bead <id>|--epic <id>] [--pr] [--rebuild]
204
+ ```
205
+
206
+ ### Epic-aware behavior
207
+
208
+ If the current chain belongs to an unresolved epic (`open`, `resolving`, `merge_ready`):
209
+
210
+ 1. `sp end` detects epic membership via `checkEpicUnresolvedGuard()`
211
+ 2. Prints redirect message
212
+ 3. Delegates to `sp epic merge <epic-id>`
213
+
214
+ Example:
215
+ ```
216
+ Chain unitAI-impl belongs to unresolved epic unitAI-3f7b (status: resolving).
217
+ Redirecting session close publication to epic merge (direct mode).
218
+ Epic unitAI-3f7b: resolving -> merge_ready
219
+ Epic unitAI-3f7b: merge_ready -> merged
220
+ Publication successful.
221
+ ```
222
+
223
+ ### Direct chain publication
224
+
225
+ For standalone chains NOT belonging to an epic:
226
+
227
+ ```bash
228
+ sp end --bead unitAI-55d
229
+ # → merges branch feature/unitAI-55d-executor
230
+ ```
231
+
232
+ ---
233
+
234
+ ---
235
+
236
+ ## Chained bead review/fix loop
237
+
238
+ A common orchestration pattern with worktree isolation:
239
+
240
+ ```bash
241
+ # 1. Executor claims bead, provisions worktree, does implementation
242
+ specialists run executor --worktree --bead hgpu.3
243
+ # → executor closes bead as COMPLETE/PARTIAL, job id: 49adda
244
+
245
+ # 2. Reviewer enters the same worktree (read bead notes from the executor's run)
246
+ specialists run reviewer --job 49adda --bead hgpu.3-review
247
+
248
+ # 3. If reviewer returns PARTIAL, fix-it agent re-enters same workspace
249
+ specialists run executor --job 49adda --bead hgpu.3-fix
250
+ ```
251
+
252
+ Key invariants:
253
+ - Reviewer sees exactly the state the executor left — same branch, same files.
254
+ - Caller's `--bead` controls which bead is opened/closed; `--job` only selects the workspace.
255
+ - The executor's bead is never re-opened by the reviewer — lifecycle stays with the original claimer.
256
+
257
+ For orchestration patterns that compose this loop, see `SKILL.md` and `workflow.md`.
258
+
259
+ ---
260
+
261
+ ## Auto-checkpoint behavior
262
+
263
+ Specialists with `auto_commit: checkpoint_on_waiting` or `checkpoint_on_terminal` automatically commit substantive worktree changes at designated lifecycle points. This prevents lost work if a job crashes or is stopped mid-task.
264
+
265
+ | Policy | When commits happen | Typical use |
266
+ |--------|---------------------|-------------|
267
+ | `never` | Never | Default — no auto-commit |
268
+ | `checkpoint_on_waiting` | Each keep-alive turn entering `waiting` | Executors, debuggers — preserve partial work before review |
269
+ | `checkpoint_on_terminal` | Terminal completion (`done`/`error`) | One-shot specialists — commit only at end |
270
+
271
+ Default specialists with auto-checkpoint enabled:
272
+ - **executor**: `checkpoint_on_waiting`
273
+ - **debugger**: `checkpoint_on_waiting`
274
+
275
+ Commit messages follow the pattern:
276
+ ```
277
+ checkpoint(executor): unitAI-55d turn 1
278
+ ```
279
+
280
+ Status metadata tracks checkpoints:
281
+ ```json
282
+ {
283
+ "auto_commit_count": 3,
284
+ "last_auto_commit_sha": "a1b2c3d",
285
+ "last_auto_commit_at_ms": 1714020000000
286
+ }
287
+ ```
288
+
289
+ Auto-checkpoint runs silently — no user action required. The guard persists result + bead notes even on initial waiting turn (unitAI-8b812), ensuring no work is lost before the first checkpoint.
290
+
291
+ ---
292
+
293
+ ## Key files
294
+
295
+ | File | Responsibility |
296
+ |------|---------------|
297
+ | `src/specialist/job-root.ts` | `resolveJobsDir()` — common-root job registry anchor |
298
+ | `src/specialist/worktree.ts` | `provisionWorktree()`, branch/path derivation, `listWorktrees()` |
299
+ | `src/specialist/worktree-gc.ts` | `collectWorktreeGcCandidates()`, `pruneWorktrees()` |
300
+ | `src/cli/run.ts` | `resolveWorkingDirectory()` — `--worktree`/`--job` dispatch |
301
+ | `src/specialist/supervisor.ts` | Persists `worktree_path` + `branch` to DB-first runtime state and legacy mirrors when enabled |
302
+
303
+ ---
304
+
305
+ ## See also
306
+
307
+ - [background-jobs.md](background-jobs.md) — job lifecycle, status polling, keep-alive
308
+ - [workflow.md](workflow.md) — orchestration patterns and specialist chaining
309
+ - [worktree.md](worktree.md) — xtrm `xt pi` / `xt end` integration (separate topic)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jaggerxtrm/specialists",
3
- "version": "3.17.0",
3
+ "version": "3.18.0",
4
4
  "description": "OmniSpecialist — 7-tool MCP orchestration layer powered by the Specialist System. Discover and execute .specialist.yaml files across project/user/system scopes via pi.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/types/lib.d.ts",
@@ -27,6 +27,7 @@
27
27
  "config/nodes/",
28
28
  "config/hooks/",
29
29
  "config/presets.json",
30
+ "docs/",
30
31
  "LICENSE",
31
32
  "!config/benchmarks/",
32
33
  "!config/skills/**/evals/",
@@ -75,6 +76,7 @@
75
76
  "dependencies": {
76
77
  "@earendil-works/pi-tui": "0.75.5",
77
78
  "@modelcontextprotocol/sdk": "1.29.0",
79
+ "hono": "4.12.26",
78
80
  "qs": "6.15.2",
79
81
  "yaml": "2.9.0",
80
82
  "zod": "3.25.76",
@@ -86,15 +88,16 @@
86
88
  "@vitest/coverage-v8": "4.1.7",
87
89
  "tsx": "4.22.3",
88
90
  "typescript": "5.9.3",
89
- "vitest": "4.1.7"
91
+ "vitest": "4.1.7",
92
+ "vite": "8.0.16"
90
93
  },
91
94
  "engines": {
92
95
  "bun": ">=1.0.0"
93
96
  },
94
97
  "overrides": {
95
98
  "@hono/node-server": "^1.19.13",
99
+ "esbuild": "^0.28.1",
96
100
  "fast-uri": "^3.1.2",
97
- "hono": "^4.12.18",
98
101
  "ip-address": "^10.2.0",
99
102
  "path-to-regexp": "^8.4.0",
100
103
  "qs": "6.15.2"