gentle-pi 4.7.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 (617) hide show
  1. package/README.md +115 -44
  2. package/assets/agents/gentle-ai-explore.md +3 -3
  3. package/assets/agents/gentle-ai-verify.md +20 -6
  4. package/assets/agents/gentle-ai-worker.md +14 -13
  5. package/assets/agents/jd-judge-a.md +1 -3
  6. package/assets/agents/jd-judge-b.md +1 -3
  7. package/assets/agents/review-readability.md +1 -5
  8. package/assets/agents/review-reliability.md +1 -5
  9. package/assets/agents/review-resilience.md +1 -5
  10. package/assets/agents/review-risk.md +1 -5
  11. package/assets/design-canvas/canvas-api.js +45 -0
  12. package/assets/design-canvas/canvas-boards.js +476 -0
  13. package/assets/design-canvas/canvas-boot.js +219 -0
  14. package/assets/design-canvas/canvas-checks.js +491 -0
  15. package/assets/design-canvas/canvas-comments.js +315 -0
  16. package/assets/design-canvas/canvas-compare.js +159 -0
  17. package/assets/design-canvas/canvas-events.js +75 -0
  18. package/assets/design-canvas/canvas-export.js +393 -0
  19. package/assets/design-canvas/canvas-focus.js +203 -0
  20. package/assets/design-canvas/canvas-handoffs.js +150 -0
  21. package/assets/design-canvas/canvas-i18n-es.js +397 -0
  22. package/assets/design-canvas/canvas-i18n.js +108 -0
  23. package/assets/design-canvas/canvas-layout.js +526 -0
  24. package/assets/design-canvas/canvas-menu.js +219 -0
  25. package/assets/design-canvas/canvas-messages.js +86 -0
  26. package/assets/design-canvas/canvas-minimap.js +163 -0
  27. package/assets/design-canvas/canvas-parts.js +401 -0
  28. package/assets/design-canvas/canvas-popover.js +234 -0
  29. package/assets/design-canvas/canvas-rail.js +351 -0
  30. package/assets/design-canvas/canvas-sizes.js +524 -0
  31. package/assets/design-canvas/canvas-store.js +167 -0
  32. package/assets/design-canvas/canvas-theme.js +69 -0
  33. package/assets/design-canvas/canvas-tokens.js +674 -0
  34. package/assets/design-canvas/canvas-ui.js +24 -0
  35. package/assets/design-canvas/canvas-view.js +184 -0
  36. package/assets/design-canvas/canvas.css +773 -17
  37. package/assets/design-canvas/canvas.js +2 -1506
  38. package/assets/design-canvas/index.html +120 -36
  39. package/assets/design-canvas/inspector.js +574 -21
  40. package/assets/design-canvas/theme-early.js +10 -0
  41. package/assets/install-wizard/wizard.js +5 -1
  42. package/assets/migrations/agent-body-history.json +30 -0
  43. package/assets/orchestrator-delegation-reference.md +8 -14
  44. package/assets/orchestrator-delegation.md +5 -9
  45. package/assets/orchestrator-full-delegation-card.md +11 -16
  46. package/assets/orchestrator-full-delegation.md +9 -9
  47. package/assets/orchestrator-memory.md +4 -4
  48. package/assets/orchestrator-prompts.md +3 -31
  49. package/assets/orchestrator-quota-recovery.md +5 -0
  50. package/assets/orchestrator-skills.md +13 -12
  51. package/assets/orchestrator-tracking.md +13 -17
  52. package/assets/orchestrator-verification.md +12 -10
  53. package/assets/orchestrator-writer.md +13 -13
  54. package/assets/orchestrator.md +20 -24
  55. package/bin/gentle-shell.mjs +205 -10
  56. package/contracts/review-provider-contract-mirror/provider-contract.lock.json +8 -9
  57. package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.6.0}/bundle/manifest.json +3 -3
  58. package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.6.0}/bundle/orchestration/pi.md +2 -1
  59. package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.6.0}/bundle/routing/pi.md +16 -16
  60. package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.6.0}/generated/provider-capabilities.baseline.json +3 -3
  61. package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.6.0}/generated/provider-roles.baseline.json +1 -1
  62. package/docs/assets/brand/sponsor-banner.svg +60 -0
  63. package/docs/assets/features/gentle-tower.png +0 -0
  64. package/docs/auto-permission-answers.md +1 -1
  65. package/docs/bundled-install.md +14 -6
  66. package/docs/delegated-verification.md +23 -5
  67. package/docs/desktop-feed.md +303 -0
  68. package/docs/desktop-rpc.md +1931 -0
  69. package/docs/fast-mode.md +2 -2
  70. package/docs/gentle-agents-activity.md +26 -0
  71. package/docs/gentle-shell-desktop.md +465 -0
  72. package/docs/gentle-shell.md +102 -17
  73. package/docs/images/desktop/chat.png +0 -0
  74. package/docs/images/desktop/palette.png +0 -0
  75. package/docs/images/desktop/todo.png +0 -0
  76. package/docs/install-wizard.md +30 -21
  77. package/docs/odd-preparation-continuity.md +24 -0
  78. package/docs/permission-modes.md +9 -1
  79. package/docs/prompt-budget.md +12 -0
  80. package/docs/rdd-odd-friction-triage-2026-11-07.md +57 -0
  81. package/docs/readme-reference.md +113 -32
  82. package/docs/review-coordinator.md +29 -9
  83. package/docs/review-delivery-preflight.md +22 -0
  84. package/docs/work-continuity.md +19 -6
  85. package/extensions/ask-user-choice.ts +36 -18
  86. package/extensions/ask-user-question.ts +48 -9
  87. package/extensions/child-context.ts +21 -7
  88. package/extensions/gentle-agents.ts +436 -66
  89. package/extensions/gentle-ai.ts +809 -158
  90. package/extensions/gentle-design.ts +69 -3
  91. package/extensions/gentle-desktop-feed.ts +778 -0
  92. package/extensions/gentle-desktop-rpc.ts +276 -0
  93. package/extensions/gentle-guide.ts +3 -0
  94. package/extensions/gentle-herdr-desktop-status.ts +275 -0
  95. package/extensions/gentle-shell.ts +174 -59
  96. package/extensions/gentle-stats.ts +30 -1
  97. package/extensions/gentle-todo.ts +48 -25
  98. package/extensions/gentle-tower.ts +305 -0
  99. package/extensions/skill-registry.ts +260 -225
  100. package/herdr/RECIPE.md +157 -0
  101. package/herdr/keys.json +14 -0
  102. package/herdr/layouts/gentle-shell.json +202 -0
  103. package/herdr/mods/gentle-agents/icons/kind-herdr.svg +1 -0
  104. package/herdr/mods/gentle-agents/icons/kind-remote.svg +1 -0
  105. package/herdr/mods/gentle-agents/icons/kind-tui.svg +1 -0
  106. package/herdr/mods/gentle-agents/main.js +190 -0
  107. package/herdr/mods/gentle-agents/mod.json +1 -0
  108. package/herdr/mods/gentle-agents/snapshot.js +469 -0
  109. package/herdr/mods/gentle-agents/tokens.js +273 -0
  110. package/herdr/mods/gentle-chat/MINIMAL.md +69 -0
  111. package/herdr/mods/gentle-chat/actions.js +180 -0
  112. package/herdr/mods/gentle-chat/feed.js +321 -0
  113. package/herdr/mods/gentle-chat/icons/branch.svg +1 -0
  114. package/herdr/mods/gentle-chat/icons/chat.svg +1 -0
  115. package/herdr/mods/gentle-chat/icons/check.svg +1 -0
  116. package/herdr/mods/gentle-chat/icons/chev.svg +1 -0
  117. package/herdr/mods/gentle-chat/icons/clip.svg +1 -0
  118. package/herdr/mods/gentle-chat/icons/down.svg +1 -0
  119. package/herdr/mods/gentle-chat/icons/folder.svg +1 -0
  120. package/herdr/mods/gentle-chat/icons/kind-herdr.svg +1 -0
  121. package/herdr/mods/gentle-chat/icons/kind-remote.svg +1 -0
  122. package/herdr/mods/gentle-chat/icons/kind-tui.svg +1 -0
  123. package/herdr/mods/gentle-chat/icons/mark.svg +1 -0
  124. package/herdr/mods/gentle-chat/icons/send.svg +1 -0
  125. package/herdr/mods/gentle-chat/icons/shield.svg +1 -0
  126. package/herdr/mods/gentle-chat/icons/stop.svg +1 -0
  127. package/herdr/mods/gentle-chat/icons/term.svg +1 -0
  128. package/herdr/mods/gentle-chat/icons/user.svg +1 -0
  129. package/herdr/mods/gentle-chat/icons/x.svg +1 -0
  130. package/herdr/mods/gentle-chat/main.js +968 -0
  131. package/herdr/mods/gentle-chat/mod.json +1 -0
  132. package/herdr/mods/gentle-chat/session.js +212 -0
  133. package/herdr/mods/gentle-chat/snapshot.js +469 -0
  134. package/herdr/mods/gentle-chat/tokens.js +137 -0
  135. package/herdr/mods/gentle-chat/ui.js +883 -0
  136. package/herdr/mods/gentle-confirm/main.js +60 -0
  137. package/herdr/mods/gentle-confirm/mod.json +1 -0
  138. package/herdr/mods/gentle-inspector/actions.js +180 -0
  139. package/herdr/mods/gentle-inspector/icons/bolt.svg +1 -0
  140. package/herdr/mods/gentle-inspector/icons/bot.svg +1 -0
  141. package/herdr/mods/gentle-inspector/icons/check.svg +1 -0
  142. package/herdr/mods/gentle-inspector/icons/db.svg +1 -0
  143. package/herdr/mods/gentle-inspector/icons/diff.svg +1 -0
  144. package/herdr/mods/gentle-inspector/icons/jobs.svg +1 -0
  145. package/herdr/mods/gentle-inspector/icons/plug.svg +1 -0
  146. package/herdr/mods/gentle-inspector/icons/review.svg +1 -0
  147. package/herdr/mods/gentle-inspector/icons/stats.svg +1 -0
  148. package/herdr/mods/gentle-inspector/icons/stop.svg +1 -0
  149. package/herdr/mods/gentle-inspector/icons/todo.svg +1 -0
  150. package/herdr/mods/gentle-inspector/main.js +500 -0
  151. package/herdr/mods/gentle-inspector/mod.json +1 -0
  152. package/herdr/mods/gentle-inspector/snapshot.js +469 -0
  153. package/herdr/mods/gentle-inspector/tokens.js +273 -0
  154. package/herdr/mods/gentle-palette/actions.js +180 -0
  155. package/herdr/mods/gentle-palette/icons/bolt.svg +1 -0
  156. package/herdr/mods/gentle-palette/icons/bot.svg +1 -0
  157. package/herdr/mods/gentle-palette/icons/chat.svg +1 -0
  158. package/herdr/mods/gentle-palette/icons/check.svg +1 -0
  159. package/herdr/mods/gentle-palette/icons/cmd.svg +1 -0
  160. package/herdr/mods/gentle-palette/icons/diff.svg +1 -0
  161. package/herdr/mods/gentle-palette/icons/jobs.svg +1 -0
  162. package/herdr/mods/gentle-palette/icons/plus.svg +1 -0
  163. package/herdr/mods/gentle-palette/icons/review.svg +1 -0
  164. package/herdr/mods/gentle-palette/icons/search.svg +1 -0
  165. package/herdr/mods/gentle-palette/icons/shield.svg +1 -0
  166. package/herdr/mods/gentle-palette/icons/stats.svg +1 -0
  167. package/herdr/mods/gentle-palette/icons/stop.svg +1 -0
  168. package/herdr/mods/gentle-palette/icons/term.svg +1 -0
  169. package/herdr/mods/gentle-palette/icons/todo.svg +1 -0
  170. package/herdr/mods/gentle-palette/main.js +333 -0
  171. package/herdr/mods/gentle-palette/mod.json +1 -0
  172. package/herdr/mods/gentle-palette/snapshot.js +469 -0
  173. package/herdr/mods/gentle-palette/tokens.js +273 -0
  174. package/herdr/mods/gentle-pane/icons/chat.svg +1 -0
  175. package/herdr/mods/gentle-pane/icons/close.svg +1 -0
  176. package/herdr/mods/gentle-pane/icons/kind-herdr.svg +1 -0
  177. package/herdr/mods/gentle-pane/icons/kind-remote.svg +1 -0
  178. package/herdr/mods/gentle-pane/icons/kind-tui.svg +1 -0
  179. package/herdr/mods/gentle-pane/icons/split-down.svg +1 -0
  180. package/herdr/mods/gentle-pane/icons/split-right.svg +1 -0
  181. package/herdr/mods/gentle-pane/icons/term.svg +1 -0
  182. package/herdr/mods/gentle-pane/icons/unzoom.svg +1 -0
  183. package/herdr/mods/gentle-pane/icons/zoom.svg +1 -0
  184. package/herdr/mods/gentle-pane/main.js +91 -0
  185. package/herdr/mods/gentle-pane/mod.json +1 -0
  186. package/herdr/mods/gentle-pane/snapshot.js +469 -0
  187. package/herdr/mods/gentle-pane/tokens.js +273 -0
  188. package/herdr/mods/gentle-sidebar/actions.js +180 -0
  189. package/herdr/mods/gentle-sidebar/icons/gear.svg +1 -0
  190. package/herdr/mods/gentle-sidebar/icons/mark.svg +1 -0
  191. package/herdr/mods/gentle-sidebar/icons/refresh.svg +1 -0
  192. package/herdr/mods/gentle-sidebar/icons/server-plus.svg +1 -0
  193. package/herdr/mods/gentle-sidebar/main.js +171 -0
  194. package/herdr/mods/gentle-sidebar/mod.json +1 -0
  195. package/herdr/mods/gentle-sidebar/snapshot.js +469 -0
  196. package/herdr/mods/gentle-sidebar/tokens.js +273 -0
  197. package/herdr/mods/gentle-spaces/icons/kind-herdr.svg +1 -0
  198. package/herdr/mods/gentle-spaces/icons/kind-remote.svg +1 -0
  199. package/herdr/mods/gentle-spaces/icons/kind-tui.svg +1 -0
  200. package/herdr/mods/gentle-spaces/icons/monitor.svg +1 -0
  201. package/herdr/mods/gentle-spaces/icons/plus.svg +1 -0
  202. package/herdr/mods/gentle-spaces/icons/server.svg +1 -0
  203. package/herdr/mods/gentle-spaces/machines.js +31 -0
  204. package/herdr/mods/gentle-spaces/main.js +299 -0
  205. package/herdr/mods/gentle-spaces/mod.json +1 -0
  206. package/herdr/mods/gentle-spaces/snapshot.js +469 -0
  207. package/herdr/mods/gentle-spaces/tokens.js +273 -0
  208. package/herdr/mods/gentle-status/actions.js +180 -0
  209. package/herdr/mods/gentle-status/main.js +192 -0
  210. package/herdr/mods/gentle-status/mod.json +1 -0
  211. package/herdr/mods/gentle-status/snapshot.js +469 -0
  212. package/herdr/mods/gentle-status/tokens.js +273 -0
  213. package/herdr/mods/gentle-tabs/icons/close.svg +1 -0
  214. package/herdr/mods/gentle-tabs/icons/kind-herdr.svg +1 -0
  215. package/herdr/mods/gentle-tabs/icons/kind-remote.svg +1 -0
  216. package/herdr/mods/gentle-tabs/icons/kind-tui.svg +1 -0
  217. package/herdr/mods/gentle-tabs/icons/plus.svg +1 -0
  218. package/herdr/mods/gentle-tabs/icons/win-close.svg +1 -0
  219. package/herdr/mods/gentle-tabs/icons/win-max.svg +1 -0
  220. package/herdr/mods/gentle-tabs/icons/win-min.svg +1 -0
  221. package/herdr/mods/gentle-tabs/icons/win-restore.svg +1 -0
  222. package/herdr/mods/gentle-tabs/main.js +171 -0
  223. package/herdr/mods/gentle-tabs/mod.json +1 -0
  224. package/herdr/mods/gentle-tabs/snapshot.js +469 -0
  225. package/herdr/mods/gentle-tabs/tokens.js +273 -0
  226. package/herdr/mods/gentle-tokens/main.js +20 -0
  227. package/herdr/mods/gentle-tokens/mod.json +1 -0
  228. package/herdr/mods/gentle-tokens/snapshot.js +469 -0
  229. package/herdr/mods/gentle-tokens/tokens.js +273 -0
  230. package/herdr/preview.png +0 -0
  231. package/herdr/themes/gentle-shell-dark.json +33 -0
  232. package/herdr/themes/gentle-shell-light.json +34 -0
  233. package/lib/agent-assets.ts +30 -6
  234. package/lib/agent-tool-overlay.ts +117 -0
  235. package/lib/agents-config.ts +47 -6
  236. package/lib/agents-message-delivery.ts +17 -0
  237. package/lib/agents-messaging.ts +8 -2
  238. package/lib/agents-protocol.ts +17 -0
  239. package/lib/agents-report-cap.ts +115 -0
  240. package/lib/agents-rpc-publisher.ts +39 -12
  241. package/lib/agents-runner.ts +92 -6
  242. package/lib/agents-session-transport.ts +17 -1
  243. package/lib/auto-permission-answers.ts +2 -1
  244. package/lib/background-jobs-tools.ts +9 -4
  245. package/lib/background-jobs.ts +22 -2
  246. package/lib/bounded-writer-admission.ts +184 -31
  247. package/lib/change-diff.ts +104 -0
  248. package/lib/child-context-files.ts +21 -6
  249. package/lib/codemode-renderer.ts +1 -0
  250. package/lib/commit-slice-signal.ts +1 -1
  251. package/lib/delivery-conflict-markers.ts +349 -0
  252. package/lib/design-canvas-assets.ts +38 -0
  253. package/lib/design-canvas-server.ts +241 -23
  254. package/lib/design-comments.ts +94 -4
  255. package/lib/design-handoffs.ts +2 -1
  256. package/lib/design-layout.ts +125 -0
  257. package/lib/design-parts.ts +281 -0
  258. package/lib/design-system-tokens.ts +111 -0
  259. package/lib/desktop-agents-service.ts +315 -0
  260. package/lib/desktop-changes-service.ts +171 -0
  261. package/lib/desktop-design-service.ts +233 -0
  262. package/lib/desktop-feed-actions.ts +804 -0
  263. package/lib/desktop-feed-answers.ts +129 -0
  264. package/lib/desktop-feed-sources.ts +184 -0
  265. package/lib/desktop-feed-stats.ts +98 -0
  266. package/lib/desktop-feed-store.ts +124 -0
  267. package/lib/desktop-feed.ts +788 -0
  268. package/lib/desktop-jobs-service.ts +290 -0
  269. package/lib/desktop-review-service.ts +187 -0
  270. package/lib/desktop-rpc-agents.ts +403 -0
  271. package/lib/desktop-rpc-changes.ts +223 -0
  272. package/lib/desktop-rpc-config-watch.ts +285 -0
  273. package/lib/desktop-rpc-config.ts +885 -0
  274. package/lib/desktop-rpc-design.ts +138 -0
  275. package/lib/desktop-rpc-jobs.ts +290 -0
  276. package/lib/desktop-rpc-permissions.ts +328 -0
  277. package/lib/desktop-rpc-profiles.ts +196 -0
  278. package/lib/desktop-rpc-review.ts +180 -0
  279. package/lib/desktop-rpc-session.ts +203 -0
  280. package/lib/desktop-rpc-sessions.ts +250 -0
  281. package/lib/desktop-rpc-stats.ts +187 -0
  282. package/lib/desktop-rpc-updates.ts +143 -0
  283. package/lib/desktop-rpc-usage.ts +229 -0
  284. package/lib/desktop-rpc.ts +336 -0
  285. package/lib/desktop-session-service.ts +223 -0
  286. package/lib/desktop-sessions-service.ts +249 -0
  287. package/lib/desktop-stats-service.ts +142 -0
  288. package/lib/desktop-updates-service.ts +268 -0
  289. package/lib/desktop-usage-service.ts +310 -0
  290. package/lib/destructive-command-guard.ts +188 -13
  291. package/lib/gentle-ai-renderer.ts +13 -1
  292. package/lib/gentle-design.ts +201 -14
  293. package/lib/gentle-shell-bundled.ts +100 -9
  294. package/lib/gentle-shell-desktop.ts +1370 -0
  295. package/lib/gentle-shell-launcher.ts +45 -3
  296. package/lib/herdr-desktop-events.ts +40 -0
  297. package/lib/herdr-desktop-status.ts +229 -0
  298. package/lib/hidden-tools.ts +35 -0
  299. package/lib/inprocess-reviewer.ts +96 -12
  300. package/lib/jobs-sidebar-state.ts +5 -0
  301. package/lib/model-fallback-policy.ts +9 -0
  302. package/lib/model-routing-authority.ts +9 -0
  303. package/lib/nan-provider.ts +42 -28
  304. package/lib/native-review-cli.ts +86 -4
  305. package/lib/openai-fast-tier.ts +1 -0
  306. package/lib/orchestrator-discovery.ts +39 -2
  307. package/lib/reply-language-anchor.ts +27 -2
  308. package/lib/request-context-placement.ts +53 -0
  309. package/lib/review-candidate-view.ts +11 -1
  310. package/lib/review-continuation-registry.ts +17 -0
  311. package/lib/review-coordinator.ts +252 -8
  312. package/lib/review-delivery-preflight.ts +85 -0
  313. package/lib/review-host-relay.ts +5 -1
  314. package/lib/review-integration-v2.ts +56 -3
  315. package/lib/reviewer-stream.ts +87 -0
  316. package/lib/session-profile-freeze.ts +13 -5
  317. package/lib/shell-prompt.ts +16 -3
  318. package/lib/shell-usage.ts +10 -0
  319. package/lib/stats-collector.ts +56 -27
  320. package/lib/tower-actions.ts +100 -0
  321. package/lib/tower-hub.ts +73 -0
  322. package/lib/tower-launch.ts +111 -0
  323. package/lib/tower-open.ts +99 -0
  324. package/lib/tower-presence.ts +70 -0
  325. package/lib/tower-server.ts +234 -0
  326. package/lib/tower-snapshot.ts +298 -0
  327. package/lib/update-status.ts +238 -0
  328. package/lib/verifier-settle-reminder.ts +1 -1
  329. package/lib/vim-editor-adapter.ts +9 -2
  330. package/lib/writer-batch-admission.ts +55 -0
  331. package/lib/yolo-session-policy.ts +6 -1
  332. package/package.json +14 -5
  333. package/prompts/skill-creation.md +1 -10
  334. package/runtime/design-canvas-assets.mjs +39 -0
  335. package/runtime/gentle-shell-bundled.mjs +100 -9
  336. package/runtime/gentle-shell-desktop.mjs +1371 -0
  337. package/runtime/gentle-shell-launcher.mjs +44 -2
  338. package/runtime/native-review-cli.mjs +86 -4
  339. package/runtime/review-integration-v2.mjs +56 -3
  340. package/runtime/tower-actions.mjs +101 -0
  341. package/runtime/tower-hub.mjs +74 -0
  342. package/runtime/tower-launch.mjs +112 -0
  343. package/runtime/tower-open.mjs +100 -0
  344. package/runtime/tower-presence.mjs +71 -0
  345. package/runtime/tower-server.mjs +234 -0
  346. package/runtime/tower-snapshot.mjs +299 -0
  347. package/scripts/bootstrap.cmd +2 -2
  348. package/scripts/bootstrap.sh +41 -4
  349. package/scripts/build-full-delegation-card.mjs +5 -21
  350. package/scripts/build-runtime-modules.mjs +10 -0
  351. package/scripts/gentle-ai-installer.mjs +10 -10
  352. package/scripts/gentle-ai-proxy.mjs +1 -1
  353. package/scripts/installer-downloads.mjs +34 -8
  354. package/scripts/installer-preflight.mjs +28 -17
  355. package/scripts/installer-probes.mjs +25 -5
  356. package/scripts/installer-server.mjs +38 -9
  357. package/scripts/installer-windows.mjs +2 -2
  358. package/scripts/pi-update.mjs +166 -27
  359. package/scripts/prepare-verifier.mjs +107 -0
  360. package/scripts/update-agent-body-history.mjs +55 -8
  361. package/scripts/verify-package-files.mjs +61 -20
  362. package/skills/branch-pr/SKILL.md +16 -16
  363. package/skills/comment-writer/SKILL.md +1 -1
  364. package/skills/design/SKILL.md +6 -6
  365. package/skills/gentle-ai/SKILL.md +5 -5
  366. package/skills/judgment-day/SKILL.md +2 -2
  367. package/skills/judgment-day/references/prompts-and-formats.md +1 -1
  368. package/skills/provider-defect-report/SKILL.md +61 -0
  369. package/skills/rdd-defect-workflow/SKILL.md +6 -6
  370. package/skills/skill-improver/SKILL.md +2 -2
  371. package/skills/skill-registry/SKILL.md +11 -13
  372. package/skills/tui-design/SKILL.md +1 -1
  373. package/skills/work-unit-commits/SKILL.md +5 -5
  374. package/tests/agent-prompt-diet-contract.test.ts +101 -0
  375. package/tests/agent-tool-overlay-acceptance.test.ts +158 -0
  376. package/tests/agent-tool-overlay.test.ts +89 -0
  377. package/tests/agents-config.test.ts +10 -1
  378. package/tests/agents-message-delivery.test.ts +36 -0
  379. package/tests/agents-queries.test.ts +144 -4
  380. package/tests/agents-report-cap.test.ts +126 -0
  381. package/tests/agents-runner.test.ts +37 -1
  382. package/tests/agents-session-transport.test.ts +34 -0
  383. package/tests/always-on-prompt-verdicts-contract.test.ts +188 -0
  384. package/tests/append-system-prompt-route.test.ts +26 -7
  385. package/tests/approved-text-leftovers-contract.test.ts +136 -0
  386. package/tests/artifact-language.test.ts +1 -1
  387. package/tests/ask-user-choice.test.ts +78 -21
  388. package/tests/ask-user-question.test.ts +61 -6
  389. package/tests/audit-leftovers-contract.test.ts +51 -0
  390. package/tests/auto-permission-answers.test.ts +12 -1
  391. package/tests/background-jobs.test.ts +12 -0
  392. package/tests/bounded-stop-contract.test.ts +148 -27
  393. package/tests/branch-pr-skill.test.ts +10 -1
  394. package/tests/bundled-install.test.ts +1 -1
  395. package/tests/change-diff.test.ts +75 -0
  396. package/tests/child-context-files.test.ts +64 -8
  397. package/tests/child-skills-catalog.test.ts +56 -0
  398. package/tests/codemode-rendering.test.ts +4 -1
  399. package/tests/commit-slice-signal.test.ts +3 -2
  400. package/tests/decision-routing-contract.test.ts +390 -0
  401. package/tests/delegate-for-reason-contract.test.ts +30 -8
  402. package/tests/delegated-key-learnings-contract.test.ts +21 -28
  403. package/tests/delivery-b-rendered-surfaces.test.ts +32 -0
  404. package/tests/delivery-conflict-markers.test.ts +348 -0
  405. package/tests/design-canvas-all-sizes.test.ts +631 -0
  406. package/tests/design-canvas-allowlist.test.ts +32 -0
  407. package/tests/design-canvas-assets.test.ts +11 -878
  408. package/tests/design-canvas-boards.test.ts +77 -0
  409. package/tests/design-canvas-checks.test.ts +655 -0
  410. package/tests/design-canvas-compare.test.ts +79 -0
  411. package/tests/design-canvas-events.test.ts +59 -0
  412. package/tests/design-canvas-export.test.ts +1168 -0
  413. package/tests/design-canvas-focus.test.ts +113 -0
  414. package/tests/design-canvas-handoffs.test.ts +59 -0
  415. package/tests/design-canvas-i18n-review.test.ts +513 -0
  416. package/tests/design-canvas-i18n-views.test.ts +259 -0
  417. package/tests/design-canvas-i18n.test.ts +528 -0
  418. package/tests/design-canvas-inspector.test.ts +1004 -0
  419. package/tests/design-canvas-layout.test.ts +1222 -0
  420. package/tests/design-canvas-minimap.test.ts +413 -0
  421. package/tests/design-canvas-modules.test.ts +91 -0
  422. package/tests/design-canvas-parts.test.ts +721 -0
  423. package/tests/design-canvas-rail.test.ts +799 -0
  424. package/tests/design-canvas-server.test.ts +855 -17
  425. package/tests/design-canvas-sizes.test.ts +548 -0
  426. package/tests/design-canvas-store.test.ts +189 -0
  427. package/tests/design-canvas-theme.test.ts +198 -0
  428. package/tests/design-canvas-tokens.test.ts +965 -0
  429. package/tests/design-canvas-view.test.ts +299 -0
  430. package/tests/design-comments.test.ts +201 -1
  431. package/tests/design-handoffs.test.ts +20 -0
  432. package/tests/design-layout.test.ts +100 -0
  433. package/tests/design-parts.test.ts +260 -0
  434. package/tests/design-system-tokens.test.ts +215 -0
  435. package/tests/desktop-feed-actions-guards.test.ts +595 -0
  436. package/tests/desktop-feed-actions.test.ts +761 -0
  437. package/tests/desktop-feed-live-work.test.ts +209 -0
  438. package/tests/desktop-feed-performance.test.ts +369 -0
  439. package/tests/desktop-feed-plan-profiles.test.ts +509 -0
  440. package/tests/desktop-feed-send-prompt.test.ts +303 -0
  441. package/tests/desktop-feed-tool-summaries.test.ts +69 -0
  442. package/tests/desktop-feed.test.ts +615 -0
  443. package/tests/desktop-rpc-agents.test.ts +1319 -0
  444. package/tests/desktop-rpc-changes.test.ts +608 -0
  445. package/tests/desktop-rpc-config-watch.test.ts +1159 -0
  446. package/tests/desktop-rpc-config.test.ts +1462 -0
  447. package/tests/desktop-rpc-design.test.ts +672 -0
  448. package/tests/desktop-rpc-jobs.test.ts +1193 -0
  449. package/tests/desktop-rpc-permissions.test.ts +321 -0
  450. package/tests/desktop-rpc-profiles.test.ts +140 -0
  451. package/tests/desktop-rpc-review.test.ts +678 -0
  452. package/tests/desktop-rpc-safety.test.ts +119 -0
  453. package/tests/desktop-rpc-session.test.ts +642 -0
  454. package/tests/desktop-rpc-sessions.test.ts +647 -0
  455. package/tests/desktop-rpc-stats.test.ts +431 -0
  456. package/tests/desktop-rpc-updates.test.ts +525 -0
  457. package/tests/desktop-rpc-usage.test.ts +707 -0
  458. package/tests/desktop-rpc.test.ts +293 -0
  459. package/tests/devbinary/pi-host-relay.devtest.ts +149 -80
  460. package/tests/devbinary/review-session-consent.devtest.ts +84 -0
  461. package/tests/engram-safety.test.ts +111 -0
  462. package/tests/fixtures/devbinary/status-v9-escalated-non-blocking.captured.json +92 -0
  463. package/tests/fixtures/devbinary/status-v9-escalated-non-blocking.provenance.md +3 -0
  464. package/tests/fixtures/primary-session-prompt/gentleman.golden.md +30 -41
  465. package/tests/fixtures/refusal-identity.probe.mjs +139 -0
  466. package/tests/fixtures/session-profile-v1/replay.ts +4 -1
  467. package/tests/full-delegation-closure.test.ts +48 -0
  468. package/tests/gentle-agents.test.ts +848 -8
  469. package/tests/gentle-ai-binary.test.ts +1 -1
  470. package/tests/gentle-ai-child-guards.test.ts +1 -0
  471. package/tests/gentle-ai-installer.test.ts +52 -51
  472. package/tests/gentle-ai-renderer.test.ts +36 -2
  473. package/tests/gentle-ai.test.ts +195 -21
  474. package/tests/gentle-design.test.ts +365 -1
  475. package/tests/gentle-fast.test.ts +15 -0
  476. package/tests/gentle-herdr-desktop-status.test.ts +595 -0
  477. package/tests/gentle-shell-bundled.test.ts +91 -5
  478. package/tests/gentle-shell-desktop-bin.test.ts +125 -0
  479. package/tests/gentle-shell-desktop.test.ts +927 -0
  480. package/tests/gentle-shell-launcher-tower.test.ts +104 -0
  481. package/tests/gentle-shell-launcher.test.ts +1 -1
  482. package/tests/gentle-shell.test.ts +121 -87
  483. package/tests/gentle-todo.test.ts +32 -9
  484. package/tests/gentle-tower.test.ts +578 -0
  485. package/tests/herdr-desktop-status.test.ts +285 -0
  486. package/tests/hidden-tools.test.ts +188 -0
  487. package/tests/independent-recovery-delivery.test.ts +35 -9
  488. package/tests/inprocess-reviewer.test.ts +73 -0
  489. package/tests/install-wizard.test.ts +27 -1
  490. package/tests/installer-downloads.test.ts +30 -1
  491. package/tests/installer-posix-bootstrap.test.ts +114 -13
  492. package/tests/installer-preflight.test.ts +49 -1
  493. package/tests/installer-probes.test.ts +146 -0
  494. package/tests/installer-server.test.ts +203 -4
  495. package/tests/installer-windows-bootstrap.test.ts +19 -1
  496. package/tests/judgment-day-severity-admission.test.ts +46 -0
  497. package/tests/lazy-module-contradictions-contract.test.ts +181 -0
  498. package/tests/maintainer/desktop-rpc.maintest.ts +907 -0
  499. package/tests/maintainer/pi-update-source.maintest.ts +48 -18
  500. package/tests/model-fallback-policy.test.ts +26 -7
  501. package/tests/nan-provider-runtime.test.ts +17 -3
  502. package/tests/nan-provider.test.ts +111 -56
  503. package/tests/native-review-capability-contract.test.ts +19 -1
  504. package/tests/native-review-cli-nonblocking-findings.test.ts +165 -0
  505. package/tests/native-review-parity.test.ts +24 -5
  506. package/tests/native-review-refusal-identity.test.ts +25 -0
  507. package/tests/no-self-pause-contract.test.ts +33 -15
  508. package/tests/odd-integration.test.ts +11 -3
  509. package/tests/odd-routing-canonical-ratchet.test.ts +10 -0
  510. package/tests/odd-routing-contract.test.ts +99 -31
  511. package/tests/orchestrator-budget.test.ts +32 -5
  512. package/tests/orchestrator-consultation-sdk.test.ts +32 -6
  513. package/tests/orchestrator-delegation-mode.test.ts +2 -1
  514. package/tests/orchestrator-discovery.test.ts +28 -0
  515. package/tests/orchestrator-prompt-budget.test.ts +12 -2
  516. package/tests/orchestrator-prompt-diet-contract.test.ts +249 -0
  517. package/tests/orchestrator-rdd-ownership.test.ts +2 -1
  518. package/tests/orchestrator-work-search.test.ts +4 -2
  519. package/tests/package-files.test.ts +25 -1
  520. package/tests/package-manifest.test.ts +15 -14
  521. package/tests/parallel-reason-contract.test.ts +6 -3
  522. package/tests/permission-allowlist.test.ts +200 -30
  523. package/tests/persona-neutral-voseo.test.ts +4 -4
  524. package/tests/persona-reply-language.test.ts +1 -1
  525. package/tests/persona-single-channel.test.ts +13 -5
  526. package/tests/pi-routing-measured-values.test.ts +24 -0
  527. package/tests/pi-update-launcher.test.ts +17 -7
  528. package/tests/pi-update-source.test.ts +113 -6
  529. package/tests/pi-update.test.ts +294 -19
  530. package/tests/pnpm-workspace-policy.test.ts +47 -0
  531. package/tests/primary-context-files.test.ts +233 -0
  532. package/tests/primary-context-three-files.test.ts +174 -0
  533. package/tests/primary-session-prompt.test.ts +25 -0
  534. package/tests/profile-fast-tier.test.ts +66 -1
  535. package/tests/provider-defect-handoff.test.ts +124 -99
  536. package/tests/rdd-aware-verification-contract.test.ts +1 -1
  537. package/tests/rdd-status-line.test.ts +94 -1
  538. package/tests/reply-language-anchor-placement.test.ts +184 -0
  539. package/tests/reply-language-anchor.test.ts +17 -1
  540. package/tests/request-context-append-only.test.ts +218 -0
  541. package/tests/request-context-placement.test.ts +148 -0
  542. package/tests/review-agent-end-preflight.test.ts +79 -1
  543. package/tests/review-candidate-view.test.ts +65 -0
  544. package/tests/review-continuation-registry.test.ts +31 -0
  545. package/tests/review-contract-prompt.test.ts +2 -1
  546. package/tests/review-controller.test.ts +2 -1
  547. package/tests/review-coordinator-correction-gate.test.ts +105 -0
  548. package/tests/review-coordinator-findings.test.ts +206 -0
  549. package/tests/review-coordinator-nonblocking-scope.test.ts +169 -0
  550. package/tests/review-coordinator.test.ts +271 -4
  551. package/tests/review-delivery-preflight.test.ts +462 -0
  552. package/tests/review-due-compaction.test.ts +31 -0
  553. package/tests/review-due-public-boundary.test.ts +27 -0
  554. package/tests/review-integration-nonblocking-findings.test.ts +108 -0
  555. package/tests/review-json-arguments.test.ts +41 -2
  556. package/tests/review-ledger-contract.test.ts +19 -40
  557. package/tests/review-loadout-rdd-off-sdk.test.ts +30 -1
  558. package/tests/review-one-call-findings.test.ts +131 -0
  559. package/tests/review-one-call-followups.test.ts +308 -0
  560. package/tests/review-one-call-reviewer-requests.test.ts +207 -0
  561. package/tests/review-one-call.test.ts +452 -0
  562. package/tests/review-relay-transport-agent.test.ts +28 -1
  563. package/tests/review-reviewer-evidence.test.ts +41 -1
  564. package/tests/review-risk-assessment.test.ts +52 -5
  565. package/tests/review-run-statement-guidance-independent.test.ts +54 -0
  566. package/tests/review-session-standing-permission-controller.test.ts +32 -2
  567. package/tests/review-tool-prose-budget.test.ts +1 -0
  568. package/tests/reviewer-stream.test.ts +149 -0
  569. package/tests/sensitive-path-tools.test.ts +138 -4
  570. package/tests/session-profile-extension.test.ts +312 -18
  571. package/tests/session-profile-freeze.test.ts +26 -0
  572. package/tests/session-profile-v1-compat.test.ts +20 -0
  573. package/tests/shell-prompt.test.ts +17 -0
  574. package/tests/shell-usage.test.ts +59 -10
  575. package/tests/skill-collision-prefixes.test.ts +1 -0
  576. package/tests/skill-contradictions-contract.test.ts +124 -0
  577. package/tests/skill-registry-watcher.test.ts +216 -2
  578. package/tests/skill-registry.test.ts +983 -306
  579. package/tests/stats-collector.test.ts +109 -2
  580. package/tests/support/design-canvas-dom.ts +386 -0
  581. package/tests/support/review-coordinator-runtime.ts +212 -17
  582. package/tests/task-size-routing-contract.test.ts +49 -14
  583. package/tests/test-strength-contract.test.ts +2 -1
  584. package/tests/todo-request-append-only.test.ts +214 -0
  585. package/tests/tool-batching-contract.test.ts +3 -1
  586. package/tests/tower-actions.test.ts +247 -0
  587. package/tests/tower-artifacts.test.ts +114 -0
  588. package/tests/tower-open.test.ts +97 -0
  589. package/tests/tower-presence.test.ts +175 -0
  590. package/tests/tower-server.test.ts +122 -0
  591. package/tests/tower-snapshot.test.ts +236 -0
  592. package/tests/tower-web-echo.test.ts +125 -0
  593. package/tests/tower-web-hover.test.ts +251 -0
  594. package/tests/update-agent-body-history.test.ts +138 -0
  595. package/tests/verification-scoped-stop-contract.test.ts +32 -0
  596. package/tests/verification-tiers-contract.test.ts +229 -0
  597. package/tests/verifier-preparation.test.ts +229 -0
  598. package/tests/verifier-settle-reminder.test.ts +2 -2
  599. package/tests/verify-agent-contract.test.ts +20 -2
  600. package/tests/verify-first-launch-contract.test.ts +88 -12
  601. package/tests/vim-editor-adapter.test.ts +2 -2
  602. package/tests/work-continuity-contract.test.ts +136 -27
  603. package/tests/writer-admission-messages.test.ts +232 -0
  604. package/tests/writer-batch-admission.test.ts +66 -0
  605. package/tests/writer-edit-surface-scope.test.ts +52 -20
  606. package/tests/writer-feature-document-admission.test.ts +184 -0
  607. package/tests/writer-rejection-next-step.test.ts +55 -0
  608. package/tests/writer-surface-authority-contract.test.ts +158 -0
  609. package/tests/yolo-mode.test.ts +39 -0
  610. package/skills/_shared/review-ledger-contract.md +0 -106
  611. /package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.6.0}/bundle/README.md +0 -0
  612. /package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.6.0}/bundle/schemas/lens.schema.json +0 -0
  613. /package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.6.0}/bundle/schemas/refuter.schema.json +0 -0
  614. /package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.6.0}/bundle/schemas/targeted-validator.schema.json +0 -0
  615. /package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.6.0}/bundle/vectors/lens.json +0 -0
  616. /package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.6.0}/bundle/vectors/refuter.json +0 -0
  617. /package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.6.0}/bundle/vectors/targeted-validator.json +0 -0
@@ -47,6 +47,7 @@ import {
47
47
  otherPackageInjections,
48
48
  parseLauncherArgs,
49
49
  parseLauncherConfig,
50
+ parseTowerArgs,
50
51
  parseRawLauncherConfig,
51
52
  planSpawn,
52
53
  POST_INSTALL_REMOVAL_SOURCES,
@@ -73,7 +74,9 @@ import {
73
74
  ENGRAM_RECOVERY_NOTICE,
74
75
  ENGRAM_START_FAILED_NOTICE,
75
76
  GENTLE_SHELL_CONFIG_HOME_ENV,
77
+ engramContractMismatchNotice,
76
78
  engramProbeAllowed,
79
+ engramSupportsDaemonLifecycle,
77
80
  sharedEngramEnv,
78
81
  piVersionOrHelpRequested,
79
82
  probeEngramEndpoint,
@@ -86,6 +89,8 @@ import {
86
89
  bundledUpdatePlan,
87
90
  nodeBundledFs,
88
91
  parseBundledUpgradeArgs,
92
+ parseEngramRuntimeContract,
93
+ probeEngramRuntimeContract,
89
94
  resolveBundledInstall,
90
95
  withBundledNpmCommand,
91
96
  withoutMissingBundledNpmCommand,
@@ -230,23 +235,37 @@ async function classifyBundledMemory() {
230
235
  }
231
236
 
232
237
  // Like other agents' hooks, Shell starts the shared server when nothing
233
- // listens: the verified core's plain `serve` on Engram's own default port and
234
- // data directory, detached so it outlives Pi. Its environment drops the user's
235
- // Engram settings and GitHub tokens and skips the update check. Ready means the
236
- // same /compatibility contract any reused server must answer, so a concurrent
237
- // launch that wins the bind converges too: after the child exits, polling
238
- // continues for a short grace within the overall bound.
238
+ // listens. Cores with the daemon lifecycle (>= 3.7.0) become a first-class
239
+ // daemon through `engram run -d`, so the standard engram verbs manage them;
240
+ // anything else (older cores, a failed daemon handoff) keeps the legacy
241
+ // detached plain `serve` on Engram's own default port and data directory, so it
242
+ // outlives Pi. Both paths' environment drops the user's Engram settings and
243
+ // GitHub tokens and skips the update check. Ready means the same
244
+ // /compatibility contract any reused server must answer, and a concurrent
245
+ // launch that wins the bind converges through it within the overall bounds.
239
246
  const ENGRAM_START_TIMEOUT_MS = 10000;
240
247
  const ENGRAM_START_EXIT_GRACE_MS = 2000;
248
+ // `engram run -d` itself waits up to 15 s for its daemon's readiness before the
249
+ // wrapper exits (engram cmd/engram/run.go), so the daemon wrapper await can run
250
+ // slightly longer than the serve-only start budget.
251
+ const ENGRAM_DAEMON_START_TIMEOUT_MS = 16000;
241
252
 
242
253
  async function startSharedEngram() {
243
254
  const failed = { policy: "disabled", notice: ENGRAM_START_FAILED_NOTICE };
244
255
  const core = verifiedBundledCore();
245
256
  if (core === undefined) return failed;
257
+ const env = sharedEngramEnv(process.env);
258
+ // Cores with the daemon lifecycle (>= 3.7.0) start through `engram run -d`:
259
+ // the pidfile it keeps is what `engram ps/stop/logs/restart` manage, so the
260
+ // shared server becomes a first-class daemon (engram#2346). Anything short of
261
+ // a compatible running server falls back to the legacy detached serve below,
262
+ // which is the only option an older core would have had anyway.
263
+ if (engramSupportsDaemonLifecycle(engramPinVersion) && (await startEngramDaemon(core, env))) {
264
+ return { policy: "allow", url: ENGRAM_DEFAULT_URL };
265
+ }
246
266
  let deadline = Date.now() + ENGRAM_START_TIMEOUT_MS;
247
267
  const exited = () => { deadline = Math.min(deadline, Date.now() + ENGRAM_START_EXIT_GRACE_MS); };
248
268
  try {
249
- const env = sharedEngramEnv(process.env);
250
269
  const child = spawn(core, ["serve"], { cwd: homedir(), env, detached: true, stdio: "ignore", windowsHide: true });
251
270
  child.once("error", exited);
252
271
  child.once("exit", exited);
@@ -262,6 +281,34 @@ async function startSharedEngram() {
262
281
  return failed;
263
282
  }
264
283
 
284
+ // Runs `engram run -d` to completion and reports whether a compatible server is
285
+ // listening: the wrapper exits 0 after the daemon reported readiness and exits
286
+ // non-zero on failure; a concurrent launch that wins the bind converges through
287
+ // the same probed contract as serve. Spawn errors and a wrapper that never ends
288
+ // are cut off at the start budget. Bounded either way.
289
+ async function startEngramDaemon(core, env) {
290
+ try {
291
+ const child = spawn(core, ["run", "-d"], { cwd: homedir(), env, stdio: "ignore", windowsHide: true });
292
+ await Promise.race([
293
+ new Promise((resolve, reject) => {
294
+ child.once("error", reject);
295
+ child.once("exit", (status) => resolve(typeof status === "number" ? status : -1));
296
+ }),
297
+ new Promise((_, reject) => setTimeout(() => reject(new Error("engram run -d start budget exceeded")), ENGRAM_DAEMON_START_TIMEOUT_MS)),
298
+ ]);
299
+ const deadline = Date.now() + ENGRAM_START_EXIT_GRACE_MS;
300
+ while (Date.now() < deadline) {
301
+ const endpoint = await probeEngramEndpoint({ timeoutMs: 500 });
302
+ if (endpoint.kind === "listening" && endpoint.compatible) return true;
303
+ await new Promise((resolve) => setTimeout(resolve, 100));
304
+ }
305
+ } catch {
306
+ // Spawn error or the wrapper outlived the start budget: fall back to the
307
+ // legacy detached serve.
308
+ }
309
+ return false;
310
+ }
311
+
265
312
  const LEGACY_ENGRAM_COMPANION_SOURCE = "npm:gentle-engram@0.4.2";
266
313
  const companionSource = (entry) => typeof entry === "string" ? entry : entry?.source;
267
314
 
@@ -323,10 +370,56 @@ async function migrateManagedEngramCompanion(home, homeHadContentBeforeBootstrap
323
370
  }
324
371
  }
325
372
 
373
+ // A stderr write that resolves once the bytes are handed to the stream. When
374
+ // stderr is a pipe (a parent process, a test harness) Node writes
375
+ // asynchronously, so an immediate process.exit() truncates the message. Anything
376
+ // written right before the process exits must go through this.
377
+ function writeStderrAndFlush(text) {
378
+ return new Promise((resolve) => { process.stderr.write(text, () => resolve()); });
379
+ }
380
+
381
+ // Companion-vs-core contract gate (S1, S3, S4), warn only: a companion whose
382
+ // runtime contract differs from the bundled core's is still installed and run,
383
+ // and the mismatch is only announced loudly — never a failure, never an exit
384
+ // code change, never a rewritten selection. A missing or malformed contract
385
+ // file is not an error: without a parsed digest there is nothing to compare.
386
+ function warnEngramContractMismatch(home) {
387
+ try {
388
+ const contract = parseEngramRuntimeContract(JSON.parse(readJsonIfExists(join(home.dir, "npm", "node_modules", "gentle-engram", "runtime-contract.json")) ?? "null"));
389
+ const notice = engramContractMismatchNotice(contract?.digest, engramPinVersion);
390
+ if (notice) process.stderr.write(`gentle-shell: ${notice}\n`);
391
+ } catch {
392
+ // Warn only: an unreadable contract file never blocks anything.
393
+ }
394
+ }
395
+
396
+ // At launch, after the shared server is ready: compare the digest the running
397
+ // server answers on GET /runtime-contract with the companion's own contract
398
+ // file, and warn loudly on a mismatch. Warn only: a probe failure, an
399
+ // unparseable answer or a missing file never disables memory or changes the
400
+ // exit code, and the selection is never rewritten.
401
+ async function warnLiveEngramContractMismatch(home) {
402
+ try {
403
+ const companion = parseEngramRuntimeContract(JSON.parse(readJsonIfExists(join(home.dir, "npm", "node_modules", "gentle-engram", "runtime-contract.json")) ?? "null"));
404
+ if (companion === undefined) return;
405
+ const live = await probeEngramRuntimeContract();
406
+ // Without a well-formed live answer the core side is unknown: the gate is
407
+ // silent here, and the companion-vs-pinned check already warned above.
408
+ if (live === undefined) return;
409
+ const notice = engramContractMismatchNotice(companion.digest, engramPinVersion, live, "the running Engram server");
410
+ if (notice) process.stderr.write(`gentle-shell: ${notice}\n`);
411
+ } catch {
412
+ // Warn only: an unreadable contract file never blocks anything.
413
+ }
414
+ }
415
+
326
416
  // Use Pi's install command, never an alternate extension loader. A user's
327
417
  // selected companion stays selected; missing or unverified capability is only
328
418
  // warned about, while the guard continues to protect unverified stores.
329
419
  async function ensureEngramCompanion(home, runtime, stdio, timeoutMs, homeHadContentBeforeBootstrap) {
420
+ // S1/S3/S4: warn on a companion whose contract does not match the bundled
421
+ // core, but never fail, never change the exit code, never rewrite the selection.
422
+ warnEngramContractMismatch(home);
330
423
  const metadata = join(home.dir, "npm", "node_modules", "gentle-engram", "package.json");
331
424
  let packages;
332
425
  try {
@@ -1784,6 +1877,66 @@ async function handleUpgradeCommand(commandArgs) {
1784
1877
  if (error instanceof MainChannelError) fail(`gentle-shell upgrade: ${error.message}`, error.code === "upgrade-usage" ? 2 : 1);
1785
1878
  throw error;
1786
1879
  }
1880
+ if (process.exitCode === 0) await refreshDesktopAfterUpgrade(undefined);
1881
+ }
1882
+
1883
+ // After a forward upgrade the new Gentle Shell refreshes Gentle Shell Desktop's
1884
+ // gentle-* mods and layout, only when `gentle-shell desktop` installed them (its
1885
+ // state file); a user who never ran desktop gets nothing installed. The old
1886
+ // process cannot do it: the new mods ship with the new package. A target
1887
+ // without the desktop command (an older release) would take `desktop` as a
1888
+ // prompt for the model, so it is never launched. `upgrade --rollback` never
1889
+ // calls this.
1890
+ async function refreshDesktopAfterUpgrade(bundled) {
1891
+ let stateFile;
1892
+ let supportsDesktop;
1893
+ try {
1894
+ // After an npm upgrade this package folder holds the new version, which may not ship desktop.
1895
+ const desktop = await import("../runtime/gentle-shell-desktop.mjs");
1896
+ stateFile = desktop.desktopPaths(process.env, homedir()).stateFile;
1897
+ supportsDesktop = desktop.supportsDesktop;
1898
+ } catch {
1899
+ return;
1900
+ }
1901
+ if (!existsSync(stateFile)) return;
1902
+ const warn = (reason) => process.stderr.write(`gentle-shell upgrade: could not refresh Gentle Shell Desktop's mods (${reason}); run 'gentle-shell desktop'.\n`);
1903
+ try {
1904
+ const next = bundled
1905
+ ? await resolveStartupRelaunch({ root: bundled.root, home: homedir(), platform: process.platform, env: process.env, argv: ["desktop", "--refresh"] })
1906
+ : { command: process.execPath, args: [join(packageRoot, "bin", "gentle-shell.mjs"), "desktop", "--refresh"], env: process.env };
1907
+ // next.args[0] is the target's bin/gentle-shell.mjs.
1908
+ if (!supportsDesktop(dirname(dirname(next.args[0])))) return;
1909
+ const result = spawnSync(next.command, next.args, { stdio: "inherit", env: next.env });
1910
+ if (result.error) warn(result.error.message);
1911
+ else if (result.status !== 0) warn(`exit ${result.status}`);
1912
+ } catch (error) {
1913
+ warn(error.message);
1914
+ }
1915
+ }
1916
+
1917
+ // `gentle-shell desktop` (Gentle Shell Desktop): before any Pi runtime check,
1918
+ // since it never runs Pi; lib/gentle-shell-desktop.ts owns the decisions.
1919
+ async function handleDesktopCommand(commandArgs) {
1920
+ const { nodeDesktopIO, runDesktop } = await import("../runtime/gentle-shell-desktop.mjs");
1921
+ const { askLine } = await import("../runtime/gentle-shell-uninstall.mjs");
1922
+ return runDesktop({
1923
+ args: commandArgs,
1924
+ env: process.env,
1925
+ home: homedir(),
1926
+ platform: process.platform,
1927
+ arch: process.arch,
1928
+ cwd: process.cwd(),
1929
+ interactive: process.stdin.isTTY === true && process.stdout.isTTY === true,
1930
+ packageRoot,
1931
+ shellVersion: ownPackageVersion(),
1932
+ io: {
1933
+ ...nodeDesktopIO(),
1934
+ // End of input or Ctrl+C answers No.
1935
+ ask: (question) => askLine(question, { input: process.stdin, output: process.stdout }).catch(() => ""),
1936
+ out: (line) => process.stdout.write(`${line}\n`),
1937
+ err: (line) => process.stderr.write(`${line}\n`),
1938
+ },
1939
+ });
1787
1940
  }
1788
1941
 
1789
1942
  // `gentle-shell upgrade` in a bundled install: the latest release installed
@@ -1814,11 +1967,12 @@ async function handleBundledUpgrade(bundled, commandArgs) {
1814
1967
  adapters: { latest: () => latestRelease(globalThis.fetch), distribution: (version) => fetchDistribution({ version }) },
1815
1968
  out,
1816
1969
  });
1817
- return 0;
1818
1970
  } catch (error) {
1819
1971
  process.stderr.write(`gentle-shell upgrade: ${error.message}${error.stderr ? `\n${error.stderr}` : ""}\n`);
1820
1972
  return 1;
1821
1973
  }
1974
+ await refreshDesktopAfterUpgrade(bundled);
1975
+ return 0;
1822
1976
  }
1823
1977
 
1824
1978
  // `gentle-shell update` in a bundled install: the newest published
@@ -2002,7 +2156,7 @@ async function main() {
2002
2156
  const args = parseLauncherArgs(process.argv.slice(2));
2003
2157
  if (args.error !== undefined) fail(`${args.error}\nRun 'gentle-shell --help' for usage.`, 2);
2004
2158
  if (args.help) {
2005
- process.stdout.write("Pi updates: update reinstalls the verified supplier of the Pi this launcher runs (a global Pi, or the\nShell package whose adjacent peer it is, at the same Shell version) and reads the resulting Pi version back.\nA linked source Shell updates its local Pi with its project manager and one matching lockfile;\npnpm may be newer than the declared minimum; npm must match its pin. No manager is downloaded;\nGit roots only, no lifecycle scripts or range changes. Root-only pnpm configuration is preserved;\nmulti-project/ancestor workspaces and conflicting lockfiles refuse before installation. Unknown ownership refuses; update --extensions-only stays Pi-only.\nPrefix-bundled Pi updates with gentle-shell upgrade.\n");
2159
+ process.stdout.write("Pi updates: update resolves the newest published stable Pi and updates its verified supplier\n(a global Pi, or its Shell package at the same Shell version), then reads the Pi version back.\npnpm temporarily exempts only Pi and the @earendil-works packages it pins exactly (transitively) from\nminimumReleaseAge, merged into their existing exclusions; other exclusions and policy stay in force.\nA linked source Shell updates local Pi with its project manager and one matching lockfile;\npnpm may be newer than the declared minimum; npm must match its pin. No manager is downloaded;\nGit roots only, no lifecycle scripts or manifest range changes. Root-only pnpm configuration is preserved;\nmulti-project/ancestor workspaces and conflicting lockfiles refuse before installation. Unknown ownership refuses; update --extensions-only stays Pi-only.\nPrefix-bundled update also selects the latest stable Pi; upgrade updates Shell.\n");
2006
2160
  process.stdout.write(`${helpText()}\nBundled Engram memory: Shell shares the global Engram server on 127.0.0.1:7437, like other agents' hooks.\nA running server is reused only with verified /compatibility evidence; when nothing listens, Shell starts the\nbundled core's engram serve (default ~/.engram) and waits for that evidence. Otherwise ENGRAM_BIN is Shell's\nguard and memory stays off for that launch. Matching versions or updating alone do not prove compatibility.\nBack up existing data before manual changes; do not delete it or bypass the safety check.\nShell rechecks on every launch and remains usable without memory.\nAn explicit ENGRAM_BIN or ENGRAM_URL is kept and bypasses the guard.\n`);
2007
2161
  process.exit(0);
2008
2162
  }
@@ -2011,6 +2165,20 @@ async function main() {
2011
2165
  else handleHomeCommand(args.commandArgs);
2012
2166
  return;
2013
2167
  }
2168
+ if (args.command === "desktop") {
2169
+ process.exitCode = await handleDesktopCommand(args.commandArgs);
2170
+ return;
2171
+ }
2172
+ // `gentle-shell tower`: the same local web view as /gentle:tower, without a
2173
+ // session or a Pi runtime; serves until SIGINT/SIGTERM.
2174
+ if (args.command === "tower") {
2175
+ const tower = parseTowerArgs(args.commandArgs);
2176
+ if (tower.error !== undefined) fail(`gentle-shell tower: ${tower.error}\nRun 'gentle-shell --help' for usage.`, 2);
2177
+ const { runTower } = await import("../runtime/tower-open.mjs");
2178
+ process.exitCode = await runTower({ env: process.env, open: tower.open, port: tower.port,
2179
+ stdout: (text) => process.stdout.write(text), stderr: (text) => process.stderr.write(text) });
2180
+ return;
2181
+ }
2014
2182
  // The verification input applies to `--version` only (scripts/bundled-install.mjs upgradeBundled).
2015
2183
  const verifying = args.version && args.command === undefined ? process.env[BUNDLED_VERIFY_ENV] : undefined;
2016
2184
  const bundled = resolveBundledInstall({ packageRoot, platform: process.platform, fs: bundledFs, verifying });
@@ -2317,6 +2485,9 @@ async function main() {
2317
2485
  // Only this final decision starts the shared server, and Pi gets its
2318
2486
  // URL only once the server verified.
2319
2487
  if (bundledMemory.spawn) bundledMemory = await startSharedEngram();
2488
+ // S1/S4: with the shared server ready, the live GET /runtime-contract is
2489
+ // compared with the companion's file. Warn only.
2490
+ if (bundledMemory.policy === "allow") await warnLiveEngramContractMismatch(home);
2320
2491
  if (bundledMemory.notice) process.stderr.write(`gentle-shell: ${bundledMemory.notice}\n`);
2321
2492
  }
2322
2493
  bundledEnv = bundledProcessEnv();
@@ -2371,7 +2542,7 @@ async function main() {
2371
2542
  resumeHandoff?.dispose();
2372
2543
  fail(`Could not start pi: ${error.message}`, 1);
2373
2544
  });
2374
- child.on("exit", (code, signal) => {
2545
+ child.on("exit", async (code, signal) => {
2375
2546
  const exitCode = signal ? signalExitCode(signal) : ((code ?? 1) || updateExitCode);
2376
2547
  if (resumeHandoff) {
2377
2548
  const hint = planResumeHint({
@@ -2393,6 +2564,30 @@ async function main() {
2393
2564
  return;
2394
2565
  }
2395
2566
  }
2567
+ // T4 (S2, S5): after the `pi update --extensions` child completes for a
2568
+ // bundled, Shell-owned home, run the same companion verification that setup
2569
+ // and launch run, instead of skipping it because a piSubcommand is set: the
2570
+ // migration above un-pins the source, Pi replaces it with @latest, and
2571
+ // nothing else re-verifies the replaced companion. Warn only: a successful
2572
+ // update is never reported as failed because of this, the user's package
2573
+ // selection is never rewritten or deleted, and the version found after the
2574
+ // update is reported. A signal-killed child did not complete; the next
2575
+ // launch re-verifies as always.
2576
+ // `signal` is null, not undefined, on a normal exit; keep the truthiness the
2577
+ // exit code above already relies on.
2578
+ if (bundled && extensionUpdate && !signal && ownsCompanionHome(home, homeHadContentBeforeBootstrap)) {
2579
+ try {
2580
+ const companion = await ensureEngramCompanion(home, runtime, ["ignore", 2, 2], 10000, homeHadContentBeforeBootstrap);
2581
+ if (companion.ok) {
2582
+ const version = JSON.parse(readJsonIfExists(join(home.dir, "npm", "node_modules", "gentle-engram", "package.json")) ?? "null")?.version;
2583
+ if (typeof version === "string") await writeStderrAndFlush(`gentle-shell: gentle-engram ${version} verified after the extensions update\n`);
2584
+ } else {
2585
+ await writeStderrAndFlush(`${companion.message}\n`);
2586
+ }
2587
+ } catch (error) {
2588
+ await writeStderrAndFlush(`gentle-shell: could not verify the gentle-engram companion after the extensions update (${error.message}); continuing\n`);
2589
+ }
2590
+ }
2396
2591
  process.exit(exitCode);
2397
2592
  });
2398
2593
  }
@@ -1,17 +1,16 @@
1
1
  {
2
2
  "schema": "gentle-pi.review-provider-contract-mirror-lock/v1",
3
3
  "acquisition": "field-test-local",
4
- "contract_semver": "1.4.0",
4
+ "contract_semver": "1.6.0",
5
5
  "source": {
6
- "kind": "archive",
7
- "archive_sha256": "9d2927a84ba9a596f69029e3f854b16f86ca4c8b32cc5d63683764ccf2fb394b"
6
+ "kind": "tree"
8
7
  },
9
- "tree_sha256": "aab5ab7fe7ee6bb180d8bbce21c034cebb0c0d284afcc8664a9b3bb57323c35d",
8
+ "tree_sha256": "bda75839d0b345e63e876bc52c9c858802b1d54651703be4ca83fabb660f7e31",
10
9
  "entries": {
11
10
  "README.md": "3a655c2f19aee02636da062f0cae7a189b7e5f691c8ba8010f2ed50e5d8e8d70",
12
- "manifest.json": "d2b5765e28df5b2459848379e91a27beb806916fabc96207060ad1cc5e911972",
13
- "orchestration/pi.md": "2d7ddd99f1c739a97f4a6b3929e5e2bdddcbf69aed69356395038d90bca25b2f",
14
- "routing/pi.md": "1c7466e2333c08e386b4b5afb081531146d181030692463431e7695df7f90690",
11
+ "manifest.json": "b25b3e22f95d624ca12cd4e78036abaf9080cc829271a5a82eef92bbe1277eae",
12
+ "orchestration/pi.md": "ee25b26c5e913008a115e1cde258288a2c4b1ad9a41cb0b040fab2b76561e124",
13
+ "routing/pi.md": "da52909e3b91b044d36556f7775d5d2b10410212b5c0466f267006fea16a58c3",
15
14
  "schemas/lens.schema.json": "9b8a2354a570888486015434501b66b51441a3baf5bf858635e4fff56b2e8298",
16
15
  "schemas/refuter.schema.json": "36f8267c6c3f04600b8f1cb77df70d90858611af822cc81922efd6b3502fb646",
17
16
  "schemas/targeted-validator.schema.json": "40e397195bdfbc6782fc3090f20c5be082e4d14d2855314f99ecb8506133eddc",
@@ -20,8 +19,8 @@
20
19
  "vectors/targeted-validator.json": "7b5a5165e3a913863fb98d2ba5387811860c21333b5c37e6ed3b4e0d121cf2fa"
21
20
  },
22
21
  "generated": {
23
- "generated/provider-capabilities.baseline.json": "bca708f5f67f506b4acb2cfdcb775b02a51468579fc7d6b4d169785ff411a215",
24
- "generated/provider-roles.baseline.json": "aa36ec6f7469ac6faab756eec681f68f234cbadc1e12b345a93c6c34aa01f7aa"
22
+ "generated/provider-capabilities.baseline.json": "9f143c602b30fb4581dc8446441872fd9dca84ccdeb3a70719958e12b24040fb",
23
+ "generated/provider-roles.baseline.json": "05e945986453659180c1111988449a3ab0fb39cd44f3a3b7b9774a42cea47648"
25
24
  },
26
25
  "runtimes": [
27
26
  "claude-code",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "schema": "gentle-ai.review-provider-contract-bundle/v1",
3
- "contract_semver": "1.4.0",
3
+ "contract_semver": "1.6.0",
4
4
  "transport_capability": "gentle-ai.provider-transport/v1",
5
5
  "runtimes": [
6
6
  "claude-code",
@@ -67,7 +67,7 @@
67
67
  "runtime": "pi",
68
68
  "file": {
69
69
  "path": "orchestration/pi.md",
70
- "sha256": "2d7ddd99f1c739a97f4a6b3929e5e2bdddcbf69aed69356395038d90bca25b2f"
70
+ "sha256": "ee25b26c5e913008a115e1cde258288a2c4b1ad9a41cb0b040fab2b76561e124"
71
71
  }
72
72
  }
73
73
  ],
@@ -76,7 +76,7 @@
76
76
  "runtime": "pi",
77
77
  "file": {
78
78
  "path": "routing/pi.md",
79
- "sha256": "1c7466e2333c08e386b4b5afb081531146d181030692463431e7695df7f90690"
79
+ "sha256": "da52909e3b91b044d36556f7775d5d2b10410212b5c0466f267006fea16a58c3"
80
80
  }
81
81
  }
82
82
  ]
@@ -52,6 +52,7 @@ A `stop` ends its transition, never approves delivery. `D` means the human disab
52
52
  | Reason codes | Continuation |
53
53
  | --- | --- |
54
54
  | `captured_artifacts_unverifiable`, `captured_result_selection_unavailable`, `captured_verification_evidence_invalid`, `final_verification_retry_unavailable`, `missing_authority_binding`, `corrupted_or_unverifiable_authority`, `manual_intervention_required`, `native_stop_required` | Terminal: the maintainer inspects authority/lineage, or `D`. |
55
+ | `correction_request_unavailable` | Valid authority cannot build a correction request (invalid frozen budget or non-actionable finding). If eligible, the stop's `continuation` names the manual release command; obtain its binding template and explicit maintainer authorization, never invent authorization or abandon automatically. Release neither corrects nor approves the lineage; its forecast remains terminal. Without a continuation, stop and report the defect with the lineage. |
55
56
  | `empty_base_diff_bootstrap_required` | Terminal: authorized empty-root bootstrap for a new target, or `D`. |
56
57
  | `lens_context_budget_exceeded` | Terminal: reduce the candidate scope and start a new transaction, or `D`. |
57
58
  | `correction_context_budget_exceeded` | Terminal: this authority has to be released rather than left in place, and invalidation refuses here. The maintainer runs the release command the stop's `continuation` names, exactly as printed; it is the preparatory step its `detail` describes, and its refusal prints the binding the full release needs. A stop with no `continuation` means the authority is not releasable in its current state: the maintainer inspects it, or `D`. Then review as smaller candidates, or `D`. |
@@ -67,4 +68,4 @@ A `stop` ends its transition, never approves delivery. `D` means the human disab
67
68
 
68
69
  ## Delivery follows ordinary repository policy
69
70
 
70
- After exact acknowledgement burns terminal `approved` authority, the review lifecycle stops. Commit, push, PR, and release remain separate human decisions under ordinary repository policy. A review outcome is informational and never authorizes delivery.
71
+ After exact acknowledgement burns terminal `approved` authority, the review lifecycle stops. Commit, push, PR, and release remain separate human decisions under ordinary repository policy. A review outcome is informational and never authorizes delivery. With RDD on, the pre-delivery guard still blocks a foreground push or PR until the committed range is assessed and any due review is resolved, and never runs it beside candidate-changing or background commands.
@@ -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
 
@@ -28,14 +28,14 @@ The number of files, commands or tests, fixes, or a requested todo list never de
28
28
 
29
29
  Small path: work inline. Read and edit, several files of one understood change included; observe RED inline before the fix; run the focused test and the suite inline, once each. No explore, worker, or verifier; no feature document, mirror, or commits unless the user asks; a todo list is optional.
30
30
 
31
- **High risk**: a mistake would be hard to detect, hard to undo, or reaches beyond the change. It touches (1) data or irreversible effects: migrations, changing or deleting existing stored data, persisted format changes (not saving new records); (2) security: auth, permissions, credentials, secrets, guards, sandbox; (3) contracts others consume: changing or removing public API, CLI flags, config formats, published exports, or mirrored prompts or contracts others already consume (not adding a flag, command, or optional field; requested changes are not high risk by themselves; unrequested breaks in shared code are); (4) concurrency: locks, races, async ordering; (5) delivery or environment: installers, release, CI, deploy, dependencies; (6) no test would catch a regression in what changes. Count "unclear" as high only when a bounded look cannot tell whether (1)-(5) apply. When RDD is on, the native assess tier decides native review and you may only raise it; it never adds an independent verifier by itself, only a named high-risk item does.
31
+ **High risk**: a mistake would be hard to detect, hard to undo, or reaches beyond the change. It touches (1) data or irreversible effects that cannot be rebuilt: migrations, changing or deleting existing stored data, persisted format changes (not saving new records, nor a dev or test database a seed or backup rebuilds); (2) security: auth, permissions, credentials, secrets, guards, sandbox; (3) contracts others consume: changing or removing public API, CLI flags, config formats, published exports, or mirrored prompts or contracts others already consume (not adding a flag, command, or optional field; requested changes are not high risk by themselves; unrequested breaks in shared code are); (4) concurrency: locks, races, async ordering; (5) delivery or environment: installers, release, CI, deploy, dependencies; (6) no test would catch a regression in what changes. Count "unclear" as high only when a bounded look cannot tell whether (1)-(5) apply. When RDD is on, the native assess tier decides native review and you may only raise it; it never adds an independent verifier by itself, only a named high-risk item does.
32
32
 
33
33
  **Risk line**: close every code change, small path or delegated, with `Risk: item N (reason)` or `Risk: none` per the list; any item fires the Verification trigger. Before writing `Risk: none`, check whether the diff changes code that existing behavior the request did not mention also uses (shared options, parsers, helpers); if it does, that is item 3.
34
34
 
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,16 +43,16 @@ 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
- - **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; (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).
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).
51
51
  - **Parallel writers:** work in another repository goes in a fresh worktree based on that repository's main, never in a checkout someone else may be using. Parallel units in the same local repository run in the same tree, each with declared disjoint edit surfaces: the parent owns git; writers run no repository-wide formatters, generators, or installs; a shared file has one owner or the parent edits it at the end; the parent checks each writer's diff against its surface before accepting it; and one seam check runs at the end (the full suite, once). Units that need the same file use isolated worktrees.
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,22 +63,22 @@ 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.
70
70
  - Validate consequential premises against available evidence before building; reuse relevant sibling investigation instead of repeating it. Run focused checks during iteration and all applicable full checks at task closure. Keep spend proportional without a hard spend or line gate; preserve the applicable test-first policy, native RDD, safety, and consent requirements.
71
71
  - Size every task by the Task Size section; small work creates no durable task artifacts, and counts of files, commands, tests, fixes, or lines never make it large. For large authorized implementation, automatically create the feature document after exploration, without a task or storage permission prompt.
72
- - Use about 400 authored changed lines per ODD task only as a planning heuristic, counting additions plus deletions; prefer the smallest coherent behavior with its tests and docs. This is not a task acceptance criterion, hard cap, counter-trigger, automatic stop, forced split, or RDD trigger. If the correct, clear solution naturally exceeds it, briefly explain why and continue without size-only rework loops. Never delete spaces, blank lines, or comments for cosmetic line savings; never omit tests, minify, add gratuitous abstractions, or split artificially to fit the heuristic. Forward this same advisory-only instruction when delegating tasks to subagents. The delivery budget below reads the accumulated branch, not this per-task heuristic. Existing PR size gates remain unchanged; continue under existing repository policy.
72
+ - Use about 400 authored changed lines per ODD task only as a planning heuristic, counting additions plus deletions; prefer the smallest coherent behavior with its tests and docs. This is not a task acceptance criterion, hard cap, counter-trigger, automatic stop, forced split, or RDD trigger. If the correct, clear solution naturally exceeds it, briefly explain why and continue without size-only rework loops. Never delete spaces, blank lines, or comments for cosmetic line savings; never omit tests, minify, add gratuitous abstractions, or split artificially to fit the heuristic. Forward this same advisory-only instruction when delegating tasks to subagents. The delivery budget below reads the accumulated branch, not this per-task heuristic. Existing PR size gates remain unchanged; continue under existing repository policy. A user's line limit is a ceiling, never an exact-count gate; never invent acceptance gates the user did not ask for.
73
73
  - Keep `odd/tasks/<feature-name>.md` and an Engram recovery copy under topic `odd/<feature-name>/tasks`, scoped to the current project. Use a descriptive filename-safe feature name. Reuse the same feature identity; never overwrite another feature. Keep one feature document, not a separate plan file or topic. It is the specification subagents read by reference, so keep this fixed order, stable content first and the growing log last: a header of two or three lines with the objective, branch, delivery strategy, and test runner; `## Specs` with numbered `S1`..`Sn` requirements and their authorized scope, acceptance criteria, and applicable checks, quoting the user's exact strings, error messages, commands, and examples verbatim in the user's language (number and order them, but never summarize or reword those fragments; Do not add requirements the user never asked for, and mark assumptions as assumptions); `## Tasks` with one line per task, using stable task IDs, with its linked `S#`, route (inline or delegated), status, and commit identity or RED/GREEN evidence; `## Log` as the logbook, where `L1` holds the user's original request verbatim, later user corrections are logged verbatim with their date, and problem analysis, rationale for meaningful accepted changes, verification evidence, progress, and next step are appended. Routine corrections stay brief; no exhaustive decision journal. Mirror the full current document and repository-relative file locator, not just a summary or completion notice.
74
74
  - Accepted user, review, or verification changes automatically update affected intent and TODOs, unlike a process that regenerates every artifact: a requirement change appends its verbatim `## Log` entry, rewrites only the affected `S#`, and reopens only its linked task; preserve valid completed and unrelated work; add genuinely new tasks or reopen invalidated items with a reason, and revise their checks. Findings alone never authorize scope expansion or automatic acceptance. Business scope changes still require user authorization. Check off only observed outcomes with applicable proof; record failed, unavailable, skipped, or pending checks honestly. Checkboxes grant no approval or receipt.
75
- - Read back both writes; they are not atomic. If Engram is unavailable, preserve local progress and explicitly mark the mirror pending; do not claim success or block unrelated safe work. Resynchronize when available. If a file write is unsafe or unavailable, preserve existing state and report the limitation. Preserve both versions on irreconcilable edits and ask only about the real conflict.
75
+ - Read back both writes with the normal read tool; they are not atomic, but never author comparison or reconciliation scripts or gates for them. After a partial or failed sync, check which writes already applied and continue from that state; never replay an applied write. The file is the source: a mirror that differs from the file just written is refreshed from the file, never a blocker. Refresh the mirror once per task transition (a task starts, finishes, is blocked, reopened, or dropped) or material plan change, and at close; `## Log` entries and evidence added between those points go to the file only and reach the mirror at the next one. If Engram is unavailable, preserve local progress and explicitly mark the mirror pending; do not claim success or block unrelated safe work. Resynchronize when available. If a file write is unsafe or unavailable, preserve existing state and report the limitation. Preserve both versions on irreconcilable edits and ask only about the real conflict.
76
76
  - On resume, use `mem_context`, then `mem_search` scoped to the current project and feature, and `mem_get_observation` for the full saved document; read the actual task file. Do not infer active work from the newest global memory. Reconcile current requirements, code, and proof before resuming the next unfinished task; preserve pending mirrors and conflicting edits.
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
- - 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, close the open slice first, assessing and reviewing it as the slice, so the high-risk commit is then reviewed alone against the new 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: treat the commit as due and run the preflight STATUS with `--base-ref <last reviewed boundary> --committed-only`. 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.
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 and follows the 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.
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 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
+ - 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
84
84
 
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "schema": "gentle-pi.provider-contract-capabilities-baseline/v1",
3
- "contract_semver": "1.4.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": "2d7ddd99f1c739a97f4a6b3929e5e2bdddcbf69aed69356395038d90bca25b2f"
19
+ "sha256": "ee25b26c5e913008a115e1cde258288a2c4b1ad9a41cb0b040fab2b76561e124"
20
20
  }
21
21
  ],
22
22
  "routing": [
23
23
  {
24
24
  "runtime": "pi",
25
25
  "path": "routing/pi.md",
26
- "sha256": "1c7466e2333c08e386b4b5afb081531146d181030692463431e7695df7f90690"
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.4.0",
3
+ "contract_semver": "1.6.0",
4
4
  "roles": [
5
5
  {
6
6
  "id": "lens",