@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,556 @@
1
+ ---
2
+ name: setup-specialists
3
+ description: >
4
+ First-run setup workflow for a Specialists install. Use when the user says
5
+ "setup specialists", "configure specialists", "change the specialist models",
6
+ "models shipped do not exist on my machine", "set notes_mode globally", "opt
7
+ out of Serena for one specialist", "sp init --global", "sp edit --global", or
8
+ asks how to apply specialist overrides across all repos at once. Verifies
9
+ local Pi models, explains the 3-layer field merge (package canonical →
10
+ ~/.config/specialists/user.json → .specialists/user), bootstraps the global
11
+ user.json via `sp init --global`, applies model + behavior overrides via
12
+ `sp edit --global`, and validates with `sp doctor --specialists`.
13
+ version: 3.0
14
+ synced_at: 5a86c1ce
15
+ ---
16
+
17
+ # setup-specialists
18
+
19
+ KAN-90 shipped the global user-config layer at `~/.config/specialists/user.json`
20
+ on 2026-06-13. KAN-91 expanded the allowlist with fallback chains, preset refs,
21
+ extension opt-out, byte limits, the `_doc` sentinel, and per-spec `notes_mode` /
22
+ `output_file` overrides through 2026-06-15. Use this workflow after installing
23
+ `@jaggerxtrm/specialists` in a fresh environment, or whenever you want to set
24
+ model and runtime behavior **once for all repos** instead of forking
25
+ per-repo specs.
26
+
27
+ ## 3.0 interactive playbook
28
+
29
+ From `setup-specialists` v3.0 onward, the operator flow is explicit and directed.
30
+ All decisions come from machine-parseable state and operator answers. Interactive
31
+ checkpoints are mandatory.
32
+
33
+ > Version gate: commands marked with `sp setup` verbs require **sp >= 3.18**.
34
+ > If installed version is older, ask operator to upgrade first and pause.
35
+
36
+ ### Phase 1 (DISCOVERY)
37
+
38
+ Commands:
39
+
40
+ ```bash
41
+ pi --list-models
42
+ sp doctor --specialists
43
+ sp list --full
44
+ ```
45
+
46
+ Parse contract (JSON state):
47
+
48
+ ```json
49
+ {
50
+ "discovered_at": "ISO-8601",
51
+ "pi_models": [
52
+ {"provider": "string", "model": "string", "id": "provider/model", "context_window": "string", "max_output": "string", "thinking": true, "images": true, "raw": "string"}
53
+ ],
54
+ "doctor": {
55
+ "configured": 0,
56
+ "total": 0,
57
+ "missing": ["specialist"],
58
+ "global_user_config_present": true,
59
+ "missing_global_file": false,
60
+ "blocked_field_warnings": [
61
+ {"specialist": "string", "field": "string", "source": "global|repo", "severity": "strip|warn", "value": "unknown|null|string|array|number|bool"}
62
+ ]
63
+ },
64
+ "registry": [
65
+ {
66
+ "name": "string",
67
+ "version": "string",
68
+ "model": "string",
69
+ "permission_required": "READ_ONLY|LOW|MEDIUM|HIGH",
70
+ "scope": "default|package|user",
71
+ "chain_position": "pre-impl|impl|post-impl|merge|standalone",
72
+ "description": "string",
73
+ "model_from_source": "global|package|repo"
74
+ }
75
+ ],
76
+ "providers": [
77
+ { "label": "provider-id", "status": "OAuth|API-key|missing" }
78
+ ],
79
+ "notes": "string"
80
+ }
81
+ ```
82
+
83
+ Exact parsing rules:
84
+
85
+ - `pi --list-models` output is parsed as newline table rows; split each line by
86
+ whitespace and map
87
+ `provider model context_window max_output thinking images` into `PiModel`.
88
+ Preserve order after filtering out empty fields and dedupe identical
89
+ `provider/model` pairs.
90
+ - `sp doctor --specialists` parse first line matching
91
+ `^(\d+)\/(\d+) specialists have a model configured` into
92
+ `doctor.configured` and `doctor.total`.
93
+ - If line contains `global user config NOT present`, set
94
+ `doctor.global_user_config_present=false`, `doctor.missing_global_file=true`.
95
+ - Collect blocked-field lines from `checkSpecialistOverrides()` hints in two
96
+ buckets:
97
+ - `source: global` + `severity: strip`
98
+ - `source: <repo-path>` + `severity: warn`
99
+ - `doctor.missing` are the specialists named on the `missing:` hint line, if
100
+ present.
101
+ - Build `providers` from phase-1 discovery data:
102
+ - `label`: provider id
103
+ - `status`: auth status (`OAuth`, `API-key`, or `missing`).
104
+ - `sp list --full` parse every spec row that matches
105
+ `^\s{2}(?<name>\S+)`.
106
+ - Capture `[v<version>]`, model, version tag, permission model and scope tags.
107
+ - Map `scope` from `[package]`, `[default]`, `[user]`.
108
+ - Set `model_from_source` from source row tag in `sp doctor --specialists` output
109
+ when available; fallback to `model` provenance from list summary if ambiguous.
110
+ - Normalize deterministic JSON shape: stable sort
111
+ `pi_models` by `id`, `registry` by `name`, `missing` alphabetical, and
112
+ `providers` by `label` alphabetical.
113
+
114
+ Persist this object in the session as `state.setupPhase1`.
115
+
116
+ ### Phase 2 (FETCH)
117
+
118
+ Execute exactly:
119
+
120
+ ```bash
121
+ sp setup --fetch-benchmarks --json
122
+ ```
123
+
124
+ Expected JSON shape for phase orchestration:
125
+
126
+ ```json
127
+ {
128
+ "snapshot": {
129
+ "source": "string",
130
+ "source_url": "https://...",
131
+ "fetched_at": "ISO-8601"
132
+ },
133
+ "model_count": 0,
134
+ "warnings": ["string"],
135
+ "offline": true|false,
136
+ "cache_status": "fresh|stale|missing"
137
+ }
138
+ ```
139
+
140
+ If `snapshot` is null, mark benchmark availability as failed and continue to
141
+ Phase 3 only with `state.benchmarks = unavailable`.
142
+
143
+ Render a pre-operator comparison table from this response with columns:
144
+
145
+ | source | model_count | fetched_at | cache_status |
146
+ |---|---:|---|---|
147
+
148
+ ### Phase 3 (INTERACTIVE Q)
149
+
150
+ Use five `AskUserQuestion` checkpoints. Privacy is represented as a two-step flow with a conditional follow-up.
151
+ Every question must include this exact
152
+ question wording, header, options, and parsing contract.
153
+
154
+ 1. **Budget preference**
155
+ - **header:** `Budget`
156
+ - **question wording:** `Choose setup budget profile for model selection.`
157
+ - **options (2-4):**
158
+ - `cheap` — prioritize lowest cost input models
159
+ - `balanced` — balanced cost / quality default
160
+ - `power` — prefer quality and throughput (higher cost)
161
+ - **expected answer parsing:** `{ "budget": "cheap" | "balanced" | "power" }`
162
+
163
+ 2. **Working provider auth**
164
+ - **header:** `Auth`
165
+ - **question wording:** `Which providers do you have working auth for in this environment?`
166
+ - **multiSelect:** `true`
167
+ - **options:** bounded by discovered providers in `state.providers` (build this from phase-1 discovery output).
168
+ - **provider option shape:**
169
+ ```json
170
+ { "label": "provider-id", "description": "<status: OAuth | API-key | missing>" }
171
+ ```
172
+ - **options example (shape):**
173
+ ```json
174
+ [
175
+ {"label":"openai","description":"OAuth available"},
176
+ {"label":"anthropic","description":"API key present"},
177
+ {"label":"mistral","description":"missing credentials"}
178
+ ]
179
+ ```
180
+ - **expected answer parsing:** `{ "providers": ["string"] }`
181
+
182
+ 3. **Privacy exclusions (Step 1)**
183
+ - **header:** `Privacy`
184
+ - **question wording:** `Are there any providers to exclude (data-privacy / vendor-policy)?`
185
+ - **multiSelect:** `false`
186
+ - **options (2):**
187
+ - { `label`: `No exclusions`, `description`: `all working providers are eligible` }
188
+ - { `label`: `Yes, exclude some`, `description`: `narrow down on next step` }
189
+ - **expected answer parsing:** `{ "has_exclusions": true|false }`
190
+
191
+ **Privacy Step 2 (conditional only when Step 1 answer is `Yes, exclude some`)**
192
+ - **header:** `Exclude`
193
+ - **question wording:** `Select providers to exclude from this setup`
194
+ - **multiSelect:** `true`
195
+ - **options:** provider option objects from auth-confirmed list:
196
+ ```json
197
+ [
198
+ {"label":"openai","description":"working auth confirmed in this session"},
199
+ {"label":"anthropic","description":"working auth confirmed in this session"}
200
+ ]
201
+ ```
202
+ - **expected answer parsing:** `{ "disallowed_providers": ["string"] }`
203
+
204
+ 4. **Project shape**
205
+ - **header:** `Shape`
206
+ - **question wording:** `What is the project shape for this setup?`
207
+ - **options (3):**
208
+ - `code-heavy` — implementation and refactor tasks dominate
209
+ - `research-heavy` — investigation and docs-heavy sessions dominate
210
+ - `mixed` — both engineering and research are frequent
211
+ - **expected answer parsing:** `{ "project_shape": "code-heavy" | "research-heavy" | "mixed" }`
212
+
213
+ 5. **Verify probes**
214
+ - **header:** `Probe`
215
+ - **question wording:** `Run agentic-followthrough probe before apply?`
216
+ - **options (3):**
217
+ - `yes` — run probes for all proposed spec/model changes
218
+ - `no` — skip probe phase
219
+ - `only-for-specs-X` — run probes only for candidate specs in X
220
+ - **expected answer parsing:**
221
+ ```json
222
+ {
223
+ "run_probe": "yes" | "no" | "only-for-specs",
224
+ "probe_specs": ["string"]
225
+ }
226
+ ```
227
+ If `run_probe === "only-for-specs"`, treat `probe_specs` as authoritative and
228
+ run each with `sp setup --probe-only <model> <spec> --json`.
229
+
230
+ ### Phase 4 (PROPOSE)
231
+
232
+ Map question answers to setup plan input object and run:
233
+
234
+ ```bash
235
+ sp setup --plan <preset> --json
236
+ ```
237
+
238
+ where preset is:
239
+ - `cheap` → `cheap`
240
+ - `balanced` → `balanced`
241
+ - `power` → `premium`
242
+
243
+ Expected output JSON is from Phase B plan shape:
244
+
245
+ ```json
246
+ {
247
+ "version": "3.0",
248
+ "generated_at": "ISO-8601",
249
+ "preset": "cheap|balanced|premium",
250
+ "inputs": {
251
+ "specialists": ["string"],
252
+ "preferred_providers": ["string"],
253
+ "disallowed_models": ["string"]
254
+ },
255
+ "writes": [
256
+ {
257
+ "specialist": "string",
258
+ "path": "execution.model",
259
+ "value": "string",
260
+ "reason": "string"
261
+ }
262
+ ],
263
+ "entries": [
264
+ {
265
+ "specialist": "string",
266
+ "current_model": "string",
267
+ "recommended_model": "string",
268
+ "score": "string",
269
+ "rationale_snippet": "string"
270
+ }
271
+ ],
272
+ "benchmark": {"source":"string","source_url":"string","fetched_at":"ISO-8601"}
273
+ }
274
+ ```
275
+
276
+ Render to operator as a comparable markdown table:
277
+
278
+ | specialist | current model | recommended model | score | rationale |
279
+ |---|---|---|---:|---|
280
+
281
+ Require operator review and explicit confirmation before proceeding.
282
+
283
+ ### Phase 5 (APPLY)
284
+
285
+ If confirmed:
286
+
287
+ ```bash
288
+ sp setup --apply <plan.json> --json
289
+ ```
290
+
291
+ Then run:
292
+
293
+ ```bash
294
+ sp doctor --specialists
295
+ ```
296
+
297
+ For plans where a proposed `(model, spec)` has `runs multi-turn roles`, run probe check
298
+ first:
299
+
300
+ ```bash
301
+ sp setup --probe-only <model> <spec> --json
302
+ ```
303
+
304
+ If probe verdict is `FAIL`, keep that write out and continue only with explicit
305
+ operator override (do not auto-apply). For `PARTIAL`, show warning and require
306
+ reconfirm.
307
+
308
+ Final verification command:
309
+
310
+ ```bash
311
+ sp doctor --specialists
312
+ ```
313
+
314
+ Mark setup done only when doctor shows configured specialists no longer regressed
315
+ from proposal state.
316
+
317
+ ## Legacy v2.0 workflow reference (kept for field facts)
318
+
319
+ ## The 3-layer field merge
320
+
321
+ Specialist resolution merges top-down:
322
+
323
+ 1. **Package canonical** — `config/specialists/<name>.specialist.json` shipped
324
+ in the npm package. Most fields are concrete defaults; `model` /
325
+ `fallback_model` ship as `null` since KAN-90 part 2 because each operator
326
+ has different providers.
327
+ 2. **`~/.config/specialists/user.json`** — your global override. Per-spec
328
+ sub-tree containing only the allowlisted fields (below).
329
+ Wins over package canonical.
330
+ 3. **`.specialists/user/<name>.specialist.json`** — per-repo override. Wins
331
+ over global. Can change any field (including ones blocked from global).
332
+
333
+ The retired `.specialists/default/<name>.specialist.json` mirror is no longer
334
+ walked (commit `31a6421c`). Stale entries surface in `sp doctor --check-drift`
335
+ and are pruned by `sp prune-stale-defaults`.
336
+
337
+ `sp edit <name> …` writes to a repo-local file (forks from package if no
338
+ `.specialists/user/<name>.specialist.json` exists yet).
339
+ `sp edit --global <name>.<field> <value>` writes to `~/.config/specialists/user.json`.
340
+
341
+ ## When to use `--global` vs per-repo
342
+
343
+ | Need | Layer |
344
+ |---|---|
345
+ | Your provider's models, set once for everywhere | `--global` |
346
+ | Extension opt-out (e.g. no Serena for transcriber) | `--global` |
347
+ | `notes_mode` / `output_file` for chained pipelines | `--global` |
348
+ | `thinking_level`, byte limits, fallback chains | `--global` |
349
+ | Different model just for this repo | per-repo |
350
+ | Override a field NOT allowlisted at the global layer (see below) | per-repo |
351
+
352
+ ## Workflow
353
+
354
+ ### 1) Bootstrap `~/.config/specialists/user.json`
355
+
356
+ ```bash
357
+ sp init --global
358
+ ```
359
+
360
+ What it does (idempotent — safe to re-run):
361
+
362
+ - Creates `~/.config/specialists/user.json` if missing.
363
+ - For every specialist in the resolved registry, seeds an entry with `null`
364
+ placeholders for the allowed user-environment fields.
365
+ - Writes a `_doc` sentinel at the top pointing at
366
+ `~/.config/specialists/overrides-guide.md`.
367
+ - (Re)generates `overrides-guide.md` with the full field reference.
368
+ - Preserves existing user values — only newly-discovered specialists get fresh
369
+ placeholders on re-run.
370
+
371
+ Output reports "preserved N existing specialists (user values kept)" when a
372
+ file already existed.
373
+
374
+ ### 2) Check your local model fleet
375
+
376
+ ```bash
377
+ pi --list-models # what your pi installation actually exposes
378
+ sp doctor --specialists # which specialists still have null model after merge
379
+ ```
380
+
381
+ `sp doctor --specialists` reports e.g. `30/31 specialists have a model
382
+ configured` — only `bare` (the template) is expected to remain null after a
383
+ full setup.
384
+
385
+ ### 3) Apply global overrides
386
+
387
+ The reliable form is `--set` with the dot-path:
388
+
389
+ ```bash
390
+ sp edit --global --set <name>.<dot.path> <value>
391
+ ```
392
+
393
+ The bare positional form (`sp edit --global <name>.field value`) currently
394
+ falls through to `$EDITOR` in some environments (open follow-up). Prefer
395
+ `--set` in scripts and one-liners.
396
+
397
+ **Fields the global layer may set** (`OVERRIDE_ALLOWED_*` in
398
+ `src/specialist/schema.ts` + `GlobalSpecialistOverrideSchema` in
399
+ `src/specialist/global-config.ts`):
400
+
401
+ | Dot-path | Type | Notes |
402
+ |---|---|---|
403
+ | `<name>.execution.model` | string | Required for dispatch. Use a real `pi --list-models` id or a `@preset/<name>` ref. |
404
+ | `<name>.execution.fallback_model` | string \| null | Legacy singular fallback. |
405
+ | `<name>.execution.fallback_models` | string[] \| null | Plural chain (KAN-91 Phase 2). Walked **only on transient failures** (rate limits, network errors, 5xx). Plural wins over singular. |
406
+ | `<name>.execution.timeout_ms` | number \| null | Per-spec timeout. |
407
+ | `<name>.execution.stall_timeout_ms` | number \| null | Stall-detection threshold. |
408
+ | `<name>.execution.interactive` | bool \| null | Global default keep-alive behavior. CLI still wins: `--no-keep-alive` > `--keep-alive` > merged `execution.interactive`. |
409
+ | `<name>.execution.thinking_level` | enum \| null | `off \| minimal \| low \| medium \| high \| xhigh`. **Leave `null` to inherit pi's `defaultThinkingLevel` (typically `high`)**. Forcing `off` on Kimi-class models silently produces empty assistant text. |
410
+ | `<name>.execution.max_retries` | number \| null | Transient-retry budget. |
411
+ | `<name>.execution.prompt_limit_bytes` | number \| null | Script-runner prompt-size guard (~4 MB default). |
412
+ | `<name>.execution.stdout_limit_bytes` | number \| null | Script-runner stdout cap (~32 MB default). |
413
+ | `<name>.execution.extensions.serena` | bool \| null | `false` to skip Serena MCP injection for this spec (RAM saver on non-LSP roles). |
414
+ | `<name>.execution.extensions.gitnexus` | bool \| null | `false` to skip GitNexus MCP injection. |
415
+ | `<name>.prompt.system_prompt_mode` | enum \| null | `append` (default for package specs) or `replace`. |
416
+ | `<name>.stall_detection.waiting_auto_close_ms` | number \| null | Opt-in waiting auto-close threshold. Graceful close first; forced termination only if close hangs. |
417
+ | `<name>.beads_write_notes` | bool \| null | `false` to disable auto-append to input bead notes. |
418
+ | `<name>.notes_mode` | enum \| null | `full-trail` (default) or `final-only` — see [Handoff modes](#handoff-modes). |
419
+ | `<name>.output_file` | string \| null | Path to write the rendered handoff block. **No env flag required** since `unitAI-f58ma`. |
420
+
421
+ **Blocked at the global layer** (these MUST be overridden per-repo via
422
+ `.specialists/user/<name>.specialist.json` if needed):
423
+ `execution.permission_required`, `execution.bare`, `mandatory_rules`,
424
+ `capabilities`, `output_schema`, `auto_commit`, `prompt.system`,
425
+ `prompt.task_template`, `skills.scripts`.
426
+
427
+ A blocked field that sneaks in is **applied with a warning** (forward compat,
428
+ v1) and surfaced by `sp doctor --specialists` as
429
+ `blocked-field overrides present in repo layers`. Fork to a per-repo spec to
430
+ clear the warning.
431
+
432
+ ### 4) Preset references (KAN-91 Phase 3)
433
+
434
+ Instead of hard-coding model ids, point to a named preset:
435
+
436
+ ```bash
437
+ sp edit --global --set executor.execution.model @preset/medium
438
+ sp edit --global --set executor.execution.fallback_models '["@preset/cheap"]'
439
+ ```
440
+
441
+ Built-in presets ship in the package. Show what's available:
442
+
443
+ ```bash
444
+ sp edit --list-presets
445
+ ```
446
+
447
+ Typical names: `cheap`, `medium`, `power`. Update the preset definition once
448
+ and every spec referencing it picks up the new model on next dispatch.
449
+
450
+ Resolution depth cap = 5 levels; cycles surface a structured error at dispatch.
451
+
452
+ ### 5) Verify and smoke
453
+
454
+ ```bash
455
+ sp doctor --specialists # 30/31 should have model configured
456
+ sp config show <name> --resolved # see merged spec for one specialist
457
+ sp list --full # human view of the registry
458
+ ```
459
+
460
+ Optionally ping each chosen model:
461
+
462
+ ```bash
463
+ pi --model <provider>/<model> --print "ping" # must reply: pong
464
+ ```
465
+
466
+ ## Handoff modes
467
+
468
+ `notes_mode` controls how the rendered handoff block lands in the input bead
469
+ notes **and** in the spec's `output_file`. Both are fed from a single source
470
+ (`turn_summary.text_content`) so there is no divergence.
471
+
472
+ The supervisor renders markdown-native blocks (no emoji, no dividers):
473
+
474
+ ```
475
+ ### service-skills-sync · kimi-k2.5 · [turn 12 · WAITING] ← H3 per-turn
476
+ <assistant output verbatim>
477
+ _turn 12 · 8413 ms · 4222 to 167 tok · 2026-06-16 02:11 · git fc9168e2_
478
+
479
+ ## service-skills-sync · kimi-k2.5 · [FINAL · DONE] ← H2 canonical, greppable
480
+ <final assistant output verbatim>
481
+ _final · 107106 ms · 18269 to 468 tok · 2026-06-16 02:13 · git fc9168e2_
482
+ ```
483
+
484
+ | Mode | Bead notes | `output_file` |
485
+ |---|---|---|
486
+ | `full-trail` (default) | Append every turn's H3 WAITING block + the H2 FINAL block | Append per turn |
487
+ | `final-only` | Persist only the H2 FINAL block; intermediate turns are skipped | **Overwritten** with just the FINAL block on each run |
488
+
489
+ Recipe for a chained non-coding pipeline where the next specialist reads the
490
+ previous one's note:
491
+
492
+ ```bash
493
+ sp edit --global --set sync-docs.notes_mode final-only
494
+ sp edit --global --set sync-docs.output_file ".specialists/sync-docs-result.md"
495
+ echo '.specialists/*-result.md' >> .gitignore # avoid committing the artifact
496
+ ```
497
+
498
+ For a human-monitored keep-alive role, leave `notes_mode: null` (= default
499
+ `full-trail`) so you see the trail accumulate in `bd show <id>`.
500
+
501
+ ## Common pitfalls
502
+
503
+ - **`sp edit --global <name>.<dot.path> <value>` falls through to vim in some
504
+ environments**. Use `--set` explicitly: `sp edit --global --set <name>.field value`.
505
+ - **`thinking_level: "off"` silently breaks some thinking-class models** —
506
+ Kimi-via-nano-gpt verified emitting empty assistant text (`char_count: 1`)
507
+ after multi-tool runs when forced to `off`. Leave it `null` (inherit pi's
508
+ `defaultThinkingLevel`) unless you have a documented reason.
509
+ - **Provider auth missing** — if you assign `anthropic/*` models but Anthropic
510
+ OAuth is not configured in your pi setup, dispatch fails without a
511
+ user-friendly error. Verify with `pi --print --model <…> "ping"` first.
512
+ - **Repo override shadowing global** — `.specialists/user/<name>.specialist.json`
513
+ wins over global. If your global model doesn't take effect, run
514
+ `sp config show <name> --resolved` and look for `source: user` rows to find
515
+ the shadowing layer.
516
+ - **Stale `.specialists/default/` entries from pre-KAN-90 installs** — the
517
+ loader no longer walks them, but they confuse human readers. Run
518
+ `sp prune-stale-defaults` to clean.
519
+
520
+ ## Reference files
521
+
522
+ | Path | Role |
523
+ |---|---|
524
+ | `~/.config/specialists/user.json` | Your global config |
525
+ | `~/.config/specialists/overrides-guide.md` | Auto-generated field reference (rewritten by every `sp init --global`) |
526
+ | `docs/upgrade-notes/kan-90-global-user-config.md` | KAN-90 design + migration |
527
+ | `docs/upgrade-notes/kan-91-expanded-overrides.md` | KAN-91 design + field reference |
528
+ | `src/specialist/global-config.ts` | `GlobalSpecialistOverrideSchema` + `mergeGlobalUserConfig` |
529
+ | `src/specialist/schema.ts` | `OVERRIDE_ALLOWED_*` constants + per-spec schema |
530
+ | `src/specialist/loader.ts` | 3-layer merge implementation |
531
+ | `src/cli/init.ts`, `src/cli/edit.ts`, `src/cli/doctor.ts` | CLI surface |
532
+
533
+ ## Report template
534
+
535
+ ```
536
+ KAN-91 global setup result:
537
+ - ~/.config/specialists/user.json: <created|preserved-and-augmented>
538
+ - Specialists with model configured: <N/31>
539
+ - Per-spec overrides applied (model): <list>
540
+ - Preset refs in use: <list or none>
541
+ - notes_mode set globally for: <list or none>
542
+ - output_file set globally for: <list or none>
543
+ - Extension opt-out (serena/gitnexus): <list per spec>
544
+ - Caveats / models that failed pi --list-models check: <list or none>
545
+ - Per-repo overrides still in .specialists/user that shadow global: <list or none>
546
+ ```
547
+
548
+
549
+ ## Related skills
550
+
551
+ - `specialists-creator` — authoring NEW specialists or editing per-spec fields
552
+ not allowlisted at the global layer. The global override layer reuses the
553
+ same per-spec field semantics; see its §"Global User Override Layer
554
+ (KAN-90/91)" section for the dot-path syntax mapping.
555
+ - `using-specialists-v3` — orchestration discipline once specialists are
556
+ configured.