@jaggerxtrm/specialists 3.16.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 (257) hide show
  1. package/README.md +268 -132
  2. package/config/mandatory-rules/json-only-final-output.md +13 -0
  3. package/config/mandatory-rules/research-tool-routing.md +4 -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 +1 -1
  7. package/config/skills/setup-specialists/SKILL.md +556 -0
  8. package/config/skills/specialists-creator/SKILL.md +160 -5
  9. package/config/skills/specialists-creator/scripts/audit-spec-uniformity.mjs +1 -1
  10. package/config/skills/using-specialists-auto/SKILL.md +1 -1
  11. package/config/skills/using-specialists-v2/SKILL.md +7 -7
  12. package/config/skills/using-specialists-v3/SKILL.md +223 -147
  13. package/config/specialists/bare.specialist.json +3 -3
  14. package/config/specialists/changelog-drafter.specialist.json +9 -6
  15. package/config/specialists/changelog-keeper.specialist.json +10 -7
  16. package/config/specialists/debugger.specialist.json +8 -6
  17. package/config/specialists/executor.specialist.json +9 -7
  18. package/config/specialists/explorer.specialist.json +8 -6
  19. package/config/specialists/memory-processor.specialist.json +7 -5
  20. package/config/specialists/node-coordinator.specialist.json +7 -5
  21. package/config/specialists/obligations-scanner.specialist.json +149 -0
  22. package/config/specialists/overthinker.specialist.json +7 -5
  23. package/config/specialists/planner.specialist.json +8 -6
  24. package/config/specialists/quant-methodologist.specialist.json +145 -0
  25. package/config/specialists/quant-researcher.specialist.json +144 -0
  26. package/config/specialists/researcher.specialist.json +14 -9
  27. package/config/specialists/reviewer.specialist.json +11 -9
  28. package/config/specialists/seconder.specialist.json +170 -0
  29. package/config/specialists/security-auditor.specialist.json +6 -4
  30. package/config/specialists/service-skills-sync.specialist.json +93 -0
  31. package/config/specialists/specialists-creator.specialist.json +9 -7
  32. package/config/specialists/sync-docs.specialist.json +6 -4
  33. package/config/specialists/test-engineer.specialist.json +134 -0
  34. package/config/specialists/test-runner.specialist.json +11 -9
  35. package/config/specialists/transcriber.specialist.json +59 -0
  36. package/config/specialists/xt-merge.specialist.json +7 -5
  37. package/dist/asset-contract.json +39 -8
  38. package/dist/index.js +37083 -26912
  39. package/dist/lib.js +9850 -6147
  40. package/dist/types/cli/console/components.d.ts +83 -0
  41. package/dist/types/cli/console/components.d.ts.map +1 -0
  42. package/dist/types/cli/console/config-source.d.ts +58 -0
  43. package/dist/types/cli/console/config-source.d.ts.map +1 -0
  44. package/dist/types/cli/console/forensic.d.ts +11 -0
  45. package/dist/types/cli/console/forensic.d.ts.map +1 -0
  46. package/dist/types/cli/console/git.d.ts +28 -0
  47. package/dist/types/cli/console/git.d.ts.map +1 -0
  48. package/dist/types/cli/console/help.d.ts +2 -0
  49. package/dist/types/cli/console/help.d.ts.map +1 -0
  50. package/dist/types/cli/console/log.d.ts +13 -0
  51. package/dist/types/cli/console/log.d.ts.map +1 -0
  52. package/dist/types/cli/console/repo-config.d.ts +26 -0
  53. package/dist/types/cli/console/repo-config.d.ts.map +1 -0
  54. package/dist/types/cli/console/repo-discovery.d.ts +12 -0
  55. package/dist/types/cli/console/repo-discovery.d.ts.map +1 -0
  56. package/dist/types/cli/console/runtime.d.ts +12 -0
  57. package/dist/types/cli/console/runtime.d.ts.map +1 -0
  58. package/dist/types/cli/console/subscribe-prototype.d.ts +18 -0
  59. package/dist/types/cli/console/subscribe-prototype.d.ts.map +1 -0
  60. package/dist/types/cli/console/theme.d.ts +91 -0
  61. package/dist/types/cli/console/theme.d.ts.map +1 -0
  62. package/dist/types/cli/console/types.d.ts +231 -0
  63. package/dist/types/cli/console/types.d.ts.map +1 -0
  64. package/dist/types/cli/console/view-model.d.ts +252 -0
  65. package/dist/types/cli/console/view-model.d.ts.map +1 -0
  66. package/dist/types/cli/console.d.ts +2 -0
  67. package/dist/types/cli/console.d.ts.map +1 -0
  68. package/dist/types/cli/db.d.ts.map +1 -1
  69. package/dist/types/cli/doctor.d.ts.map +1 -1
  70. package/dist/types/cli/edit.d.ts.map +1 -1
  71. package/dist/types/cli/epic.d.ts.map +1 -1
  72. package/dist/types/cli/feed.d.ts.map +1 -1
  73. package/dist/types/cli/forensic.d.ts +2 -0
  74. package/dist/types/cli/forensic.d.ts.map +1 -0
  75. package/dist/types/cli/format-helpers.d.ts +4 -2
  76. package/dist/types/cli/format-helpers.d.ts.map +1 -1
  77. package/dist/types/cli/help.d.ts.map +1 -1
  78. package/dist/types/cli/init.d.ts +10 -0
  79. package/dist/types/cli/init.d.ts.map +1 -1
  80. package/dist/types/cli/list.d.ts.map +1 -1
  81. package/dist/types/cli/log.d.ts +2 -0
  82. package/dist/types/cli/log.d.ts.map +1 -0
  83. package/dist/types/cli/metrics.d.ts +2 -0
  84. package/dist/types/cli/metrics.d.ts.map +1 -0
  85. package/dist/types/cli/ps.d.ts.map +1 -1
  86. package/dist/types/cli/result.d.ts.map +1 -1
  87. package/dist/types/cli/resume.d.ts.map +1 -1
  88. package/dist/types/cli/run.d.ts +1 -0
  89. package/dist/types/cli/run.d.ts.map +1 -1
  90. package/dist/types/cli/script.d.ts +3 -0
  91. package/dist/types/cli/script.d.ts.map +1 -1
  92. package/dist/types/cli/serve.d.ts.map +1 -1
  93. package/dist/types/cli/setup.d.ts +19 -1
  94. package/dist/types/cli/setup.d.ts.map +1 -1
  95. package/dist/types/cli/status.d.ts.map +1 -1
  96. package/dist/types/cli/steer.d.ts.map +1 -1
  97. package/dist/types/cli/version-check.d.ts +1 -0
  98. package/dist/types/cli/version-check.d.ts.map +1 -1
  99. package/dist/types/index.d.ts +1 -1
  100. package/dist/types/pi/session.d.ts +11 -1
  101. package/dist/types/pi/session.d.ts.map +1 -1
  102. package/dist/types/server.d.ts +15 -0
  103. package/dist/types/server.d.ts.map +1 -1
  104. package/dist/types/specialist/benchmarks.d.ts +37 -0
  105. package/dist/types/specialist/benchmarks.d.ts.map +1 -0
  106. package/dist/types/specialist/chain-identity.d.ts +7 -1
  107. package/dist/types/specialist/chain-identity.d.ts.map +1 -1
  108. package/dist/types/specialist/control.d.ts.map +1 -1
  109. package/dist/types/specialist/forensic-events.d.ts +138 -0
  110. package/dist/types/specialist/forensic-events.d.ts.map +1 -0
  111. package/dist/types/specialist/forensic-renderer.d.ts +34 -0
  112. package/dist/types/specialist/forensic-renderer.d.ts.map +1 -0
  113. package/dist/types/specialist/git-diff-evidence.d.ts +28 -0
  114. package/dist/types/specialist/git-diff-evidence.d.ts.map +1 -0
  115. package/dist/types/specialist/global-config.d.ts +389 -0
  116. package/dist/types/specialist/global-config.d.ts.map +1 -0
  117. package/dist/types/specialist/job-file-output.d.ts +2 -0
  118. package/dist/types/specialist/job-file-output.d.ts.map +1 -1
  119. package/dist/types/specialist/launch.d.ts +1 -0
  120. package/dist/types/specialist/launch.d.ts.map +1 -1
  121. package/dist/types/specialist/live-aggregates.d.ts +46 -0
  122. package/dist/types/specialist/live-aggregates.d.ts.map +1 -0
  123. package/dist/types/specialist/loader.d.ts +50 -1
  124. package/dist/types/specialist/loader.d.ts.map +1 -1
  125. package/dist/types/specialist/model-chain.d.ts +7 -0
  126. package/dist/types/specialist/model-chain.d.ts.map +1 -0
  127. package/dist/types/specialist/model-probes.d.ts +28 -0
  128. package/dist/types/specialist/model-probes.d.ts.map +1 -0
  129. package/dist/types/specialist/node-contract.d.ts +18 -18
  130. package/dist/types/specialist/node-supervisor.d.ts.map +1 -1
  131. package/dist/types/specialist/observability-db.d.ts +1 -1
  132. package/dist/types/specialist/observability-db.d.ts.map +1 -1
  133. package/dist/types/specialist/observability-sqlite.d.ts +25 -0
  134. package/dist/types/specialist/observability-sqlite.d.ts.map +1 -1
  135. package/dist/types/specialist/preset-resolver.d.ts +56 -0
  136. package/dist/types/specialist/preset-resolver.d.ts.map +1 -0
  137. package/dist/types/specialist/prometheus-projection.d.ts +25 -0
  138. package/dist/types/specialist/prometheus-projection.d.ts.map +1 -0
  139. package/dist/types/specialist/runner.d.ts +29 -1
  140. package/dist/types/specialist/runner.d.ts.map +1 -1
  141. package/dist/types/specialist/schema.d.ts +181 -63
  142. package/dist/types/specialist/schema.d.ts.map +1 -1
  143. package/dist/types/specialist/script-runner.d.ts +5 -1
  144. package/dist/types/specialist/script-runner.d.ts.map +1 -1
  145. package/dist/types/specialist/snapshot-diff.d.ts +8 -0
  146. package/dist/types/specialist/snapshot-diff.d.ts.map +1 -0
  147. package/dist/types/specialist/source-queue.d.ts +13 -0
  148. package/dist/types/specialist/source-queue.d.ts.map +1 -0
  149. package/dist/types/specialist/supervisor.d.ts +39 -2
  150. package/dist/types/specialist/supervisor.d.ts.map +1 -1
  151. package/dist/types/specialist/timeline-events.d.ts +88 -2
  152. package/dist/types/specialist/timeline-events.d.ts.map +1 -1
  153. package/dist/types/tools/specialist/resume_specialist.tool.d.ts +4 -4
  154. package/dist/types/tools/specialist/specialist_status.tool.d.ts +1 -1
  155. package/dist/types/tools/specialist/steer_specialist.tool.d.ts +4 -4
  156. package/dist/types/tools/specialist/use_specialist.tool.d.ts +16 -16
  157. package/docs/ARCHITECTURE.md +1176 -0
  158. package/docs/TODO.md +9 -0
  159. package/docs/architecture.md +11 -0
  160. package/docs/archive/2026-03-13-bd-decision-context-template-plan.md +96 -0
  161. package/docs/archive/AGENT-HANDOFF.md +351 -0
  162. package/docs/archive/PARITY-ANALYSIS.md +296 -0
  163. package/docs/archive/SPECIALISTS_REFACTOR.md.md +30 -0
  164. package/docs/archive/cc-programmatic.md +216 -0
  165. package/docs/archive/claude-agent-sdk.md +594 -0
  166. package/docs/archive/decision-specialist-directory.md +41 -0
  167. package/docs/archive/discoveries.md +148 -0
  168. package/docs/archive/executor-benchmark-protocol.md +198 -0
  169. package/docs/archive/future-features.md +66 -0
  170. package/docs/archive/gzrx-completion-critique.md +183 -0
  171. package/docs/archive/gzrx-research-notes.md +401 -0
  172. package/docs/archive/gzrx-tool-catalog.md +760 -0
  173. package/docs/archive/iron-review-hardening-qa-chain-substrate.md +322 -0
  174. package/docs/archive/iron-review-hardening.html +1004 -0
  175. package/docs/archive/issuetracking.md +312 -0
  176. package/docs/archive/qa-v3.0.2.md +220 -0
  177. package/docs/archive/restructure.md +231 -0
  178. package/docs/archive/script-specialists.md +1254 -0
  179. package/docs/archive/spec-v3.md +792 -0
  180. package/docs/archive/specialist-stats.md +127 -0
  181. package/docs/archive/specialists-friction-audit.md +1347 -0
  182. package/docs/archive/specialists-runtime-critique.md +170 -0
  183. package/docs/archive/specialists-service-evaluation.md +713 -0
  184. package/docs/archive/specialists-substrate-alignment.md +255 -0
  185. package/docs/archive/substrate-review.md +1288 -0
  186. package/docs/archive/test-writer-specialist.md +254 -0
  187. package/docs/archive/using-specialists-v3-improvements-2026-05-09.md +600 -0
  188. package/docs/archive/xtrm-specialists-analysis.md +314 -0
  189. package/docs/authoring.md +701 -0
  190. package/docs/background-jobs.md +203 -0
  191. package/docs/bare-specialists.md +83 -0
  192. package/docs/benchmarks/executor-benchmark-runner.md +66 -0
  193. package/docs/bootstrap.md +161 -0
  194. package/docs/cli-reference.md +1645 -0
  195. package/docs/deploying-alongside.md +155 -0
  196. package/docs/design/README.md +36 -0
  197. package/docs/design/darth-feedor-migration.md +290 -0
  198. package/docs/design/roadmap/README.md +32 -0
  199. package/docs/design/roadmap/chain-templates/README.md +146 -0
  200. package/docs/design/roadmap/chain-templates/code-quick.formula.json +27 -0
  201. package/docs/design/roadmap/chain-templates/code-standard.formula.json +126 -0
  202. package/docs/design/roadmap/chain-templates/code-with-advisors.formula.json +128 -0
  203. package/docs/design/roadmap/chain-templates/code-with-tests.formula.json +76 -0
  204. package/docs/design/roadmap/chain-templates/debug.formula.json +128 -0
  205. package/docs/design/roadmap/chain-templates/doc-sync.formula.json +28 -0
  206. package/docs/design/roadmap/chain-templates/memory-hygiene.formula.json +27 -0
  207. package/docs/design/roadmap/chain-templates/planning.formula.json +27 -0
  208. package/docs/design/roadmap/chain-templates/premortem.formula.json +26 -0
  209. package/docs/design/roadmap/chain-templates/release-prep.formula.json +36 -0
  210. package/docs/design/roadmap/chain-templates/research-only.formula.json +28 -0
  211. package/docs/design/roadmap/chain-templates/restitch.formula.json +125 -0
  212. package/docs/design/roadmap/chain-templates/security-deep.formula.json +161 -0
  213. package/docs/design/roadmap/chain-templates/test-only.formula.json +52 -0
  214. package/docs/design/roadmap/chain-templates/triage.formula.json +35 -0
  215. package/docs/design/roadmap/history/handoff-from-substrate-design.md +87 -0
  216. package/docs/design/roadmap/history/substrate-reconciliation.md +105 -0
  217. package/docs/design/roadmap/specialists-roadmap.md +1193 -0
  218. package/docs/design/sp-console-subscribe-via-materializer.md +231 -0
  219. package/docs/design/sp-console-tui-mock-v2.html +293 -0
  220. package/docs/design/sp-console-tui-mock.html +120 -0
  221. package/docs/design/sp-console-tui.md +340 -0
  222. package/docs/design/specialist-agentops-suite.md +323 -0
  223. package/docs/design/substrate/channels.md +14 -0
  224. package/docs/design/substrate/devops-platform-engineering-prd.md +446 -0
  225. package/docs/design/substrate/html-design-example.md +339 -0
  226. package/docs/design/xtrm-tiers-architecture.svg +132 -0
  227. package/docs/devops/dependency-verdict-materialization.md +46 -0
  228. package/docs/epic-readiness.md +75 -0
  229. package/docs/examples/mercury-atomic-summarizer.specialist.json +26 -0
  230. package/docs/examples/smoke-echo-text-expected-keys.specialist.json +25 -0
  231. package/docs/examples/smoke-echo.specialist.json +25 -0
  232. package/docs/features.md +1577 -0
  233. package/docs/hooks.md +81 -0
  234. package/docs/installation.md +142 -0
  235. package/docs/manifest.md +184 -0
  236. package/docs/mcp-servers.md +73 -0
  237. package/docs/mcp-tools.md +71 -0
  238. package/docs/nodes.md +231 -0
  239. package/docs/observability-metrics.md +152 -0
  240. package/docs/operator/sp-console-v2-walkthrough.md +410 -0
  241. package/docs/overrides-guide.md +306 -0
  242. package/docs/pi-rpc-boundary.md +118 -0
  243. package/docs/pi-session.md +195 -0
  244. package/docs/release.md +22 -0
  245. package/docs/skills.md +132 -0
  246. package/docs/specialists/handoff-schema.md +181 -0
  247. package/docs/specialists-catalog.md +99 -0
  248. package/docs/specialists-service-install.md +226 -0
  249. package/docs/specialists-service.md +363 -0
  250. package/docs/surface-ownership.md +138 -0
  251. package/docs/upgrade-notes/kan-90-global-user-config.md +114 -0
  252. package/docs/upgrade-notes/kan-91-expanded-overrides.md +261 -0
  253. package/docs/workflow.md +114 -0
  254. package/docs/worktree.md +71 -0
  255. package/docs/worktrees.md +309 -0
  256. package/package.json +17 -12
  257. package/config/specialists/code-sanity.specialist.json +0 -108
@@ -0,0 +1,148 @@
1
+ ---
2
+ title: Agent Forge — Discovery Notes
3
+ scope: discoveries
4
+ category: reference
5
+ version: 1.0.0
6
+ updated: 2026-03-19
7
+ domain: []
8
+ ---
9
+
10
+ <!-- INDEX: auto-generated by validate_doc.py — do not edit manually -->
11
+ | Section | Summary |
12
+ |---|---|
13
+ | [Architettura — Chiarimenti post-PRD](#architettura-chiarimenti-post-prd) | **Posizione nel sistema:** Agent Forge è layer 2-3 |
14
+ | [Orchestratore — Worktrees e Branch Model](#orchestratore-worktrees-e-branch-model) | **Il modello corretto** (nuovo punto di questo pomeriggio): |
15
+ | [Beads — Integrazione Agent Forge](#beads-integrazione-agent-forge) | **Livello corretto di integrazione:** beads è infrastruttura opzionale, non obbligatoria |
16
+ | [Pi — Perché è il runtime giusto per gli specialists](#pi-perch-il-runtime-giusto-per-gli-specialists) | Rispetto a Task() di Claude Code: |
17
+ | [The Claude Protocol — Cosa vale, cosa no](#the-claude-protocol-cosa-vale-cosa-no) | **Vale:** |
18
+ | [System Prompt Engineering — `claudio` alias e workflow files](#system-prompt-engineering-claudio-alias-e-workflow-files) | **Alias `claudio`** con `--append-system-prompt-file ~/ |
19
+ | [Nice to Have — Backlog](#nice-to-have-backlog) | - [ ] `claudio` alias + beads enforce append — testare degradazione vs CLAUDE |
20
+ <!-- END INDEX -->
21
+
22
+ # Agent Forge — Discovery Notes
23
+ *Research session: Claude Code / Pi / Beads / The Claude Protocol + PRD review*
24
+ *Updated: 2026-03-09*
25
+
26
+ ---
27
+
28
+ ## Architettura — Chiarimenti post-PRD
29
+
30
+ **Posizione nel sistema:** Agent Forge è layer 2-3. Non sostituisce l'orchestratore umano, lo amplifica. L'orchestratore (Claude, boss) fa lavoro reale, interagisce con l'umano direttamente, e usa gli specialists come strumenti cognitivi — non come sostituti. Human still in the loop, sempre.
31
+
32
+ **Specialists come repo standalone open-source.** Non è blocking per lo sviluppo di Agent Forge. Il formato `.specialist.yaml` è il contratto condiviso. La repo pubblica diventa il registry della community, analogamente a come beads ha `AGENTS.md` e le sue skill community. Il `@jaggerxtrm/specialist-loader` è il pacchetto npm che unifica il parsing tra Agent Forge, unitAI, e Mercury.
33
+
34
+ ---
35
+
36
+ ## Orchestratore — Worktrees e Branch Model
37
+
38
+ **Il modello corretto** (nuovo punto di questo pomeriggio):
39
+
40
+ L'orchestratore (Claude boss) lavora sempre su feature branch, mai su main. Non è blocking per il suo lavoro diretto — può editare, committare, pushare — ma su un branch. Questo è il default, non un'eccezione.
41
+
42
+ Il worktree diventa rilevante quando l'orchestratore lancia **più specialists che toccano aree sovrapposte**. In quel caso un hook gli ricorda di isolare ciascuno su un worktree separato per evitare conflitti. Non è enforcement automatico (troppo rigido) — è un prompt informativo che lascia decidere all'orchestratore.
43
+
44
+ ```
45
+ Orchestratore su feature/branch-X
46
+ → lavora direttamente (edit, commit sul suo branch)
47
+ → hook: "lanci specialist A su src/api/ e specialist B su src/api/ — vuoi worktrees separati?"
48
+ → se sì: crea .agent-forge/worktrees/specialist-a/ e /specialist-b/
49
+ → se no: entrambi lavorano sul branch corrente, conflitti gestiti manualmente
50
+ ```
51
+
52
+ Questo è diverso dal Claude Protocol (enforcement totale, ogni task in worktree) e da Overstory (3-tier rigido). L'orchestratore mantiene agency e interazione diretta con l'umano. Il worktree è un tool disponibile, non una prigione.
53
+
54
+ ---
55
+
56
+ ## Beads — Integrazione Agent Forge
57
+
58
+ **Livello corretto di integrazione:** beads è infrastruttura opzionale, non obbligatoria. Agent Forge ha già il suo SQLite per session state e il message bus. Beads aggiunge il tracking del lavoro cross-session, non lo stato degli agenti.
59
+
60
+ **Pattern confermato:**
61
+
62
+ ```
63
+ SpecialistRunner (meccanico)
64
+ pre_execute: bd q → bead_id, bd update --status=in_progress
65
+ post_execute: bd close --reason "DONE, Xs, model"
66
+ bd audit record (telemetria separata)
67
+
68
+ Orchestratore Claude (giudizio — la parola finale)
69
+ Dopo poll done, decide:
70
+ bd remember "insight" → memoria cross-session persistente
71
+ bd update <id> --notes "..." → contestuale, muore con compaction
72
+ bd create ... discovered-from → nuovo lavoro scoperto
73
+ nulla → run di routine
74
+ ```
75
+
76
+ **Campo `beads_integration` in specialist YAML:**
77
+ ```yaml
78
+ beads_integration: auto # default: write-perm → sempre | READ_ONLY → mai
79
+ always # discovery specialists
80
+ never # utility one-offs <1s
81
+ ```
82
+
83
+ **`bd remember` vs `bd update --notes`:** la distinzione è critica. Un modello minore non sa quale usare — solo l'orchestratore con contesto globale Mercury può farlo. Questo è il motivo per cui il livello 3 (orchestratore) non è opzionale nella catena di gestione beads.
84
+
85
+ ---
86
+
87
+ ## Pi — Perché è il runtime giusto per gli specialists
88
+
89
+ Rispetto a Task() di Claude Code:
90
+
91
+ - **Lifecycle hooks per-turn** (non solo per sessione): `before_agent_start` modifica system prompt dinamicamente, `context` filtra messaggi prima di ogni call. Utile per iniettare contesto variabile senza ricreare la sessione.
92
+ - **SDK embeddabile** con `session.agent.state.systemPrompt` accessibile da Node.js → SpecialistRunner può iniettare domain knowledge a runtime prima dell'esecuzione.
93
+ - **Quattro modalità**: interactive, print/JSON, RPC, SDK. Agent Forge usa JSON RPC — output strutturato, nessun parsing di terminale.
94
+ - **Skills on-demand** con progressive disclosure — la skill carica nel contesto solo quando il trigger semantico nel frontmatter viene matchato. Non gonfia il prompt all'avvio.
95
+ - **Sistema prompt minimale di default** — il modello parte leggero. La domain knowledge viene iniettata da Agent Forge, non è hardcoded nel runtime.
96
+
97
+ La differenza filosofica: Pi dice "adatta il tool al tuo workflow". Task() dice "adattati a Claude Code". Per un sistema custom come Mercury/Agent Forge, Pi vince.
98
+
99
+ ---
100
+
101
+ ## The Claude Protocol — Cosa vale, cosa no
102
+
103
+ **Vale:**
104
+
105
+ 1. **Separazione ruoli via PreToolUse hook.** L'orchestratore non può scrivere codice su main — il hook blocca fisicamente. Per Agent Forge: orchestratore lavora su feature branch, workers lavorano su worktrees. Il hook implementa questo senza dipendere dalla buona volontà del modello.
106
+
107
+ 2. **Knowledge base come `knowledge.jsonl` + `recall.sh`.** Alternativa/complemento a `bd remember` per discovery tecniche specifiche al progetto. Searchable via bash senza invocare il modello, sopravvive alla compaction, ogni agente può appendere in append-only senza stato condiviso. Candidato per il `expertise-store.ts` di Agent Forge v1.4.0.
108
+
109
+ 3. **Quick-fix exception con approvazione umana.** Per modifiche triviali (<10 linee) su feature branch, l'orchestratore può editare direttamente con prompt di approvazione. Zero eccezioni create friction inutile — un'eccezione esplicita con gate umano è meglio. Allineato con il principio "human in the loop".
110
+
111
+ **Non vale:**
112
+
113
+ - Worktree per ogni singolo task (overhead con 50+ microservizi Mercury)
114
+ - Task() come runtime (Pi è superiore per tutti i motivi sopra)
115
+ - Bootstrap Python (inutile con Agent Forge CLI)
116
+ - 3-tier rigido orchestrator/supervisor/worker (boss/worker con specialist roles è sufficiente e più flessibile)
117
+ - Enforcement totale senza eccezioni (rompe il modello "orchestratore fa lavoro reale")
118
+
119
+ ---
120
+
121
+ ## System Prompt Engineering — `claudio` alias e workflow files
122
+
123
+ **Alias `claudio`** con `--append-system-prompt-file ~/.claude/prompts/beads-enforce.md` come base di ogni sessione. Più robusto di CLAUDE.md che decade nel corso di sessioni lunghe per degradazione dell'attenzione.
124
+
125
+ **Cartella `~/.claude/prompts/` versionata in git:**
126
+ ```
127
+ ~/.claude/prompts/
128
+ beads-enforce.md # regole beads obbligatorie, session protocol
129
+ deepwiki-mode.md # workflow ricerca con DeepWiki come fonte primaria
130
+ websearch-structured.md # output strutturato per web research
131
+ fixed-income-ctx.md # contesto mercati pre-iniettato (EF spread, SOFR, etc.)
132
+ ```
133
+
134
+ Agent Forge seleziona il file corretto al lancio in base al task type o all'alias usato. Questo è il meccanismo che permette di caricare "workflow predefiniti" senza modificare il runtime — è configurazione, non codice.
135
+
136
+ ---
137
+
138
+ ## Nice to Have — Backlog
139
+
140
+ - [ ] `claudio` alias + beads enforce append — testare degradazione vs CLAUDE.md in sessioni di 2+ ore
141
+ - [ ] Hook "worktree reminder" quando orchestratore lancia 2+ specialists su path sovrapposti
142
+ - [ ] `knowledge.jsonl` per Mercury come layer di memoria tecnica separato da `bd remember`
143
+ - [ ] `beads_integration: never` per specialists utility veloci (evitare overhead su run <1s)
144
+ - [ ] Workflow append files versionati: deepwiki mode, fixed income context, web research
145
+ - [ ] `bd audit record` come telemetria per ogni specialist run — foundation per evals SFT futuri
146
+ - [ ] `bd agent` + `bd slot` per omnis dashboard v1.5.0+ (stato persistente per TYPE di specialist)
147
+ - [ ] Quick-fix hook con approvazione umana per l'orchestratore su feature branch (dal Claude Protocol)
148
+ - [ ] Specialists repo standalone open-source — `/specialists` community registry analogamente a pi packages su npm
@@ -0,0 +1,198 @@
1
+ # Executor model benchmark protocol (unitAI-gc2a.1)
2
+
3
+ ## 1) Goal
4
+
5
+ Pick lowest-cost non-Anthropic executor model that preserves delivery quality versus current baseline.
6
+
7
+ Quality floor first. Cost/time optimization second.
8
+
9
+ ---
10
+
11
+ ## 2) Candidate model matrix (non-Anthropic only)
12
+
13
+ Baseline fixed from `config/specialists/executor.specialist.json`.
14
+
15
+ | Role | Provider | Exact model ID | Why included |
16
+ |---|---|---|---|
17
+ | Baseline | OpenAI Codex | `openai-codex/gpt-5.3-codex` | Current production default for executor. Reference line for quality/cost/time. |
18
+ | Challenger A | OpenAI Codex | `openai-codex/gpt-5.4-mini` | Cost-effective OpenAI variant relative to baseline; tests whether lower-cost Codex tier preserves quality floor. |
19
+ | Challenger B | DashScope | `dashscope/qwen3.5-plus` | Existing in repo configs; expected cheaper token profile; tests cross-provider behavior. |
20
+ | Challenger C | Z.AI | `zai/glm-5` | Existing in repo configs; useful low-cost challenger with different failure surface. |
21
+
22
+ ### Explicit exclusion
23
+
24
+ All Anthropic/Claude models excluded by benchmark rule (user constraint + known keep-alive instability memories).
25
+
26
+ ---
27
+
28
+ ## 3) Task corpus design
29
+
30
+ ### 3.1 Corpus size
31
+
32
+ 3 benchmark tasks total — 1 per bucket:
33
+ - 1 bug-fix task
34
+ - 1 refactor task
35
+ - 1 implementation task
36
+
37
+ Reason: 3 tasks × 4 models × 1 rep = 12 runs. Lean and fast.
38
+
39
+ ### 3.2 Selection rules (must hold)
40
+
41
+ 1. Source tasks from closed beads with known good outcome and reviewer evidence (PASS or PASS-after-fix).
42
+ 2. Freeze inputs using immutable snapshot branch/tag per task (`benchmark/<task-id>-snapshot`).
43
+ 3. Each task must touch at least 2 files or include 1 non-trivial behavior change (not typo/docs-only).
44
+ 4. Include at least:
45
+ - 1 validation/CLI parsing change
46
+ - 1 lifecycle/state transition change
47
+ - 1 observability/metrics change
48
+ 5. Include both “first-pass PASS” and “needs fix-loop” historical patterns.
49
+
50
+ ### 3.3 Seed task matrix template
51
+
52
+ Use cloned benchmark beads (`bench-*`) mapped 1:1 from historical seeds:
53
+
54
+ | Bucket | Seed bead | Why representative |
55
+ |---|---|---|
56
+ | Bug fix | `unitAI-y4ia` | Status lifecycle correctness — typical executor bug-fix shape. |
57
+ | Refactor | `unitAI-22tq` | Multi-file structural change with behavior preservation. |
58
+ | Implementation | `unitAI-8zui` | New capability delivery with reviewer-verifiable outcome. |
59
+
60
+ > If any seed task unavailable, replace with same bucket + same complexity class, then freeze new snapshot before runs.
61
+
62
+ ---
63
+
64
+ ## 4) Controlled run procedure
65
+
66
+ ## 4.1 Pre-run freeze
67
+
68
+ 1. Create benchmark branch from clean main: `benchmark/unitAI-gc2a-<date>`.
69
+ 2. Create per-task snapshot branches:
70
+ - `benchmark/<task-id>-snapshot`
71
+ 3. Clone beads into benchmark namespace (`bench-...`) with fixed prompt text and AC.
72
+ 4. Lock reviewer model for benchmark to one ID:
73
+ - `openai-codex/gpt-5.3-codex`
74
+
75
+ ## 4.2 Execution invariants (must be identical for all models)
76
+
77
+ 1. Same executor prompt template and specialist config except `execution.model`.
78
+ 2. Same task text, same bead metadata, same context-depth.
79
+ 3. Same clean worktree creation per run.
80
+ 4. Same reviewer workflow:
81
+ - reviewer runs after executor
82
+ - same verdict rubric (PASS/PARTIAL/FAIL)
83
+ - same evidence requirements
84
+ 5. Same post-run checks:
85
+ - `npm run lint`
86
+ - `npx tsc --noEmit`
87
+
88
+ ## 4.3 Run order and replication
89
+
90
+ - Randomize model order per task to reduce time-of-day/provider noise.
91
+ - Run each (model, task) pair once.
92
+ - Total runs: `4 models × 3 tasks × 1 rep = 12 runs`.
93
+
94
+ ## 4.4 Per-run data capture schema (required)
95
+
96
+ Capture these fields for every run:
97
+ - `model_id`
98
+ - `task_id`
99
+ - `replicate`
100
+ - `lint_pass` (bool)
101
+ - `tsc_pass` (bool)
102
+ - `reviewer_verdict` (PASS|PARTIAL|FAIL)
103
+ - `reviewer_score` (0-100 if present)
104
+ - `token_usage` (input/output/total if available)
105
+ - `cost_usd`
106
+ - `elapsed_ms`
107
+ - `retry_count`
108
+ - `failure_type` (none|empty_output|hang|tool_error|other)
109
+ - `notes`
110
+
111
+ ---
112
+
113
+ ## 5) Scoring rubric
114
+
115
+ ## 5.1 Quality gate (hard floor)
116
+
117
+ Run counts as quality-pass only when all true:
118
+ 1. `lint_pass == true`
119
+ 2. `tsc_pass == true`
120
+ 3. `reviewer_verdict == PASS`
121
+
122
+ Model-level quality floor:
123
+ - PASS-rate across all runs >= 90%
124
+ - Zero critical integrity failures (wrong-branch review, empty diff with fake success, unresolved compile errors)
125
+
126
+ Any model below floor = reject. No cost comparison step.
127
+
128
+ ## 5.2 Efficiency ranking (only after floor)
129
+
130
+ For models that pass floor, compute normalized score:
131
+
132
+ `score = 0.50 * quality_stability + 0.30 * cost_efficiency + 0.20 * speed_efficiency`
133
+
134
+ Where:
135
+ - `quality_stability`: inverse of variance in PASS/PARTIAL across tasks
136
+ - `cost_efficiency`: baseline_cost / model_cost (capped)
137
+ - `speed_efficiency`: baseline_elapsed / model_elapsed (capped)
138
+
139
+ ---
140
+
141
+ ## 6) Decision rule (replace vs reject)
142
+
143
+ Cheaper model accepted as baseline replacement only if all true:
144
+
145
+ 1. Meets quality floor.
146
+ 2. Mean `cost_usd` improvement >= 25% vs baseline.
147
+ 3. Mean `elapsed_ms` not worse than baseline by > 15%.
148
+ 4. Retry/failure burden not worse than baseline by > 10% relative.
149
+
150
+ If quality floor met but cost gain < 25% or reliability borderline:
151
+ - classify as `shadow-only` (keep baseline default, continue sampling).
152
+
153
+ If quality floor missed:
154
+ - classify as `reject`.
155
+
156
+ ---
157
+
158
+ ## 7) Stop conditions (early fail)
159
+
160
+ Stop model evaluation early if any trigger:
161
+
162
+ 1. First 6 runs include >= 3 FAIL verdicts.
163
+ 2. Two consecutive `empty_output` or hang failures.
164
+ 3. Lint/tsc hard-fail rate > 50% after first 8 runs.
165
+ 4. Proven systematic workflow break (cannot complete reviewer cycle on frozen snapshots).
166
+
167
+ Mark model `rejected_early`, record evidence, skip remaining tasks.
168
+
169
+ ---
170
+
171
+ ## 8) Known confounders and controls
172
+
173
+ 1. `supervisor.test.ts` FIFO hang confounder
174
+ - Memory notes: test hangs around FIFO cleanup/readline path.
175
+ - Control: benchmark quality gate uses lint + tsc + reviewer verdict, not full vitest pass.
176
+
177
+ 2. Stale worktree review confounder
178
+ - Prior reports show reviewer PARTIAL caused by stale branch/worktree, not code quality.
179
+ - Control: enforce per-run fresh worktree + verify commit SHA before reviewer dispatch.
180
+
181
+ 3. Keep-alive commit behavior confounder
182
+ - Executor may reach waiting without commit finalized.
183
+ - Control: explicit post-executor `git status`/`git rev-parse HEAD` checkpoint before reviewer; require deterministic commit/diff presence.
184
+
185
+ 4. Intermittent 0-token empty-output confounder (`gpt-5.3-codex` historical)
186
+ - Control: count as failure_type, include retries, keep in reliability denominator (do not silently drop).
187
+
188
+ ---
189
+
190
+ ## 9) Output package from benchmark run
191
+
192
+ Must produce:
193
+
194
+ 1. Raw run table (all 72+ rows).
195
+ 2. Model aggregate table (quality, cost, speed, retries).
196
+ 3. Decision summary per model: `replace` | `shadow-only` | `reject`.
197
+ 4. Incident appendix for early stops and anomalous failures.
198
+
@@ -0,0 +1,66 @@
1
+ # Future Features Backlog
2
+
3
+ Stability-first triage moved the following open issues out of the active shipping path. These are not considered crucial for a clean working product right now, but remain useful as future upgrades once the core product is stable.
4
+
5
+ ## Workflow and automation
6
+
7
+ - `unitAI-c64` — Memory curator specialist
8
+ - Review completed specialist runs, compare against `bd memories`, and suggest durable memory updates.
9
+
10
+ - `unitAI-hos` — Commit/PR provenance hook
11
+ - Auto-wire commit and PR references back to the active bead for stronger traceability.
12
+
13
+ - `unitAI-9xa` — `specialists clean`
14
+ - Explicit command for job directory cleanup beyond the existing automatic GC in `Supervisor`.
15
+
16
+ ## Specialist catalog expansion
17
+
18
+ - `unitAI-jj83` — Generic specialist archetypes
19
+ - Reusable explorer/executor/reviewer/analyst/planner/tester definitions.
20
+
21
+ - `unitAI-rlne` — Challenger specialist
22
+ - Adversarial critic specialist for plans, ideas, code, and outputs.
23
+
24
+ - `unitAI-1pxf` — `specialists run --read-only`
25
+ - Safety override to force read-only execution regardless of configured permission tier.
26
+
27
+ ## Orchestration and multi-agent systems
28
+
29
+ - `unitAI-dzbk` — Parallel-runner / multi-agent orchestrator
30
+ - Fan-out/fan-in, review loops, and coordinated specialist execution.
31
+
32
+ - `unitAI-2pl1` — Planner → Explorer → Test-Planning pipeline
33
+ - Single pipeline that chains planning, exploration, and test issue generation.
34
+
35
+ ## Persistent lifecycle / xt-merge ideas
36
+
37
+ - `unitAI-n1b` — Persistent and event-driven specialist lifecycle
38
+ - Long-lived event-driven specialist architecture.
39
+
40
+ - `unitAI-e1t` — Auto-spawn merge-master on worktree creation
41
+ - Start xt-merge automation when new worktrees are opened.
42
+
43
+ - `unitAI-6dn` — Coordinate `xt end` with active merge-master
44
+ - Session-close orchestration when merge automation is active.
45
+
46
+ - `unitAI-5m0` — Worktree opening message should include merge-master status
47
+ - Better operator visibility for xt-merge state.
48
+
49
+ ## Docs and quality improvements to revisit later
50
+
51
+ These still have value, but they are backlog work rather than immediate ship work:
52
+
53
+ - `unitAI-pple` — Expand deep technical docs after SSOT hub recovery
54
+ - `unitAI-3nwl` — Schema review and documentation
55
+ - `unitAI-mi6j` — Add TypeScript compilation check to `specialists doctor`
56
+ - `unitAI-j8gj` — Fix duplicated backend prefix in run footer
57
+ - `unitAI-tv3` — Implement `specialists status --job <id>`
58
+
59
+ ## Active ship-stability focus instead
60
+
61
+ Current stabilization priority is:
62
+
63
+ 1. `unitAI-80y9` — Fix current test and TypeScript regressions blocking ship readiness
64
+ 2. `unitAI-f0oh` — Implement `stall_timeout_ms` watchdog in `PiAgentSession`
65
+ 3. `unitAI-agkd` — Persist `bead_id` immediately for `--bead` runs
66
+ 4. `unitAI-9o9z` — Planner hierarchy bug
@@ -0,0 +1,183 @@
1
+ # gzrx Completion Critique — 2026-05-03
2
+
3
+ > Status: Gap analysis. Anchors `unitAI-qujxo` (completion epic) child `.1`.
4
+ > Author: Orchestrator review at end of 2026-05-03 session.
5
+ > Cross-references: [gzrx-tool-catalog.md](./gzrx-tool-catalog.md) (canonical
6
+ > design), [gzrx-research-notes.md](./gzrx-research-notes.md) (6-runtime
7
+ > survey), [.xtrm/reports/2026-05-03-5ad59543.md](../../.xtrm/reports/2026-05-03-5ad59543.md)
8
+ > (session report).
9
+
10
+ ---
11
+
12
+ ## TL;DR
13
+
14
+ The 2026-05-03 session shipped phases 1-7 of the `unitAI-8vb65` impl epic plus
15
+ inline correctness fixes. The work is **functionally complete as a parallel
16
+ infrastructure** but **does not replace the legacy hardcoded tier→tool arrays
17
+ in `src/pi/session.ts:156-219` as the production source of truth**. The
18
+ original §0 problem statement remains unresolved at runtime.
19
+
20
+ Specifically:
21
+
22
+ - ✅ Catalog files exist and validate
23
+ - ✅ Resolver library (`src/specialist/manifest-resolver.ts`) returns
24
+ byte-equivalent output to legacy and supports per-specialist override,
25
+ health-aware hard deny, layer attribution
26
+ - ✅ `sp config show <specialist> --resolved` is correct end-to-end and shows
27
+ the aspirational state (explorer denies grep/find/ls when GitNexus+Serena
28
+ are healthy)
29
+ - ❌ Live `sp run` invocations still go through legacy `mapPermissionToTools`
30
+ unless `SPECIALISTS_USE_RESOLVER=1` env var is set
31
+ - ❌ Even when the env flag is set, `src/pi/session.ts:resolvePermissionTools`
32
+ does not receive the specialist's `permissions[tier]` block — the runtime
33
+ call site has no access to the specialist name or its parsed JSON, so it
34
+ passes only `tier` to the resolver. Per-specialist hard deny is **never
35
+ applied at runtime.**
36
+ - ❌ Legacy `GITNEXUS_*_TOOLS` / `SERENA_*_TOOLS` constants and
37
+ `mapPermissionToTools` function remain the production source of truth
38
+
39
+ Net effect: the design's §0 problem ("explorer reaches for `grep` instead of
40
+ `gitnexus_query`") is **not fixed in production**.
41
+
42
+ ---
43
+
44
+ ## Designed vs shipped
45
+
46
+ ### Designed (per `gzrx-tool-catalog.md` §7, refined 11 steps)
47
+
48
+ 1. Specify precedence + conflict order
49
+ 2. Add catalog files + JSON schema validation
50
+ 3. Implement resolver as pure library
51
+ 4. Tests before integration (snapshots + matrix)
52
+ 5. `sp config show <name> --resolved` using same resolver
53
+ 6. Per-capability health probes + drift detection
54
+ 7. Thread resolver into `src/pi/session.ts` behind feature flag
55
+ 8. Enable soft deny for all tiers
56
+ 9. Add hard deny support, gated on health
57
+ 10. Enable explorer hard-deny for `grep/find/ls`
58
+ 11. Remove legacy hardcoded arrays after one parity release
59
+
60
+ ### Shipped
61
+
62
+ | Step | Status | Notes |
63
+ |------|--------|-------|
64
+ | 1 | ✅ | §3.0 in design doc; encoded in `src/specialist/tool-catalog.ts` header comment + asserted by test |
65
+ | 2 | ✅ | `.specialists/catalog/{native,gitnexus,serena,index}.json` |
66
+ | 3 | ✅ | `src/specialist/manifest-resolver.ts` — pure function, `resolveManifestTools(input)` |
67
+ | 4 | ✅ | 7 matrix tests in `tests/unit/specialist/manifest-resolver.test.ts` covering tier × health × override × exclusion |
68
+ | 5 | ✅ | `sp config show <name> --resolved` in `src/cli/config.ts` + `src/specialist/resolution-diagnostics.ts` |
69
+ | 6 | ⚠️ | Health probes exist (`probeHealth` in resolution-diagnostics.ts); **per-capability** model from §3.3 is partial — `ExtensionHealth` type is `not_installed \| disabled \| loaded_healthy \| loaded_unhealthy \| unknown`, missing `loaded_degraded` and `version_mismatch` from design |
70
+ | 7 | ⚠️ | Threaded behind `useSharedToolResolver` option AND `SPECIALISTS_USE_RESOLVER=1` env var. **Default OFF.** Runtime never sees per-specialist override layer because the call site (`PiAgentSession.start`) has no access to the specialist's parsed JSON |
71
+ | 8 | ⚠️ | Resolver supports soft mode correctly. **Runtime never invokes it for any specialist** because (a) flag default-off, (b) no per-specialist override threaded |
72
+ | 9 | ⚠️ | Resolver supports hard mode with health-aware native restoration. **Runtime never invokes it.** Diagnostic-only |
73
+ | 10 | ⚠️ | `config/specialists/explorer.specialist.json` has `permissions.READ_ONLY.denied_natives_when_extension: ["grep","find","ls"]` with `denied_natives_mode: "hard"`. **Runtime ignores this block.** Visible only in `sp config show` |
74
+ | 11 | ❌ | Deferred to "post-release parity window". Reasoning was sound *if* the resolver was actually receiving production traffic. It is not. The "parity window" is fiction — zero specialists have been spawned through the resolver |
75
+
76
+ ### Inline fixes shipped (not in §7)
77
+
78
+ Five end-to-end correctness bugs surfaced by exercising `sp config show
79
+ explorer --resolved` and patched in commits `6b057e01`, `ee7dec6d`,
80
+ `5ad59543`:
81
+
82
+ 1. Tier was hardcoded to HIGH in `resolution-diagnostics.ts:loadResolvedConfigReport` — fixed by reading `execution.permission_required` from the specialist JSON
83
+ 2. Extension probe used project-local `require.resolve` paths — fixed by adding `npm root -g` to resolution paths
84
+ 3. Specialist JSON's `permissions[tier]` was passed as `manifestPolicy` — fixed by routing it through `specialistOverride` parameter
85
+ 4. Layer attribution only emitted `tier_policy` — fixed to emit `catalog`, `specialist_override`, `runtime_health` distinctly
86
+ 5. Catalog compatibility check considered only `drift !== 'none'` — fixed to also flag `health !== 'loaded_healthy'`
87
+ 6. Probe entrypoint check rejected pi extension packages with no `main` field — relaxed to package.json presence
88
+ 7. Renamed `yamlExclusions` → `specialistExclusions` and layer `yaml_exclusion` → `specialist_exclusion` (terminology drift fix; specialists are JSON not YAML)
89
+
90
+ ---
91
+
92
+ ## Why §0 remains unresolved
93
+
94
+ The original problem statement (`gzrx-tool-catalog.md` §0):
95
+
96
+ > Native tools (`read`, `grep`, `find`, `ls`, `bash`, `edit`, `write`) and
97
+ > extension tools coexist with no policy distinguishing **preferred** from
98
+ > **fallback**. There is no concept of "deny native `grep` when GitNexus is
99
+ > loaded" — explorer can still reach for `grep` instead of `gitnexus_query`.
100
+
101
+ The fix path:
102
+
103
+ 1. Design a manifest that lets specialists override tier policy
104
+ 2. Build a resolver that applies the manifest to produce final `--tools`
105
+ 3. Make the resolver the source of truth at runtime
106
+ 4. Migrate explorer to hard-deny grep/find/ls
107
+
108
+ Today: steps 1-2 are done. Step 3 is half-done (resolver exists but is opt-in
109
+ and runtime cannot access per-specialist data). Step 4 is done in JSON but
110
+ the runtime ignores it.
111
+
112
+ The **call site** is the missing link. `PiAgentSession.start` in
113
+ `src/pi/session.ts:660` does:
114
+
115
+ ```ts
116
+ const useResolver = this.options.useSharedToolResolver ?? process.env.SPECIALISTS_USE_RESOLVER === '1';
117
+ const toolsFlag = useResolver
118
+ ? resolvePermissionTools(this.options.permissionLevel) ?? mapPermissionToTools(this.options.permissionLevel)
119
+ : mapPermissionToTools(this.options.permissionLevel);
120
+ ```
121
+
122
+ `resolvePermissionTools(level)` accepts only the tier string. It cannot apply
123
+ the per-specialist override because `PiSessionOptions` does not carry the
124
+ specialist's name or parsed JSON. The caller (`src/specialist/runner.ts`)
125
+ has the specialist name and JSON in scope but never passes them down.
126
+
127
+ Two missing fields and a small wiring change unlock everything.
128
+
129
+ ---
130
+
131
+ ## File:line gap inventory
132
+
133
+ | Gap | File | Lines | What needs to change |
134
+ |-----|------|-------|----------------------|
135
+ | `PiSessionOptions` lacks specialist context | `src/pi/session.ts` | 95-147 | Add `specialistName?: string` and `specialistPermissions?: ManifestPolicy['permissions']` |
136
+ | Runtime resolver call ignores per-specialist override | `src/pi/session.ts` | 243-258 | Accept the new fields, pass `specialistOverride: specialistPermissions?.[tier]` to `resolveManifestTools` |
137
+ | Caller doesn't pass specialist context | `src/specialist/runner.ts` | (TBD — search for `new PiAgentSession`) | Read specialist JSON, pass `specialistName` + `specialistPermissions` into options |
138
+ | MCP caller doesn't pass specialist context | `src/tools/specialist/use_specialist.tool.ts` | (TBD) | Same |
139
+ | Resolver default-off | `src/pi/session.ts` | 665 | Either flip default to on (`useResolver !== false`), or delete the flag entirely |
140
+ | Legacy arrays still source of truth | `src/pi/session.ts` | 156-219 | Delete `GITNEXUS_READ_TOOLS`, `SERENA_READ_TOOLS`, `SERENA_LOW_TOOLS`, `SERENA_WRITE_TOOLS`, `GITNEXUS_WRITE_TOOLS` |
141
+ | Legacy mapping function | `src/pi/session.ts` | 260-280 | Delete `mapPermissionToTools` |
142
+ | `ExtensionHealth` type missing degraded/version_mismatch states | `src/specialist/manifest-resolver.ts` | 3 | Widen union (logic already handles them via `HEALTHY` whitelist) |
143
+ | Test fixture for session.ts | `tests/unit/pi/session.test.ts` | (TBD) | Update Phase 4 tests to reflect resolver-only path |
144
+ | No `docs/manifest.md` | (new file) | — | User-facing reference for `permissions[tier]` block |
145
+ | No `docs/cli-reference.md` entry | `docs/cli-reference.md` | (TBD) | Document `sp config show <name> --resolved` |
146
+ | No CHANGELOG `[Unreleased]` entry | `CHANGELOG.md` | top | Document the new diagnostic CLI + opt-in env flag |
147
+
148
+ ---
149
+
150
+ ## Operational debt collected
151
+
152
+ Observations from this session that complicate next session's work:
153
+
154
+ 1. **Phase 4 merge was silently dropped.** The "Already up to date" output during merge was a lie because of how the worktree-tracking interacted with master. Detected only when `grep` for `resolveManifestTools` in `src/pi/session.ts` returned zero matches. Recovered via explicit `git merge bc0f290c --no-ff`. Worth noting that `git merge feature-branch` followed by "Already up to date" is not a guarantee that the changes actually arrived.
155
+
156
+ 2. **Phase 6 first attempt stalled.** RPC stalled after 120s with no activity, then the bead became unable to dispatch new executors silently. Required `--force-stale-base` because sp's bookkeeping flagged Phase 4 as having "unmerged sibling commits" even though Phase 4 was on master. Manual merges break sp's epic-tracking.
157
+
158
+ 3. **Reviewer specialists died from tmux memory pressure.** Inline orchestrator review was used as fallback. Worked but bypasses the reviewer's gating discipline.
159
+
160
+ 4. **Global pi extensions were silently broken across all prior sessions** (`pi-gitnexus` missing `cross-spawn`, `pi-mcp-adapter` missing `@modelcontextprotocol/sdk`). Fixed locally via `npm install` in nvm global node_modules. Upstream PR to mariozechner/pi-mono required for any other developer.
161
+
162
+ 5. **Phase children not formally closed.** `unitAI-8vb65.1` through `.7` were memory-acked via `bd kv set` but `bd close` was never invoked. Bead state is OPEN despite work being merged. Bulk close needed.
163
+
164
+ 6. **YAML→JSON terminology drift.** Specialists are JSON files; legacy YAML support exists in `src/specialist/loader.ts:101` with a `deprecatedYaml` flag. Field naming and design doc had drifted to YAML language. Fixed in commit `5ad59543`.
165
+
166
+ 7. **Dolt remote push permission denied throughout.** Local bd state is fine; remote sync is broken. Auth fix needed independently.
167
+
168
+ ---
169
+
170
+ ## Recommended next-session approach
171
+
172
+ See `unitAI-qujxo.2` for the full bead contract. Summary:
173
+
174
+ 1. Plumb `specialistName` + `specialistPermissions` through `PiSessionOptions` and the runner caller — ~30 min.
175
+ 2. Flip the resolver to default-on (delete env flag or invert default).
176
+ 3. Spawn one specialist per tier (READ_ONLY/LOW/MEDIUM/HIGH) with a no-op bead, capture `--tools` from spawn args via feed `META` events, confirm against `sp config show --resolved`.
177
+ 4. Delete legacy `mapPermissionToTools` + the five hardcoded array constants in `src/pi/session.ts:156-280`.
178
+ 5. Verify §0 promise: live explorer feed shows zero `grep`/`find`/`ls` calls and uses `gitnexus_query` / `search_for_pattern` / `find_file` instead. Capture as evidence.
179
+ 6. Bulk-close gzrx phase beads.
180
+ 7. (Optional) Add user-facing docs (`docs/manifest.md`, CLI reference entry, CHANGELOG).
181
+
182
+ Estimated 2-4 hours total. Reviewer chain optional given the small surface
183
+ and existing 75-test coverage.