gentle-pi 4.9.0 → 5.1.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 (443) hide show
  1. package/README.md +2 -2
  2. package/assets/agents/gentle-ai-explore.md +3 -6
  3. package/assets/agents/gentle-ai-verify.md +2 -2
  4. package/assets/agents/gentle-ai-worker.md +9 -9
  5. package/assets/agents/jd-fix-agent.md +2 -2
  6. package/assets/agents/jd-judge-a.md +0 -1
  7. package/assets/agents/jd-judge-b.md +0 -1
  8. package/assets/migrations/agent-body-history.json +9 -0
  9. package/assets/orchestrator-delegation.md +1 -1
  10. package/assets/orchestrator-full-delegation.md +1 -1
  11. package/assets/orchestrator-maintenance.md +11 -0
  12. package/assets/orchestrator-quota-recovery.md +1 -1
  13. package/assets/orchestrator-skills.md +10 -0
  14. package/assets/orchestrator-tracking.md +2 -2
  15. package/assets/orchestrator-verification.md +10 -8
  16. package/assets/orchestrator.md +2 -2
  17. package/bin/gentle-shell.mjs +69 -17
  18. package/contracts/review-provider-contract-mirror/provider-contract.lock.json +11 -10
  19. package/contracts/review-provider-contract-mirror/{v1.6.0 → v1.7.0}/bundle/manifest.json +5 -5
  20. package/contracts/review-provider-contract-mirror/{v1.6.0 → v1.7.0}/bundle/orchestration/pi.md +5 -3
  21. package/contracts/review-provider-contract-mirror/{v1.6.0 → v1.7.0}/bundle/routing/pi.md +2 -2
  22. package/contracts/review-provider-contract-mirror/{v1.6.0 → v1.7.0}/bundle/schemas/lens.schema.json +3 -3
  23. package/contracts/review-provider-contract-mirror/v1.7.0/bundle/vectors/lens.json +1 -0
  24. package/contracts/review-provider-contract-mirror/{v1.6.0 → v1.7.0}/generated/provider-capabilities.baseline.json +3 -3
  25. package/contracts/review-provider-contract-mirror/{v1.6.0 → v1.7.0}/generated/provider-roles.baseline.json +3 -3
  26. package/docs/bundled-install.md +2 -2
  27. package/docs/delegated-verification.md +10 -6
  28. package/docs/desktop-feed.md +15 -6
  29. package/docs/desktop-rpc.md +298 -30
  30. package/docs/gentle-shell-desktop.md +10 -3
  31. package/docs/gentle-shell.md +25 -19
  32. package/docs/install-wizard.md +7 -5
  33. package/docs/native-authority-architecture.md +3 -3
  34. package/docs/odd-preparation-continuity.md +2 -2
  35. package/docs/permission-modes.md +10 -2
  36. package/docs/readme-reference.md +53 -24
  37. package/docs/review-coordinator.md +4 -2
  38. package/docs/session-profile-format.md +33 -7
  39. package/docs/sound-notifications.md +1 -1
  40. package/docs/work-continuity.md +7 -7
  41. package/docs/yolo-mode.md +1 -1
  42. package/extensions/ask-user-choice.ts +2 -2
  43. package/extensions/ask-user-question.ts +1 -1
  44. package/extensions/child-context.ts +2 -11
  45. package/extensions/gentle-agents.ts +86 -30
  46. package/extensions/gentle-ai.ts +918 -632
  47. package/extensions/gentle-desktop-feed.ts +13 -3
  48. package/extensions/gentle-desktop-rpc.ts +51 -2
  49. package/extensions/gentle-fast.ts +9 -2
  50. package/extensions/gentle-music.ts +2 -0
  51. package/extensions/gentle-notifications.ts +12 -4
  52. package/extensions/gentle-shell.ts +157 -62
  53. package/extensions/gentle-star-prompt.ts +3 -0
  54. package/extensions/gentle-tps.ts +7 -0
  55. package/extensions/history/index.ts +1 -1
  56. package/extensions/quiet-tools.ts +13 -22
  57. package/extensions/skill-registry.ts +9 -1
  58. package/extensions/startup-banner.ts +8 -13
  59. package/herdr/mods/gentle-agents/snapshot.js +30 -23
  60. package/herdr/mods/gentle-chat/feed.js +6 -0
  61. package/herdr/mods/gentle-chat/main.js +76 -16
  62. package/herdr/mods/gentle-chat/session.js +13 -5
  63. package/herdr/mods/gentle-chat/snapshot.js +30 -23
  64. package/herdr/mods/gentle-chat/ui.js +7 -1
  65. package/herdr/mods/gentle-inspector/main.js +2 -0
  66. package/herdr/mods/gentle-inspector/snapshot.js +30 -23
  67. package/herdr/mods/gentle-palette/main.js +1 -1
  68. package/herdr/mods/gentle-palette/snapshot.js +30 -23
  69. package/herdr/mods/gentle-pane/snapshot.js +30 -23
  70. package/herdr/mods/gentle-sidebar/snapshot.js +30 -23
  71. package/herdr/mods/gentle-spaces/snapshot.js +30 -23
  72. package/herdr/mods/gentle-status/snapshot.js +30 -23
  73. package/herdr/mods/gentle-tabs/main.js +3 -2
  74. package/herdr/mods/gentle-tabs/new-tab.js +9 -0
  75. package/herdr/mods/gentle-tabs/snapshot.js +30 -23
  76. package/herdr/mods/gentle-tokens/snapshot.js +30 -23
  77. package/lib/agent-profiles.ts +50 -10
  78. package/lib/agents-config.ts +69 -5
  79. package/lib/agents-runner.ts +34 -1
  80. package/lib/auto-permission-runtime.ts +2 -1
  81. package/lib/background-jobs-tools.ts +24 -16
  82. package/lib/banner-config.ts +69 -0
  83. package/lib/child-session.ts +6 -0
  84. package/lib/claude-bridge-config.ts +41 -0
  85. package/lib/codex-turn-continuation.ts +40 -0
  86. package/lib/compaction-threshold.ts +46 -0
  87. package/lib/context-threshold.ts +5 -5
  88. package/lib/desktop-agent-definitions-service.ts +93 -0
  89. package/lib/desktop-auth-service.ts +102 -0
  90. package/lib/desktop-background-subagents-service.ts +155 -0
  91. package/lib/desktop-command-rpc.ts +71 -0
  92. package/lib/desktop-feed-sources.ts +44 -1
  93. package/lib/desktop-feed.ts +41 -29
  94. package/lib/desktop-rpc-agent-definitions.ts +119 -0
  95. package/lib/desktop-rpc-agents.ts +44 -3
  96. package/lib/desktop-rpc-auth.ts +103 -0
  97. package/lib/desktop-rpc-background-subagents.ts +126 -0
  98. package/lib/desktop-rpc-changes.ts +13 -4
  99. package/lib/desktop-rpc-config.ts +287 -13
  100. package/lib/desktop-rpc-profile-binding.ts +212 -0
  101. package/lib/desktop-rpc-profiles.ts +2 -0
  102. package/lib/desktop-rpc-stats.ts +16 -4
  103. package/lib/desktop-rpc-status.ts +103 -0
  104. package/lib/desktop-status-service.ts +86 -0
  105. package/lib/destructive-command-guard.ts +9 -185
  106. package/lib/exploration-budget.ts +3 -7
  107. package/lib/gentle-design.ts +23 -4
  108. package/lib/gentle-shell-desktop.ts +85 -0
  109. package/lib/gentle-shell-launcher.ts +120 -8
  110. package/lib/mcp-config.ts +214 -0
  111. package/lib/native-choice-list.ts +1 -1
  112. package/lib/native-fullscreen-interaction.ts +3 -0
  113. package/lib/native-pointer-region.ts +1 -1
  114. package/lib/native-review-cli.ts +213 -397
  115. package/lib/odd-phase-inference.ts +1 -1
  116. package/lib/orchestrator-mode-policy.ts +25 -12
  117. package/lib/path-consent-fence.ts +113 -0
  118. package/lib/persona-config.ts +77 -0
  119. package/lib/pi-settings.ts +157 -0
  120. package/lib/questionnaire/questionnaire-view.ts +1 -1
  121. package/lib/review-continuation-registry.ts +9 -26
  122. package/lib/review-coordinator.ts +13 -2
  123. package/lib/review-host-relay.ts +2 -35
  124. package/lib/review-integration-v2.ts +129 -180
  125. package/lib/review-object-store.ts +0 -57
  126. package/lib/review-repository.ts +0 -44
  127. package/lib/review-risk-assessment.ts +11 -36
  128. package/lib/review-start-context.ts +2 -1
  129. package/lib/review-transaction.ts +6 -6
  130. package/lib/sensitive-paths.ts +45 -0
  131. package/lib/session-profile-binding.ts +29 -0
  132. package/lib/session-profile-freeze.ts +11 -4
  133. package/lib/session-worktree-registry.ts +11 -5
  134. package/lib/shell-bar.ts +41 -18
  135. package/lib/shell-card.ts +27 -1
  136. package/lib/shell-changes-view.ts +6 -2
  137. package/lib/shell-changes.ts +94 -37
  138. package/lib/shell-git-worker.ts +158 -0
  139. package/lib/shell-idle-changes.ts +88 -0
  140. package/lib/shell-untracked-cache.ts +142 -0
  141. package/lib/shell-untracked-lines.ts +178 -0
  142. package/lib/stats-collector.ts +24 -0
  143. package/lib/tower-open.ts +8 -1
  144. package/lib/tps-policy.ts +85 -0
  145. package/lib/vim-editor-adapter.ts +9 -2
  146. package/lib/voice-artifacts.ts +8 -1
  147. package/lib/voice-install.ts +7 -3
  148. package/lib/yolo-session-policy.ts +2 -2
  149. package/package.json +1 -1
  150. package/runtime/gentle-shell-desktop.mjs +85 -0
  151. package/runtime/gentle-shell-launcher.mjs +120 -8
  152. package/runtime/native-review-cli.mjs +206 -390
  153. package/runtime/review-integration-v2.mjs +129 -180
  154. package/runtime/review-risk-assessment.mjs +11 -36
  155. package/runtime/sensitive-paths.mjs +46 -0
  156. package/runtime/tower-open.mjs +8 -1
  157. package/scripts/build-runtime-modules.mjs +2 -0
  158. package/scripts/gentle-ai-installer.mjs +13 -14
  159. package/scripts/installer-preflight.mjs +1 -1
  160. package/scripts/main-channel.mjs +47 -11
  161. package/scripts/pi-update.mjs +10 -4
  162. package/scripts/prepare-verifier.mjs +14 -4
  163. package/scripts/verify-package-files.mjs +45 -13
  164. package/skills/judgment-day/SKILL.md +1 -1
  165. package/skills/judgment-day/references/prompts-and-formats.md +1 -1
  166. package/skills/provider-defect-report/SKILL.md +1 -1
  167. package/skills/rdd-defect-workflow/SKILL.md +2 -2
  168. package/skills/skill-creator/SKILL.md +4 -4
  169. package/skills/skill-improver/SKILL.md +4 -4
  170. package/skills/skill-registry/SKILL.md +2 -2
  171. package/tests/agent-profiles-workflow.test.ts +102 -0
  172. package/tests/agent-risk-escalation.test.ts +15 -0
  173. package/tests/agents-config.test.ts +22 -2
  174. package/tests/agents-protocol.test.ts +1 -1
  175. package/tests/agents-runner.test.ts +94 -2
  176. package/tests/append-system-prompt-route.test.ts +16 -11
  177. package/tests/ask-user-choice.test.ts +19 -0
  178. package/tests/ask-user-question.test.ts +23 -4
  179. package/tests/auto-permission-runtime.test.ts +4 -4
  180. package/tests/bounded-stop-contract.test.ts +50 -62
  181. package/tests/built-web-guard.test.ts +32 -0
  182. package/tests/child-context-files.test.ts +6 -6
  183. package/tests/child-ui-extensions.test.ts +125 -0
  184. package/tests/child-web-package.test.ts +1 -1
  185. package/tests/codex-turn-continuation.test.ts +183 -0
  186. package/tests/committed-range-untracked-exclusion.test.ts +18 -0
  187. package/tests/controlled-engineering-editor.test.ts +192 -0
  188. package/tests/controlled-engineering-launch.test.ts +136 -0
  189. package/tests/controlled-engineering.test.ts +244 -0
  190. package/tests/delegate-for-reason-contract.test.ts +1 -1
  191. package/tests/delivery-b-rendered-surfaces.test.ts +1 -1
  192. package/tests/delivery-conflict-markers.test.ts +2 -3
  193. package/tests/desktop-feed-tool-summaries.test.ts +1 -1
  194. package/tests/desktop-feed-transcript.test.ts +17 -0
  195. package/tests/desktop-feed.test.ts +141 -7
  196. package/tests/desktop-liveness.test.ts +125 -0
  197. package/tests/desktop-persona.test.ts +17 -0
  198. package/tests/desktop-rpc-agent-definitions.test.ts +219 -0
  199. package/tests/desktop-rpc-agents.test.ts +113 -3
  200. package/tests/desktop-rpc-auth.test.ts +278 -0
  201. package/tests/desktop-rpc-background-subagents.test.ts +186 -0
  202. package/tests/desktop-rpc-changes.test.ts +81 -4
  203. package/tests/desktop-rpc-config-mcp-fidelity.test.ts +106 -0
  204. package/tests/desktop-rpc-config-readonly-stores.test.ts +458 -0
  205. package/tests/desktop-rpc-config-settings.test.ts +234 -0
  206. package/tests/desktop-rpc-config.test.ts +17 -3
  207. package/tests/desktop-rpc-design.test.ts +30 -1
  208. package/tests/desktop-rpc-jobs.test.ts +9 -1
  209. package/tests/desktop-rpc-permissions.test.ts +9 -1
  210. package/tests/desktop-rpc-profile-binding.test.ts +195 -0
  211. package/tests/desktop-rpc-review.test.ts +1 -1
  212. package/tests/desktop-rpc-session-snapshot-commands.test.ts +50 -0
  213. package/tests/desktop-rpc-session.test.ts +2 -2
  214. package/tests/desktop-rpc-stats.test.ts +42 -11
  215. package/tests/desktop-rpc-status.test.ts +195 -0
  216. package/tests/desktop-rpc-updates.test.ts +1 -1
  217. package/tests/desktop-rpc-usage.test.ts +9 -1
  218. package/tests/desktop-rpc.test.ts +2 -2
  219. package/tests/desktop-session-switch.test.ts +237 -0
  220. package/tests/desktop-target-session.test.ts +104 -0
  221. package/tests/destructive-command-guard.test.ts +187 -0
  222. package/tests/devbinary/pi-host-relay.devtest.ts +73 -9
  223. package/tests/exploration-budget.test.ts +2 -26
  224. package/tests/fixtures/primary-session-prompt/gentleman.golden.md +15 -11
  225. package/tests/full-delegation-closure.test.ts +19 -9
  226. package/tests/generic-agent-tools.test.ts +3 -3
  227. package/tests/gentle-agents.test.ts +215 -10
  228. package/tests/gentle-ai-binary.test.ts +3 -3
  229. package/tests/gentle-ai-exploration-budget.test.ts +3 -2
  230. package/tests/gentle-ai-installer.test.ts +60 -59
  231. package/tests/gentle-ai.test.ts +30 -59
  232. package/tests/gentle-chat-read-failure.test.ts +74 -0
  233. package/tests/gentle-chat-session-read.test.ts +127 -0
  234. package/tests/gentle-design.test.ts +39 -0
  235. package/tests/gentle-notifications.test.ts +43 -5
  236. package/tests/gentle-shell-desktop.test.ts +108 -0
  237. package/tests/gentle-shell-launcher-auto-provision.test.ts +152 -0
  238. package/tests/gentle-shell-launcher-machine-output.test.ts +356 -0
  239. package/tests/gentle-shell-launcher-tower.test.ts +7 -1
  240. package/tests/gentle-shell.test.ts +163 -15
  241. package/tests/gentle-tps.test.ts +57 -0
  242. package/tests/independent-recovery-delivery.test.ts +15 -13
  243. package/tests/installer-preflight.test.ts +3 -2
  244. package/tests/installer-server.test.ts +3 -2
  245. package/tests/installer-windows-bootstrap.test.ts +6 -0
  246. package/tests/job-turn-end-texts.test.ts +57 -0
  247. package/tests/judgment-day-dispatch-diagnostics.test.ts +87 -0
  248. package/tests/lazy-module-contradictions-contract.test.ts +2 -3
  249. package/tests/main-channel-upgrade.test.ts +14 -7
  250. package/tests/main-channel.test.ts +78 -23
  251. package/tests/maintainer/desktop-rpc.maintest.ts +4 -4
  252. package/tests/native-fullscreen-interaction.test.ts +37 -1
  253. package/tests/native-review-capability-contract.test.ts +13 -1
  254. package/tests/native-review-cli-nonblocking-findings.test.ts +9 -84
  255. package/tests/native-review-cli.test.ts +199 -21
  256. package/tests/native-review-consent.test.ts +20 -3
  257. package/tests/native-review-start-escalation-real-binary.test.ts +42 -0
  258. package/tests/no-self-pause-contract.test.ts +8 -7
  259. package/tests/odd-phase-inference.test.ts +2 -2
  260. package/tests/odd-routing-canonical-ratchet.test.ts +1 -1
  261. package/tests/odd-routing-contract.test.ts +2 -2
  262. package/tests/orchestrator-budget.test.ts +7 -2
  263. package/tests/orchestrator-prompt-diet-contract.test.ts +5 -5
  264. package/tests/orchestrator-skills-inline-contract.test.ts +26 -0
  265. package/tests/package-manifest.test.ts +11 -16
  266. package/tests/packaged-agent-codemode.test.ts +79 -0
  267. package/tests/path-consent-fence.test.ts +326 -0
  268. package/tests/persona-config.test.ts +42 -0
  269. package/tests/pi-update-launcher.test.ts +1 -1
  270. package/tests/pi-update-source.test.ts +48 -2
  271. package/tests/primary-session-prompt.test.ts +9 -7
  272. package/tests/profile-fast-tier.test.ts +79 -4
  273. package/tests/progress-rule-contract.test.ts +54 -0
  274. package/tests/rdd-delivery-warning.test.ts +109 -0
  275. package/tests/review-actor-tool-deny.test.ts +1 -2
  276. package/tests/review-agent-end-preflight.test.ts +3 -1
  277. package/tests/review-assess-escalation-forwarding.test.ts +99 -0
  278. package/tests/review-authority-recovery-docs.test.ts +9 -12
  279. package/tests/review-continuation-registry.test.ts +24 -25
  280. package/tests/review-controller-native-recovery.test.ts +165 -178
  281. package/tests/review-controller-native-routing.test.ts +352 -27
  282. package/tests/review-coordinator-correction-gate.test.ts +5 -9
  283. package/tests/review-coordinator-runtime.test.ts +3 -2
  284. package/tests/review-coordinator.test.ts +14 -0
  285. package/tests/review-due-compaction.test.ts +1 -1
  286. package/tests/review-failure-facts.test.ts +2 -2
  287. package/tests/review-host-relay-restart-parity.test.ts +2 -52
  288. package/tests/review-host-relay-routing.test.ts +59 -298
  289. package/tests/review-host-relay.test.ts +0 -46
  290. package/tests/review-integration-nonblocking-findings.test.ts +3 -6
  291. package/tests/review-integration-v2-forward.test.ts +114 -234
  292. package/tests/review-integration-v2.test.ts +85 -39
  293. package/tests/review-json-arguments.test.ts +30 -9
  294. package/tests/review-legacy-check.test.ts +38 -0
  295. package/tests/review-object-store.test.ts +2 -57
  296. package/tests/review-one-call-findings.test.ts +1 -0
  297. package/tests/review-one-call.test.ts +56 -0
  298. package/tests/review-risk-assessment.test.ts +14 -43
  299. package/tests/review-run-escalate-forwarding.test.ts +59 -0
  300. package/tests/review-sidebar-state.test.ts +2 -1
  301. package/tests/review-untracked-inventory-replay.test.ts +181 -0
  302. package/tests/runtime-harness.mjs +30 -4
  303. package/tests/sensitive-path-tools.test.ts +210 -5
  304. package/tests/session-profile-binding-observers.test.ts +47 -0
  305. package/tests/session-profile-extension.test.ts +109 -11
  306. package/tests/session-profile-freeze.test.ts +49 -2
  307. package/tests/session-profile-v1-compat.test.ts +11 -3
  308. package/tests/session-worktree-registry.test.ts +23 -0
  309. package/tests/shell-bar.test.ts +21 -3
  310. package/tests/shell-changes-idle-start.test.ts +510 -0
  311. package/tests/shell-changes-untracked-bound.test.ts +230 -0
  312. package/tests/shell-changes-view.test.ts +8 -2
  313. package/tests/shell-changes.test.ts +134 -0
  314. package/tests/shell-git-runner-stall.test.ts +74 -0
  315. package/tests/shell-git-worker-fallback.test.ts +140 -0
  316. package/tests/shell-git-worker-lifetime.test.ts +91 -0
  317. package/tests/shell-render-cache-runtime.test.ts +256 -3
  318. package/tests/shell-sidebar-layout.test.ts +1 -1
  319. package/tests/shell-sidebar-scroll-benchmark.test.ts +14 -5
  320. package/tests/shell-untracked-cache.test.ts +213 -0
  321. package/tests/short-check-routing-contract.test.ts +11 -7
  322. package/tests/skill-references.test.ts +39 -0
  323. package/tests/skill-registry.test.ts +4 -4
  324. package/tests/startup-banner.test.ts +2 -1
  325. package/tests/status-timing-diagnostics.test.ts +2 -1
  326. package/tests/support/capabilities-v26.ts +22 -0
  327. package/tests/support/chat-ui.ts +39 -0
  328. package/tests/support/review-coordinator-runtime.ts +11 -2
  329. package/tests/support/status-v9.ts +8 -0
  330. package/tests/t7-recovery-preservation.test.ts +68 -0
  331. package/tests/tower-open.test.ts +24 -0
  332. package/tests/tower-pack.test.ts +48 -0
  333. package/tests/tps-policy.test.ts +96 -0
  334. package/tests/turn-end-rule-contract.test.ts +155 -0
  335. package/tests/turn-end-scope.test.ts +39 -0
  336. package/tests/verification-proportionality.test.ts +1 -1
  337. package/tests/verification-scoped-stop-contract.test.ts +1 -1
  338. package/tests/verification-tiers-contract.test.ts +4 -3
  339. package/tests/verifier-admission.test.ts +1 -1
  340. package/tests/verifier-preparation.test.ts +94 -1
  341. package/tests/verifier-settle-reminder.test.ts +1 -1
  342. package/tests/verify-first-launch-contract.test.ts +19 -7
  343. package/tests/vim-editor-adapter.test.ts +12 -2
  344. package/tests/voice-install.test.ts +97 -11
  345. package/tests/windows-hidden-processes.test.ts +11 -44
  346. package/tests/work-continuity-contract.test.ts +48 -55
  347. package/tests/yolo-session-policy.test.ts +2 -0
  348. package/web/tower/dist/assets/BatchableSprite-BJ_TQxjN.js +217 -0
  349. package/web/tower/dist/assets/BufferResource-DeJpHuO6.js +139 -0
  350. package/web/tower/dist/assets/CanvasPool-cwc03T_x.js +23 -0
  351. package/web/tower/dist/assets/CanvasRenderer-DO84oP5R.js +1 -0
  352. package/web/tower/dist/assets/Filter-BKhT9lO8.js +1 -0
  353. package/web/tower/dist/assets/GlUniformGroupSystem-DluI7cqd.js +130 -0
  354. package/web/tower/dist/assets/GpuUboSystem-CM4Dys0F.js +17 -0
  355. package/web/tower/dist/assets/Graphics-3OyUtCzC.js +1 -0
  356. package/web/tower/dist/assets/RenderTargetSystem-X-9GAQ1C.js +184 -0
  357. package/web/tower/dist/assets/WebGLRenderer-I0fqIX1w.js +20 -0
  358. package/web/tower/dist/assets/WebGPURenderer-BRWSXotK.js +79 -0
  359. package/web/tower/dist/assets/_commonjsHelpers-CqkleIqs.js +1 -0
  360. package/web/tower/dist/assets/abnfDiagram-VCTEODGH-C4iBBhTL.js +1 -0
  361. package/web/tower/dist/assets/architectureDiagram-5GKGNRK7-Ih-qvfTu.js +36 -0
  362. package/web/tower/dist/assets/blockDiagram-I7D4REHJ-I9z_u3wb.js +129 -0
  363. package/web/tower/dist/assets/browserAll-gmBFNIA4.js +14 -0
  364. package/web/tower/dist/assets/c4Diagram-7LVT6UL2-DOyk2rEJ.js +38 -0
  365. package/web/tower/dist/assets/canvasUtils-DTaMcbkN.js +1 -0
  366. package/web/tower/dist/assets/channel-wuxBkGGz.js +1 -0
  367. package/web/tower/dist/assets/chunk-2Q5K7J3B-BaJ-OrJ_.js +1 -0
  368. package/web/tower/dist/assets/chunk-5VM5RSS4-wICrhvyw.js +15 -0
  369. package/web/tower/dist/assets/chunk-F27PBJKO-DUQ_JqvZ.js +1 -0
  370. package/web/tower/dist/assets/chunk-IMKFNOWR-DKfgQrGM.js +231 -0
  371. package/web/tower/dist/assets/chunk-JWPE2WC7-1k1LW87d.js +1 -0
  372. package/web/tower/dist/assets/chunk-POPQ4Y6H-Df8cN2w9.js +1 -0
  373. package/web/tower/dist/assets/chunk-SVP7TREG-CxU5LDj8.js +88 -0
  374. package/web/tower/dist/assets/chunk-TICWLB2K-CEuHEBi0.js +206 -0
  375. package/web/tower/dist/assets/chunk-XXDRQBXY-CbSAjj9l.js +1 -0
  376. package/web/tower/dist/assets/classDiagram-ZZMXUADV-DbRmVQRX.js +1 -0
  377. package/web/tower/dist/assets/classDiagram-v2-VYDZK3BY-DbRmVQRX.js +1 -0
  378. package/web/tower/dist/assets/cose-bilkent-JH36ORCC-8xZLSHER.js +1 -0
  379. package/web/tower/dist/assets/cynefin-OW5HDTMX-Cw4XG9Zj.js +166 -0
  380. package/web/tower/dist/assets/cynefinDiagram-5FMLGOSQ-CcQdokUv.js +62 -0
  381. package/web/tower/dist/assets/cytoscape.esm-BHa1VTXv.js +321 -0
  382. package/web/tower/dist/assets/d3-scale-4DPf7zan.js +1 -0
  383. package/web/tower/dist/assets/dagre-GXQ25YYZ-D-Xv7L9X.js +4 -0
  384. package/web/tower/dist/assets/diagram-S7CK7UJ4-Bqy2eT2c.js +30 -0
  385. package/web/tower/dist/assets/diagram-UQ7AKVKN-B2wK2GHj.js +41 -0
  386. package/web/tower/dist/assets/diagram-VSXAHHWV-CIZqh7BH.js +3 -0
  387. package/web/tower/dist/assets/diagram-VX7I27RA-BGX4HBj2.js +24 -0
  388. package/web/tower/dist/assets/diagram-Z3DM3KII-DYpsfaJW.js +24 -0
  389. package/web/tower/dist/assets/ebnfDiagram-PWID7BFC-BNnwCZNv.js +1 -0
  390. package/web/tower/dist/assets/erDiagram-RLTQ6QDP-_MN9W-1E.js +99 -0
  391. package/web/tower/dist/assets/flowDiagram-HODETNUW-D_ndx1UC.js +168 -0
  392. package/web/tower/dist/assets/ganttDiagram-EL5Y4UJY-C8chdEiZ.js +292 -0
  393. package/web/tower/dist/assets/getPo2TextureFromSource-CqJsdi0J.js +1 -0
  394. package/web/tower/dist/assets/getTexelRangeRects-DN3N5aFp.js +57 -0
  395. package/web/tower/dist/assets/getTextureBatchBindGroup-RNSiAVH3.js +1 -0
  396. package/web/tower/dist/assets/gitGraphDiagram-WWUBYQGX-B5ijv7LI.js +106 -0
  397. package/web/tower/dist/assets/index-B1Ho-Igs.css +1 -0
  398. package/web/tower/dist/assets/index-CfNjH1Wr.js +45 -0
  399. package/web/tower/dist/assets/infoDiagram-27XIBGKW-AYbp5ElT.js +2 -0
  400. package/web/tower/dist/assets/ishikawaDiagram-5VMMS53U-DnmwARuR.js +70 -0
  401. package/web/tower/dist/assets/journeyDiagram-3NMN7TZE-CK737kko.js +139 -0
  402. package/web/tower/dist/assets/kanban-definition-UXKFOSKX-0AhM3axC.js +89 -0
  403. package/web/tower/dist/assets/katex-HP8lGamR.js +257 -0
  404. package/web/tower/dist/assets/layout-wOIeK9c_.js +1 -0
  405. package/web/tower/dist/assets/mermaid.core-CGYyw6G7.js +310 -0
  406. package/web/tower/dist/assets/mindmap-definition-YA3MSWOX-CkZ_JOdx.js +96 -0
  407. package/web/tower/dist/assets/pegDiagram-XKGWAZYB-CHAPspih.js +1 -0
  408. package/web/tower/dist/assets/pieDiagram-E7YTZNPT-LwCcZl5o.js +39 -0
  409. package/web/tower/dist/assets/preload-helper-PPVm8Dsz.js +1 -0
  410. package/web/tower/dist/assets/quadrantDiagram-AXDQQJYC-Cm4uijV2.js +7 -0
  411. package/web/tower/dist/assets/railroadDiagram-O6MQD6OU-BPQHZ2b5.js +1 -0
  412. package/web/tower/dist/assets/requirementDiagram-BXWQKSXE-JLtSUDfS.js +84 -0
  413. package/web/tower/dist/assets/sankeyDiagram-P5KCCOFB-DJsYv9ii.js +40 -0
  414. package/web/tower/dist/assets/sequenceDiagram-WJ2MYXX4-Ca8T8sT0.js +162 -0
  415. package/web/tower/dist/assets/sizeCapture-INFHLROL-Ch4i2dS-.js +1 -0
  416. package/web/tower/dist/assets/stateDiagram-D77RDMKH-DDSkncYm.js +1 -0
  417. package/web/tower/dist/assets/stateDiagram-v2-MP3YSRHH-BkO_9mIH.js +1 -0
  418. package/web/tower/dist/assets/swimlanes-42K2YHIH-Bns5iI3y.js +1 -0
  419. package/web/tower/dist/assets/swimlanesDiagram-VR7AAH4N--LEBb1ti.js +8 -0
  420. package/web/tower/dist/assets/timeline-definition-24CTP7MA-QJDuVTb3.js +120 -0
  421. package/web/tower/dist/assets/vennDiagram-4TSXK5OY-pBNxKxOV.js +34 -0
  422. package/web/tower/dist/assets/wardleyDiagram-VM6X3IG4-1PEarjN1.js +78 -0
  423. package/web/tower/dist/assets/webworkerAll-D_Np003p.js +83 -0
  424. package/web/tower/dist/assets/xychartDiagram-S5SC5T6Z-CLwsvOg7.js +7 -0
  425. package/web/tower/dist/index.html +41 -0
  426. package/contracts/review-provider-contract-mirror/v1.6.0/bundle/vectors/lens.json +0 -1
  427. package/docs/review-delivery-preflight.md +0 -22
  428. package/extensions/codegraph-tools.ts +0 -437
  429. package/lib/native-review-authority-quarantine.ts +0 -2
  430. package/lib/review-delivery-preflight.ts +0 -85
  431. package/lib/review-legacy-detector.ts +0 -81
  432. package/tests/child-codegraph-bootstrap.test.ts +0 -74
  433. package/tests/codegraph-tools.test.ts +0 -554
  434. package/tests/fixtures/devbinary/capabilities-v2.1.derived.json +0 -331
  435. package/tests/fixtures/refusal-identity.probe.mjs +0 -139
  436. package/tests/native-review-authority-quarantine.test.ts +0 -10
  437. package/tests/native-review-refusal-identity.test.ts +0 -25
  438. package/tests/review-delivery-preflight.test.ts +0 -462
  439. /package/contracts/review-provider-contract-mirror/{v1.6.0 → v1.7.0}/bundle/README.md +0 -0
  440. /package/contracts/review-provider-contract-mirror/{v1.6.0 → v1.7.0}/bundle/schemas/refuter.schema.json +0 -0
  441. /package/contracts/review-provider-contract-mirror/{v1.6.0 → v1.7.0}/bundle/schemas/targeted-validator.schema.json +0 -0
  442. /package/contracts/review-provider-contract-mirror/{v1.6.0 → v1.7.0}/bundle/vectors/refuter.json +0 -0
  443. /package/contracts/review-provider-contract-mirror/{v1.6.0 → v1.7.0}/bundle/vectors/targeted-validator.json +0 -0
@@ -12,6 +12,8 @@ GENTLE_SHELL_INTERACTIVE_HOST=1 pi --mode rpc
12
12
 
13
13
  The channel is inactive in the TUI and in headless RPC children. It does not register an agent-callable tool.
14
14
 
15
+ A Desktop that shows the design canvas itself also sets `GENTLE_DESIGN_OPEN_BROWSER=0`, so `gentle_design {action: "open"}` never launches the system browser. The canvas still starts, the `open` transition still reaches the `design_canvas` event, and the tool answers `opened: false, browserDisabled: true` with the URL.
16
+
15
17
  ## Transport
16
18
 
17
19
  Desktop sends an ordinary Pi `prompt` command. Its `message` contains `/gentle:desktop` followed by one JSON request:
@@ -62,12 +64,12 @@ Returns the currently implemented contract; clients must not infer support from
62
64
  "schema": "gentle-shell.desktop-rpc/v1",
63
65
  "command": "gentle:desktop",
64
66
  "widget": "gentle-desktop-rpc",
65
- "methods": ["capabilities", "get_snapshot", "get_config", "set_config", "get_permission_mode", "set_permission_mode", "get_subscription_usage", "refresh_subscription_usage", "get_design_canvas", "list_jobs", "cancel_job", "get_job_output", "apply_profile", "list_subagents", "cancel_subagent", "get_subagent_thread", "list_sessions", "switch_session", "get_changes", "get_change_diff", "get_review_mode", "set_review_mode", "get_usage_stats", "get_update_status"],
66
- "events": ["config_changed", "permission_mode_changed", "rate_limit", "design_canvas", "jobs_update", "profile_applied", "agents_update", "review_mode_changed", "session_snapshot"]
67
+ "methods": ["capabilities", "get_snapshot", "get_config", "set_config", "get_permission_mode", "set_permission_mode", "get_subscription_usage", "refresh_subscription_usage", "get_design_canvas", "list_jobs", "cancel_job", "get_job_output", "apply_profile", "list_subagents", "cancel_subagent", "get_subagent_thread", "list_sessions", "switch_session", "get_changes", "get_change_diff", "get_review_mode", "set_review_mode", "get_usage_stats", "get_update_status", "list_agent_definitions", "get_status", "get_background_subagents", "set_background_subagents", "get_profile_binding", "clear_profile_binding", "get_auth_status", "reload_credentials"],
68
+ "events": ["config_changed", "permission_mode_changed", "rate_limit", "design_canvas", "jobs_update", "profile_applied", "agents_update", "review_mode_changed", "profile_binding_changed", "session_snapshot"]
67
69
  }
68
70
  ```
69
71
 
70
- The permission methods, the bounded config read and write, the subscription-usage read and refresh, the design-canvas read, the background-jobs list, cancel, and output read, the profile apply, the subagents list, cancel, and thread read, the review-mode read and change, the cross-session usage-stats read, the update-status read, and the `config_changed`, `permission_mode_changed`, `rate_limit`, `design_canvas`, `jobs_update`, `profile_applied`, `agents_update`, and `review_mode_changed` events are advertised because this extension wires them. `set_config` and `config_changed` are advertised only because the config bridge actually implements that writer — advertising is not a forward-looking wish list. The design slice advertises exactly its one read method and its one transition event, not the canvas `open`/`stop` actions, which stay the `gentle_design` tool's job. The jobs slice advertises exactly its list, cancel, and output-read methods and its one registry-change event, not the `bash_background`/`monitor` start tools, which stay agent tools. The profiles slice advertises exactly its one apply method and its one applied event; profile edits stay `set_config`. The subagents slice advertises exactly its list, cancel, and thread-read methods and its one transition event, not the agent dispatch tools, which stay agent tools. `session_snapshot` is the one entry that depends on the session: it is listed only while the feed owner seam (`extensions/gentle-desktop-feed.ts`) is wired for this session, and absent otherwise; the `get_snapshot` method itself is always listed. The review slice advertises exactly its read and change methods and its one change event; review start, skip, and consent stay terminal-only. The stats slice advertises exactly its one read method and no event: usage stats are an explicit read. The updates slice advertises exactly its one read method and no event; running an update stays the launcher's job. Method availability is not a claim that every dependency is loaded — see [Permission limits](#permission-limits), [Configuration limits](#configuration-limits), [Usage limits](#usage-limits), [Design limits](#design-limits), [Jobs limits](#jobs-limits), [Profiles limits](#profiles-limits), [Subagents limits](#subagents-limits), [Review limits](#review-limits), [Stats limits](#stats-limits), and [Updates limits](#updates-limits).
72
+ The permission methods, the bounded config read and write, the subscription-usage read and refresh, the design-canvas read, the background-jobs list, cancel, and output read, the profile apply, the subagents list, cancel, and thread read, the review-mode read and change, the cross-session usage-stats read, the update-status read, and the `config_changed`, `permission_mode_changed`, `rate_limit`, `design_canvas`, `jobs_update`, `profile_applied`, `agents_update`, and `review_mode_changed` events are advertised because this extension wires them. `set_config` and `config_changed` are advertised only because the config bridge actually implements that writer — advertising is not a forward-looking wish list. The design slice advertises exactly its one read method and its one transition event, not the canvas `open`/`stop` actions, which stay the `gentle_design` tool's job. The jobs slice advertises exactly its list, cancel, and output-read methods and its one registry-change event, not the `bash_background`/`monitor` start tools, which stay agent tools. The profiles slice advertises exactly its one apply method and its one applied event; profile edits stay `set_config`. The subagents slice advertises exactly its list, cancel, and thread-read methods and its one transition event, not the agent dispatch tools, which stay agent tools. `session_snapshot` is the one entry that depends on the session: it is listed only while the feed owner seam (`extensions/gentle-desktop-feed.ts`) is wired for this session, and absent otherwise; the `get_snapshot` method itself is always listed. The review slice advertises exactly its read and change methods and its one change event; review start, skip, and consent stay terminal-only. The stats slice advertises exactly its one read method and no event: usage stats are an explicit read. The updates slice advertises exactly its one read method and no event; running an update stays the launcher's job. The agent-definitions slice advertises exactly its one read method and no event; editing definitions stays a file edit. The package-status slice advertises exactly its one read method and no event; `/gentle:doctor` stays terminal-only. The background-subagents slice advertises exactly its read and change methods and no event; every answer carries the state. Method availability is not a claim that every dependency is loaded — see [Permission limits](#permission-limits), [Configuration limits](#configuration-limits), [Usage limits](#usage-limits), [Design limits](#design-limits), [Jobs limits](#jobs-limits), [Profiles limits](#profiles-limits), [Subagents limits](#subagents-limits), [Review limits](#review-limits), [Stats limits](#stats-limits), [Updates limits](#updates-limits), [Agent definitions limits](#agent-definitions-limits), [Status limits](#status-limits), and [Background subagents limits](#background-subagents-limits).
71
73
 
72
74
  ### `get_snapshot`
73
75
 
@@ -85,14 +87,20 @@ Returns the current event sequence and a bounded state projection:
85
87
  { "store": "profile_fallbacks", "scope": "global", "readOnly": false, "status": "missing", "revision": "sha256:3c11…" },
86
88
  { "store": "subagents", "scope": "global+project", "readOnly": true, "status": "ok", "revision": "sha256:77be…" },
87
89
  { "store": "pins", "scope": "local+repo", "readOnly": false, "status": "ok", "revision": "sha256:0d19…" },
88
- { "store": "managed_assets", "scope": "global", "readOnly": true, "status": "ok", "revision": "sha256:be05…" }
90
+ { "store": "managed_assets", "scope": "global", "readOnly": true, "status": "ok", "revision": "sha256:be05…" },
91
+ { "store": "persona", "scope": "global+project", "readOnly": false, "status": "ok", "revision": "sha256:41aa…" },
92
+ { "store": "banner", "scope": "global", "readOnly": false, "status": "missing", "revision": "sha256:9c02…" },
93
+ { "store": "notifications", "scope": "global", "readOnly": false, "status": "ok", "revision": "sha256:d317…" },
94
+ { "store": "mcp", "scope": "global+project", "readOnly": true, "status": "ok", "revision": "sha256:5e21…" },
95
+ { "store": "pi_settings", "scope": "global+project", "readOnly": true, "status": "ok", "revision": "sha256:a8c4…" },
96
+ { "store": "claude_bridge", "scope": "global", "readOnly": true, "status": "missing", "revision": "sha256:07fd…" }
89
97
  ]
90
98
  }
91
99
  }
92
100
  }
93
101
  ```
94
102
 
95
- The projection carries only store identity, scope, mutability, status, and revision — never store content, never a path. It is the cheap way for a client to notice that one of the six revisions moved and then call `get_config` for that store. `state` is `{}` when no Desktop command has bound a session context yet, or when that context has no working directory: without one, the project and pin layers cannot be read truthfully, so nothing is projected instead of a guess.
103
+ The projection carries only store identity, scope, mutability, status, and revision — never store content, never a path. It is the cheap way for a client to notice that one of the twelve revisions moved and then call `get_config` for that store. `state` is `{}` when no Desktop command has bound a session context yet, or when that context has no working directory: without one, the project and pin layers cannot be read truthfully, so nothing is projected instead of a guess.
96
104
 
97
105
  This snapshot does not project permission state: use `get_permission_mode` for that. `sequence` is the number of delivered events, so a client that saw `seq: 4` expects `sequence: 4` from a fresh snapshot unless it missed an event.
98
106
 
@@ -133,6 +141,8 @@ Without a `sections` key the request is the legacy read above, byte-for-byte (ot
133
141
 
134
142
  Each section is the feed's own shape (see `DesktopFeedSnapshot` in `lib/desktop-feed.ts`) with two path-free changes: `project` is `{ "name", "branch", "dirty" }`, where `name` is the basename of the working directory (`null` for a filesystem root such as `/` or a drive root such as `C:\`), and in `changes` every worktree `root` is an opaque, stable label (`root-` plus 12 hex characters) while every file carries a `path` relative to its worktree plus that worktree's `root` label (`null`, with the bare file name, for a path no worktree holds). Windows-style roots (a drive letter or backslashes) match their files case- and separator-insensitively; POSIX roots match case-sensitively. A worktree whose root is `/` or a bare drive gets `root: null` and never relativizes a path: its files cross as bare file names with `root: null`. A section the session has nothing for is `null`, as in the feed (`changes` before the first scan, `review` before a review, `pendingQuestion` with no open question). When the feed is not running for this session (the extension is not loaded, the process is not Gentle Shell, or the session is not live) the answer is `session_unavailable`; `get_snapshot` without `sections` is unaffected. A read never emits an event.
135
143
 
144
+ The `commands` section lists `items[]` of `{ "name", "description", "args", "terminal", "rpc", "source" }` and `truncated`, the same 200-item bound as the feed. `terminal` keeps its Herdr meaning: the command answers with a screen of the TUI, so a client that types it into the TUI shows the Terminal afterwards; it is unchanged by `rpc`. `rpc` is `true` when the command works from an RPC client: for an extension command, Gentle Shell declares it in `lib/desktop-command-rpc.ts` after reading its handler, because it answers only through what Pi's RPC mode forwards (select, confirm, input, editor dialogs and notifications) or through messages and side effects, never `ctx.ui.custom`, an overlay, a TUI component, raw keys, or a refusal outside the TUI; for a built-in, Pi's RPC protocol has a matching command (`new_session`, `fork`, `clone`, `compact`, `set_session_name`, `export_html`, `get_session_stats`, `get_last_assistant_text`, `set_model`, `set_thinking_level`), since typing a built-in into Pi's `prompt` does not run it; prompt templates and skills are always `true`, because Pi's `prompt` expands them. Any extension command Gentle Shell does not declare, including every third-party one, is `false`. `rpc` is advisory, for an RPC client that sends the command through Pi's own `prompt`: this channel's `send_prompt` still answers `terminal_command` for every extension command and built-in, whatever `rpc` says.
145
+
136
146
  ### `get_config`
137
147
 
138
148
  Reads one existing configuration store through the owner that already reads it. Desktop names a store identifier, never a path: the request accepts exactly one param.
@@ -148,7 +158,7 @@ Reads one existing configuration store through the owner that already reads it.
148
158
 
149
159
  | Param | Required | Type | Meaning |
150
160
  | --- | --- | --- | --- |
151
- | `store` | yes | one of the six store identifiers below | The store to read. |
161
+ | `store` | yes | one of the twelve store identifiers below | The store to read. |
152
162
 
153
163
  Any other key — including `scope`, `path`, `file`, or `physical_path` — is rejected as `invalid_request`. A string that is not a known store identifier is rejected as `unknown_store`. Neither case reads anything.
154
164
 
@@ -160,6 +170,12 @@ Any other key — including `scope`, `path`, `file`, or `physical_path` — is r
160
170
  | `subagents` | `parseAgentsConfig` over `<agentHome>/subagents.json` + `<cwd>/.pi/subagents.json` | `global+project` | `true` | Normalized `AgentsConfig` the runtime would launch with. A layer that cannot be parsed is skipped and the remaining layer still merges, exactly like the runtime reader. |
161
171
  | `pins` | `readProfilePinStatus` + `evaluateProfilePin` over the local pin and the repo declaration | `local+repo` | `false` | `resolved`, the winning layer and profile, plus the `invalid` and `stale` layers. Writable per layer — see [`set_config`](#set_config). |
162
172
  | `managed_assets` | `readManagedAssetsManifestResult` over `<agentHome>/gentle-ai/managed-assets.json` | `global` | `true` | The installer's ownership manifest (`schemaVersion`, `assets`), filtered to ownership-shaped entries: relative asset paths below the agent home and 64-hex sha256 digests. Anything else is omitted, never echoed. |
173
+ | `persona` | `readPersonaLayer` + `resolvePersonaMode` over `<configHome>/persona.json` + `<cwd>/.pi/gentle-ai/persona.json` | `global+project` | `false` | `{ mode }`: the persona in effect, the project layer winning. |
174
+ | `banner` | `readBannerConfigSync` over `<configHome>/banner.json` | `global` | `false` | `{ showRose, showTextLogo, color }`. |
175
+ | `notifications` | `parseNotificationSettingsFile` over `<configHome>/notifications.json` | `global` | `false` | The validated settings without `schema`, every `file:` sound replaced by `"file"`. |
176
+ | `mcp` | `readMcpConfig` (mirrors Pi's `loadMcpConfig`) over `<agentHome>/mcp.json` + `<cwd>/.pi/mcp.json` (project file only for a trusted project) | `global+project` | `true` | `{ servers: [{ name, transport, enabled }], truncated, omitted }`, `transport` being `stdio` or `http`: at most 64 servers, in Pi's load order; `truncated` reports the cut at 64 and `omitted` counts servers left out because their name is longer than 128 characters. No `command`, `args`, `env`, `cwd`, `url`, `headers`, `oauth`, or `auth` value. |
177
+ | `pi_settings` | `readPiSettings` through Pi's `SettingsManager` over `<agentHome>/settings.json` + `<cwd>/.pi/settings.json` (project file only for a trusted project) | `global+project` | `true` | Display settings only: `{ defaultProvider, defaultModel, defaultThinkingLevel, enabledModels, extensions, truncated }`, `extensions` being names. Packages (see `get_update_status`), the theme, and `sessionDir` are not part of it. |
178
+ | `claude_bridge` | `readClaudeBridgeConfig` over `<agentHome>/claude-bridge.json` | `global` | `true` | `{ plan }` from `provider.plan` in the config file of `pi-claude-bridge`, a third-party Pi package some users already have. `missing` when the file is absent. |
163
179
 
164
180
  Success:
165
181
 
@@ -191,7 +207,7 @@ Success:
191
207
  | --- | --- |
192
208
  | `store` | The store identifier that was read. |
193
209
  | `scope` | Which owner layers this store is assembled from: `global`, `global+project`, or `local+repo`. |
194
- | `readOnly` | `false` for the three authoritative stores (`profiles`, `profile_fallbacks`, `pins`); `true` for the three derived or installer-owned stores (`models`, `subagents`, `managed_assets`). |
210
+ | `readOnly` | `false` for the six writable stores (`profiles`, `profile_fallbacks`, `pins`, `persona`, `banner`, `notifications`); `true` for the three derived or installer-owned stores (`models`, `subagents`, `managed_assets`) and the three display stores (`mcp`, `pi_settings`, `claude_bridge`). |
195
211
  | `status` | `ok` (normalized content follows), `missing` (no layer produced content because no layer file exists), or `invalid` (layers exist but none of them produced content). See [Layer semantics](#layer-semantics). |
196
212
  | `revision` | Opaque read-time digest of the canonical normalized content. See [Revision limits](#revision-limits). |
197
213
  | `value` | Normalized owner content, present when the store produced one. Absent when a layer is missing or invalid. |
@@ -202,7 +218,14 @@ Success:
202
218
 
203
219
  `status` answers for the store; `layers` answers for each file it is assembled from. For a merged store the two are different questions:
204
220
 
205
- - `profiles`, `profile_fallbacks`, and `managed_assets` have one layer, so `status` is that layer's status.
221
+ - `profiles`, `profile_fallbacks`, `managed_assets`, `banner`, `notifications`, and `claude_bridge` have one layer, so `status` is that layer's status.
222
+ - `mcp` and `pi_settings` follow Pi's project trust: Pi reads the project `mcp.json` and `settings.json` only when the session trusts the project, so these stores list a `project` layer only then. For an untrusted project (or a host that cannot say) `layers` holds the `global` layer alone and `value` ignores the project file. A file that is not JSON (or, for `mcp`, not an object with an `mcpServers` object) is an `invalid` layer and the other layer still merges. Pi does not announce a trust change to extensions, so a change made during the session is noticed when the next Desktop command binds the session: `mcp` and `pi_settings` are re-read then, and each whose revision moved is announced as an external `config_changed`. Until a command arrives nothing is pushed, so a client should re-read these stores (or send any command) after the user trusts or distrusts the project.
223
+ - `mcp` lists the servers Pi's MCP loader would produce from those files: a project entry replaces the global entry of the same name, a project entry without `command`, `url`, or `type` only overrides `enabled` (and exposure) of an existing global server, and an entry Pi would reject is left out while the rest of the file still loads. `transport` is the one Pi connects with: `http` whenever the entry has a `url` key (even with `type: "stdio"` and a `command`), otherwise `stdio`; `enabled` is `false` only when the file says so. Pi's loader is not part of its package exports, so `lib/mcp-config.ts` mirrors that resolution and its per-entry checks (OAuth and `auth` included), and a test compares it with Pi's own loader. Servers an extension registers at runtime are not listed.
224
+ - `pi_settings` is Pi's own merged view (global, then the trusted project file on top, with Pi's migrations), read without taking Pi's settings lock and never written back. `defaultProvider` is shown only as one plain token. `defaultModel` and each `enabledModels` entry are shown only in Pi's `--models` shape: a bare model id or `provider/modelId` (the id may hold more `/`, as in `openrouter/anthropic/claude-3.5-sonnet`), with wildcards and an optional `:thinking` suffix; every `/`-separated segment starts with a letter or digit. Any other value is `null` (or left out of `enabledModels`): a value with both `@` and `:` (`user:secret@host`), a backslash, an absolute path (`/home/...`) or a `./` / `../` path, a URL, control text, or more than 128 characters. `defaultThinkingLevel` is one of Pi's levels or `null`; `enabledModels` is `null` when no layer restricts models. An extension is named by its last path segment, and only when that segment is a plain file or package name (letters, digits, `.`, `_`, `+`, `-`; at most 128 characters); an entry that is a URL, or whose name is longer, credential-shaped, or holds control text, is left out. Each list keeps at most 64 entries and `truncated` reports a cut. When Pi's own getters cannot read a merged value, `value` is absent, every layer whose file exists reads `invalid`, and an absent file still reads `missing`.
225
+ - `claude_bridge` reads `claude-bridge.json` in the Pi agent dir, the config file of the third-party `pi-claude-bridge` package. Gentle Shell does not install or write it; the store only lets a client show the plan a user already chose. `value` is `{ "plan": <string> | null }`: the plan when `provider.plan` is a short plain token (letters, digits, `.`, `_`, `-`; at most 32 characters), otherwise `null`. No other key crosses. The installed package version is not reported: Pi's package listing can run `npm root -g` synchronously, which a revision recompute must not do.
226
+ - `persona` has a `global` layer (`persona.json` in the Gentle config home) and a `project` layer (`<cwd>/.pi/gentle-ai/persona.json`); `value` is `{ "mode": "gentleman" | "neutral" }`, the mode in effect (the project layer wins), exactly as the prompt build resolves it.
227
+ - `banner` is `{ showRose, showTextLogo, color }` from `banner.json`. A file without those three valid settings is `invalid` and is never repaired by a read; extra keys are ignored, as the `/gentle:banner` editor ignores them, and a Desktop write keeps only the three settings.
228
+ - `notifications` is the owner's validated `notifications.json` without its `schema` key. Every `file:` sound is replaced by the marker `"file"`, so no sound path crosses the wire.
206
229
  - `subagents` mirrors the runtime reader: a layer that cannot be parsed is skipped and the remaining layer still merges. `status` is `ok` as soon as one layer is usable, and `layers` still names the broken one.
207
230
  - `models` keeps the owner's merge rule, which rejects the saved routing when a layer it reads is malformed; there `status` is `invalid` even if the other layer is fine.
208
231
  - `missing` means every layer file is absent. `invalid` means layer files exist but none produced content; in that case the owner would fall back to its own defaults, which are not the content of this store, so no `value` is returned.
@@ -282,13 +305,18 @@ Reads have no side effect. A `get_config` request never creates, rewrites, repai
282
305
 
283
306
  #### Write targets
284
307
 
285
- A write target is one file, not one store. `get_config` reports it only for a writable store, and `set_config` requires the revision of the exact target it is about to replace:
308
+ A write target is one file, not one store, with one exception: `persona`'s `global` target. `get_config` reports targets only for a writable store, and `set_config` requires the revision of the exact target it is about to replace:
286
309
 
287
310
  | `store` | `target` values | File |
288
311
  | --- | --- | --- |
289
312
  | `profiles` | `global` | `<configHome>/profiles.json` |
290
313
  | `profile_fallbacks` | `global` | `<configHome>/profile-fallbacks.json` |
291
314
  | `pins` | `local`, `repo` | `<git-common-dir>/gentle-ai/profile-pin.json`, `<worktree-root>/.pi/gentle-ai/profile.json` |
315
+ | `persona` | `global` | `<configHome>/persona.json`, plus `<cwd>/.pi/gentle-ai/persona.json` when it already exists |
316
+ | `banner` | `global` | `<configHome>/banner.json` |
317
+ | `notifications` | `global` | `<configHome>/notifications.json` |
318
+
319
+ `persona`'s `global` target covers both persona files, because the owner rewrites the project file too when it exists: its `writeRevision` digests both layers (so a project edit makes a token stale even while the global file is missing), and its `value` is `{ global, project }` layer states rather than one file. Each file is replaced atomically, but the two-file write is not a transaction: a failure after the global file is written can leave the project file unchanged, and the answer reports the layers as they are.
292
320
 
293
321
  `writeRevision` is the digest of that one target's state: `sha256` over canonical JSON of `{store, target, status, value}`. When the target reads `ok`, `value` is the owner-normalized file content (for a pin layer, the profile name it holds), so any content change moves the digest. When the target reads `missing` or `invalid`, `value` is absent and the digest covers **only `{store, target, status}`** — the owner produced no content to hash, and this contract does not hash raw bytes. Two consequences follow, and they are limits rather than incidents:
294
322
 
@@ -336,7 +364,7 @@ Writes one existing, owner-maintained store. Desktop names a store and, for `pin
336
364
  | `data` | yes | store-specific object (below) | The **complete** new content of that store, not a patch. |
337
365
  | `expectedRevision` | yes | string | `writeTargets[].writeRevision` of the target as the client last read it. |
338
366
 
339
- Exactly these three keys are accepted. Any other key — including `scope`, `path`, `file`, or `physical_path` — is rejected as `invalid_request` before anything is read or written. An unknown store string is `unknown_store`. A write to `models`, `subagents`, or `managed_assets` is `read_only`, rejected before its `data` is inspected, because the reason the write cannot happen is the store, not the payload.
367
+ Exactly these three keys are accepted. Any other key — including `scope`, `path`, `file`, or `physical_path` — is rejected as `invalid_request` before anything is read or written. An unknown store string is `unknown_store`. A write to `models`, `subagents`, `managed_assets`, `mcp`, `pi_settings`, or `claude_bridge` is `read_only`, rejected before its `data` is inspected, because the reason the write cannot happen is the store, not the payload.
340
368
 
341
369
  #### `data` for `profiles`
342
370
 
@@ -412,8 +440,8 @@ A layer whose file currently reads `invalid` is likewise a valid target for a se
412
440
  The checks below run in this order, and the first one that fails answers the request. Nothing is read or written after a rejection.
413
441
 
414
442
  1. **Envelope** (`invalid_request`): exactly the keys `store`, `data`, and `expectedRevision`; `store` must be a string; `data` must be present. A request missing `data` is malformed whatever store or revision it names, so this check comes before the store rules — a `models` write without `data` is `invalid_request`, not `read_only`. Store contents are not looked at here.
415
- 2. **Store identity** (`unknown_store`): the string must be one of the six store identifiers.
416
- 3. **Mutability** (`read_only`): `models`, `subagents`, and `managed_assets` are rejected before their `data` is inspected or their revision is compared, so any payload gets the same answer.
443
+ 2. **Store identity** (`unknown_store`): the string must be one of the twelve store identifiers.
444
+ 3. **Mutability** (`read_only`): `models`, `subagents`, `managed_assets`, `mcp`, `pi_settings`, and `claude_bridge` are rejected before their `data` is inspected or their revision is compared, so any payload gets the same answer.
417
445
  4. **Usable revision** (`revision_conflict`): `expectedRevision` must be a non-empty string. Absent, empty, and non-string tokens are all "the client did not prove it saw the current state", and this is decided before the payload is validated.
418
446
  5. **Session roots** (`config_unavailable`): the bound session must have a working directory.
419
447
  6. **Payload** (`invalid_data`): `data` is validated by the owner's own normalizer (`normalizeProfilesFile`, `normalizeFallbacksFile`, the pin name and store rules). A value the owner would reject is `invalid_data`. So is any value the owner's normalizer would **rewrite or silently drop** — an illegal profile or agent name, a stale `active` marker, an unknown workflow mode, an empty fallback chain, the `effort` alias, an organic workflow entry, an unknown routing member. A write is applied complete or not at all, so a client can never delete or silently reshape content by sending it: send exactly the canonical form `get_config` returned. For `pins`, `profile` must be a defined profile name or the literal `null`; a missing, empty, non-string, or unknown `profile`, an extra `data` key, and a `source` other than `local`/`repo` are all `invalid_data`, and a pin request outside a resolvable Git worktree is `config_unavailable`.
@@ -877,6 +905,8 @@ Each entry carries only the whitelisted fields of the owner's `TaskRecord`:
877
905
  | `fallbackFrom` | The model the run moved away from, present only after a fallback switch. |
878
906
  | `thinking` | The thinking level the helper ran at, present only when one was resolved. |
879
907
  | `lastStep` | A closed phase label derived from the task status, never the raw owner step text: `queued`, `waiting`, `running`, a fixed safe active step (`starting`, `writing`, `cleaning up`, `generating tool arguments`, `question dismissed`, `answered`, `interrupted`), or the generic terminal reason (`completed`, `failed`, `cancelled`, `timed_out`). Raw `TaskRecord.lastStep` text can carry an error message, a stderr tail, or a provider body, so it is mapped into this closed vocabulary and never forwarded. |
908
+ | `turns`, `toolCalls` | Progress inside the run: turns finished and tool calls started so far. Absent only from an owner that predates them. |
909
+ | `activeTool` | The name of the tool running right now, only while the task is active and only when the name is a plain identifier (`[A-Za-z0-9_.:-]`, at most 64). Its arguments and output never cross; read them with `get_subagent_thread`. |
880
910
  | `usage` | The helper's accumulated usage: `total` tokens, `cost`, and — once the run settled — the final-assistant `input`, `output`, `cache` (read + write), and `reasoning` token breakdown. The breakdown fields are absent for an in-flight task whose breakdown is not recorded yet, and for a restored finished task whose run never recorded one. |
881
911
 
882
912
  No prompt text, tool arguments or output, working directory, session path, result, error text, or full session internals ever cross the wire in a list entry; tool arguments, tool output, and thread text are only readable, bounded, through [`get_subagent_thread`](#get_subagent_thread). The list is bounded: active tasks first (recency order), then recently-finished tasks (newest end first), capped at 50 entries, so the answer can never grow with the process lifetime. When the agents owner is absent (the owning extension is not loaded), the answer is `agents_unavailable` — never a fabricated empty list.
@@ -991,12 +1021,13 @@ Success:
991
1021
  { "model": "claude-opus-5-5", "messages": 2, "tokens": 1365, "cost": 0.51, "share": 0.512 },
992
1022
  { "model": "gpt-5.5", "messages": 2, "tokens": 1300, "cost": 1.25, "share": 0.488 }
993
1023
  ],
994
- "byDay": [{ "day": "2026-09-20", "tokens": 1000 }, { "day": "2026-10-08", "tokens": 300 }, { "day": "2026-10-09", "tokens": 1365 }],
1024
+ "byDay": [{ "day": "2026-09-20", "tokens": 1000, "cost": 1 }, { "day": "2026-10-08", "tokens": 300, "cost": 0.25 }, { "day": "2026-10-09", "tokens": 1365, "cost": 0.51 }],
1025
+ "byProvider": [{ "provider": "anthropic", "messages": 4, "tokens": 2665, "cost": 1.76, "share": 1 }],
995
1026
  "byProject": [
996
1027
  { "name": "alpha", "sessions": 2, "messages": 3, "tokens": 2365, "cost": 1.51 },
997
1028
  { "name": "beta", "sessions": 1, "messages": 1, "tokens": 300, "cost": 0.25 }
998
1029
  ],
999
- "truncated": { "byModel": false, "byDay": false, "byProject": false }
1030
+ "truncated": { "byModel": false, "byDay": false, "byProvider": false, "byProject": false }
1000
1031
  }
1001
1032
  }
1002
1033
  ```
@@ -1005,11 +1036,12 @@ Success:
1005
1036
  | --- | --- |
1006
1037
  | `totals` | Sessions with at least one assistant usage record in range, those records (`messages`), their token counts, `totalTokens` (each record's own total, or the sum of its parts when it has none), and `cost` in the provider's currency units. Totals always cover the whole range, even when an array below is truncated. |
1007
1038
  | `byModel` | One row per model id, largest `tokens` first; `share` is the model's fraction of `totals.totalTokens`. At most 50 rows. |
1008
- | `byDay` | Tokens per local calendar day (`YYYY-MM-DD`) with any usage, oldest first. At most 400 rows: the most recent days are kept. |
1039
+ | `byDay` | Tokens and cost per local calendar day (`YYYY-MM-DD`) with any usage, oldest first. At most 400 rows: the most recent days are kept. |
1040
+ | `byProvider` | One row per provider id (as Pi records it on each assistant message, `unknown` when missing), largest `tokens` first; `share` is the provider's fraction of `totals.totalTokens`. At most 50 rows. |
1009
1041
  | `byProject` | Present only for `scope: "all"`. One row per working directory, shown by its display name (the last path segment, never the path), largest `tokens` first. Two directories with the same last segment stay two rows. At most 50 rows. |
1010
1042
  | `truncated` | `true` for each array that had more rows than its bound. `byProject` appears only with `byProject`. |
1011
1043
 
1012
- Model ids and project names longer than 128 characters are cut. No session id, path, provider, prompt, or message text ever crosses the wire. The panel's other figures (streaks, most active day, longest session) are not part of this answer. When no sessions root can be read, or the stats owner is not loaded, the answer is `stats_unavailable` — never a fabricated zero.
1044
+ Model ids, provider ids, and project names longer than 128 characters are cut. No session id, path, prompt, or message text ever crosses the wire. The panel's other figures (streaks, most active day, longest session) are not part of this answer. When no sessions root can be read, or the stats owner is not loaded, the answer is `stats_unavailable` — never a fabricated zero.
1013
1045
 
1014
1046
  ### `apply_profile`
1015
1047
 
@@ -1378,6 +1410,191 @@ Success:
1378
1410
 
1379
1411
  No absolute path, raw package source, registry URL, token, command line, or lookup output crosses the wire. A failed lookup is reported as `unknown`, never by its message. Running an update is out of scope: the client shows the command, and the launcher runs it. `updates_unavailable` answers only when the session is not bound or was replaced during the read, or a source fails unexpectedly.
1380
1412
 
1413
+ ### `list_agent_definitions`
1414
+
1415
+ Lists the agent definitions `/gentle:profiles` can route, the subagent defaults, and Pi's default orchestrator, so a client can build its profile routing table from this answer alone. It reads the same roots `/gentle:profiles` lists, fresh on every call, lowest precedence first: the agents bundled with the package (the installed `pi-subagents` agent folders), `<agent home>/agents`, `<agent home>/subagents`, `~/.agents`, `<cwd>/.agents`, `<cwd>/.pi/agents`, and `<cwd>/.pi/subagents` (a later folder wins a name clash, so a project definition replaces a global one, and a user one replaces a built-in one). Only the `.md` files directly inside each folder are read. It also reads the global and project `subagents.json`, and the three orchestrator keys of Pi's `settings.json` in the agent home. Params must be an empty object; any key is `invalid_request`, and a malformed request reads nothing. It has no side effects and emits no event.
1416
+
1417
+ ```json
1418
+ { "schema": "gentle-shell.desktop-rpc/v1", "requestId": "desktop-90", "method": "list_agent_definitions", "params": {} }
1419
+ ```
1420
+
1421
+ ```json
1422
+ {
1423
+ "schema": "gentle-shell.desktop-rpc/v1",
1424
+ "kind": "response",
1425
+ "requestId": "desktop-90",
1426
+ "ok": true,
1427
+ "data": {
1428
+ "agents": [
1429
+ { "name": "explore", "description": "Global explorer.", "scope": "global", "source": "user", "model": "openai-codex/gpt-5.6-terra", "thinking": "high", "mode": null, "tools": ["read", "grep"], "toolsTruncated": false },
1430
+ { "name": "worker", "description": "Project worker.", "scope": "project", "source": "project", "model": null, "thinking": null, "mode": "background", "tools": [], "toolsTruncated": false }
1431
+ ],
1432
+ "truncated": false,
1433
+ "problems": { "invalid": 1, "notices": 0 },
1434
+ "subagentDefaults": { "model": "anthropic/claude-luna", "thinking": null, "mode": "background" },
1435
+ "defaultOrchestrator": { "status": "set", "model": "openai-codex/gpt-5.6-terra", "thinking": "medium" }
1436
+ }
1437
+ }
1438
+ ```
1439
+
1440
+ | Field | Meaning |
1441
+ | --- | --- |
1442
+ | `agents` | The discovered definitions, sorted by name, at most 200. `model`, `thinking`, and `mode` are what the definition declares (`null` when it inherits); the model a launch actually uses can still come from `subagents.json` profiles or a repository profile pin. `tools` is the list after tool overlays, at most 64 names. |
1443
+ | `agents[].scope` | `global` for the built-in, agent-home, and `~/.agents` folders; `project` for the `<cwd>` folders. |
1444
+ | `agents[].source` | Where the winning definition came from: `builtin` (bundled with the package), `user` (agent home or `~/.agents`), or `project` (`<cwd>/.agents` or `<cwd>/.pi`). |
1445
+ | `truncated` | `true` when more than 200 definitions exist. |
1446
+ | `problems` | Counts of definitions that failed to parse (`invalid`) and of discovery notices such as unknown frontmatter keys or overlays naming unknown agents (`notices`). Their text names files, so only counts cross. |
1447
+ | `subagentDefaults` | `default_model`, `default_thinking`, and `default_mode` from `subagents.json` (project over global); `mode` defaults to `task`. |
1448
+ | `defaultOrchestrator.status` | `set` when Pi's `settings.json` names `defaultProvider` and `defaultModel`; `unset` when the file exists without them; `missing` when the file does not exist; `invalid` when it cannot be parsed. `model` is `provider/model` and `thinking` is `defaultThinkingLevel`, both only when `set`. |
1449
+
1450
+ No file path, prompt body, or problem text crosses the wire. `agent_definitions_unavailable` answers when the session is not bound or discovery fails (for example an unreadable folder); its message never carries the failure text.
1451
+
1452
+ ### `get_status`
1453
+
1454
+ Reads the facts `/gentle:status` prints for this session's project, through the status owner in `extensions/gentle-ai.ts` (a versioned owner service, like review). Params must be an empty object; any key is `invalid_request`, and a malformed request never reaches the owner. It has no side effects and emits no event.
1455
+
1456
+ ```json
1457
+ { "schema": "gentle-shell.desktop-rpc/v1", "requestId": "desktop-95", "method": "get_status", "params": {} }
1458
+ ```
1459
+
1460
+ ```json
1461
+ {
1462
+ "schema": "gentle-shell.desktop-rpc/v1",
1463
+ "kind": "response",
1464
+ "requestId": "desktop-95",
1465
+ "ok": true,
1466
+ "data": {
1467
+ "package": "active",
1468
+ "odd": "active",
1469
+ "persona": "gentleman",
1470
+ "devBinary": { "state": "inactive", "sha256Prefix": null },
1471
+ "assets": {
1472
+ "delegation": { "stale": 0, "userOverrides": 1, "activeAgentOverrides": 0 },
1473
+ "review": { "stale": 0, "userOverrides": 0, "activeAgentOverrides": 0 }
1474
+ },
1475
+ "modelConfig": { "global": "present", "routing": "valid" },
1476
+ "severity": "info"
1477
+ }
1478
+ }
1479
+ ```
1480
+
1481
+ | Field | Meaning |
1482
+ | --- | --- |
1483
+ | `persona` | The persona in effect: the project `persona.json` wins over the global one; `gentleman` by default. |
1484
+ | `devBinary` | The `gentle-ai` dev-binary override: `inactive`, `active` (with the first 16 hex characters of its SHA-256), or `invalid` (declared but unusable). The binary is never run, so no version is reported; `/gentle:status` shows it. |
1485
+ | `assets.<owner>.stale` | Managed `delegation` or `review` assets missing from the agent home or different from the packaged copy. `/gentle:install-<owner> --force` refreshes them. |
1486
+ | `assets.<owner>.userOverrides` | Installed files the user replaced; preserved, not drift. |
1487
+ | `assets.<owner>.activeAgentOverrides` | Active non-builtin agents that shadow package agents of that owner. |
1488
+ | `modelConfig.global` | Whether the global `models.json` exists. |
1489
+ | `modelConfig.routing` | The saved model routing: `missing`, `invalid`, or `valid`. Per-agent routing is read with `get_config` (`models`). |
1490
+ | `severity` | `warning` exactly when `/gentle:status` warns: invalid routing, an active or invalid dev binary, stale assets, or active agent overrides. |
1491
+
1492
+ No path, command hint, or display text crosses the wire. `status_unavailable` answers when the session is not bound or was replaced during the read, no owner answers (for example inside a subagent process), or the owner's answer fails validation or throws; its message never carries the failure text.
1493
+
1494
+ ### `get_background_subagents`
1495
+
1496
+ Reads the background-subagents policy the way `/gentle:background-subagents status` resolves it for this session's project: the project file `.pi/gentle-ai/background-subagents.json`, then the machine-wide file in the Gentle config home, then `GENTLE_PI_BACKGROUND_SUBAGENTS`, then the default `off`. Params must be an empty object. It has no side effects and emits no event.
1497
+
1498
+ ```json
1499
+ {
1500
+ "schema": "gentle-shell.desktop-rpc/v1",
1501
+ "kind": "response",
1502
+ "requestId": "desktop-96",
1503
+ "ok": true,
1504
+ "data": { "effective": "off", "source": "default", "malformed": false, "projectFile": "absent", "globalFile": "absent", "capability": "ready" }
1505
+ }
1506
+ ```
1507
+
1508
+ | Field | Meaning |
1509
+ | --- | --- |
1510
+ | `effective` | `on` or `off`: whether background subagents may be launched. |
1511
+ | `source` | What decided it: `project`, `global`, `environment`, or `default`. |
1512
+ | `malformed` | The deciding file exists but is not a valid policy file; the policy is then `off` (fail closed). |
1513
+ | `projectFile`, `globalFile` | `present` or `absent`. No path crosses the wire. |
1514
+ | `capability` | `ready` when this session can launch background subagents at all, `absent` otherwise. Read-time only. |
1515
+
1516
+ ### `set_background_subagents`
1517
+
1518
+ Writes the machine-wide policy, exactly as `/gentle:background-subagents enable|disable` does. The policy is a user-owned switch, so a change takes two calls, like `set_review_mode`.
1519
+
1520
+ | Param | Required | Type | Meaning |
1521
+ | --- | --- | --- | --- |
1522
+ | `policy` | yes | `on` \| `off` | The machine-wide policy to write. |
1523
+ | `confirmationToken` | no | string (1-128) | The token from the confirmation answer. |
1524
+
1525
+ Any other key, including a `scope`, is `invalid_request`: only the machine-wide file is written, never a project file. Without a matching token the answer is `{ "status": "confirmation_required", "policy", "state", "confirmation": { "title", "message", "token" } }` and nothing is written. The message says when this project's file decides instead, so the change would not apply here. The token is bound to the request, the exact text shown, and the state it describes: if the state changes before the second call, the answer asks again. A request dispatched before a session reset is refused, even if a replacement session attached meanwhile.
1526
+
1527
+ With a matching token the owner writes the file and re-reads: `{ "status": "applied", "policy", "changed", "state" }`. `state` is the re-read state (so `effective` can stay unchanged when a project file decides), and `changed` reports whether it differs from the state shown.
1528
+
1529
+ Errors: `invalid_request`; `background_subagents_busy` while another Desktop change is in progress; `background_subagents_unavailable` when no owner answers (for example inside a subagent process), the state cannot be read, the request predates a session reset, or the write did not complete (re-read the policy).
1530
+
1531
+ ### `get_profile_binding`
1532
+
1533
+ Reads which profile this session routes its subagents with, through the same rule launches, the status bar, and `/gentle:profiles` use (`resolveSessionProfile`). A binding chosen in the terminal, restored on resume, or inherited at the session's start is reported exactly as a launch would apply it. Params must be an empty object. It writes nothing and emits no event; like the status bar and the Desktop feed, the read can freeze the inherited profile of a session that has not frozen it yet, which is the same freeze its first launch would do.
1534
+
1535
+ ```json
1536
+ { "ok": true, "data": { "kind": "explicit", "profile": "fast", "origin": "session" } }
1537
+ ```
1538
+
1539
+ | Field | Meaning |
1540
+ | --- | --- |
1541
+ | `kind` | `explicit` (chosen for this session), `inherited` (the profile the session started with), `follow` (follows the shared layers live, `GENTLE_PI_PROFILE_FOLLOW`), or `live` (a child session reading the layers). |
1542
+ | `profile` | The profile name, or `null` for the routing without a profile. |
1543
+ | `origin` | `session` for an explicit choice; otherwise the layer that supplied it: `local` (the clone pin), `repo` (the repository declaration), or `global`; `null` without a profile. |
1544
+
1545
+ Errors: `invalid_request` (any param) and `profiles_unavailable` (no session id or working directory).
1546
+
1547
+ ### `clear_profile_binding`
1548
+
1549
+ Runs `/gentle:profiles clear` for this session: the session goes back to the profile it started with, or to the routing without a session profile. Params must be an empty object. It takes the profile apply slot, so it never runs during an `apply_profile`.
1550
+
1551
+ ```json
1552
+ { "ok": true, "data": { "status": "cleared", "changed": true, "binding": { "kind": "inherited", "profile": null, "origin": null } } }
1553
+ ```
1554
+
1555
+ `status` is `not_cleared` whenever the owner warned (for example an unreadable session record or unavailable profile authority), even if the binding moved; otherwise `cleared` when the binding store changed and `unchanged` when there was nothing to clear. The owner's notices are not forwarded. A binding written elsewhere while the clear runs is folded into the one `desktop` event. When the clear ends `busy` or fails, a binding written elsewhere while it ran is published afterwards as one `external` event. `binding` is the state after the call, and `changed` says whether it differs from before. A change also emits `profile_binding_changed` with `source: "desktop"`, after the response. Errors: `invalid_request`, `profile_apply_busy` while an apply runs, and `profiles_unavailable` when no owner answers or the owner predates this method.
1556
+
1557
+ Publishing a profile to the repository is not a separate method: it is the repository pin, written with `set_config` on `pins` with `{ "source": "repo", "profile": "<name>" }` (and `profile: null` to unpublish).
1558
+
1559
+ ### `get_auth_status`
1560
+
1561
+ Lists the providers this session knows models for, and whether each has credentials and of which kind. It reads Pi's model registry (`ctx.modelRegistry`) from memory: no file is read and no credential value is ever touched. Params must be an empty object. It has no side effects and emits no event.
1562
+
1563
+ ```json
1564
+ {
1565
+ "schema": "gentle-shell.desktop-rpc/v1",
1566
+ "kind": "response",
1567
+ "requestId": "desktop-97",
1568
+ "ok": true,
1569
+ "data": {
1570
+ "providers": [
1571
+ { "provider": "anthropic", "displayName": "Anthropic", "configured": true, "type": "oauth", "source": "stored" },
1572
+ { "provider": "openai-codex", "displayName": "OpenAI Codex", "configured": false, "type": null, "source": null }
1573
+ ],
1574
+ "truncated": false
1575
+ }
1576
+ }
1577
+ ```
1578
+
1579
+ | Field | Meaning |
1580
+ | --- | --- |
1581
+ | `provider` | Pi's provider id; sorted, at most 200. Ids that are not plain names are skipped. |
1582
+ | `configured` | Pi has credentials it can use for this provider. |
1583
+ | `type` | `oauth` (a sign-in) or `api_key` when configured, otherwise `null`. |
1584
+ | `source` | Where Pi found them: `stored` (Pi's credential store), `runtime`, `environment`, `models_json` (a key or a command in `models.json`; which one is not said), or `extension` (a provider extension's fallback). `null` when not configured. |
1585
+
1586
+ The registry's status label (an environment variable name or a command) never crosses, nor any value. Errors: `invalid_request` (any param), and `auth_unavailable` (no registry in this session, or the registry read failed).
1587
+
1588
+ ### `reload_credentials`
1589
+
1590
+ Makes this session pick up credentials added or removed elsewhere (another terminal's `/login`, the desktop app's own sign-in). Environment variables are read from the process environment at each lookup, so editing an environment file does not reach a running session without restarting. It calls `modelRegistry.refresh({ allowNetwork: false })`, which rebuilds which providers are configured and which models are available; no model catalog is fetched. Params must be an empty object. Concurrent calls share one refresh.
1591
+
1592
+ ```json
1593
+ { "ok": true, "data": { "reloaded": true, "aborted": false, "failedProviders": [], "providers": [ /* as get_auth_status */ ], "truncated": false } }
1594
+ ```
1595
+
1596
+ `failedProviders` lists the ids whose refresh reported an error; the error text never crosses. Errors: `invalid_request`, `auth_unavailable` (no registry in this session, or the session was replaced during the reload), and `reload_failed` (the refresh itself failed).
1597
+
1381
1598
  ## Responses
1382
1599
 
1383
1600
  Success:
@@ -1407,13 +1624,13 @@ Failure:
1407
1624
  }
1408
1625
  ```
1409
1626
 
1410
- Current error codes are `invalid_request`, `unknown_store`, `read_only`, `invalid_data`, `revision_conflict`, `write_failed`, `unsupported_method`, `permission_unavailable`, `permission_denied`, `config_unavailable`, `usage_unavailable`, `design_unavailable`, `jobs_unavailable`, `agents_unavailable`, `profiles_unavailable`, `unknown_profile`, `profile_apply_busy`, `sessions_unavailable`, `session_switching`, `review_unavailable`, `review_mode_busy`, `stats_unavailable`, `not_found`, and `internal_error`. A request that cannot supply a valid correlation ID uses `requestId: null`. State/provider failures use the generic `internal_error` message rather than exposing raw paths, credentials, or provider errors. Transport failures from `setWidget` are never retried as a second response.
1627
+ Current error codes are `invalid_request`, `unknown_store`, `read_only`, `invalid_data`, `revision_conflict`, `write_failed`, `unsupported_method`, `permission_unavailable`, `permission_denied`, `config_unavailable`, `usage_unavailable`, `design_unavailable`, `jobs_unavailable`, `agents_unavailable`, `changes_unavailable`, `profiles_unavailable`, `unknown_profile`, `profile_apply_busy`, `sessions_unavailable`, `session_switching`, `review_unavailable`, `review_mode_busy`, `stats_unavailable`, `session_unavailable`, `updates_unavailable`, `agent_definitions_unavailable`, `status_unavailable`, `background_subagents_unavailable`, `background_subagents_busy`, `auth_unavailable`, `reload_failed`, `not_found`, and `internal_error`. A request that cannot supply a valid correlation ID uses `requestId: null`. State/provider failures use the generic `internal_error` message rather than exposing raw paths, credentials, or provider errors. Transport failures from `setWidget` are never retried as a second response.
1411
1628
 
1412
1629
  | Code | Meaning |
1413
1630
  | --- | --- |
1414
1631
  | `invalid_request` | Malformed envelope, unsupported params (including a physical path, `set_config` without `data`, or an `apply_profile` mode other than `default`/`session`), or an unknown permission mode. State unchanged. |
1415
1632
  | `unknown_store` | A store identifier this slice does not implement. Nothing was read or written. |
1416
- | `read_only` | `set_config` named `models`, `subagents`, or `managed_assets`. Rejected before the payload was inspected; nothing was written. |
1633
+ | `read_only` | `set_config` named `models`, `subagents`, `managed_assets`, `mcp`, `pi_settings`, or `claude_bridge`. Rejected before the payload was inspected; nothing was written. |
1417
1634
  | `invalid_data` | `set_config` data the owner would reject or would silently drop. Nothing was written, and no file was created. |
1418
1635
  | `revision_conflict` | `expectedRevision` was missing, unusable, or no longer current. Nothing was written. |
1419
1636
  | `write_failed` | The owner's atomic write threw. State is whatever the owner left; the message stays generic. |
@@ -1434,6 +1651,14 @@ Current error codes are `invalid_request`, `unknown_store`, `read_only`, `invali
1434
1651
  | `review_unavailable` | The review-mode owner did not answer for this session (extension not loaded, subagent child, or no Desktop command bound a session context), `gentle-ai` is not installed or does not support `review mode`, `set_review_mode` could not read the current state, or a write's outcome is unknown. The message says which; it never carries a path, CLI output, or a command line. |
1435
1652
  | `review_mode_busy` | A `set_review_mode` is still running. Nothing was written by this request. |
1436
1653
  | `stats_unavailable` | No sessions root could be read, or the stats owner did not answer for this session (the owning extension is not loaded, or the session changed). Nothing was read. |
1654
+ | `session_unavailable` | `get_snapshot` with `sections`: no Desktop command bound a session context, the feed owner did not answer for this session (the feed is not running, or the session changed), or its read failed. |
1655
+ | `updates_unavailable` | `get_update_status`: no Desktop command bound a session context, the session was replaced during the read, or a source failed unexpectedly. The message never carries the failure text. |
1656
+ | `agent_definitions_unavailable` | `list_agent_definitions`: no Desktop command bound a session context, or discovery failed (for example an unreadable folder). The message never carries the failure text. |
1657
+ | `status_unavailable` | `get_status`: no Desktop command bound a session context, the session was replaced during the read, no owner answered (for example inside a subagent process), or the owner's answer failed validation or threw. The message never carries the failure text. |
1658
+ | `background_subagents_unavailable` | `get_background_subagents` or `set_background_subagents`: no Desktop command bound a session context, no owner answered (for example inside a subagent process), the state could not be read, the request predates a session reset, or a write could not be confirmed, so the change may already have applied (re-read the policy). |
1659
+ | `background_subagents_busy` | A `set_background_subagents` is still running. Nothing was written by this request. |
1660
+ | `auth_unavailable` | `get_auth_status` or `reload_credentials`: no credential registry in this session, the registry read failed, or the session was replaced during the reload. |
1661
+ | `reload_failed` | The `reload_credentials` refresh itself failed. The error text never crosses. |
1437
1662
  | `not_found` | `cancel_job` or `get_job_output` named a job id, or `cancel_subagent` or `get_subagent_thread` named a subagent id, that does not exist, belongs to another session, or was already evicted by the store; or `switch_session` named an id that does not resolve in the requested scope; or `get_change_diff` named a root and path that are not a file in the owner's current change set. Nothing was stopped, read, or switched. |
1438
1663
  | `internal_error` | Unexpected failure; message stays generic. |
1439
1664
 
@@ -1556,7 +1781,7 @@ An external change:
1556
1781
 
1557
1782
  `store`, `scope`, `revision`, and `status` match what `get_config` and `get_snapshot` would answer for that store at that moment. There is no `value`, no `writeTarget` or `writeRevision` (an external writer may have touched any layer), and no path; read the store with `get_config` for its content and write targets.
1558
1783
 
1559
- Detection watches the owner files' directories, non-recursively, for an interactive RPC host only: the config home (`profiles.json`, `profile-fallbacks.json`, `models.json`), the agent home and its `gentle-ai/` directory (global `subagents.json`, the managed-assets manifest), the session cwd's `.pi/` and `.pi/gentle-ai/` (project `subagents.json` and `models.json`, the `repo` pin), and the Git common dir's `gentle-ai/` (the `local` pin) when the cwd is a resolvable worktree. Only events for those owner file names count. About 250 ms after the last relevant event, every store's revision is recomputed with the same readers `get_config` uses, and an event is emitted only for a store whose revision differs from the last revision this channel reported (a `get_config` answer, a `get_snapshot` projection, a `set_config` answer, or an earlier event). Consequences:
1784
+ Detection watches the owner files' directories, non-recursively, for an interactive RPC host only: the config home (`profiles.json`, `profile-fallbacks.json`, `models.json`, `persona.json`, `banner.json`, `notifications.json`), the project `.pi/gentle-ai/` directory (`persona.json`), the agent home and its `gentle-ai/` directory (global `subagents.json`, `mcp.json`, `settings.json`, `claude-bridge.json`, the managed-assets manifest), the session cwd's `.pi/` and `.pi/gentle-ai/` (project `subagents.json`, `mcp.json`, `settings.json`, and `models.json`, the `repo` pin), and the Git common dir's `gentle-ai/` (the `local` pin) when the cwd is a resolvable worktree. Only events for those owner file names count. About 250 ms after the last relevant event, every store's revision is recomputed with the same readers `get_config` uses, and an event is emitted only for a store whose revision differs from the last revision this channel reported (a `get_config` answer, a `get_snapshot` projection, a `set_config` answer, or an earlier event). Consequences:
1560
1785
 
1561
1786
  - a Desktop `set_config` is never echoed: its response records the resulting revision before the owner's own rename wakes the watcher;
1562
1787
  - reformatting a file, rewriting identical content, or undoing a change inside the window emits nothing, because the revision did not move;
@@ -1566,7 +1791,7 @@ Detection watches the owner files' directories, non-recursively, for an interact
1566
1791
 
1567
1792
  A directory that does not exist yet (for example a project without `.pi/`, or a fresh `<git-common-dir>/gentle-ai/`) is watched through its nearest existing ancestor, non-recursively and only for the creation of the next path segment. When that segment appears the ancestor watcher is closed and the next level is watched, until the owner directory itself is; each step recomputes once, so a pin that `/gentle:profiles` writes into a new directory raises exactly one event. A watched directory that is later removed reports its stores (now `missing`) and falls back to the same ancestor watching, so recreating it and writing the store again raises one event.
1568
1793
 
1569
- When a Desktop command binds a different session cwd, the watchers move with it, and the stores whose layers depend on the cwd (`models` and `subagents` project layers, and `pins`) are re-read at that moment: each one whose revision differs from the last one this channel reported is announced with `source: "external"` and becomes the new baseline, so a later unrelated change never carries stale extra events. If a change was detected but its debounce window had not closed when the cwd moved, every store is re-read instead, so that change is reported rather than dropped with the old watchers.
1794
+ When a Desktop command binds a different session cwd, the watchers move with it, and the stores whose layers depend on the cwd (`models`, `subagents`, `persona`, `mcp`, and `pi_settings` project layers, and `pins`) are re-read at that moment: each one whose revision differs from the last one this channel reported is announced with `source: "external"` and becomes the new baseline, so a later unrelated change never carries stale extra events. If a change was detected but its debounce window had not closed when the cwd moved, every store is re-read instead, so that change is reported rather than dropped with the old watchers.
1570
1795
 
1571
1796
  This is **best effort**, and `get_snapshot` revisions stay the source of truth. A path with no existing ancestor, an unsupported platform, or an exhausted watcher limit simply produces no external events for that directory; the channel keeps working and never reports an error for it. Watchers are created on `session_start` and are disposed, ancestor watchers included, on session shutdown and on session switch. A client that must not miss a change still compares `get_snapshot` revisions after connecting and after a sequence gap.
1572
1797
 
@@ -1630,7 +1855,7 @@ Carries the sanitized post-transition state of the session's design canvas whene
1630
1855
 
1631
1856
  | Field | Meaning |
1632
1857
  | --- | --- |
1633
- | `transition` | One of `open` (a canvas was shown, browser tab opened), `refresh` (an already-connected page was told to reload), or `stop` (a running server was closed). |
1858
+ | `transition` | One of `open` (a canvas was shown: a browser tab opened, or the system browser was skipped because the host set `GENTLE_DESIGN_OPEN_BROWSER=0`), `refresh` (an already-connected page was told to reload), or `stop` (a running server was closed). |
1634
1859
  | `running`, `slug`, `connectedClients` | The sanitized post-transition state, exactly as `get_design_canvas` reports it. A `stop` transition carries `running: false`, `slug: null`, `connectedClients: 0`. |
1635
1860
  | `url` | Present only for a trusted interactive Desktop client (the same trust gate as `get_design_canvas` `includeUrl`). Sanitized by default — the URL and its embedded token are never a default event field and never a bare token. A `stop` transition has no URL. |
1636
1861
 
@@ -1672,7 +1897,7 @@ Carries the active session's projected subagent list whenever the existing agent
1672
1897
  }
1673
1898
  ```
1674
1899
 
1675
- `agents` is the same whitelisted, bounded projection as `list_subagents` (`id`, `agent`, `status`, `model`, `modelSource?`, `fallbackFrom?`, `thinking?`, `lastStep`, `usage`), so a client that missed a response can reconcile from the event alone. The event is filtered to the active owner session; a foreign-session transition emits nothing to this bridge. Bursts of transitions are coalesced into one event per window and byte-identical projected lists are deduped, matching the activity publisher. A no-op or failed cancellation emits nothing: an already-terminal `cancel_subagent` changes nothing, so no event follows. When a changed `cancel_subagent` triggers the event, its response line always precedes the event line through the same router sequencer.
1900
+ `agents` is the same whitelisted, bounded projection as `list_subagents` (`id`, `agent`, `status`, `model`, `modelSource?`, `fallbackFrom?`, `thinking?`, `lastStep`, `usage`, `turns?`, `toolCalls?`, `activeTool?`), so a client that missed a response can reconcile from the event alone. The event is filtered to the active owner session; a foreign-session transition emits nothing to this bridge. Bursts of transitions are coalesced into one event per window and byte-identical projected lists are deduped, matching the activity publisher. A no-op or failed cancellation emits nothing: an already-terminal `cancel_subagent` changes nothing, so no event follows. When a changed `cancel_subagent` triggers the event, its response line always precedes the event line through the same router sequencer.
1676
1901
 
1677
1902
  ### `profile_applied`
1678
1903
 
@@ -1706,6 +1931,14 @@ Carries the session sections whose content changed since the last `session_snaps
1706
1931
 
1707
1932
  It is emitted when the feed publishes, on the feed's own tiers: within 16 ms for urgent state (an open or answered question, the permission mode, an idle/working/blocked transition, a held prompt), otherwise after a 250 ms debounce, and at most once per second while the session is busy. A flush that changes nothing emits nothing, and a section is included only when its content changed; a job's `elapsedMs`, which moves on every flush, is not a change (derive it from `startedAt`). A client that needs the whole state reads `get_snapshot` with `sections` after connecting or after a sequence gap. Advertised only while the feed seam is wired.
1708
1933
 
1934
+ ### `profile_binding_changed`
1935
+
1936
+ Emitted when this session's profile binding changes: a `clear_profile_binding` (`source: "desktop"`), or any other write to the binding store for this session (`source: "external"`): the `/gentle:profiles` screen, an `apply_profile` in session mode, or a resume restoring the record. The data is the new `get_profile_binding` answer plus `source`. Writes for other sessions and writes that leave the answer unchanged emit nothing. The event follows writes to the binding store only: in `follow` and `live` kinds the resolved profile also changes when a pin or the global active profile changes, which is not a binding write, so a client re-reads `get_profile_binding` after `config_changed` on `pins` or `profiles`, and also after its own `get_config` read of those stores (that read records the new revision, so the watcher may then emit no `config_changed` for the same external change).
1937
+
1938
+ ```json
1939
+ { "event": "profile_binding_changed", "data": { "kind": "explicit", "profile": "fast", "origin": "session", "source": "external" } }
1940
+ ```
1941
+
1709
1942
  ### `review_mode_changed`
1710
1943
 
1711
1944
  Follows a confirmed `set_review_mode` whose re-read state differs from the state the confirmation was computed from, after the response line.
@@ -1727,12 +1960,13 @@ Follows a confirmed `set_review_mode` whose re-read state differs from the state
1727
1960
 
1728
1961
  ## Configuration limits
1729
1962
 
1730
- - **One reader and one writer per store.** Each `get_config` answer and each `set_config` write comes from the module that already owns that file (`agent-profiles.ts`, `model-routing-authority.ts`, `model-fallback-store.ts`, `agents-config.ts`, `agent-profile-pin.ts`, `agent-assets.ts`). There is no second store, no cached copy, no parallel parser, no shadow precedence, and no re-implemented invariant: the merge rules are the owner's own (`readSavedModelConfig`, `parseAgentsConfig`, `evaluateProfilePin`) and the writes are the owner's validated atomic writers (`writeProfilesFileSync`, `writeFallbacksFile`, `writeProfilePinSync`).
1731
- - **Bounded write surface.** `set_config` exists only for `profiles`, `profile_fallbacks`, and `pins`, and only as a whole-store replacement, one explicitly selected pin layer, or the explicit clear of one pin layer (`profile: null`). There is no generic physical-file target, no patch operation, no setter for `models`, `subagents`, or `managed_assets`, no way to clear both layers in one request, and no profile application or materialization: a profile write stores the definition, it does not apply it, and nothing else is rewritten as a side effect.
1732
- - **Read-only rationale.** `models` and `subagents` are derived: the owners write them when a profile is applied or a route is materialized, so a Desktop write would fight that writer and leave the runtime and the store disagreeing. `managed_assets` is the installer's ownership manifest with hashes it verifies on install, so a client write would silently disable ownership checks. Only the stores whose owners accept validated writes report `readOnly: false`, and that flag describes the store's owner capability, which now matches this slice's write surface.
1963
+ - **One reader and one writer per store.** Each `get_config` answer and each `set_config` write comes from the module that already owns that file (`agent-profiles.ts`, `model-routing-authority.ts`, `model-fallback-store.ts`, `agents-config.ts`, `agent-profile-pin.ts`, `agent-assets.ts`, `persona-config.ts`, `banner-config.ts`, `notification-policy.ts`, Pi's `SettingsManager` through `pi-settings.ts`, `claude-bridge-config.ts`). The one exception is `mcp-config.ts`: Pi does not export its `mcp.json` loader, so this module is a parallel reader that re-implements Pi's resolution and per-entry validation (layering, trust gate, overrides, field and OAuth checks, and the transport Pi connects with). `tests/desktop-rpc-config-mcp-fidelity.test.ts` runs Pi's real `loadMcpConfig` and transport factory on the same fixtures and fails when the two disagree, so a Pi update that changes the rules is caught by the suite. For every other store there is no second store, no cached copy, no parallel parser, no shadow precedence, and no re-implemented invariant: the merge rules are the owner's own (`readSavedModelConfig`, `parseAgentsConfig`, `evaluateProfilePin`) and the writes are the owner's validated atomic writers (`writeProfilesFileSync`, `writeFallbacksFile`, `writeProfilePinSync`).
1964
+ - **Settings stores.** `persona` takes `{ "mode": "gentleman" | "neutral" }` and writes like `/gentle:persona`: the global file, plus the project file only when it already exists, so a project override never silently outranks the change (its `writeRevision` covers both layers, and a project file is never created). `banner` takes exactly `{ showRose, showTextLogo, color }`. `notifications` takes the settings as read: an event may keep the `"file"` marker only where its current sound is a file, which keeps that file; a new `file:` path is `invalid_data`, because the Desktop never sees one. All three write atomically, and none waits for a profile apply (`profile_apply_busy` applies only to the profile stores). Telemetry and the Pi theme are not config stores here: telemetry is a consent switch, and Pi persists its theme through an asynchronous settings queue and exports no list of installed themes to validate against.
1965
+ - **Bounded write surface.** `set_config` exists only for `profiles`, `profile_fallbacks`, `pins`, and the settings stores above, and only as a whole-store replacement, one explicitly selected pin layer, or the explicit clear of one pin layer (`profile: null`). There is no generic physical-file target, no patch operation, no setter for `models`, `subagents`, `managed_assets`, `mcp`, `pi_settings`, or `claude_bridge`, no way to clear both layers in one request, and no profile application or materialization: a profile write stores the definition, it does not apply it, and nothing else is rewritten as a side effect.
1966
+ - **Read-only rationale.** `models` and `subagents` are derived: the owners write them when a profile is applied or a route is materialized, so a Desktop write would fight that writer and leave the runtime and the store disagreeing. `managed_assets` is the installer's ownership manifest with hashes it verifies on install, so a client write would silently disable ownership checks. `mcp`, `pi_settings`, and `claude_bridge` are display projections of files Pi and a third-party package own (and `mcp.json` and `settings.json` can hold credentials this channel never returns), so they stay read-only; settings changes go through `apply_profile` and Pi's own editors. Only the stores whose owners accept validated writes report `readOnly: false`, and that flag describes the store's owner capability, which now matches this slice's write surface.
1733
1967
  - **No-op means no write.** Sending the content a store already holds, or clearing a pin layer that has no file, is answered with `changed: false`, no rewrite, no mtime churn, no removal, and no event, so a client can safely reconcile by re-sending what it read.
1734
1968
  - **Per-process guard, not a transaction.** The `expectedRevision` check and the owner's atomic rename happen in one synchronous step, so concurrent Desktop requests in one process cannot both commit from the same revision. Across processes there is no lock: another `pi` process, `/gentle:profiles`, or the installer can write between the check and the rename, and this contract cannot detect that. Treat `expectedRevision` as conflict detection, not as mutual exclusion.
1735
- - **No paths, no secrets.** Physical paths are rejected as request input and never appear in a response, an event, or an error message. Content is limited to what these stores hold: profile names, routing entries, fallback chains, pin names, layer statuses, and asset ownership keys and hashes. `managed_assets` is additionally filtered to ownership-shaped entries — a relative asset path below the agent home plus a 64-hex sha256 digest — so an absolute path, a traversal segment, or an arbitrary string in the manifest is omitted rather than echoed. No credential, token, auth file, provider error, or conversation content is read or returned.
1969
+ - **No paths, no secrets.** Physical paths are rejected as request input and never appear in a response, an event, or an error message. Content is limited to what these stores hold: profile names, routing entries, fallback chains, pin names, layer statuses, asset ownership keys and hashes, MCP server names with their transport and enabled flag, the default model and thinking level, enabled model patterns, extension names, and the bridge plan. `managed_assets` is additionally filtered to ownership-shaped entries — a relative asset path below the agent home plus a 64-hex sha256 digest — so an absolute path, a traversal segment, or an arbitrary string in the manifest is omitted rather than echoed. `mcp.json`, `settings.json`, and `claude-bridge.json` can hold env values, headers, tokens, commands, and paths: they are read to build the projection, but only the fields listed for each store are returned, and the `mcp`, `pi_settings`, and `claude_bridge` revisions digest only the returned value, so a hidden field never reaches the wire, not even as a digest. No auth file, provider error, or conversation content is read or returned.
1736
1970
  - **Truthful normalization.** Content is what the owner's normalizer produced. Entries an owner drops (an unsafe agent key, an unknown thinking level, a stale `active` marker) are absent from `value`; if everything was dropped, the store reads `ok` with an empty map rather than being reported as `invalid`. A file the owner cannot parse at all reads `invalid`. A **write** may not rely on that leniency: data the normalizer would drop is rejected as `invalid_data`, so a Desktop write can never delete content it does not understand.
1737
1971
  - **Best-effort external events.** A change made by another `pi` process, by `/gentle:profiles`, by an editor, or by the installer produces a debounced `config_changed` with `source: "external"` when the owner directory can be watched and the store's revision really moved (see [`config_changed`](#config_changed)). When a watcher cannot be created, nothing is pushed for that directory and the change becomes visible on the next read. There is no polling and no cached copy: the watcher only decides when to recompute revisions with the owner readers.
1738
1972
  - **This slice does not implement** permission changes beyond the existing slice, subscription usage beyond the read/refresh contract below, subagents beyond the list/cancel/thread-read contract below, music, profile application, store materialization, or any Gentle Desktop client change.
@@ -1787,9 +2021,9 @@ Follows a confirmed `set_review_mode` whose re-read state differs from the state
1787
2021
 
1788
2022
  - **One owner, no second store or runner.** `list_subagents`, `cancel_subagent`, and the `agents_update` event reach the existing agents owner — the single parent-session `TaskStore` plus the parent `AgentRunner` — through a defensive, versioned owner-service adapter, the agents analogue of the jobs seam. There is no second store, no second runner, no subagent spawning, and no cached copy.
1789
2023
  - **List, cancel, and thread read only.** This slice has exactly three methods, `list_subagents`, `cancel_subagent`, and `get_subagent_thread`, and one event, `agents_update`. It does not start subagents: the agent dispatch tools stay agent tools, and there is no run/start method on this channel. `cancel_subagent` is the agents panel's exact stop path — `runner.cancel` — not a second stop implementation and never a request to the model to stop itself.
1790
- - **Safe projection only.** A list or cancel entry carries exactly `id`, `agent`, `status`, `model`, `modelSource?`, `fallbackFrom?`, `thinking?`, `lastStep`, and `usage` (`total`, `cost`, and the final-assistant `input`/`output`/`cache`/`reasoning` breakdown when recorded). `lastStep` is a closed, status-derived phase label, never the raw owner step text, which can carry an error message, a stderr tail, or a provider body. No prompt text, working directory, session path, result, error text, or full session internals is ever returned or logged, and tool arguments, tool output, and thread text (including a streamed error note) appear only in a bounded `get_subagent_thread` item. A foreign field on an owner entry is dropped by the projection, never echoed.
2024
+ - **Safe projection only.** A list or cancel entry carries exactly `id`, `agent`, `status`, `model`, `modelSource?`, `fallbackFrom?`, `thinking?`, `lastStep`, `turns?`, `toolCalls?`, `activeTool?`, and `usage` (`total`, `cost`, and the final-assistant `input`/`output`/`cache`/`reasoning` breakdown when recorded). `lastStep` is a closed, status-derived phase label, never the raw owner step text, which can carry an error message, a stderr tail, or a provider body. No prompt text, working directory, session path, result, error text, or full session internals is ever returned or logged, and tool arguments, tool output, and thread text (including a streamed error note) appear only in a bounded `get_subagent_thread` item. A foreign field on an owner entry is dropped by the projection, never echoed.
1791
2025
  - **Bounded list.** `list_subagents` returns active tasks first (recency order), then recently-finished tasks (newest end first), capped at 50 entries. The store already evicts finished tasks beyond its own retention, so the answer can never grow with the process lifetime.
1792
- - **No-op and failure mean no event.** A `cancel_subagent` on an already-terminal task answers that terminal state with no event, and a `cancel_subagent` on an unknown or foreign id answers `not_found` with no event. A running task's cancel is requested but asynchronous: the response reports the still-`running` state and emits no immediate byte-identical event; only the real store transition (the child exit to `cancelled`) emits through the normal `agents_update` path. Only an actual TaskStore transition (add, status change, or the completion-time usage recording) emits `agents_update`.
2026
+ - **No-op and failure mean no event.** A `cancel_subagent` on an already-terminal task answers that terminal state with no event, and a `cancel_subagent` on an unknown or foreign id answers `not_found` with no event. A running task's cancel is requested but asynchronous: the response reports the still-`running` state and emits no immediate byte-identical event; only the real store transition (the child exit to `cancelled`) emits through the normal `agents_update` path. A TaskStore transition (add, status change, or the completion-time usage recording) emits `agents_update` at once; progress inside a running task (a turn ends, a tool starts or ends, usage grows) emits it at most once per session every 500 ms, and only when the projected list actually changed.
1793
2027
  - **Usage persists across restore.** The completion-time usage breakdown is written to the task's history record, so a restored finished task keeps its final breakdown. A task whose run never recorded a breakdown (no final-assistant observation) has no breakdown fields after restore.
1794
2028
  - **Agent work reaches the app.** The bridge subscribes to the owner eagerly at session start, so a subagent started or settled by the agent (or any other path through the owner) still arrives as an `agents_update` event. Bursts of transitions are coalesced into one event per window and byte-identical projected lists are deduped, so a settle that records usage right after its status change still emits exactly once. Session replacement or shutdown disconnects the observer, cancels the pending coalesced flush, and drops late outcomes, and the router's own publisher guard drops superseded events. A changed `cancel_subagent`'s response always precedes its event.
1795
2029
  - **Thread read is the widget's projection.** `get_subagent_thread` reuses the `gentle-agents.activity/v1` per-thread projection and bounds (`projectRpcThread`, then `boundRpcThread`, in `lib/agents-rpc-publisher.ts`): the last 40 items, 2 000 characters per text item, 500 for tool args and output, and the 256 KB halving. It is a read behind the `cancel_subagent` ownership check, emits no event, and adds no channel: it is one more read on the existing owner-service adapter. Tool args and output are the subagent's own data — whatever its tools received and printed — bounded but not redacted.
@@ -1801,7 +2035,8 @@ Follows a confirmed `set_review_mode` whose re-read state differs from the state
1801
2035
  ## Profiles limits
1802
2036
 
1803
2037
  - **One owner, no second apply.** `apply_profile` reaches the `/gentle:profiles` owner in `extensions/gentle-ai.ts` through a defensive, versioned owner-service adapter, like the usage and design seams. The owner runs the screen's own **Use in this session** and **Make default** actions with a UI that records notices and answers confirmations only with a matching token. It never opens a dialog in Pi.
1804
- - **Apply only.** This slice has one method and one event. Creating, editing, or deleting profiles stays `set_config` on the `profiles` store; pins stay `set_config` on `pins`.
2038
+ - **Apply, binding, and clear.** `apply_profile` and its `profile_applied` event, plus `get_profile_binding`, `clear_profile_binding`, and `profile_binding_changed`. Creating, editing, or deleting profiles stays `set_config` on the `profiles` store; pins, including publishing a profile to the repository, stay `set_config` on `pins`.
2039
+ - **One rule for the binding.** `get_profile_binding` and the event read `resolveSessionProfile`, the rule launches use, so they never disagree with a launch. The event follows the in-process binding store; a binding changed by another Pi process is not observed.
1805
2040
  - **Confirmation is Desktop's job.** The token binds an apply to the title and message that were shown and to the exact saved profile; it is not a proof that a person saw them.
1806
2041
  - **Truthful absence.** When the owning extension is not loaded, `apply_profile` answers `profiles_unavailable` rather than inventing an outcome.
1807
2042
 
@@ -1850,7 +2085,7 @@ Follows a confirmed `set_review_mode` whose re-read state differs from the state
1850
2085
  - **One owner, one loader, one aggregation.** `get_usage_stats` reaches the `/gentle:stats` owner in `extensions/gentle-stats.ts` through a defensive, versioned owner-service adapter, the stats analogue of the jobs seam. The owner reads the same sessions roots as the panel (the active home and the user's original Pi home) with the panel's own loader instance, so both share one size/mtime cache: an unchanged session file is never re-read. Totals, models, and days come from the panel's `aggregateStats` with the requested range and scope; each project row is that same aggregation scoped to one project. There is no second parser, cache, or store.
1851
2086
  - **Shared in-flight load.** The loader answers concurrent loads of the same roots with one in-flight scan, so overlapping Desktop requests (or a request while the panel is loading) read the history once. The scan is asynchronous and streams files line by line; nothing is persisted.
1852
2087
  - **Read only, no event.** This slice has exactly one method and no event. History changes as sessions run; a client re-reads when it wants fresh numbers.
1853
- - **Safe, bounded projection.** The wire carries counts, token sums, costs, model ids, day keys, and project display names only. Arrays are capped (models 50, days 400, projects 50) with a `truncated` flag per array; totals stay complete. A session's id, path, provider, or message text never crosses, and a raw read failure is answered with the fixed `stats_unavailable` message.
2088
+ - **Safe, bounded projection.** The wire carries counts, token sums, costs, model ids, provider ids, day keys, and project display names only. Arrays are capped (models 50, days 400, providers 50, projects 50) with a `truncated` flag per array; totals stay complete. A session's id, path, or message text never crosses (provider ids are reported in `byProvider`), and a raw read failure is answered with the fixed `stats_unavailable` message.
1854
2089
  - **Truthful absence.** When no sessions root can be read, or the owner is not loaded, the answer is `stats_unavailable`. A readable root with no usage answers zeros, which is the truth.
1855
2090
  - **Same numbers as the panel, including its gaps.** Records the panel counts are counted here too: an assistant record with zero usage still counts as a message (see #1921). This slice does not change what the aggregation counts.
1856
2091
 
@@ -1864,6 +2099,35 @@ Follows a confirmed `set_review_mode` whose re-read state differs from the state
1864
2099
  - **Gaps stated.** Pi's latest version is known only in a bundled install. Package `latest` is always `null`. A git package has no `current`. `gentle-ai-managed` is detected only when the running gentle-pi is the `npm:gentle-pi` package Pi installed.
1865
2100
  - **Read only, no event.** This slice has exactly one method and no event, and it never runs an update.
1866
2101
 
2102
+ ## Agent definitions limits
2103
+
2104
+ - **One source of truth.** Discovery, defaults, and the orchestrator come from `discoverAgents`, `loadAgentsConfig`, and `readOrchestratorSettings`, the owners `subagent_list_agents` and `/gentle:profiles` already use; nothing is copied.
2105
+ - **Declared, not effective, models.** A definition's `model` is what its frontmatter declares. Routing in `subagents.json` and a repository profile pin can override it at launch; read them with `get_config` (`models`, `profiles`, `pins`).
2106
+ - **Bounded.** At most 200 agents, 64 tools per agent, names cut at 128 characters, descriptions at 512, and model ids over 256 characters reported as `null`.
2107
+ - **Read only, no event.** Definitions are plain files; a client that needs fresh data reads again. Editing them stays a file edit.
2108
+
2109
+ ## Status limits
2110
+
2111
+ - **One source of truth.** The owner computes every field with the same helpers `/gentle:status` uses (`readPersonaMode`, the package asset audit, `resolveGentleAiDevBinaryOverride`, `readModelRoutingAuthorityAsync`); the bridge only validates and projects.
2112
+ - **No doctor.** `/gentle:doctor` is interactive and can repair things; it stays in the terminal.
2113
+ - **No spawn.** The dev-binary override is resolved but never executed, so `get_status` never waits on a process.
2114
+ - **Cost.** The asset audit reads every managed asset file; read on demand, do not poll.
2115
+ - **Read only, no event.**
2116
+
2117
+ ## Background subagents limits
2118
+
2119
+ - **Same owner, same writer.** Reads use `resolveBackgroundSubagentsPolicy` and the capability check; writes use the command's own global writer. Nothing is copied.
2120
+ - **Machine-wide only.** The Desktop writes the global file, like the command. A project file still decides for its project, and the answer shows it.
2121
+ - **Confirmed.** No write happens without a token bound to the state the user saw.
2122
+ - **No event.** A change made in the terminal or by editing a file is seen on the next read.
2123
+
2124
+ ## Credential limits
2125
+
2126
+ - **Status, never values.** Only `getAll`, `getProviderAuthStatus`, `isUsingOAuth`, `getProviderDisplayName`, and `refresh` are called. The slice never reads `auth.json` and never calls a registry method that returns a key or a token.
2127
+ - **No sign-in or sign-out.** Signing in stays with Pi's login flow; removing credentials is out of scope.
2128
+ - **Offline reload.** `reload_credentials` never allows the network, so it does not fetch model catalogs.
2129
+ - **No event.** Ask again, or call `reload_credentials`, after a change elsewhere.
2130
+
1867
2131
  ## Verification
1868
2132
 
1869
2133
  ```sh
@@ -1884,6 +2148,10 @@ node --experimental-strip-types --test \
1884
2148
  tests/desktop-rpc-review.test.ts \
1885
2149
  tests/desktop-rpc-stats.test.ts \
1886
2150
  tests/desktop-rpc-updates.test.ts \
2151
+ tests/desktop-rpc-agent-definitions.test.ts \
2152
+ tests/desktop-rpc-status.test.ts \
2153
+ tests/desktop-rpc-background-subagents.test.ts \
2154
+ tests/desktop-rpc-auth.test.ts \
1887
2155
  tests/maintainer/desktop-rpc.maintest.ts
1888
2156
  ```
1889
2157