gentle-pi 4.8.0 → 4.9.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 (370) hide show
  1. package/README.md +60 -0
  2. package/assets/agents/gentle-ai-explore.md +1 -1
  3. package/assets/agents/gentle-ai-verify.md +1 -1
  4. package/assets/agents/gentle-ai-worker.md +10 -9
  5. package/assets/design-canvas/canvas-boards.js +22 -2
  6. package/assets/design-canvas/canvas-boot.js +3 -1
  7. package/assets/design-canvas/canvas-i18n-es.js +5 -0
  8. package/assets/design-canvas/canvas-menu.js +13 -7
  9. package/assets/design-canvas/canvas-messages.js +1 -1
  10. package/assets/design-canvas/canvas-rail.js +5 -2
  11. package/assets/design-canvas/canvas-store.js +3 -0
  12. package/assets/design-canvas/canvas-theme.js +69 -0
  13. package/assets/design-canvas/canvas.css +27 -2
  14. package/assets/design-canvas/index.html +3 -0
  15. package/assets/design-canvas/inspector.js +28 -5
  16. package/assets/design-canvas/theme-early.js +10 -0
  17. package/assets/migrations/agent-body-history.json +6 -0
  18. package/assets/orchestrator-delegation.md +1 -5
  19. package/assets/orchestrator-full-delegation-card.md +9 -13
  20. package/assets/orchestrator-full-delegation.md +2 -2
  21. package/assets/orchestrator-memory.md +2 -2
  22. package/assets/orchestrator-prompts.md +3 -31
  23. package/assets/orchestrator-tracking.md +6 -6
  24. package/assets/orchestrator-verification.md +4 -4
  25. package/assets/orchestrator-writer.md +12 -12
  26. package/assets/orchestrator.md +2 -2
  27. package/bin/gentle-shell.mjs +77 -1
  28. package/contracts/review-provider-contract-mirror/provider-contract.lock.json +7 -7
  29. package/contracts/review-provider-contract-mirror/{v1.5.0 → v1.6.0}/bundle/manifest.json +3 -3
  30. package/contracts/review-provider-contract-mirror/{v1.5.0 → v1.6.0}/bundle/orchestration/pi.md +1 -1
  31. package/contracts/review-provider-contract-mirror/{v1.5.0 → v1.6.0}/bundle/routing/pi.md +10 -10
  32. package/contracts/review-provider-contract-mirror/{v1.5.0 → v1.6.0}/generated/provider-capabilities.baseline.json +3 -3
  33. package/contracts/review-provider-contract-mirror/{v1.5.0 → v1.6.0}/generated/provider-roles.baseline.json +1 -1
  34. package/docs/assets/features/gentle-tower.png +0 -0
  35. package/docs/auto-permission-answers.md +1 -1
  36. package/docs/bundled-install.md +1 -1
  37. package/docs/delegated-verification.md +6 -4
  38. package/docs/desktop-feed.md +303 -0
  39. package/docs/desktop-rpc.md +703 -25
  40. package/docs/fast-mode.md +2 -2
  41. package/docs/gentle-shell-desktop.md +465 -0
  42. package/docs/gentle-shell.md +65 -3
  43. package/docs/images/desktop/chat.png +0 -0
  44. package/docs/images/desktop/palette.png +0 -0
  45. package/docs/images/desktop/todo.png +0 -0
  46. package/docs/install-wizard.md +1 -1
  47. package/docs/odd-preparation-continuity.md +1 -1
  48. package/docs/readme-reference.md +44 -15
  49. package/docs/work-continuity.md +10 -7
  50. package/extensions/ask-user-choice.ts +36 -18
  51. package/extensions/ask-user-question.ts +47 -8
  52. package/extensions/gentle-agents.ts +206 -37
  53. package/extensions/gentle-ai.ts +234 -24
  54. package/extensions/gentle-desktop-feed.ts +778 -0
  55. package/extensions/gentle-desktop-rpc.ts +145 -12
  56. package/extensions/gentle-herdr-desktop-status.ts +275 -0
  57. package/extensions/gentle-shell.ts +69 -7
  58. package/extensions/gentle-stats.ts +30 -1
  59. package/extensions/gentle-tower.ts +305 -0
  60. package/extensions/skill-registry.ts +13 -3
  61. package/herdr/RECIPE.md +157 -0
  62. package/herdr/keys.json +14 -0
  63. package/herdr/layouts/gentle-shell.json +202 -0
  64. package/herdr/mods/gentle-agents/icons/kind-herdr.svg +1 -0
  65. package/herdr/mods/gentle-agents/icons/kind-remote.svg +1 -0
  66. package/herdr/mods/gentle-agents/icons/kind-tui.svg +1 -0
  67. package/herdr/mods/gentle-agents/main.js +190 -0
  68. package/herdr/mods/gentle-agents/mod.json +1 -0
  69. package/herdr/mods/gentle-agents/snapshot.js +469 -0
  70. package/herdr/mods/gentle-agents/tokens.js +273 -0
  71. package/herdr/mods/gentle-chat/MINIMAL.md +69 -0
  72. package/herdr/mods/gentle-chat/actions.js +180 -0
  73. package/herdr/mods/gentle-chat/feed.js +321 -0
  74. package/herdr/mods/gentle-chat/icons/branch.svg +1 -0
  75. package/herdr/mods/gentle-chat/icons/chat.svg +1 -0
  76. package/herdr/mods/gentle-chat/icons/check.svg +1 -0
  77. package/herdr/mods/gentle-chat/icons/chev.svg +1 -0
  78. package/herdr/mods/gentle-chat/icons/clip.svg +1 -0
  79. package/herdr/mods/gentle-chat/icons/down.svg +1 -0
  80. package/herdr/mods/gentle-chat/icons/folder.svg +1 -0
  81. package/herdr/mods/gentle-chat/icons/kind-herdr.svg +1 -0
  82. package/herdr/mods/gentle-chat/icons/kind-remote.svg +1 -0
  83. package/herdr/mods/gentle-chat/icons/kind-tui.svg +1 -0
  84. package/herdr/mods/gentle-chat/icons/mark.svg +1 -0
  85. package/herdr/mods/gentle-chat/icons/send.svg +1 -0
  86. package/herdr/mods/gentle-chat/icons/shield.svg +1 -0
  87. package/herdr/mods/gentle-chat/icons/stop.svg +1 -0
  88. package/herdr/mods/gentle-chat/icons/term.svg +1 -0
  89. package/herdr/mods/gentle-chat/icons/user.svg +1 -0
  90. package/herdr/mods/gentle-chat/icons/x.svg +1 -0
  91. package/herdr/mods/gentle-chat/main.js +968 -0
  92. package/herdr/mods/gentle-chat/mod.json +1 -0
  93. package/herdr/mods/gentle-chat/session.js +212 -0
  94. package/herdr/mods/gentle-chat/snapshot.js +469 -0
  95. package/herdr/mods/gentle-chat/tokens.js +137 -0
  96. package/herdr/mods/gentle-chat/ui.js +883 -0
  97. package/herdr/mods/gentle-confirm/main.js +60 -0
  98. package/herdr/mods/gentle-confirm/mod.json +1 -0
  99. package/herdr/mods/gentle-inspector/actions.js +180 -0
  100. package/herdr/mods/gentle-inspector/icons/bolt.svg +1 -0
  101. package/herdr/mods/gentle-inspector/icons/bot.svg +1 -0
  102. package/herdr/mods/gentle-inspector/icons/check.svg +1 -0
  103. package/herdr/mods/gentle-inspector/icons/db.svg +1 -0
  104. package/herdr/mods/gentle-inspector/icons/diff.svg +1 -0
  105. package/herdr/mods/gentle-inspector/icons/jobs.svg +1 -0
  106. package/herdr/mods/gentle-inspector/icons/plug.svg +1 -0
  107. package/herdr/mods/gentle-inspector/icons/review.svg +1 -0
  108. package/herdr/mods/gentle-inspector/icons/stats.svg +1 -0
  109. package/herdr/mods/gentle-inspector/icons/stop.svg +1 -0
  110. package/herdr/mods/gentle-inspector/icons/todo.svg +1 -0
  111. package/herdr/mods/gentle-inspector/main.js +500 -0
  112. package/herdr/mods/gentle-inspector/mod.json +1 -0
  113. package/herdr/mods/gentle-inspector/snapshot.js +469 -0
  114. package/herdr/mods/gentle-inspector/tokens.js +273 -0
  115. package/herdr/mods/gentle-palette/actions.js +180 -0
  116. package/herdr/mods/gentle-palette/icons/bolt.svg +1 -0
  117. package/herdr/mods/gentle-palette/icons/bot.svg +1 -0
  118. package/herdr/mods/gentle-palette/icons/chat.svg +1 -0
  119. package/herdr/mods/gentle-palette/icons/check.svg +1 -0
  120. package/herdr/mods/gentle-palette/icons/cmd.svg +1 -0
  121. package/herdr/mods/gentle-palette/icons/diff.svg +1 -0
  122. package/herdr/mods/gentle-palette/icons/jobs.svg +1 -0
  123. package/herdr/mods/gentle-palette/icons/plus.svg +1 -0
  124. package/herdr/mods/gentle-palette/icons/review.svg +1 -0
  125. package/herdr/mods/gentle-palette/icons/search.svg +1 -0
  126. package/herdr/mods/gentle-palette/icons/shield.svg +1 -0
  127. package/herdr/mods/gentle-palette/icons/stats.svg +1 -0
  128. package/herdr/mods/gentle-palette/icons/stop.svg +1 -0
  129. package/herdr/mods/gentle-palette/icons/term.svg +1 -0
  130. package/herdr/mods/gentle-palette/icons/todo.svg +1 -0
  131. package/herdr/mods/gentle-palette/main.js +333 -0
  132. package/herdr/mods/gentle-palette/mod.json +1 -0
  133. package/herdr/mods/gentle-palette/snapshot.js +469 -0
  134. package/herdr/mods/gentle-palette/tokens.js +273 -0
  135. package/herdr/mods/gentle-pane/icons/chat.svg +1 -0
  136. package/herdr/mods/gentle-pane/icons/close.svg +1 -0
  137. package/herdr/mods/gentle-pane/icons/kind-herdr.svg +1 -0
  138. package/herdr/mods/gentle-pane/icons/kind-remote.svg +1 -0
  139. package/herdr/mods/gentle-pane/icons/kind-tui.svg +1 -0
  140. package/herdr/mods/gentle-pane/icons/split-down.svg +1 -0
  141. package/herdr/mods/gentle-pane/icons/split-right.svg +1 -0
  142. package/herdr/mods/gentle-pane/icons/term.svg +1 -0
  143. package/herdr/mods/gentle-pane/icons/unzoom.svg +1 -0
  144. package/herdr/mods/gentle-pane/icons/zoom.svg +1 -0
  145. package/herdr/mods/gentle-pane/main.js +91 -0
  146. package/herdr/mods/gentle-pane/mod.json +1 -0
  147. package/herdr/mods/gentle-pane/snapshot.js +469 -0
  148. package/herdr/mods/gentle-pane/tokens.js +273 -0
  149. package/herdr/mods/gentle-sidebar/actions.js +180 -0
  150. package/herdr/mods/gentle-sidebar/icons/gear.svg +1 -0
  151. package/herdr/mods/gentle-sidebar/icons/mark.svg +1 -0
  152. package/herdr/mods/gentle-sidebar/icons/refresh.svg +1 -0
  153. package/herdr/mods/gentle-sidebar/icons/server-plus.svg +1 -0
  154. package/herdr/mods/gentle-sidebar/main.js +171 -0
  155. package/herdr/mods/gentle-sidebar/mod.json +1 -0
  156. package/herdr/mods/gentle-sidebar/snapshot.js +469 -0
  157. package/herdr/mods/gentle-sidebar/tokens.js +273 -0
  158. package/herdr/mods/gentle-spaces/icons/kind-herdr.svg +1 -0
  159. package/herdr/mods/gentle-spaces/icons/kind-remote.svg +1 -0
  160. package/herdr/mods/gentle-spaces/icons/kind-tui.svg +1 -0
  161. package/herdr/mods/gentle-spaces/icons/monitor.svg +1 -0
  162. package/herdr/mods/gentle-spaces/icons/plus.svg +1 -0
  163. package/herdr/mods/gentle-spaces/icons/server.svg +1 -0
  164. package/herdr/mods/gentle-spaces/machines.js +31 -0
  165. package/herdr/mods/gentle-spaces/main.js +299 -0
  166. package/herdr/mods/gentle-spaces/mod.json +1 -0
  167. package/herdr/mods/gentle-spaces/snapshot.js +469 -0
  168. package/herdr/mods/gentle-spaces/tokens.js +273 -0
  169. package/herdr/mods/gentle-status/actions.js +180 -0
  170. package/herdr/mods/gentle-status/main.js +192 -0
  171. package/herdr/mods/gentle-status/mod.json +1 -0
  172. package/herdr/mods/gentle-status/snapshot.js +469 -0
  173. package/herdr/mods/gentle-status/tokens.js +273 -0
  174. package/herdr/mods/gentle-tabs/icons/close.svg +1 -0
  175. package/herdr/mods/gentle-tabs/icons/kind-herdr.svg +1 -0
  176. package/herdr/mods/gentle-tabs/icons/kind-remote.svg +1 -0
  177. package/herdr/mods/gentle-tabs/icons/kind-tui.svg +1 -0
  178. package/herdr/mods/gentle-tabs/icons/plus.svg +1 -0
  179. package/herdr/mods/gentle-tabs/icons/win-close.svg +1 -0
  180. package/herdr/mods/gentle-tabs/icons/win-max.svg +1 -0
  181. package/herdr/mods/gentle-tabs/icons/win-min.svg +1 -0
  182. package/herdr/mods/gentle-tabs/icons/win-restore.svg +1 -0
  183. package/herdr/mods/gentle-tabs/main.js +171 -0
  184. package/herdr/mods/gentle-tabs/mod.json +1 -0
  185. package/herdr/mods/gentle-tabs/snapshot.js +469 -0
  186. package/herdr/mods/gentle-tabs/tokens.js +273 -0
  187. package/herdr/mods/gentle-tokens/main.js +20 -0
  188. package/herdr/mods/gentle-tokens/mod.json +1 -0
  189. package/herdr/mods/gentle-tokens/snapshot.js +469 -0
  190. package/herdr/mods/gentle-tokens/tokens.js +273 -0
  191. package/herdr/preview.png +0 -0
  192. package/herdr/themes/gentle-shell-dark.json +33 -0
  193. package/herdr/themes/gentle-shell-light.json +34 -0
  194. package/lib/agents-protocol.ts +2 -0
  195. package/lib/agents-rpc-publisher.ts +39 -12
  196. package/lib/agents-runner.ts +1 -0
  197. package/lib/auto-permission-answers.ts +2 -1
  198. package/lib/background-jobs.ts +22 -2
  199. package/lib/bounded-writer-admission.ts +1 -1
  200. package/lib/change-diff.ts +104 -0
  201. package/lib/commit-slice-signal.ts +1 -1
  202. package/lib/design-canvas-assets.ts +2 -0
  203. package/lib/desktop-agents-service.ts +31 -10
  204. package/lib/desktop-changes-service.ts +171 -0
  205. package/lib/desktop-feed-actions.ts +804 -0
  206. package/lib/desktop-feed-answers.ts +129 -0
  207. package/lib/desktop-feed-sources.ts +184 -0
  208. package/lib/desktop-feed-stats.ts +98 -0
  209. package/lib/desktop-feed-store.ts +124 -0
  210. package/lib/desktop-feed.ts +788 -0
  211. package/lib/desktop-jobs-service.ts +34 -7
  212. package/lib/desktop-review-service.ts +187 -0
  213. package/lib/desktop-rpc-agents.ts +112 -3
  214. package/lib/desktop-rpc-changes.ts +223 -0
  215. package/lib/desktop-rpc-config-watch.ts +285 -0
  216. package/lib/desktop-rpc-config.ts +162 -8
  217. package/lib/desktop-rpc-jobs.ts +118 -9
  218. package/lib/desktop-rpc-permissions.ts +154 -3
  219. package/lib/desktop-rpc-review.ts +180 -0
  220. package/lib/desktop-rpc-session.ts +203 -0
  221. package/lib/desktop-rpc-sessions.ts +250 -0
  222. package/lib/desktop-rpc-stats.ts +187 -0
  223. package/lib/desktop-rpc-updates.ts +143 -0
  224. package/lib/desktop-rpc.ts +116 -5
  225. package/lib/desktop-session-service.ts +223 -0
  226. package/lib/desktop-sessions-service.ts +249 -0
  227. package/lib/desktop-stats-service.ts +142 -0
  228. package/lib/desktop-updates-service.ts +268 -0
  229. package/lib/gentle-shell-desktop.ts +1370 -0
  230. package/lib/gentle-shell-launcher.ts +45 -3
  231. package/lib/herdr-desktop-events.ts +40 -0
  232. package/lib/herdr-desktop-status.ts +229 -0
  233. package/lib/jobs-sidebar-state.ts +5 -0
  234. package/lib/native-review-cli.ts +7 -0
  235. package/lib/openai-fast-tier.ts +1 -0
  236. package/lib/session-profile-freeze.ts +13 -5
  237. package/lib/stats-collector.ts +56 -27
  238. package/lib/tower-actions.ts +100 -0
  239. package/lib/tower-hub.ts +73 -0
  240. package/lib/tower-launch.ts +111 -0
  241. package/lib/tower-open.ts +99 -0
  242. package/lib/tower-presence.ts +70 -0
  243. package/lib/tower-server.ts +234 -0
  244. package/lib/tower-snapshot.ts +298 -0
  245. package/lib/update-status.ts +238 -0
  246. package/lib/verifier-settle-reminder.ts +1 -1
  247. package/package.json +13 -4
  248. package/runtime/design-canvas-assets.mjs +2 -0
  249. package/runtime/gentle-shell-desktop.mjs +1371 -0
  250. package/runtime/gentle-shell-launcher.mjs +44 -2
  251. package/runtime/native-review-cli.mjs +7 -0
  252. package/runtime/tower-actions.mjs +101 -0
  253. package/runtime/tower-hub.mjs +74 -0
  254. package/runtime/tower-launch.mjs +112 -0
  255. package/runtime/tower-open.mjs +100 -0
  256. package/runtime/tower-presence.mjs +71 -0
  257. package/runtime/tower-server.mjs +234 -0
  258. package/runtime/tower-snapshot.mjs +299 -0
  259. package/scripts/build-full-delegation-card.mjs +1 -21
  260. package/scripts/build-runtime-modules.mjs +9 -0
  261. package/scripts/gentle-ai-installer.mjs +10 -10
  262. package/scripts/verify-package-files.mjs +35 -15
  263. package/skills/provider-defect-report/SKILL.md +61 -0
  264. package/skills/rdd-defect-workflow/SKILL.md +3 -3
  265. package/tests/agent-prompt-diet-contract.test.ts +2 -2
  266. package/tests/append-system-prompt-route.test.ts +16 -5
  267. package/tests/ask-user-choice.test.ts +78 -21
  268. package/tests/ask-user-question.test.ts +59 -5
  269. package/tests/auto-permission-answers.test.ts +12 -1
  270. package/tests/background-jobs.test.ts +12 -0
  271. package/tests/bounded-stop-contract.test.ts +139 -26
  272. package/tests/change-diff.test.ts +75 -0
  273. package/tests/commit-slice-signal.test.ts +3 -2
  274. package/tests/decision-routing-contract.test.ts +390 -0
  275. package/tests/delegated-key-learnings-contract.test.ts +21 -28
  276. package/tests/delivery-b-rendered-surfaces.test.ts +32 -0
  277. package/tests/design-canvas-i18n.test.ts +24 -22
  278. package/tests/design-canvas-inspector.test.ts +67 -0
  279. package/tests/design-canvas-modules.test.ts +3 -2
  280. package/tests/design-canvas-rail.test.ts +10 -10
  281. package/tests/design-canvas-store.test.ts +9 -0
  282. package/tests/design-canvas-theme.test.ts +198 -0
  283. package/tests/design-canvas-tokens.test.ts +1 -1
  284. package/tests/desktop-feed-actions-guards.test.ts +595 -0
  285. package/tests/desktop-feed-actions.test.ts +761 -0
  286. package/tests/desktop-feed-live-work.test.ts +209 -0
  287. package/tests/desktop-feed-performance.test.ts +369 -0
  288. package/tests/desktop-feed-plan-profiles.test.ts +509 -0
  289. package/tests/desktop-feed-send-prompt.test.ts +303 -0
  290. package/tests/desktop-feed-tool-summaries.test.ts +69 -0
  291. package/tests/desktop-feed.test.ts +615 -0
  292. package/tests/desktop-rpc-agents.test.ts +428 -2
  293. package/tests/desktop-rpc-changes.test.ts +608 -0
  294. package/tests/desktop-rpc-config-watch.test.ts +1159 -0
  295. package/tests/desktop-rpc-config.test.ts +11 -1
  296. package/tests/desktop-rpc-design.test.ts +11 -1
  297. package/tests/desktop-rpc-jobs.test.ts +402 -5
  298. package/tests/desktop-rpc-permissions.test.ts +11 -1
  299. package/tests/desktop-rpc-review.test.ts +678 -0
  300. package/tests/desktop-rpc-session.test.ts +642 -0
  301. package/tests/desktop-rpc-sessions.test.ts +647 -0
  302. package/tests/desktop-rpc-stats.test.ts +431 -0
  303. package/tests/desktop-rpc-updates.test.ts +525 -0
  304. package/tests/desktop-rpc-usage.test.ts +11 -1
  305. package/tests/desktop-rpc.test.ts +43 -2
  306. package/tests/fixtures/primary-session-prompt/gentleman.golden.md +11 -13
  307. package/tests/fixtures/session-profile-v1/replay.ts +4 -1
  308. package/tests/full-delegation-closure.test.ts +20 -1
  309. package/tests/gentle-agents.test.ts +519 -4
  310. package/tests/gentle-ai-binary.test.ts +1 -1
  311. package/tests/gentle-ai-installer.test.ts +52 -52
  312. package/tests/gentle-ai.test.ts +75 -16
  313. package/tests/gentle-fast.test.ts +15 -0
  314. package/tests/gentle-herdr-desktop-status.test.ts +595 -0
  315. package/tests/gentle-shell-desktop-bin.test.ts +125 -0
  316. package/tests/gentle-shell-desktop.test.ts +927 -0
  317. package/tests/gentle-shell-launcher-tower.test.ts +104 -0
  318. package/tests/gentle-shell.test.ts +3 -0
  319. package/tests/gentle-tower.test.ts +578 -0
  320. package/tests/herdr-desktop-status.test.ts +285 -0
  321. package/tests/independent-recovery-delivery.test.ts +16 -4
  322. package/tests/installer-server.test.ts +2 -2
  323. package/tests/lazy-module-contradictions-contract.test.ts +27 -4
  324. package/tests/maintainer/desktop-rpc.maintest.ts +279 -4
  325. package/tests/native-review-capability-contract.test.ts +9 -1
  326. package/tests/no-self-pause-contract.test.ts +23 -13
  327. package/tests/odd-routing-canonical-ratchet.test.ts +10 -0
  328. package/tests/odd-routing-contract.test.ts +19 -3
  329. package/tests/orchestrator-budget.test.ts +3 -1
  330. package/tests/orchestrator-prompt-budget.test.ts +2 -1
  331. package/tests/orchestrator-prompt-diet-contract.test.ts +31 -3
  332. package/tests/package-manifest.test.ts +10 -10
  333. package/tests/pi-routing-measured-values.test.ts +24 -0
  334. package/tests/primary-session-prompt.test.ts +25 -0
  335. package/tests/profile-fast-tier.test.ts +66 -1
  336. package/tests/provider-defect-handoff.test.ts +118 -100
  337. package/tests/review-contract-prompt.test.ts +2 -1
  338. package/tests/review-due-public-boundary.test.ts +2 -1
  339. package/tests/sensitive-path-tools.test.ts +138 -4
  340. package/tests/session-profile-extension.test.ts +310 -16
  341. package/tests/session-profile-freeze.test.ts +26 -0
  342. package/tests/session-profile-v1-compat.test.ts +20 -0
  343. package/tests/skill-collision-prefixes.test.ts +1 -0
  344. package/tests/skill-contradictions-contract.test.ts +5 -3
  345. package/tests/skill-registry.test.ts +54 -0
  346. package/tests/stats-collector.test.ts +109 -2
  347. package/tests/support/design-canvas-dom.ts +17 -0
  348. package/tests/task-size-routing-contract.test.ts +7 -3
  349. package/tests/tower-actions.test.ts +247 -0
  350. package/tests/tower-artifacts.test.ts +114 -0
  351. package/tests/tower-open.test.ts +97 -0
  352. package/tests/tower-presence.test.ts +175 -0
  353. package/tests/tower-server.test.ts +122 -0
  354. package/tests/tower-snapshot.test.ts +236 -0
  355. package/tests/tower-web-echo.test.ts +125 -0
  356. package/tests/tower-web-hover.test.ts +251 -0
  357. package/tests/verification-scoped-stop-contract.test.ts +32 -0
  358. package/tests/verification-tiers-contract.test.ts +5 -5
  359. package/tests/verifier-settle-reminder.test.ts +2 -2
  360. package/tests/verify-first-launch-contract.test.ts +2 -2
  361. package/tests/work-continuity-contract.test.ts +83 -17
  362. package/tests/writer-rejection-next-step.test.ts +55 -0
  363. package/tests/writer-surface-authority-contract.test.ts +158 -0
  364. /package/contracts/review-provider-contract-mirror/{v1.5.0 → v1.6.0}/bundle/README.md +0 -0
  365. /package/contracts/review-provider-contract-mirror/{v1.5.0 → v1.6.0}/bundle/schemas/lens.schema.json +0 -0
  366. /package/contracts/review-provider-contract-mirror/{v1.5.0 → v1.6.0}/bundle/schemas/refuter.schema.json +0 -0
  367. /package/contracts/review-provider-contract-mirror/{v1.5.0 → v1.6.0}/bundle/schemas/targeted-validator.schema.json +0 -0
  368. /package/contracts/review-provider-contract-mirror/{v1.5.0 → v1.6.0}/bundle/vectors/lens.json +0 -0
  369. /package/contracts/review-provider-contract-mirror/{v1.5.0 → v1.6.0}/bundle/vectors/refuter.json +0 -0
  370. /package/contracts/review-provider-contract-mirror/{v1.5.0 → v1.6.0}/bundle/vectors/targeted-validator.json +0 -0
@@ -6,13 +6,13 @@ Organic Driven Development (ODD) is the predefined workflow of this orchestrator
6
6
 
7
7
  1. **Authorize.** Investigation, explanation, review, comparison, and proposal-only requests stay read-only: no writer, apply, or implementation artifacts. Ambiguous or conditional change intent (unclear whether a change is authorized at all) gets one clarification; stop and wait. A user saying they may stop you or resume later asks for notes and separate commits, not a stop.
8
8
  2. **Explore.** Explore existing code and requirements first, proportionately to the request, before proposing or writing anything. Do not delegate exploration of files you will read anyway to work inline; explore only for a map you need to decide or route.
9
- 3. **Resolve uncertainty.** Recommend optional research only for a named uncertainty; ask one focused user question only for a real unresolved product decision, then stop and wait; use at most one scoped read-only assumption challenge for a high-consequence unproven premise.
9
+ 3. **Resolve uncertainty.** Recommend optional research only for a named uncertainty, and use at most one scoped read-only assumption challenge for a high-consequence unproven premise. Continue when no human decision remains; ask with the available compatible tool; text only for a genuinely open clarification or no usable compatible interface; batch independent ordinary decisions when the interface supports it; wait. Provider consent keeps its closed lossless protocol; text is never its approval.
10
10
  4. **Classify.** Size the task by the orchestrator's Task Size section; its criteria and resume test alone decide small or large, and small work follows its small path.
11
11
  5. **Track before the first write.** For large authorized implementation, create `odd/tasks/<feature-name>.md` and its Engram mirror `odd/<feature-name>/tasks` automatically, then create or rebuild the visible `todo` list from the reconciled feature tasks, all before the first source write and without asking permission for tasks or storage. Tell the user in one line which feature document was created and how many tasks it holds. The document is the specification subagents read, in this order: a two- or three-line header; `## Specs` with numbered `S#` that quote the user's exact strings, error messages, and examples verbatim, never summarized and never adding unrequested requirements; `## Tasks` with one line per task (ID, linked `S#`, route, commit); `## Log` last, where `L1` is the user's original request verbatim and later user corrections, evidence, and decisions are appended. A requirement change appends its verbatim Log entry, rewrites only the affected `S#`, and reopens only its task.
12
- 6. **Implement task by task.** Hand off by reference, never by paraphrase: name the document, task, and specs (for example `Spec: odd/tasks/<feature>.md, T2, S3-S4`), tell workers to read until `## Log`, and ask which `S#` were covered. Without a feature document, include the user's request verbatim. Verify reads the whole document, runs the spec's examples the parent authorized, against isolated state when they mutate data, and returns a verdict per `S#`. When the user reports a failure, reproduce it before deciding it already works. Each test asserts every observable effect of the rule it covers (exit code, exact stdout and stderr, and that rejected input leaves stored data and counters unchanged), covers the cases the rule itself names (its examples, boundaries, and errors), and checks through the public interface, never internal storage. When you add or change a command, option, or message, update the help text and docs that describe it. Route each task through the orchestrator's Mechanisms, honoring its delegation triggers when their conditions truly hold, with applicable test-first development and checks. No trigger holds by default and, when in doubt, work inline; executing past a fired trigger inline is a routing defect even if the work succeeds. Check an item off only after its outcome and checks were observed; update the file, mirror, and visible `todo` projection after every task transition and material plan change. Commit work units in reviewable slices of about 400 authored changed lines on the feature branch (branch first when on the default branch), with tests and docs alongside the behavior and a Conventional Commit message; a unit whose Risk line names a high-risk item gets its own commit so native review can take it alone, and the last slice closes the feature. Record the commit that holds each task in the feature document as evidence. Work-unit commits on the feature branch are part of authorized large ODD implementation; push, pull request creation, and merge remain the user's decisions.
13
- 7. **Close.** Report the verified outcome, every failed, skipped, or pending check, and the next step. Before writing `Risk: none`, check whether your diff changes code that existing behavior the request did not mention also uses (shared options, parsers, helpers); if it does, that is item 3. Never end with a tracked task pending unless you quote the user's explicit stop. An applicable quick check runs once; an unavailable verifier or subagent is reported as unavailable, never retried or escalated into extra ceremony. Partial, blocked, unavailable, or exhausted proof becomes one **Needs your decision** result naming the open blockers or missing proof, never more verification; that result is a valid stop, hedged wording is not. The native review candidate is a work-unit commit or a PR slice, never a TODO checkbox and never the accumulated feature branch; native review runs only under the user-owned RDD switch.
12
+ 6. **Implement task by task.** Hand off by reference, never by paraphrase: name the document, task, and specs (for example `Spec: odd/tasks/<feature>.md, T2, S3-S4`), tell workers to read until `## Log`, and ask which `S#` were covered. Without a feature document, include the user's request verbatim. Verify reads the whole document, runs the spec's examples the parent authorized, against isolated state when they mutate data, and returns a verdict per `S#`. When the user reports a failure, reproduce it before deciding it already works. Each test asserts every observable effect of the rule it covers (exit code, exact stdout and stderr, and that rejected input leaves stored data and counters unchanged), covers the cases the rule itself names (its examples, boundaries, and errors), and checks through the public interface, never internal storage. When you add or change a command, option, or message, update the help text and docs that describe it. Route each task through the orchestrator's Mechanisms, honoring its delegation triggers when their conditions truly hold, with applicable test-first development and checks. No trigger holds by default and, when in doubt, work inline; executing past a fired trigger inline is a routing defect even if the work succeeds. Check an item off only after its outcome and checks were observed; mirror the file and project the visible `todo` at each task transition. Commit work units in reviewable slices of about 400 authored changed lines on the feature branch (branch first when on the default branch), with tests and docs alongside the behavior and a Conventional Commit message; a unit whose Risk line names a high-risk item gets its own commit so native review can take it alone, and the last slice closes the feature. Record the commit that holds each task in the feature document as evidence. Work-unit commits on the feature branch are part of authorized large ODD implementation; push, pull request creation, and merge remain the user's decisions.
13
+ 7. **Close.** Report the verified outcome, every failed, skipped, or pending check, and the next step. Before writing `Risk: none`, check whether your diff changes code that existing behavior the request did not mention also uses (shared options, parsers, helpers); if it does, that is item 3. An applicable quick check runs once; an unavailable verifier or subagent is reported as unavailable, never retried or escalated into extra ceremony. Authorized work continues: runnable in-scope steps run, a pending child is a wait event whose completion resumes the turn without asking the human, and only a real human decision, the user's explicit stop, a denial, missing consent, or an exhausted limit stops the work it applies to, never independent authorized work. A tracked task ends the turn pending only while it waits on already-launched work, for the affected work a denial, missing consent, the user's explicit stop, or an exhausted limit applies to, or for a genuine human decision still outstanding; independent authorized work continues, and it never abandons runnable work or presents an unverified outcome as final. Missing, partial, unavailable, or declined proof forbids claiming completion of the affected work, never an independently authorized next step, while a required authorized check the existing budget still allows keeps running; stop checking only inside an exhausted or denied boundary, report that exact blocker and the decision that is genuinely the human's, and never invent a pass. Never turn a report into a blind self-reprompt loop. Hedged wording is not a stop. The native review candidate is a work-unit commit or a PR slice, never a TODO checkbox and never the accumulated feature branch; native review runs only under the user-owned RDD switch.
14
14
 
15
- Phase reporting: the Gentle Shell prompt label is inferred automatically from the primary session's tool activity (reads show `exploring`, edits `implementing`, test runs `checking`, user questions `deciding`). When the `gentle_odd_phase` tool is available, use it to refine that label with phases tools cannot show (`authorizing`, `researching`, `deciding`, `closing`): call `gentle_odd_phase` only when the primary session's ODD phase actually changes, never per tool call or on a fixed cadence, and never from a subagent. It drives the Gentle Shell prompt label only.
15
+ Phase reporting: the Gentle Shell prompt label is inferred automatically from the primary session's tool activity (reads show `exploring`, edits `implementing`, test runs `checking`, user questions `deciding`). `gentle_odd_phase` is an optional refinement for phases tools cannot show (`authorizing`, `researching`, `deciding`, `closing`), never a per-phase obligation: call it from the primary session only when its ODD phase actually changes, never per tool call or on a fixed cadence. It drives the Gentle Shell prompt label only.
16
16
 
17
17
  Resume an interrupted feature with `mem_context`, then project- and feature-scoped `mem_search`, then `mem_get_observation` for the full document, then the task file itself; reconcile before continuing the next unfinished task. Detail for steps 3–7: `orchestrator-delegation.md` and `orchestrator-memory.md`.
18
18
 
@@ -35,7 +35,7 @@ Small path: work inline. Read and edit, several files of one understood change i
35
35
  After explicit change intent is established, route work for the requested outcome with the smallest useful topology. Every authorized change takes exactly one implementation route: direct inline or delegated direct.
36
36
 
37
37
  - **Direct inline:** small tasks, by the Task Size section, and large tasks without a Writer trigger reason, which follow their logbook. Decide or verify with one parallel batch (1 maximum), at most 3 calls and approximately 10k tokens of evidence. Use bounded search/line ranges, not whole large files. One understood change stays inline even when it spans files, and its focused test and suite run inline.
38
- - **Delegated direct:** understanding that needs more evidence or more than approximately 5 sequential lookups takes one read-only explorer, then task size is re-evaluated; a writer is delegated only by the Writer trigger.
38
+ - **Delegated direct:** understanding that needs more evidence or more than 3 lookups takes one read-only explorer, then task size is re-evaluated; a writer is delegated only by the Writer trigger.
39
39
  - File count, changed lines, size, or perceived risk alone never forces a heavier route.
40
40
  - These are implementation routes, not a ban on per-action delegation. Tests, builds, installs, and review actors may still use fresh workers without changing the selected route.
41
41
 
@@ -43,8 +43,8 @@ After explicit change intent is established, route work for the requested outcom
43
43
 
44
44
  Each trigger holds only when its condition truly holds, and only then is it mandatory, not advisory; no trigger holds by default, and when in doubt work inline. Each mechanism turns on only by its own trigger. When one fires, stop and delegate through the runtime's subagent mechanism before continuing; executing past a fired trigger inline is a routing defect even if the work succeeds. When it resolves, re-evaluate task size and stay small while the three criteria hold. Delegation keeps the parent context thin enough to orchestrate; it does not slow the work down.
45
45
 
46
- - **Ask trigger:** an open product or design decision gets one focused user question; stop and wait.
47
- - **Mapping trigger:** when understanding exceeds the inline batch budget or needs more than approximately 5 sequential lookups, delegate one read-only explorer before deciding or writing anything. Return a handoff of at most approximately 2k tokens with path:line evidence; use one parent spot check (1 maximum). Do not reread the entire mapped evidence. Never explore to read files you will read anyway before writing inline.
46
+ - **Ask trigger:** only a genuinely open clarification or a human decision no usable compatible interface can represent gets one focused text question; stop and wait.
47
+ - **Mapping trigger:** when understanding exceeds the inline batch budget or needs more than 3 lookups (the runtime's exploration notice fires past 3 lookups or 40,000 output bytes), delegate one read-only explorer before deciding or writing anything. Return a handoff of at most approximately 2k tokens with path:line evidence; use one parent spot check (1 maximum). Do not reread the entire mapped evidence. Never explore to read files you will read anyway before writing inline.
48
48
  - **Verification trigger:** only a change whose Risk line names a high-risk item gets an independent verifier after the change's own checks, as rarely as possible; a native tier, an unclear or failed assessment, and the writer's model or effort never add one by themselves. Otherwise whoever made the change runs its focused test and suite inline, small tasks included.
49
49
  - **Tracking trigger:** a large task gets the feature document, its mirror, and work-unit commits.
50
50
  - **Writer trigger:** a writer is delegated only for a named reason, one bounded writer per unit: (a) parallelism: two or more independent units of behavior with disjoint edit surfaces, each needing several minutes of work (several files or roughly 100+ changed lines; a subagent spends one to two minutes reading before it writes), launched together in one turn (in background when background mode is on); (b) context: the long-session backstop below. A unit is one independent piece of behavior with its code, tests, and docs together: never split one behavior into test, docs, and code writers, and a delivery that depends on another is not independent; several small independent changes run inline, one after another. Units of about 100 changed lines or less always run inline: writing them costs less than starting workers. Never delegate a writer for size, a large task alone, file count, or a price ratio; file count never fires this trigger. Without a reason, the parent works inline, following its logbook (feature document, mirror, work-unit commits).
@@ -52,7 +52,7 @@ Each trigger holds only when its condition truly holds, and only then is it mand
52
52
  - **Invariants:** each writer prompt names the existing helpers its unit must reuse for shared state (for example the function that adds an entry other commands also add) and the invariants they keep (ordering, uniqueness, validation, normalization); units built in parallel cannot see each other, so the prompt is the only place they learn them. Whoever writes, inline or delegated, reuses the existing function for shared state and never re-implements that step with a different shape.
53
53
  - **Preparation trigger:** when the Writer trigger delegates a write, reading that prepares it, and broad research or context compression, delegate together with or ahead of the write instead of filling the parent context. Inline writes read inline.
54
54
  - **Output budget:** keep parent bash output bounded to counts, --stat, tail, or summaries. On a large task, delegate long suites and builds and return concise observed results, including failures.
55
- - **Long-session backstop:** at approximately 150k parent-context tokens, pause and delegate the next bounded unit. This is advisory context guidance, not mechanically observed or enforced; do not claim runtime telemetry or enforcement.
55
+ - **Long-session backstop:** when the runtime signals it, at the lower of approximately 150k parent-context tokens or 15% of the context window, pause and delegate the next bounded unit.
56
56
  - **Route declaration:** for large work, record the chosen route per task (inline or delegated) and the trigger evidence in the feature document, so skipped delegation is observable instead of silent.
57
57
  - These triggers only choose between direct inline and delegated direct inside the organic flow.
58
58
 
@@ -63,7 +63,7 @@ Use this flow for direct and delegated work. Explore the existing code and requi
63
63
  This section is the reference detail for the protocol above.
64
64
 
65
65
  - Recommend optional research only for a named uncertainty. If declined, continue within authorized scope only where safe without the missing evidence; disclose unresolved uncertainty and pause affected unsafe decisions. Offer a concise proposal only when a real scope or product decision needs it. Neither research nor a proposal is mandatory.
66
- - Establish the problem, intended outcome, constraints, and current evidence; inspect relevant code. Adapt depth to uncertainty and consequence, not a fixed questionnaire or mandatory rounds. The parent owns product decisions: ask one focused user question only for a real unresolved product decision, then stop and wait. Workers return gaps to the parent rather than assuming choices.
66
+ - Establish the problem, intended outcome, constraints, and current evidence; inspect relevant code. Adapt depth to uncertainty and consequence, not a fixed questionnaire or mandatory rounds. The parent owns product decisions: ask one focused user question only for a real unresolved product decision, then stop and wait. Step 3 decides whether that question is a tool ask or text. Workers return gaps to the parent rather than assuming choices.
67
67
  - When the question needs external evidence, use available authorized documentation/web tools and prefer primary sources. Attribute material claims to source URLs or code locations; distinguish verified facts, assumptions, contradictions, freshness, and gaps. If tools are unavailable, disclose limitations without inventing access or evidence; pause only unsafe decisions dependent on missing evidence.
68
68
  - Return concise findings, recommendation, tradeoffs, open questions, and implementation implications. When delegating research, forward these research instructions to a fresh general exploration/research worker through existing delegation; do not create a specialized research agent. Keep research read-only; its findings do not authorize implementation or require new persistence or readiness machinery.
69
69
  - Use at most one scoped independent read-only assumption challenge for a high-consequence unproven premise, even in a small security-critical change. Name the premise, evidence, and consequence; do not start a debate loop. Deterministic failures need fixes, not model debate. The native RDD refuter owns native review claims; never duplicate or bypass it.
@@ -77,7 +77,7 @@ This section is the reference detail for the protocol above.
77
77
  - Before implementation or resume, the parent reads both the actual file and full observation, reconciles them, and passes the locator, task IDs, and linked `S#`; workers read the document until `## Log` before edits and report which `S#` they covered. Small work without a document still receives its authorized scope and checks.
78
78
  - Apply one default test-first policy to ODD behavior changes: when a relevant runnable deterministic test and clear expected outcome exist, observe RED before implementation, implement GREEN, then refactor while tests stay green. Write one RED test per requested rule. For every existing command or option the change touches, add one test proving its previous behavior still holds; add no other cases. An existing behavior counts as touched when it shares the code you changed (options, parsers, helpers, validation). Before finishing, run a differential check: for each existing command that shares the code you changed, run it with the new or changed input (for example a new option passed to a sibling subcommand) against the previous code (a copy of the base commit in a `mktemp -d` scratch directory, never committed as a test; committed tests never read git history or a fixed commit) and against your change, and compare stdout, stderr, and exit code; any difference nobody asked for is a regression to fix and pin with a test. Tests or frameworks being present alone do not establish applicability. For passive documentation, unavailable runners, or no meaningful runnable RED, explain the exception and run proportionate functional or structural checks. Keep test scratch state (temporary directories, `HOME`, `TMPDIR`, tool caches) outside the worktree in a `mktemp -d` directory; when it must live inside the worktree, use a path git excludes and remove it before finishing, so no tool cache or scratch path remains in the change. Subagents never delete scratch: they report its exact paths, and the parent removes outside scratch after use, including the paths a worker or verifier reports. Forward the applicable runner, this test discipline, and the evidence or exception to workers; never invent RED/GREEN evidence or a runner.
79
79
  - Preserve existing native risk selection and applicable functional verification. Run applicable functional checks per task, not a review cycle per TODO checkbox. The native review candidate is a work-unit commit or a PR slice, never a TODO checkbox and never the accumulated feature branch. After each work-unit commit, when RDD is enabled, run `gentle-ai review assess --cwd <repo> --agent pi --base-ref <last reviewed boundary> --committed-only --json` on that commit and read `review_due` and `review_due_reason`. When `review_due` is true (`high_risk`), or when the user explicitly asks for a review, execute the returned `next_transition.command` verbatim with your `--lenses`/`--lenses-reason` selection appended: it is the exact preflight STATUS for the same `--base-ref`/`--committed-only` selectors; follow the transitions it returns, and the reviewed boundary advances to this commit once that review is acknowledged. When `review_due` is false, record `review_due_reason` and continue: `passive` needs no review and the boundary advances; `under_budget` stays pending in the slice until a later commit reaches the budget; `already_reviewed` means this exact range is already covered by terminal authority. When a high-risk unit follows pending `under_budget` commits, assess the open slice first. Review the pending slice only when `review_due` is true or the user explicitly asks; otherwise preserve the pending boundary and proceed without starting review. A task boundary neither authorizes review nor advances a reviewed boundary. The first boundary is the branch point, and every reviewed boundary becomes the next base. Record per commit the assessed tier and outcome: granted, declined, passive, under budget, already reviewed, or unavailable. An unavailable or failed assessment never lowers the tier: report the missing assessment proof; never infer `review_due` or construct a preflight transition. Never infer low risk from a failed assessment, and keep existing risk, consent, and authority unchanged. Never skip an existing delivery gate. A task list or assumption challenge never enables RDD, replaces its roles or candidate consent, or adds an execution harness.
80
- - Delivery follows work units. At feature-document creation, forecast authored changed lines (additions plus deletions, generated files excluded) from the task list, and keep a running count from work-unit commits. Choose one delivery strategy per feature: `ask-on-risk` (default), `auto-chain`, `single-pr`, or `exception-ok`. When the forecast or the running count exceeds about 400 authored changed lines, apply the chosen strategy before the next commit: `ask-on-risk` asks once for the chain strategy, `stacked-to-main` or `feature-branch-chain`; `auto-chain` asks only for a missing chain strategy and slices automatically. Cache both choices, and record slice boundaries, which commits each pull request holds, in the feature document. Resolve the `work-unit-commits` and `chained-pr` skills by registry name before planning or creating any pull request, never hardcode their paths.
80
+ - Delivery follows work units. At feature-document creation, forecast authored changed lines (additions plus deletions, generated files excluded) from the task list, and keep a running count from work-unit commits. Choose one delivery strategy per feature: `ask-on-risk` (default), `auto-chain`, `single-pr`, or `exception-ok`. When the forecast or the running count exceeds about 400 authored changed lines, apply the chosen strategy only when the user asks to publish (push or PR), never before a local work-unit commit: `ask-on-risk` asks once for the chain strategy, `stacked-to-main` or `feature-branch-chain`; `auto-chain` asks only for a missing chain strategy and slices automatically. Cache both choices, and record slice boundaries, which commits each pull request holds, in the feature document. Resolve the `work-unit-commits` and `chained-pr` skills by registry name before planning or creating any pull request, never hardcode their paths.
81
81
  - When RDD is enabled, first use the existing native candidate risk assessment (`gentle-ai review assess --cwd <repo> --agent pi --json`). Passive/low uses silent structural checks with no reviewer or consent ceremony. Medium/high relays the existing candidate consent only when `review_due` is true or the user explicitly asks, and follows the returned native plan: native review runs only on grant; a decline continues under ordinary policy. Do not substitute model judgment, task size, or defect severity to lower prospective candidate risk; never infer low risk from a failed assessment. You may raise a candidate you know is high risk with `--escalate-item <1-6> --escalate-reason "<one line>"` on that same assessment command, citing the high-risk list; never lower it. Follow native continuations and authority without bypassing gates. When RDD is disabled, do not start or prompt for RDD; ordinary checks remain.
82
82
 
83
83
  ### Receipt-driven development is user-owned
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "schema": "gentle-pi.provider-contract-capabilities-baseline/v1",
3
- "contract_semver": "1.5.0",
3
+ "contract_semver": "1.6.0",
4
4
  "transport_capability": "gentle-ai.provider-transport/v1",
5
5
  "mandatory_capabilities": [
6
6
  "gentle-ai.provider-transport/v1"
@@ -16,14 +16,14 @@
16
16
  {
17
17
  "runtime": "pi",
18
18
  "path": "orchestration/pi.md",
19
- "sha256": "c0e7c4c2ab07a695ecf108b476bee81e6d9ca553b7a3860299fe2870b68d8bfc"
19
+ "sha256": "ee25b26c5e913008a115e1cde258288a2c4b1ad9a41cb0b040fab2b76561e124"
20
20
  }
21
21
  ],
22
22
  "routing": [
23
23
  {
24
24
  "runtime": "pi",
25
25
  "path": "routing/pi.md",
26
- "sha256": "f34508b060197339fc73dd885565a24d037366c02b3f91b4db15431b42a5c573"
26
+ "sha256": "da52909e3b91b044d36556f7775d5d2b10410212b5c0466f267006fea16a58c3"
27
27
  }
28
28
  ]
29
29
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "schema": "gentle-pi.provider-contract-roles-baseline/v1",
3
- "contract_semver": "1.5.0",
3
+ "contract_semver": "1.6.0",
4
4
  "roles": [
5
5
  {
6
6
  "id": "lens",
@@ -11,7 +11,7 @@ Each frozen `HumanAnswerReceipt` contains:
11
11
  - `branchAnchor`: the original `sessionManager.getLeafId()` (`string | null`), unchanged at delivery.
12
12
  - `toolName`, `toolCallId`, `questionIndex`: the exact question interaction and zero-based question position.
13
13
  - `question`: the original question text, an **untrusted referent**, not an instruction.
14
- - `prompt`: a pre-UI JSON string containing original question and offered labels/descriptions. Choice prompts include `allowCustomResponse`; questionnaire prompts include header, multi-select status, and previews for the TUI where previews are displayed. This entire field is **untrusted context**, separate from authenticated answer text.
14
+ - `prompt`: a pre-UI JSON string containing original question and offered labels/descriptions. Choice prompts include the effective `allowCustomResponse` (`true` unless the call passed `false`; a custom answer to a closed choice is never delivered); questionnaire prompts include header, multi-select status, and previews for the TUI where previews are displayed. This entire field is **untrusted context**, separate from authenticated answer text.
15
15
  - `answer`: the authenticated visible answer: `{ kind: "option" | "custom", text, selected? }` or `{ kind: "multi", selected }`.
16
16
 
17
17
  Opaque choice values are excluded entirely. Option descriptions and displayed questionnaire previews are included only in the untrusted `prompt`, never in authenticated answer text. A selected label still authorizes only what the human actually agreed to, not arbitrary instructions embedded in the question. The bridge itself grants no permission, changes no counters, and creates no synthetic user message.
@@ -347,7 +347,7 @@ S9. Everything Gentle AI and gentle-pi keep lives in the prefix, except Engram's
347
347
  - **gentle-engram.** The gentle-engram Pi extension finds Engram only through `ENGRAM_BIN`, read once when it loads, and otherwise runs `engram` from `PATH`. So Pi gets `ENGRAM_BIN` (the guard; memory reaches the shared server through `ENGRAM_URL`), and no `PATH` entry is added. An `ENGRAM_BIN` the user set is kept. The agent's shell inherits `ENGRAM_BIN` too, so an Engram MCP launcher started there through `ENGRAM_BIN` uses the same guard.
348
348
  - **Personas.** Setup snapshots and restores the persona Gentle AI may rewrite: the prefix's `config/gentle-ai/persona.json`, and also the user's `~/.pi/gentle-ai/persona.json`. A Gentle AI release without the variables still writes the user's file, and restoring an unchanged file does nothing. The managed-asset record is restored only in the user's `~/.gentle-ai/state.json`; the prefix's record belongs to the pinned Gentle AI.
349
349
  - **pi-pretty and prompt history.** In bundled mode only, the pi-pretty wrapper passes `deps.sdk` with Pi's five tool factories and `getAgentDir`, so its FFF database lands in `<agent home>/pi-pretty/fff`, and prompt history keeps its store under `<agent home>/history` ([Prompt history](prompt-history.md)). Elsewhere both keep their existing locations: Pi's deps reach pi-pretty unchanged (`$HOME/.pi/agent/pi-pretty/fff`, or no store without `HOME`), and history stays under `~/.pi/agent/history`, also in the isolated home of a pnpm or npm install, so existing histories are not left behind.
350
- - **Effective with a later Gentle AI.** gentle-pi pins Gentle AI 4.5.0 today (`INSTALLER_VERSION`); the following are historical compatibility notes for Gentle AI 4.0.0, which ignores the four `GENTLE_AI_*` variables. Whether 4.5.0 includes gentle-ai#5462 is unverified here. Until gentle-pi pins a Gentle AI release that contains gentle-ai#5462:
350
+ - **Historical compatibility (Gentle AI 4.0.0).** The current Gentle AI 4.6.0 pin honors the four `GENTLE_AI_*` variables above. Gentle AI 4.0.0 ignored them:
351
351
  - Setup still writes `~/.gentle-ai` and `~/.pi/gentle-ai`, with the restores above, and still acquires Engram its own way.
352
352
  - The persona goes to the user's `~/.pi/gentle-ai/persona.json` (Gentle AI 4.0.0 resolves it from the OS home) and is restored there. The prefix's `config/gentle-ai/persona.json` is not created by setup.
353
353
  - The background-subagents policy already lands in `<prefix>/config/gentle-ai/` through `GENTLE_PI_CONFIG_HOME=<prefix>/config` (see above).
@@ -4,7 +4,7 @@ How the Gentle Pi orchestrator decides who verifies a bounded writer's work. The
4
4
 
5
5
  ## Verifier preparation
6
6
 
7
- The independent verifier makes one isolated preparation attempt. When it fails on a deterministic error in a command or environment the verifier constructed (a wrong flag, conflicting config, a typo, a path it chose), the verifier makes exactly one corrected attempt without asking and reports both. At a second failure, or at any missing or unavailable prerequisite (a tool, network, space, permission), it stops setup and reports one concrete blocker, the exact checks left unrun as unverified, not passed, and any scratch directories created. It does not otherwise retry setup or chain helper repairs. When the verifier returns a self-caused setup error without having used its correction, the parent relaunches it once with the corrected command, without asking a human; otherwise the parent stops with one **Needs your decision** result identifying the blocker and exact unrun checks, without continuing helper repairs or automatically relaunching for the same prerequisite. After the prerequisite is repaired, the human may explicitly request one new bounded verification attempt. Setup or infrastructure failure is distinct from a code finding, whose existing correction allowance remains; auxiliary tooling defects remain subject to the existing correction bound, which setup failure does not reset. Successful preparation continues to authorized checks and independent probes within the existing isolation and permission boundaries.
7
+ The independent verifier makes one isolated preparation attempt. When it fails on a deterministic error in a command or environment the verifier constructed (a wrong flag, conflicting config, a typo, a path it chose), the verifier makes exactly one corrected attempt without asking and reports both. At a second failure, or at any missing or unavailable prerequisite (a tool, network, space, permission), it stops setup and reports one concrete blocker, the exact checks left unrun as unverified, not passed, and any scratch directories created. It does not otherwise retry setup or chain helper repairs. When the verifier returns a self-caused setup error without having used its correction, the parent relaunches it once with the corrected command, without asking a human; otherwise the parent stops that verification and reports the blocker and exact unrun checks as unverified (the unit stays `status: partial`; independent authorized work continues), without continuing helper repairs or automatically relaunching for the same prerequisite. After the prerequisite is repaired, the human may explicitly request one new bounded verification attempt. Setup or infrastructure failure is distinct from a code finding, whose existing correction allowance remains; auxiliary tooling defects remain subject to the existing correction bound, which setup failure does not reset. Successful preparation continues to authorized checks and independent probes within the existing isolation and permission boundaries.
8
8
 
9
9
  For Git-dependent checks, the runner exposes the absolute packaged `scripts/prepare-verifier.mjs` path through `GENTLE_PI_VERIFIER_PREPARER`. In one Bash call, invoke `s=$(mktemp -d) && node "$GENTLE_PI_VERIFIER_PREPARER" "$PWD" "$s" '<plan-json>'` to create and use an empty system-temp scratch directory. The plan has `include` (required untracked source and ignored dependency paths), `checks` (exact commands left unrun on failure), optional `baseline` (full commit ID), and optional `runtimeArtifacts` (known socket/FIFO paths to verify and identify as excluded). Git does not enumerate sockets; exclusions are explicitly declared, not discovered by a recursive filesystem scan. It preserves HEAD, the index and current tracked bytes in an independent local Git repository; unselected ignored evidence is excluded. It never runs probes, fetches remote objects or installs dependencies. A successful receipt identifies `work`, elapsed milliseconds, regular-file payload bytes and excluded runtime artifacts; failure exits nonzero with zero probes and exact unrun commands.
10
10
 
@@ -18,9 +18,11 @@ A failed setup is not the same as an unavailable verifier capability. After the
18
18
 
19
19
  This request does not permit automatic retries, reset native budgets, override a denial or terminal native outcome, or bypass consent or an explicit one-run/no-retry limit. If the prerequisite is still missing, report the exact blocker rather than repeating the failed setup.
20
20
 
21
- ### Explicit recovery after worker correction exhaustion
21
+ ### Parent continuation after worker correction exhaustion
22
22
 
23
- A worker-local correction limit ends its automatic cycle, not necessarily the feature. The partial report must preserve the failed commands, output, remaining implementation work, and missing proof. The parent can offer a concrete continuation for explicit human authorization, naming its scope, executor, correction limit, and checks; the human can also stop. A later conversation is not a budget reset, and an active or uncertain child prevents continuation.
23
+ The worker keeps its limit: one correction per failing check, a second only if the same check still fails after a real fix, then `status: partial`. That ends the worker's cycle, not the unit. The partial report must preserve the failed commands, output, remaining implementation work, missing proof, and the worker's diagnosed cause of the loop with its evidence. The parent decides the next step from the returned evidence, without asking the user: it names the cause (a wrong test, a wrong hypothesis, missing context, a setup or environment error, a real blocker) and acts on it through the route the active delegation mode allows. In organic mode it may fix the cause inline when it is small and understood (Task Size and writer rules unchanged); in full delegation mode it never edits and launches a new bounded writer whose handoff carries the diagnosis and the new evidence with a changed scope or hypothesis. The parent never repeats the same attempt and never swaps executors merely to dodge a limit. If the next attempt fails with the same cause, or no new hypothesis exists, the parent stops that unit as blocked with the evidence and continues independent work. The user is asked only for a genuinely human decision: scope, authority, consent, privacy, destructive or publishing actions, or a denial. A later conversation is not a budget reset, and an active or uncertain child prevents continuation.
24
+
25
+ RED construction is not a fix correction. Making a new test fail for the expected reason has its own setup bound: one self-fix for the test's harness or setup errors, separate from the fix's correction limit. If the test still cannot reproduce the failure, the worker returns a reproduction blocker with its evidence, not exhausted corrections.
24
26
 
25
27
  Specifically authorized compilation or implementation can continue only when actual native authority and other applicable limits permit it. A read-only inspection with no instantiated native budget does not itself prohibit ordinary edits; it also grants no review approval. Missing required proof still blocks completion and delivery. Native recovery, consent, and terminal-outcome rules remain separate and unchanged.
26
28
 
@@ -42,7 +44,7 @@ The `gentle-ai-verify` launch is admitted only when its `task` or `context` decl
42
44
 
43
45
  Assessment and admission are separate gates. A `gentle_review assess` plan (or its native `review assess` source) may name an independent verifier in the verification plan; it does not grant launch admission. Admission re-validates the actual launch envelope at `tool_call` time and does not receive the assessment result, so a plan that names the verifier can still be rejected when the envelope carries no supported declaration.
44
46
 
45
- After a rejection, no gate-level disposition exists for the same launch: do not retry it, and do not substitute another agent for the verifier. The rejection is launch-scoped, not feature-scoped: it does not make the verifier unavailable for the whole feature, does not mean the change has no risk, and does not by itself keep later required proof unavailable. A new verifier launch requires the user's explicit decision in a new prompt, with a conforming envelope whose risk declaration reflects the actual change. Inline tests, the writer's self-verification, and a user's visual approval never replace the missing independent verification; when it stays unavailable, close with **Needs your decision** naming the missing proof.
47
+ After a rejection, no gate-level disposition exists for the same launch: do not retry it, and do not substitute another agent for the verifier. The rejection is launch-scoped, not feature-scoped: it does not make the verifier unavailable for the whole feature, does not mean the change has no risk, and does not by itself keep later required proof unavailable. A new verifier launch requires the user's explicit decision in a new prompt, with a conforming envelope whose risk declaration reflects the actual change. Inline tests, the writer's self-verification, and a user's visual approval never replace the missing independent verification; when it stays unavailable, report the missing proof and do not claim the change complete.
46
48
 
47
49
  ## Background capability admission
48
50
 
@@ -0,0 +1,303 @@
1
+ # Read a Gentle Shell session's desktop snapshot
2
+
3
+ Every live Gentle Shell session keeps one JSON snapshot of what its terminal UI
4
+ shows, so another process (the Gentle Shell Desktop mods for Herdr app) can show
5
+ the same information without attaching to the session. The packaged
6
+ `gentle-desktop-feed` extension loads automatically; it is only active in
7
+ interactive top-level Gentle Shell sessions (the TUI or an interactive RPC host).
8
+ Subagent children, plain Pi, and print/JSON runs publish nothing.
9
+
10
+ ## Location
11
+
12
+ ```
13
+ <agentDir>/desktop/sessions/<sessionId>.json
14
+ ```
15
+
16
+ `agentDir` is the session's Pi agent directory (`GENTLE_PI_AGENT_HOME`, then
17
+ `PI_CODING_AGENT_DIR`, then `~/.pi/agent`): `~/.gentle-shell/agent` for the
18
+ bundled Gentle Shell, `~/.pi/agent` for Gentle AI installed as a Pi extension,
19
+ or a custom home. The snapshot names it in `identity.agentDir` (absolute), and
20
+ every other path of the session (its action inbox and outbox) is under it. A
21
+ session id that is not a plain `[A-Za-z0-9_-]` name is stored under its SHA-256
22
+ instead.
23
+
24
+ ### Where readers look
25
+
26
+ The Herdr app mods read the snapshots of every agent dir they know, bundled
27
+ first:
28
+
29
+ 1. `~/.gentle-shell/agent`
30
+ 2. `~/.pi/agent`
31
+ 3. each entry of `~/.config/herdr-app/gentle-shell-roots.json`, when that file
32
+ exists: `{ "roots": ["/abs/agent/dir", "~/other/agent"] }` (a bare array works
33
+ too). Entries are absolute or start with `~/`; anything else is ignored, and
34
+ at most 8 agent dirs are read in total.
35
+
36
+ They watch each existing `desktop/sessions` folder (a 10 s timer catches a
37
+ folder created later), match a terminal to a snapshot across all of them, and
38
+ send that session's actions to the inbox under its own `identity.agentDir`.
39
+
40
+ Every live snapshot is a session the desktop shows, wherever it runs: in a
41
+ terminal of the Herdr app window (kind **Herdr**), or in any other terminal —
42
+ the Herdr TUI, Ghostty, a herdr-core terminal this window does not show (kind
43
+ **TUI**). A snapshot counts as live while its publisher's `identity.pid` runs
44
+ (one `ps -p` per refresh for the pids not checked in the last 5 s; without `ps`
45
+ every snapshot counts). A Herdr session takes typed input in its terminal; a TUI
46
+ session takes prompts and answers through its inbox (`send_prompt`,
47
+ `answer_question` with `via: "session"`, below). A
48
+ snapshot from an older Gentle Shell without `identity.agentDir` is treated as
49
+ belonging to the agent dir it was found in. Herdr app lets mods read only under
50
+ the home folder, so an agent dir outside it is not seen.
51
+
52
+ The file is replaced atomically (exclusive temp file in the same folder, then
53
+ rename), only when its content changed (`updatedAt` and job elapsed counters
54
+ are not content): an idle session never rewrites it and arms no timer. Writes
55
+ come in two tiers (see Performance below): urgent state within 16 ms, the rest
56
+ at most once per second while the session is busy and 250 ms after a change
57
+ while it is idle. It is removed when
58
+ the session shuts down (quit, `/new`, `/resume`, reload). A crashed session can
59
+ leave its file behind; the next session start drops files whose publisher pid is
60
+ gone or that were not updated for a day. The folder is created `0700` and files
61
+ `0600`; symlinked folders or files are refused.
62
+
63
+ ## Format: `gentle-shell.desktop-feed/v1`
64
+
65
+ | Field | Content |
66
+ |---|---|
67
+ | `identity` | `sessionId`, exact `sessionFile`, `sessionName`, `cwd`, `realCwd`, `pid`, `ppid`, `ancestors` (nearest first, best effort), `mode`, `agentDir` (absolute agent dir the snapshot lives under), `herdr` (`paneId` from `HERDR_PANE_ID`, `env`) or `null` |
68
+ | `project` | `cwd`, `branch`, `dirty` (changed files, `null` before the first scan) |
69
+ | `model` | `id`, `provider`, `effort` (thinking level when the model reasons), `profile` `{ name, tier }` |
70
+ | `persona` | always `null` (no reachable owner yet) |
71
+ | `context` | `percent`, `tokens`, `window` |
72
+ | `cost` | `total` (session spend), `subscription` |
73
+ | `usage` | what the TUI usage panel (alt+u, `/gentle:usage`) shows, from the same owner: the session's provider at the top level (`provider`, `status`, `plan`, `fetchedAt`, `note`, `limits[]` with `name`, `limitReached` and every `windows[]` entry: `label`, `usedPercent`, `windowSeconds`, `resetAt`), and every provider the panel lists in `providers[]` (the session's own first, then its subagent routes; same fields). `note` is the panel's own words for a provider without windows (`usage arrives with the first response`, `no usage yet · r to fetch`, `fetch failed · r to retry`, `no subscription usage for this provider`), else `null`. `plan` is the plan name the provider reports (Codex does; Anthropic's headers carry none, so it stays `null` there, as in the panel). `null` before the owner answered |
74
+ | `profiles` | the saved model profiles (`/gentle:profiles`' store): `active` (the profile this session routes with), `default` (the store's default for new sessions), `items[]` (`name`, `tier`, `mode`, `orchestrator` `{ model, thinking, tier }` or `null`, `roles[]` `{ agent, model, thinking }` alphabetical, `inherit` when unset, `truncated`), `truncated`; `null` when the store cannot be read |
75
+ | `permission` | `mode` (`normal`, `auto`, `yolo`, `super-yolo`), `defaultMode`, `yolo`, `detail` |
76
+ | `statuses`, `integrations` | always `null` (pi exposes extension statuses only to the footer owner) |
77
+ | `todo` | `items[]` (`id`, `title`, `state`, `note`), `progress` (`done`, `total`, `open`), `current`, `truncated` |
78
+ | `changes` | `files[]` (`path`, `status`, `added`, `deleted`), `summary`, `worktrees[]`, `truncated`; `null` before the first scan. An untracked file's `added` is its line count (git's numstat never lists it); a binary file, a file over 1 MiB, an unreadable file or one past 200 untracked files per scan has `added` and `deleted` `null` (no count) |
79
+ | `agents` | `items[]` (`id`, `name`, `role` = `null`, `state`, `step`, `model`, `thinking`, `spend`), `active`, `spend` |
80
+ | `jobs` | `running[]` and `recent[]` (finished tail) with `startedAt`, `endedAt`, `exitCode`, `elapsedMs` at write time |
81
+ | `review` | `state`, `label`, `scope` |
82
+ | `stats` | `turns`, `toolCalls`, `toolErrors`, `cost`, token counts, `cacheHitRate`, `durationMs`, `models[]` |
83
+ | `activity` | `state` (`working`, `waiting`, `blocked`, `idle`), `streaming`, ODD `phase` and `phaseLabel`, `blockedLabel`; S15: `agents` and `jobs` (the session's subagents and background jobs that still run, the same numbers as `agents.active` and `jobs.running`) and `label`, the words every desktop region shows: "Working · 2 agents" while the turn runs, "Waiting on 2 agents · 1 job" once the turn ended but that work still runs (`waiting`, never `idle`), the blocker's label, else "Idle". Background subagents are the agents owner's, not the jobs registry's: they count in `agents`, never in `jobs` |
84
+ | `pendingQuestion` | the open question or `null` (below) |
85
+ | `commands` | the session's slash commands for the desktop palette and the composer's `/` menu: `items[]` (`name`, `description`, `args`, `terminal`, `source`) and `truncated` (below) |
86
+
87
+ `pendingQuestion.kind` is `choice` (`ask_user_choice`), `questionnaire`
88
+ (`ask_user_question`), `prompt` (an extension dialog: `promptKind` is `select`,
89
+ `confirm`, `input` or `editor`) or `consent` (a blocker without content, such as
90
+ review consent; `question` is its label). Ask tool questions carry `tool` and
91
+ `toolCallId`, the flattened first `question`, `header`, `options`
92
+ (`label`, `description`), `multi`, `custom`, and every question in `questions`.
93
+ Opaque answer tokens (`ask_user_choice` option values) are never written.
94
+ `terminalOnly` is `true` when the desktop must not pick an answer: prompts,
95
+ consent, several questions or a multi-select question, and a provider consent or
96
+ maintenance authorization the agent relays through an ask tool (below). The
97
+ desktop then shows the options for reading only, with "Answer in Terminal".
98
+
99
+ `usage` follows the panel's own fetches; the feed never asks a provider itself.
100
+ gentle-shell fetches when the session starts (forced) and after each turn (at most
101
+ once per provider every 5 minutes), and records the windows Claude and Codex send
102
+ with every response. The feed reads the owner's store when the session starts and
103
+ after each turn, then again 2 s and 12 s later (the fetch has no event of its own;
104
+ its window is 10 s), and takes every response-carried snapshot as it is recorded.
105
+ The desktop's refresh is the panel's `r` (`refresh_usage`, below).
106
+
107
+ `commands.items` lists pi's built-in commands first (`source` `builtin`: `new`,
108
+ `resume`, `fork`, `clone`, `tree`, `compact`, `name`, `export`, `session`, `copy`,
109
+ `model`, `thinking`, … — every built-in but `/quit`, which is typed, never one click
110
+ away), then pi's command registry in its own order: extension commands
111
+ (`extension`), prompt templates (`prompt`) and skills (`skill`). `terminal` is `true`
112
+ when the command answers with a screen of the TUI (a picker, a panel, a status
113
+ report), so the desktop shows the Terminal after sending it; prompt templates and
114
+ skills answer in the conversation. `args` names the argument a command needs
115
+ (`/name <name>`): the desktop puts it in the composer instead of sending it. The
116
+ desktop RPC's own `gentle:desktop` channel is never listed; source paths never
117
+ reach the file.
118
+
119
+ Arrays are capped (200 changes, 100 todo items, 50 jobs, 50 agents, 20 models,
120
+ 4 questions, 10 options, 200 commands, 8 usage providers, 20 profiles of 40 roles); command descriptions are cut at 200
121
+ characters; free text is cut at 500 characters (questions at 2000,
122
+ paths at 1000/4096) and stripped of control characters. Readers should ignore an
123
+ unknown `schema`.
124
+
125
+ ## Performance
126
+
127
+ S13 (`odd/tasks/herdr-desktop.md`): every write wakes every desktop reader, and
128
+ every flush runs on pi's event loop, so the publisher keeps both rare and cheap.
129
+
130
+ - **Urgent tier (≤ 16 ms):** a question opening or closing (`pendingQuestion`),
131
+ a permission mode change, an `activity.state` transition (idle ↔ working ↔
132
+ waiting ↔ blocked; S15: the last subagent or job ending moves `waiting` to
133
+ `idle` at once) are written at once; a desktop prompt being held or released flushes
134
+ at once too (the snapshot has no field of its own for it, so it writes only
135
+ what changed with it). A pending routine write rides along.
136
+ - **Routine tier:** everything else (stats, context, changes, usage, commands,
137
+ agents and jobs progress, streaming) coalesces: at most one write per 1000 ms
138
+ while the agent, a job or a subagent works, 250 ms after the change while
139
+ idle. A flush whose content did not change writes nothing.
140
+ - **Cheap flushes:** session stats fold only the entries added since the last
141
+ flush (`lib/desktop-feed-stats.ts`; pi's `getEntryCount()` skips the read
142
+ when nothing was added); pi's command registry is read at the first flush
143
+ after `session_start` and after `resources_discover`, not per flush;
144
+ untracked files are counted again only when their size or mtime changed.
145
+
146
+ Measured with `tests/desktop-feed-performance.test.ts` (virtual clock; real
147
+ store writes on the local disk, Apple Silicon):
148
+
149
+ | Measure | Before | After |
150
+ | --- | --- | --- |
151
+ | Writes for 100 tool events in 10 s while working | 34 (≈ 204/min) | 10 (≈ 60/min) |
152
+ | Writes in a quiet minute | 0 | 0 |
153
+ | Question / blocker / state change visible | ≤ 250 ms | ≤ 16 ms |
154
+ | Flush, 5,000 entries + 200 changed files, incremental path (median) | 1.46 ms | 0.18–0.30 ms |
155
+ | First stats walk of 5,000 entries (once per session start) | every count change | 1.5–2.2 ms once |
156
+
157
+ The test asserts ≤ 11 routine writes per 10 s burst, writes at least one second
158
+ apart, urgent changes within 50 ms, and a median flush under 15 ms.
159
+
160
+ A command registered at runtime by another extension (no pi event announces it)
161
+ appears after the next session start or resource rediscovery.
162
+
163
+ ## Privacy
164
+
165
+ The snapshot holds workspace paths, the session file path, todo titles and notes,
166
+ changed file names, and open question text. It never holds prompts, tool
167
+ arguments other than an open question, tool output, or job commands. Do not
168
+ expose the folder through a public server.
169
+
170
+ ## Actions: `gentle-shell.desktop-action/v1`
171
+
172
+ The desktop acts on a session with exactly the authority the person has in its
173
+ terminal, never more. Each session that publishes a snapshot also keeps a private
174
+ inbox and outbox:
175
+
176
+ ```
177
+ <agentDir>/desktop/inbox/<session>/<id>.json the desktop drops one action
178
+ <agentDir>/desktop/outbox/<session>/<id>.json the session answers it
179
+ ```
180
+
181
+ `<session>` is the snapshot's file name without `.json`. The session creates both
182
+ folders `0700` when it starts (with its pid in `inbox/<session>/.owner`) and
183
+ removes them when it ends; the desktop never creates them (no inbox means the
184
+ session takes no actions). The agent's own file and shell tools are denied the
185
+ whole `<agentDir>/desktop/` folder like any other sensitive path. An action file is
186
+
187
+ ```json
188
+ { "schema": "gentle-shell.desktop-action/v1", "id": "<[A-Za-z0-9_-], 1-64, = file name>",
189
+ "sessionId": "<this session>", "kind": "<kind>", "args": { }, "createdAt": "<ISO time>" }
190
+ ```
191
+
192
+ | `kind` | `args` | Runs through |
193
+ |---|---|---|
194
+ | `set_permission_mode` | `{ mode }` (`normal`, `auto`, `yolo`, `super-yolo`) | the permission owner, as desktop RPC `set_permission_mode` (the `/gentle:mode` controller decides); an escalation is first checked against the session's activity (below) |
195
+ | `cancel_job` | `{ id }` | the background-jobs owner, as desktop RPC `cancel_job` |
196
+ | `cancel_subagent` | `{ id }` | the subagents owner, as desktop RPC `cancel_subagent` |
197
+ | `answer_question` | `{ toolCallId, option }` or `{ toolCallId, text }` | nothing is answered here: the session checks that `toolCallId` is the open `ask_user_choice` / single-question `ask_user_question` and answers the keys its real list takes (`up` to the top, `down` to the row, `enter`); the desktop presses them in the terminal, then types `text` into the list's own editor |
198
+ | `abort_turn` | `{}` | the session's own abort, the one its TUI's Esc Esc runs (in the TUI, queued messages go back to the editor); refused with `not_working` while the agent is idle |
199
+ | `send_prompt` | `{ text }` (1-4000 characters, not blank; new lines and tabs, no other control character; a CRLF line end counts as one new line) | pi's `sendUserMessage`, as if typed in the session's editor and submitted: a prompt while the agent is idle, a steer while it works (the TUI's Enter); trimmed like the editor. Refused with `question_open` while a question, an extension prompt or a consent is open. A prompt template or a skill (`/review …`, `/skill:…`) expands as in the editor; a pi built-in command, an extension command (`/gentle:mode`, …) or a `!` shell line is refused with `terminal_command` (they are TUI code with their own authority); a `/word` no command owns is plain text. Answers `{ queued }`. While pi runs a manual compaction (`/compact`) or a `/tree` navigation it refuses prompts, so the session holds the text, as the TUI editor queues it, and submits it once pi takes prompts again; it answers `{ queued: true, after: "compaction" }` (`{ queued: true }` when pi is busy with no agent run the session heard of yet). One prompt is held at a time: another one is refused with `session_compacting`; a held prompt the session ends before submitting is dropped with an error in that session's UI |
200
+ | `refresh_usage` | `{}` or `{ provider }` (1-128 characters) | the usage owner's forced refresh, as desktop RPC `refresh_subscription_usage` and the TUI usage panel's `r`; answers `{ providers: [{ provider, status, refresh? }] }` (`refresh`: `unsupported` for a provider whose windows only come with responses, `out_of_scope` for a provider the session does not target); the snapshot's `usage` follows |
201
+ | `apply_profile` | `{ name }` or `{ name, confirmation }` (each 1-128 characters) | `/gentle:profiles`' own "Use in this session", as desktop RPC `apply_profile` with mode `session` (never the global default, never another mode): the owner checks the name and binds the profile to this session. Answers `{ profile, mode, status, notes }` (`applied` or `not_applied`, with the screen's notices), or `status: "confirmation_required"` with `confirmation` `{ title, message, token }`: the desktop shows that dialog and, on Confirm, sends the same action with `confirmation: token` (the owner accepts it only while its dialog would still say the same). Owner refusals keep their codes: `unknown_profile`, `profile_apply_busy`, `profiles_unavailable`. Like `/gentle:profiles`, it also runs while the session works |
202
+ | `answer_question` with `via: "session"` | `{ toolCallId, option, via }` or `{ toolCallId, text, via }` | the same checks as the key path (still the open question, answerable from the desktop, an existing option or the list's free-text row), then the ask tool's own list takes the answer, exactly as a click or Enter in it would; answers `{ toolCallId, answered: true }`, or `answer_in_terminal` ("Answer this question in that session's terminal.") when the list has no handle (a Gentle Shell older than this one) |
203
+
204
+ The session refuses, removes and answers (code in `error.code`) a file that is a
205
+ link, not a private regular file (`unsafe_file`), over 16 KiB (`too_large`), older
206
+ than 60 s or dated ahead (`stale`), of another kind (`unknown_kind`), for another
207
+ session (`wrong_session`), malformed or with other args (`invalid_action`), already
208
+ run (`duplicate`), a question that is no longer open (`question_mismatch`), a
209
+ stop while the agent is idle (`not_working`), a permission escalation written
210
+ while the session was busy (`escalation_while_busy`), a prompt while a question is
211
+ open (`question_open`), a prompt that is a command or shell line only the terminal
212
+ runs (`terminal_command`), a second prompt while one is held for after a
213
+ compaction (`session_compacting`), a prompt to a session without a prompt
214
+ owner (`unsupported`).
215
+
216
+ **Prompts are not human evidence.** A `send_prompt` reaches pi with the input
217
+ source `extension`, as any extension message does, never `interactive`: Gentle
218
+ AI's consent and reply-language rules, which count only interactive input as the
219
+ person's own words, never treat a desktop prompt as a typed consent. Consent stays
220
+ in the terminal.
221
+
222
+ **The ask tools' answer handle.** `ask_user_choice` and `ask_user_question`
223
+ register, while their TUI list is open, one handle per tool call id in a
224
+ process-wide registry (`lib/desktop-feed-answers.ts`; their event-bus traffic is
225
+ unchanged). It finishes the list once, with the result a click gives; a finished
226
+ list leaves the registry. Only a single single-select question can be answered
227
+ through it, and never with a consent token (`granted`, `declined`) as the option
228
+ value, label or typed text.
229
+ A non-regular entry (a folder, a FIFO, a device) is refused once: an empty
230
+ folder is removed, anything that cannot be removed is skipped until it changes.
231
+
232
+ **Escalations.** Any process of the same user can write the inbox, the agent's
233
+ own tools included (the tool guard covers the folder by name, but a shell can
234
+ spell a path other ways). So a change to a less restrictive mode (`normal` →
235
+ `auto` → `yolo` → `super-yolo`) is refused with `escalation_while_busy`, before
236
+ the permission owner is asked, when its file was last written (the later of the
237
+ file's `mtime` and `ctime`, never `createdAt`) while the agent worked, a
238
+ background job or a subagent of the session ran, within 2 s after that activity
239
+ ended, or before the session started. Lowering the mode, `abort_turn` and the
240
+ `cancel_*` actions are always accepted. `apply_profile` does not follow this rule:
241
+ like `/gentle:profiles` in the TUI, it runs while the session works. The desktop's confirmation dialog stays
242
+ the human gate for Super-YOLO; the session does not ask for a dialog nonce,
243
+ because a nonce file would be written by the same user the agent runs as and
244
+ proves nothing the activity check does not.
245
+
246
+ Multi-question and multi-select questions, extension prompts and consent are
247
+ answered in the terminal (`answer_in_terminal`); consent is never answered from
248
+ the desktop. That includes a provider consent or maintenance authorization the
249
+ agent relays through `ask_user_choice` / `ask_user_question`: the session treats
250
+ an ask call as such a relay when a tool result in the same or the previous agent
251
+ run carried a provider decision (a `gentle-ai.review-integration.consent/…` or
252
+ `gentle-ai.review-repair-authorization/…` envelope, a consent binding,
253
+ `maintainer_authorization`), or when the call's own options carry the consent
254
+ answers (`granted` / `declined`) or such an envelope. Every file is removed once
255
+ read; a fresh file that does not parse yet is read again 250 ms later (it may
256
+ still be written).
257
+
258
+ The answer is `{ schema: "gentle-shell.desktop-action-result/v1", id, sessionId,
259
+ kind, ok, data | error, finishedAt }`, `0600`, `data` at most 4 KiB. Owner errors
260
+ keep the owner's code and message (`permission_denied`, `not_found`, …); the
261
+ desktop shows them. The session keeps at most 32 answers for 10 minutes and
262
+ removes the folder when it ends (Herdr mods may write files only under the app's
263
+ own folder, so the desktop leaves answers in place). A session killed without
264
+ its shutdown leaves both folders behind; a later session start removes them once
265
+ they have not changed for 10 minutes and their session is proven gone: the pid in
266
+ `.owner` (or, without one, in its snapshot) no longer runs, or there is neither.
267
+ A live session's folders stay however long it is idle.
268
+
269
+ What the desktop does without this inbox, as the person would, for a session in
270
+ a terminal of its window (kind Herdr): it sends prompts
271
+ and the TUI's own slash commands (any command typed in the composer or chosen in
272
+ the `/` menu or the ⌘K palette, and the views' own `/gentle:changes`,
273
+ `/gentle:agents`, `/gentle:jobs`, `/gentle:profiles`, `/gentle:persona`) with
274
+ `hc send`, only while no question is open (the composer refuses to send while
275
+ one is); it pastes the clipboard with Ctrl+V; and the review switch runs
276
+ `gentle-ai review mode enable|disable --scope global --cwd <project> --json`
277
+ after a confirmation that says it is global: it changes receipt-driven review for
278
+ every repository (a repository's clone-local `off` still wins). Super-YOLO and
279
+ the review switch ask in a dialog first (`gentle-confirm`: Confirm runs the
280
+ action once; Cancel or Esc forgets it, and an unanswered dialog expires after two
281
+ minutes). Right before pressing an answer's keys, the chat reads the snapshot
282
+ again and presses nothing if the question changed.
283
+
284
+ ## Desktop keys
285
+
286
+ The Herdr mods ship `herdr/keys.json`, a `layout:gentle-shell` section for the
287
+ person's `~/.config/herdr-app/keys.json` (merged into it, never replacing a key
288
+ they already use):
289
+
290
+ | Key | Command | Does |
291
+ |---|---|---|
292
+ | ⌘K | `mod.open:gentle-palette` | the Gentle commands palette: needs-you items, session commands, views, permission modes, every command of the session |
293
+ | ⌘J | `gentle-status.toggle` | Chat ↔ Terminal |
294
+ | ⌘. | `gentle-status.stop` | stops the shown session's turn (`abort_turn`) |
295
+ | ⌥⌘1 … ⌥⌘6 | `gentle-inspector.tab-<changes\|todo\|agents\|jobs\|review\|session>` | the inspector tab |
296
+
297
+ `gentle-status.session-next` and `gentle-status.session-prev` (no default key; run
298
+ them with `herdr-app do` or bind them) show the next or previous live session,
299
+ wherever it runs.
300
+
301
+ Inside the chat, without that merge: ⌘K opens the palette, ⌘J shows the Terminal,
302
+ Esc Esc stops the agent (Esc first closes the `/` menu), and `/` in the composer
303
+ opens the command menu (↑/↓ move, Enter runs, Tab completes, Esc closes).