@moretea-labs/forge 1.8.0 → 1.8.2

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 (695) hide show
  1. package/AGENTS.md +73 -7
  2. package/CHANGELOG.md +34 -0
  3. package/CLAUDE.md +17 -2
  4. package/CONTRIBUTING.md +3 -2
  5. package/README.en.md +24 -3
  6. package/README.md +10 -6
  7. package/README.zh-CN.md +5 -3
  8. package/THIRD_PARTY_NOTICES.md +1 -2
  9. package/adapters/chatgpt/browser-delivery-host.ts +7 -1
  10. package/adapters/chatgpt/browser-delivery-runtime.ts +531 -56
  11. package/adapters/chatgpt/controller-binding-store.ts +101 -22
  12. package/adapters/chatgpt/controller-round-host.ts +15 -25
  13. package/adapters/chatgpt/controller-round-settlement-store.ts +58 -4
  14. package/adapters/chatgpt/provider-delivery.ts +229 -2
  15. package/adapters/chatgpt/work-conversation-binding-store.ts +99 -54
  16. package/adapters/computer/chatgpt-extension-target.ts +708 -0
  17. package/adapters/computer/chrome-extension/background.js +541 -0
  18. package/adapters/computer/chrome-extension/content.js +402 -0
  19. package/adapters/computer/chrome-extension/core.js +24 -0
  20. package/adapters/computer/chrome-extension/manifest.json +32 -0
  21. package/adapters/computer/desktop-operator-discovery.ts +11 -31
  22. package/adapters/computer/desktop-operator-provider.ts +18 -6
  23. package/adapters/computer/interaction-target-authority.ts +178 -24
  24. package/adapters/mcp/access-mode.ts +18 -39
  25. package/adapters/mcp/auth.ts +2 -7
  26. package/adapters/mcp/instructions.ts +6 -5
  27. package/adapters/mcp/multi-repository.ts +10 -47
  28. package/adapters/mcp/oauth.ts +73 -0
  29. package/adapters/mcp/paths.ts +4 -1
  30. package/adapters/mcp/runtime-gateway/bounded-result-runtime.ts +62 -0
  31. package/adapters/mcp/runtime-gateway/cognition-settlement.ts +201 -0
  32. package/adapters/mcp/runtime-gateway/context-adapter.ts +490 -113
  33. package/adapters/mcp/runtime-gateway/context-pack-sidecar.ts +83 -0
  34. package/adapters/mcp/runtime-gateway/controller-authority-adapter.ts +20 -5
  35. package/adapters/mcp/runtime-gateway/core-capability-adapter.ts +258 -0
  36. package/adapters/mcp/runtime-gateway/engineering-preconditions.ts +10 -27
  37. package/adapters/mcp/runtime-gateway/engineering-tool-contract.ts +15 -0
  38. package/adapters/mcp/runtime-gateway/execution-tools.ts +14 -54
  39. package/adapters/mcp/runtime-gateway/gateway-execution-adapter.ts +2 -1
  40. package/adapters/mcp/runtime-gateway/plugin-adapter.ts +132 -47
  41. package/adapters/mcp/runtime-gateway/process-tools.ts +173 -23
  42. package/adapters/mcp/runtime-gateway/protected-computer-adapter.ts +16 -4
  43. package/adapters/mcp/runtime-gateway/recovery-adapter.ts +69 -52
  44. package/adapters/mcp/runtime-gateway/repository-compat-adapter.ts +4 -35
  45. package/adapters/mcp/runtime-gateway/result-adapter.ts +10 -4
  46. package/adapters/mcp/runtime-gateway/router.ts +19 -507
  47. package/adapters/mcp/runtime-gateway/routing-policy.ts +506 -0
  48. package/adapters/mcp/runtime-gateway/runtime-observation-adapter.ts +15 -66
  49. package/adapters/mcp/runtime-gateway/runtime-readiness-observation.ts +218 -0
  50. package/adapters/mcp/runtime-gateway/runtime-tool-definitions.ts +123 -178
  51. package/adapters/mcp/runtime-gateway/runtime-tools.ts +11 -5
  52. package/adapters/mcp/runtime-gateway/scheduler-adapter.ts +37 -1
  53. package/adapters/mcp/runtime-gateway/shared-adapter.ts +20 -0
  54. package/adapters/mcp/runtime-gateway/status-inbox-adapter.ts +416 -270
  55. package/adapters/mcp/runtime-gateway/typescript-navigation-sidecar.ts +140 -0
  56. package/adapters/mcp/runtime-gateway/work-adapter.ts +262 -3123
  57. package/adapters/mcp/runtime-gateway/work-controller-operations.ts +257 -0
  58. package/adapters/mcp/runtime-gateway/work-detail-projection.ts +60 -0
  59. package/adapters/mcp/runtime-gateway/work-input-wire-migration.ts +229 -0
  60. package/adapters/mcp/runtime-gateway/work-learning-operations.ts +145 -0
  61. package/adapters/mcp/runtime-gateway/work-list-projection.ts +38 -0
  62. package/adapters/mcp/runtime-gateway/work-plan-operations.ts +382 -0
  63. package/adapters/mcp/runtime-gateway/work-repair-adapter.ts +308 -0
  64. package/adapters/mcp/runtime-gateway/work-requirement-operations.ts +148 -0
  65. package/adapters/mcp/runtime-gateway/work-semantic-operations.ts +320 -0
  66. package/adapters/mcp/runtime-gateway/work-workflow-operations.ts +113 -0
  67. package/adapters/mcp/runtime-gateway/workflow-supervisor-adapter.ts +180 -0
  68. package/adapters/mcp/server.ts +91 -26
  69. package/adapters/mcp/setup.ts +5 -13
  70. package/adapters/mcp/tool-mapping/access-tools.ts +0 -6
  71. package/adapters/mcp/tool-mapping/legacy-tool-service.ts +703 -3092
  72. package/adapters/mcp/tool-mapping/post-finalize-work-attribution.ts +5 -10
  73. package/adapters/mcp/tool-mapping/repository-tools.ts +170 -213
  74. package/adapters/mcp/toolset-names.ts +11 -37
  75. package/adapters/mcp/toolset.ts +19 -92
  76. package/{src/cli → adapters}/mcp/transports/AGENTS.md +5 -5
  77. package/{src/cli → adapters}/mcp/transports/CLAUDE.md +5 -5
  78. package/adapters/mcp/transports/http-observation.ts +377 -0
  79. package/adapters/mcp/transports/http-post-lifecycle.ts +19 -0
  80. package/adapters/mcp/transports/http.ts +200 -683
  81. package/adapters/mcp/transports/oauth-http.ts +322 -0
  82. package/adapters/mcp/transports/session-registry.ts +6 -0
  83. package/adapters/mcp/tunnels/openai-secure-tunnel.ts +89 -5
  84. package/adapters/mcp/types.ts +0 -6
  85. package/assets/hooks/lib/session-state.sh +0 -38
  86. package/assets/hooks/post-bash.sh +1 -1
  87. package/assets/hooks/post-tool-observer.sh +0 -5
  88. package/assets/hooks/prompt-guard.sh +0 -55
  89. package/assets/partials/04-project-structure.partial.md +1 -1
  90. package/assets/partials/07-footer.partial.md +1 -1
  91. package/assets/partials-agents/02-operating-mode.partial.md +1 -1
  92. package/assets/partials-agents/08-deep-docs.partial.md +1 -1
  93. package/assets/plugin-registry.v1.json +6 -4
  94. package/assets/reference-configs/agentic-development-flow.md +26 -1
  95. package/assets/reference-configs/external-tooling.md +0 -76
  96. package/assets/reference-configs/global-working-rules.md +19 -0
  97. package/assets/reference-configs/release-deploy.md +1 -1
  98. package/assets/templates/helpers/architecture-queue.sh +1 -1
  99. package/assets/templates/helpers/check-agent-tooling.sh +1 -327
  100. package/assets/templates/helpers/check-task-workflow.sh +1 -1
  101. package/assets/templates/helpers/ensure-task-workflow.sh +0 -14
  102. package/assets/templates/helpers/migrate-project-template.sh +2 -2
  103. package/assets/workflow-contract.v1.json +0 -2
  104. package/docs/README.md +5 -2
  105. package/docs/architecture/CURRENT.md +205 -51
  106. package/docs/architecture/decisions/20260803-release-identity-binding-and-exit-policy.md +14 -5
  107. package/docs/architecture/decisions/20260823-immediate-controller-relay.md +6 -3
  108. package/docs/architecture/decisions/20260904-ios-device-migration-baseline.md +42 -0
  109. package/docs/architecture/decisions/20260907-assistant-learning-loop.md +2 -0
  110. package/docs/architecture/decisions/20260907-controller-round-transition-policy.md +19 -4
  111. package/docs/architecture/decisions/20260916-workflow-supervisor-authority.md +249 -0
  112. package/docs/architecture/decisions/20260917-cognitive-memory-foundation.md +82 -0
  113. package/docs/architecture/decisions/20260918-stable-candidate-release-lifecycle.md +234 -0
  114. package/docs/architecture/decisions/20260919-autonomous-work-liveness.md +62 -0
  115. package/docs/architecture/decisions/20260924-thin-semantic-working-context.md +74 -0
  116. package/docs/architecture/decisions/20261001-supervisor-turn-authority.md +342 -0
  117. package/docs/architecture/decisions/20261005-forge-v3-desktop-client-boundary.md +77 -0
  118. package/docs/architecture/decisions/20261009-exact-code-context-discovery.md +19 -0
  119. package/docs/architecture/decisions/20261009-generated-xcode-cache-retention.md +37 -0
  120. package/docs/architecture/decisions/20261011-autonomous-continuation-convergence.md +597 -0
  121. package/docs/architecture/decisions/20261017-edit-session-finalization-reconciliation.md +17 -0
  122. package/docs/architecture/decisions/20261019-retire-host-skills.md +16 -0
  123. package/docs/architecture/diagrams/agentic-dev-plugin-architecture.html +1 -1
  124. package/docs/architecture/domains/public-surface.md +3 -5
  125. package/docs/architecture/domains/verification.md +6 -5
  126. package/docs/architecture/domains/workflow-engine.md +6 -0
  127. package/docs/architecture/modules/controller-runtime/transport-lifecycle.md +3 -3
  128. package/docs/architecture/requests/2026-09-04-computer-plugin-workflow-taxonomy.md +4 -4
  129. package/docs/architecture/reviews/20261015-code-search-runtime-acceptance.md +75 -0
  130. package/docs/forge-plugin-management.md +16 -4
  131. package/docs/operations/controller-browser-plugin.md +23 -0
  132. package/docs/operations/controller-performance-and-502.md +17 -0
  133. package/docs/operations/controller-reliability-runbook.md +2 -2
  134. package/docs/operations/features.md +6 -7
  135. package/docs/operations/features.zh-CN.md +1 -1
  136. package/docs/operations/github-repository.md +4 -4
  137. package/docs/operations/github-semantic-release-projection.md +20 -0
  138. package/docs/operations/homebrew.md +2 -2
  139. package/docs/operations/mcp-tool-exposure.md +13 -52
  140. package/docs/operations/releasing.md +2 -0
  141. package/docs/operations/runtime-performance-diagnostics.md +8 -0
  142. package/docs/operations/standalone-disaster-recovery.md +15 -7
  143. package/docs/tutorials/01-install-and-start.zh-CN.md +1 -1
  144. package/docs/tutorials/03-first-repository-task.md +2 -0
  145. package/docs/wiki/Computer-and-Plugins.md +78 -0
  146. package/docs/wiki/Computer-and-Plugins.zh-CN.md +88 -0
  147. package/docs/wiki/Home.md +16 -2
  148. package/docs/wiki/Implementation.md +25 -13
  149. package/docs/wiki/Installation.md +28 -32
  150. package/docs/wiki/Integrations.md +4 -0
  151. package/docs/wiki/Quick-Start.md +35 -22
  152. package/docs/wiki/Releases-and-Upgrades.md +15 -25
  153. package/docs/wiki/_Sidebar.md +5 -1
  154. package/package.json +25 -25
  155. package/packages/kernel/cognition/api/index.ts +6 -0
  156. package/packages/kernel/cognition/application/activation-service.ts +451 -0
  157. package/packages/kernel/cognition/application/consolidation-service.ts +185 -0
  158. package/packages/kernel/cognition/application/legacy-experience-adapter.ts +38 -0
  159. package/packages/kernel/cognition/application/memory-service.ts +64 -0
  160. package/packages/kernel/cognition/domain/learning.ts +106 -0
  161. package/packages/kernel/cognition/domain/memory.ts +254 -0
  162. package/packages/kernel/controller/api/index.ts +1 -0
  163. package/packages/kernel/controller/application/continuation-service.ts +281 -0
  164. package/packages/kernel/controller/application/controller-round-service.ts +12 -0
  165. package/packages/kernel/controller/domain/controller-round-transition-policy.ts +242 -21
  166. package/packages/kernel/controller/domain/controller-round.ts +4 -1
  167. package/packages/kernel/controller/domain/execution-quality.ts +3 -1
  168. package/packages/kernel/controller/infrastructure/controller-round-store.ts +689 -103
  169. package/packages/kernel/controller/infrastructure/controller-session-store.ts +348 -97
  170. package/packages/kernel/controller/ports/controller-host.ts +2 -0
  171. package/packages/kernel/identity/api/index.ts +10 -0
  172. package/packages/kernel/identity/domain/activity-projection.ts +43 -0
  173. package/packages/kernel/identity/domain/capability-broker.ts +60 -0
  174. package/packages/kernel/identity/domain/grant.ts +72 -0
  175. package/packages/kernel/identity/domain/owned-resource.ts +116 -0
  176. package/packages/kernel/identity/domain/user-request.ts +93 -0
  177. package/packages/kernel/identity/infrastructure/activity-projection-store.ts +87 -0
  178. package/packages/kernel/identity/infrastructure/capability-broker.ts +81 -0
  179. package/packages/kernel/identity/infrastructure/grant-store.ts +284 -0
  180. package/packages/kernel/identity/infrastructure/owned-resource-store.ts +259 -0
  181. package/packages/kernel/identity/infrastructure/user-request-store.ts +182 -0
  182. package/packages/kernel/scheduler/api/index.ts +0 -2
  183. package/packages/kernel/scheduler/application/eligibility.ts +4 -1
  184. package/packages/kernel/scheduler/application/schedule-service.ts +3 -0
  185. package/packages/kernel/scheduler/application/settlement.ts +0 -15
  186. package/packages/kernel/scheduler/domain/schedule.ts +87 -0
  187. package/packages/kernel/scheduler/infrastructure/schedule-store.ts +166 -143
  188. package/packages/kernel/work/api/index.ts +3 -2
  189. package/packages/kernel/work/application/work-service.ts +18 -42
  190. package/packages/kernel/work/domain/current-task-lineage.ts +104 -0
  191. package/packages/kernel/work/domain/engineering-design.ts +10 -5
  192. package/packages/kernel/work/domain/engineering-profile.ts +8 -12
  193. package/packages/kernel/work/domain/evaluation-promotion-receipt.ts +186 -0
  194. package/packages/kernel/work/domain/execution-concurrency.ts +19 -26
  195. package/packages/kernel/work/domain/execution-snapshot.ts +0 -31
  196. package/packages/kernel/work/domain/implementation-review.ts +14 -331
  197. package/packages/kernel/work/domain/objective-graph.ts +119 -0
  198. package/packages/kernel/work/domain/project-engineering-contract.ts +23 -1
  199. package/packages/kernel/work/domain/repository-completion-receipt.ts +1 -1
  200. package/packages/kernel/work/domain/state-machine.ts +34 -65
  201. package/packages/kernel/work/domain/types.ts +57 -51
  202. package/packages/kernel/work/infrastructure/work-contract-store.ts +847 -729
  203. package/packages/kernel/work/ports/work-contract-store.ts +5 -2
  204. package/packages/plugin-runtime/browser/provider-registry.ts +12 -36
  205. package/packages/plugin-runtime/browser/session-authority.ts +2 -1
  206. package/packages/plugin-runtime/computer/chatgpt-identity.ts +24 -0
  207. package/packages/plugin-runtime/computer/conversation-target.ts +153 -0
  208. package/packages/plugin-runtime/computer/index.ts +2 -0
  209. package/packages/plugin-runtime/computer/target-authority.ts +26 -1
  210. package/packages/plugin-runtime/external/unix-jsonl-transport.ts +142 -18
  211. package/packages/protocols/computer/contract.ts +27 -1
  212. package/scripts/activate-source-baseline.ts +7 -9
  213. package/scripts/assemble-template.ts +11 -72
  214. package/scripts/canary-controller-semantic-wait.ts +12 -24
  215. package/scripts/check-mcp-compatibility.ts +94 -201
  216. package/scripts/check-package-identity.mjs +0 -5
  217. package/scripts/check-runtime-architecture.mjs +921 -239
  218. package/scripts/forge-local-recovery-helper.mjs +93 -15
  219. package/scripts/init-project.sh +0 -46
  220. package/scripts/install-ios-hid-toolchain.sh +60 -0
  221. package/scripts/install-standalone-recovery.ts +1 -1
  222. package/scripts/lib/project-init-lib.sh +6 -3
  223. package/scripts/migrate-windows-wsl-controller-home.ts +2 -0
  224. package/scripts/open-source-audit-allowlist.txt +1 -3
  225. package/scripts/run-bounded-command.mjs +5 -0
  226. package/scripts/run-governed-gate.ts +2 -1
  227. package/scripts/run-mobile-monitor-bridge.ts +0 -1
  228. package/scripts/smoke-control-plane-failure-domain.ts +94 -0
  229. package/scripts/smoke-ios-physical-device.ts +38 -10
  230. package/scripts/smoke-mcp-http-runtime.ts +12 -8
  231. package/scripts/smoke-mcp-tool-surface.ts +27 -41
  232. package/scripts/smoke-runtime-recovery.ts +12 -43
  233. package/scripts/smoke-schedule-engine.ts +23 -15
  234. package/scripts/smoke-unattended-transport-recovery.ts +223 -0
  235. package/scripts/smoke-user-request-continuation-restart.ts +232 -0
  236. package/scripts/smoke-workflow-supervisor-chrome-adapter.ts +95 -0
  237. package/scripts/smoke-workflow-supervisor-process-restart.ts +276 -0
  238. package/scripts/smoke-workflow-supervisor-restart-recovery.ts +150 -0
  239. package/scripts/smoke-workflow-supervisor.ts +103 -0
  240. package/scripts/sync-generated-authority.mjs +0 -1
  241. package/scripts/verify-forge-runtime.sh +2 -1
  242. package/src/cli/agent-jobs/executor-health.ts +12 -35
  243. package/src/cli/agent-jobs/integration.ts +20 -51
  244. package/src/cli/agent-jobs/job-manager.ts +7 -3
  245. package/src/cli/chatgpt-browser/file-policy.ts +2 -2
  246. package/src/cli/commands/brain-assistant.ts +27 -13
  247. package/src/cli/commands/brain.ts +13 -15
  248. package/src/cli/commands/chatgpt.ts +1 -163
  249. package/src/cli/commands/doctor.ts +1 -143
  250. package/src/cli/commands/global-runtime.ts +3 -196
  251. package/src/cli/commands/init-hook.ts +6 -23
  252. package/src/cli/commands/init.ts +3 -252
  253. package/src/cli/commands/mcp.ts +0 -5
  254. package/src/cli/commands/prompt-guard-decision.ts +0 -2
  255. package/src/cli/commands/recovery.ts +137 -135
  256. package/src/cli/commands/repository.ts +17 -1
  257. package/src/cli/commands/runtime.ts +3 -3
  258. package/src/cli/commands/setup-execution.ts +41 -0
  259. package/src/cli/commands/setup-profile.ts +8 -0
  260. package/src/cli/controller/check-runner.ts +13 -2
  261. package/src/cli/controller/completion-backlog.ts +3 -3
  262. package/src/cli/controller/completion-orchestrator.ts +5 -44
  263. package/src/cli/controller/completion-target.ts +3 -72
  264. package/src/cli/controller/composite-operations.ts +1 -1
  265. package/src/cli/controller/context/instruction-context.ts +1 -1
  266. package/src/cli/controller/context/known-paths.ts +2 -2
  267. package/src/cli/controller/context/query-planning.ts +11 -4
  268. package/src/cli/controller/context/rule-resolution.ts +2 -2
  269. package/src/cli/controller/context/source-materializer.ts +83 -102
  270. package/src/cli/controller/context/structural-provider.ts +84 -0
  271. package/src/cli/controller/context/structural.ts +6 -6
  272. package/src/cli/controller/context/types.ts +8 -9
  273. package/src/cli/controller/context-pack.ts +107 -84
  274. package/src/cli/controller/execution-completion.ts +4 -7
  275. package/src/cli/controller/execution-policy.ts +36 -153
  276. package/src/cli/controller/governance.ts +2 -3
  277. package/src/cli/controller/issue-store.ts +4 -99
  278. package/src/cli/controller/launch-agents.ts +59 -18
  279. package/src/cli/controller/operational-plan.ts +25 -52
  280. package/src/cli/controller/runtime-config.ts +5 -1
  281. package/src/cli/controller/stuck-state-migration.ts +2 -3
  282. package/src/cli/controller/systemd-user.ts +42 -10
  283. package/src/cli/editing/edit-session.ts +18 -12
  284. package/src/cli/github/github.ts +4 -4
  285. package/src/cli/github/semantic-projection.ts +174 -0
  286. package/src/cli/hook/prompt-intents.ts +0 -9
  287. package/src/cli/index.ts +1 -43
  288. package/src/cli/local-bridge/connector-freshness.ts +1 -12
  289. package/src/cli/local-bridge/console-automations.ts +19 -14
  290. package/src/cli/local-bridge/console-view-models.ts +4 -13
  291. package/src/cli/local-bridge/facade-api.ts +64 -193
  292. package/src/cli/local-bridge/server.ts +24 -147
  293. package/src/cli/local-bridge/types.ts +0 -1
  294. package/src/cli/mcp/oauth-client-retirement.ts +74 -0
  295. package/src/cli/repositories/command-classifier.ts +0 -9
  296. package/src/cli/repositories/command-executor.ts +29 -23
  297. package/src/cli/repositories/command-scope.ts +37 -18
  298. package/src/cli/repositories/controller-home.ts +48 -0
  299. package/src/cli/repositories/ephemeral-workspace.ts +20 -30
  300. package/src/cli/repositories/git-command-executor.ts +2 -2
  301. package/src/cli/repositories/locks.ts +20 -0
  302. package/src/cli/repositories/registry.ts +79 -12
  303. package/src/cli/repositories/safe-patch.ts +2 -12
  304. package/src/cli/repositories/structured-git.ts +101 -5
  305. package/src/cli/repository/inspector.ts +185 -343
  306. package/src/cli/repository/session-cache.ts +92 -6
  307. package/src/effects/process-runner.ts +17 -1
  308. package/src/runtime/context/assistant-context.ts +20 -7
  309. package/src/runtime/context/assistant-work-context.ts +89 -27
  310. package/src/runtime/context/automatic-learning.ts +565 -0
  311. package/src/runtime/context/cognitive-attention.ts +173 -0
  312. package/src/runtime/context/cognitive-skill-canary.ts +158 -0
  313. package/src/runtime/context/context-closure.ts +46 -9
  314. package/src/runtime/context/context-pack-process.ts +103 -0
  315. package/src/runtime/context/context-plane.ts +1 -9
  316. package/src/runtime/context/direct-controller-learning.ts +298 -0
  317. package/src/runtime/context/generic-lsp-provider.ts +1 -1
  318. package/src/runtime/context/semantic-navigation-contract.ts +16 -0
  319. package/src/runtime/context/semantic-navigation.ts +7 -35
  320. package/src/runtime/context/typescript-navigation-process.ts +145 -0
  321. package/src/runtime/context/typescript-navigation.ts +89 -3
  322. package/src/runtime/control-plane/cleanup-artifact-retention.ts +215 -12
  323. package/src/runtime/control-plane/concurrency/work-execution-concurrency.ts +9 -47
  324. package/src/runtime/control-plane/execution/controller-authority-recovery.ts +34 -4
  325. package/src/runtime/control-plane/execution/edit-validation-coordinator.ts +29 -20
  326. package/src/runtime/control-plane/execution/execution-identity.ts +23 -3
  327. package/src/runtime/control-plane/execution/repository-work-attribution.ts +7 -30
  328. package/src/runtime/control-plane/execution/retained-work-resume.ts +206 -199
  329. package/src/runtime/control-plane/execution/session-store.ts +31 -1
  330. package/src/runtime/control-plane/execution/validation.ts +6 -8
  331. package/src/runtime/control-plane/execution/work-authority-reconciler.ts +13 -42
  332. package/src/runtime/control-plane/execution/work-check-evidence.ts +137 -0
  333. package/src/runtime/control-plane/execution/work-completion-authority.ts +30 -85
  334. package/src/runtime/control-plane/execution/work-delivery-service.ts +616 -0
  335. package/src/runtime/control-plane/execution/work-evidence-policy.ts +12 -50
  336. package/src/runtime/control-plane/execution/work-execution-support.ts +50 -149
  337. package/src/runtime/control-plane/execution/work-handle-authority.ts +197 -110
  338. package/src/runtime/control-plane/execution/work-handle-store.ts +72 -44
  339. package/src/runtime/control-plane/execution/work-head-settlement.ts +53 -20
  340. package/src/runtime/control-plane/execution/work-lifecycle-audit.ts +52 -29
  341. package/src/runtime/control-plane/execution/work-operation-service.ts +60 -34
  342. package/src/runtime/control-plane/execution/work-preparation-service.ts +231 -267
  343. package/src/runtime/control-plane/execution/work-process-evidence.ts +2 -2
  344. package/src/runtime/control-plane/execution/work-remote-delivery.ts +2 -3
  345. package/src/runtime/control-plane/execution/work-revision-diff.ts +39 -0
  346. package/src/runtime/control-plane/execution/work-terminal-cleanup.ts +201 -199
  347. package/src/runtime/control-plane/execution/work-validation-reconciler.ts +33 -85
  348. package/src/runtime/control-plane/execution/work-verification-service.ts +406 -50
  349. package/src/runtime/control-plane/execution/work-verification-snapshot.ts +6 -2
  350. package/src/runtime/control-plane/facade/capability-registry.ts +364 -37
  351. package/src/runtime/control-plane/facade/check-normalization.ts +3 -9
  352. package/src/runtime/control-plane/facade/codex-delegation.ts +10 -11
  353. package/src/runtime/control-plane/facade/controller-connection.ts +135 -0
  354. package/src/runtime/control-plane/facade/goal-workloop-access.ts +1 -20
  355. package/src/runtime/control-plane/facade/goal-workloop.ts +281 -1753
  356. package/src/runtime/control-plane/facade/handoff-inbox-application.ts +12 -25
  357. package/src/runtime/control-plane/facade/handoff-inbox-store.ts +256 -52
  358. package/src/runtime/control-plane/facade/index.ts +0 -1
  359. package/src/runtime/control-plane/facade/operation-digest.ts +12 -15
  360. package/src/runtime/control-plane/facade/plan-contract-store.ts +451 -991
  361. package/src/runtime/control-plane/facade/policy-gate.ts +0 -23
  362. package/src/runtime/control-plane/facade/repository-work-admission.ts +12 -22
  363. package/src/runtime/control-plane/facade/requirement-authority.ts +102 -199
  364. package/src/runtime/control-plane/facade/requirement-board.ts +3 -3
  365. package/src/runtime/control-plane/facade/rh-work-operation-contract.ts +51 -14
  366. package/src/runtime/control-plane/facade/self-healing-loop.ts +18 -53
  367. package/src/runtime/control-plane/facade/suggested-actions.ts +15 -18
  368. package/src/runtime/control-plane/facade/types.ts +49 -108
  369. package/src/runtime/control-plane/facade/work-continuation.ts +9 -9
  370. package/src/runtime/control-plane/generated-cache-retention.ts +206 -59
  371. package/src/runtime/control-plane/global-scheduler/autonomous-continuation.ts +248 -0
  372. package/src/runtime/control-plane/global-scheduler/durable-admission.ts +1 -1
  373. package/src/runtime/control-plane/global-scheduler/maintenance.ts +256 -117
  374. package/src/runtime/control-plane/global-scheduler/reconciliation.ts +3 -12
  375. package/src/runtime/control-plane/global-scheduler/scheduler.ts +66 -40
  376. package/src/runtime/control-plane/global-scheduler/wake-signal.ts +42 -2
  377. package/src/runtime/control-plane/governance/access-policy.ts +19 -2
  378. package/src/runtime/control-plane/governance/authorization.ts +20 -3
  379. package/src/runtime/control-plane/governance/external-effects.ts +1 -1
  380. package/src/runtime/control-plane/launcher/chatgpt-round-continuation.ts +63 -300
  381. package/src/runtime/control-plane/launcher/chatgpt-work-continuation.ts +29 -300
  382. package/src/runtime/control-plane/launcher/local-conversation-controller.ts +238 -0
  383. package/src/runtime/control-plane/launcher/provider-mcp-bootstrap.ts +5 -2
  384. package/src/runtime/control-plane/launcher/thin-launcher.ts +96 -240
  385. package/src/runtime/control-plane/persistence/cognition-store.ts +820 -0
  386. package/src/runtime/control-plane/persistence/experience-store.ts +162 -29
  387. package/src/runtime/control-plane/persistence/requirement-store.ts +216 -74
  388. package/src/runtime/control-plane/persistence/sqlite-store.ts +113 -6
  389. package/src/runtime/control-plane/release-retention.ts +135 -47
  390. package/src/runtime/control-plane/repository-namespace-retention.ts +2 -2
  391. package/src/runtime/control-plane/runtime-cleanup.ts +295 -107
  392. package/src/runtime/control-plane/workspace/project-onboarding.ts +80 -0
  393. package/src/runtime/control-plane/workspace/semantic-sync-service.ts +19 -5
  394. package/src/runtime/control-plane/workspace/workspace-store.ts +169 -0
  395. package/src/runtime/diagnostics/incident-repair.ts +313 -146
  396. package/src/runtime/diagnostics/mcp-timing.ts +114 -0
  397. package/src/runtime/evidence/artifact-store.ts +158 -40
  398. package/src/runtime/evidence/evidence-store.ts +112 -8
  399. package/src/runtime/evidence/output-handle-index.ts +225 -0
  400. package/src/runtime/evidence/result-store.ts +158 -44
  401. package/src/runtime/evidence/sensitive-output.ts +22 -2
  402. package/src/runtime/execution/jobs/child-reference.ts +11 -0
  403. package/src/runtime/execution/jobs/receipt-recovery.ts +1 -11
  404. package/src/runtime/execution/jobs/store.ts +3 -4
  405. package/src/runtime/execution/managed-workspace.ts +57 -0
  406. package/src/runtime/execution/process-runtime/check-facade.ts +1 -1
  407. package/src/runtime/execution/process-runtime/check-result-retention.ts +2 -2
  408. package/src/runtime/execution/process-runtime/check-result.ts +105 -1
  409. package/src/runtime/execution/process-runtime/check-runner-sidecar.ts +18 -8
  410. package/src/runtime/execution/process-runtime/command-facade.ts +82 -30
  411. package/src/runtime/execution/process-runtime/gc.ts +15 -2
  412. package/src/runtime/execution/process-runtime/handle-index.ts +176 -0
  413. package/src/runtime/execution/process-runtime/host-command-lane.ts +139 -0
  414. package/src/runtime/execution/process-runtime/index.ts +3 -0
  415. package/src/runtime/execution/process-runtime/lightweight-managed.ts +251 -72
  416. package/src/runtime/execution/process-runtime/persisted-check.ts +3 -3
  417. package/src/runtime/execution/process-runtime/process-runner-entry.ts +47 -5
  418. package/src/runtime/execution/process-runtime/process-scope.ts +160 -0
  419. package/src/runtime/execution/process-runtime/resource-claims.ts +65 -61
  420. package/src/runtime/execution/process-runtime/runtime.ts +55 -18
  421. package/src/runtime/execution/process-runtime/store.ts +30 -2
  422. package/src/runtime/execution/process-runtime/types.ts +6 -1
  423. package/src/runtime/execution/thin-harness/execution-router.ts +16 -16
  424. package/src/runtime/execution/thin-harness/fast-executor.ts +2 -2
  425. package/src/runtime/execution/thin-harness/search-worker.ts +2 -2
  426. package/src/runtime/execution/workers/executor.ts +3 -8
  427. package/src/runtime/maintenance/cleanup.ts +41 -5
  428. package/src/runtime/platform/service-inventory.ts +130 -0
  429. package/src/runtime/platform/service-manager.ts +8 -0
  430. package/src/runtime/plugins/action-application.ts +97 -29
  431. package/src/runtime/plugins/app-store-connect-adapter.ts +290 -18
  432. package/src/runtime/plugins/browser-adapter.ts +1124 -333
  433. package/src/runtime/plugins/browser-automation-service.ts +23 -3
  434. package/src/runtime/plugins/browser-macos-bridge.ts +431 -137
  435. package/src/runtime/plugins/browser-manifest-surface.ts +47 -12
  436. package/src/runtime/plugins/browser-native-session-service.ts +63 -13
  437. package/src/runtime/plugins/browser-registration.ts +18 -0
  438. package/src/runtime/plugins/browser-runtime.ts +40 -36
  439. package/src/runtime/plugins/browser-session-authority.ts +2 -2
  440. package/src/runtime/plugins/browser-session-store.ts +46 -76
  441. package/src/runtime/plugins/capability-authorization-grants.ts +258 -62
  442. package/src/runtime/plugins/computer-chatgpt-browser-adapter-installer.ts +228 -0
  443. package/src/runtime/plugins/computer-registration.ts +298 -20
  444. package/src/runtime/plugins/desktop-operator-external-policy.ts +36 -4
  445. package/src/runtime/plugins/desktop-operator-registration.ts +12 -4
  446. package/src/runtime/plugins/external-adapter.ts +42 -6
  447. package/src/runtime/plugins/external-registration.ts +21 -1
  448. package/src/runtime/plugins/github-adapter.ts +30 -3
  449. package/src/runtime/plugins/gmail-adapter.ts +189 -3
  450. package/src/runtime/plugins/google-calendar-adapter.ts +2 -2
  451. package/src/runtime/plugins/google-shared.ts +24 -12
  452. package/src/runtime/plugins/google-tasks-adapter.ts +2 -2
  453. package/src/runtime/plugins/ios/remote-xpc-hid.ts +70 -30
  454. package/src/runtime/plugins/ios-adapter.ts +46 -41
  455. package/src/runtime/plugins/ios-agent-device.ts +54 -4
  456. package/src/runtime/plugins/ios-device-ownership.ts +103 -0
  457. package/src/runtime/plugins/ios-physical-device.ts +497 -79
  458. package/src/runtime/plugins/lightweight-action.ts +208 -2
  459. package/src/runtime/plugins/local-system-adapter.ts +12 -100
  460. package/src/runtime/plugins/managed-process-adapter.ts +12 -5
  461. package/src/runtime/plugins/plugin-action-sidecar.ts +17 -13
  462. package/src/runtime/plugins/plugin-management-adapter.ts +1 -1
  463. package/src/runtime/plugins/store.ts +682 -435
  464. package/src/runtime/plugins/types.ts +24 -0
  465. package/src/runtime/plugins/xiaohongshu-publish.ts +16 -0
  466. package/src/runtime/projections/git-status-sampler.ts +2 -19
  467. package/src/runtime/projections/invalidation.ts +7 -3
  468. package/src/runtime/projections/materialized-view.ts +80 -36
  469. package/src/runtime/recovery/actions.ts +4 -4
  470. package/src/runtime/recovery/capability-action-application.ts +46 -45
  471. package/src/runtime/recovery/lifecycle-inventory.ts +30 -40
  472. package/src/runtime/recovery/maintenance-executor.ts +374 -123
  473. package/src/runtime/recovery/probe.ts +2 -2
  474. package/src/runtime/recovery/store.ts +29 -11
  475. package/src/runtime/release/release-coordinator.ts +312 -0
  476. package/src/runtime/release/release-session.ts +716 -0
  477. package/src/runtime/release/release-state-migration.ts +25 -0
  478. package/src/runtime/resources/leases/store.ts +56 -25
  479. package/src/runtime/root/computer-composition.ts +191 -6
  480. package/src/runtime/root/controller-progression-composition.ts +254 -0
  481. package/src/runtime/root/controller-round-composition.ts +20 -1
  482. package/src/runtime/root/deployment-topology.ts +106 -0
  483. package/src/runtime/root/entry.ts +4 -3
  484. package/src/runtime/root/known-good-recovery.ts +184 -0
  485. package/src/runtime/root/local-bridge.ts +0 -1
  486. package/src/runtime/root/mcp-transport.ts +111 -18
  487. package/src/runtime/root/ownership.ts +261 -9
  488. package/src/runtime/root/package-connector-service.ts +227 -29
  489. package/src/runtime/root/package-runtime-release.ts +117 -30
  490. package/src/runtime/root/package-runtime-service.ts +24 -24
  491. package/src/runtime/root/release-execution-canary.ts +57 -12
  492. package/src/runtime/root/release-loader.ts +90 -8
  493. package/src/runtime/root/release-manifest.ts +80 -40
  494. package/src/runtime/root/release-materialize.ts +372 -106
  495. package/src/runtime/root/release-store.ts +395 -36
  496. package/src/runtime/root/runtime-lane.ts +191 -0
  497. package/src/runtime/root/runtime.ts +160 -29
  498. package/src/runtime/root/scheduled-controller-composition.ts +29 -3
  499. package/src/runtime/root/service-runner.ts +2 -2
  500. package/src/runtime/root/service.ts +126 -44
  501. package/src/runtime/root/status.ts +48 -0
  502. package/src/runtime/root/types.ts +32 -9
  503. package/src/runtime/root/workflow-supervisor-composition.ts +681 -0
  504. package/src/runtime/root/workflow-supervisor-runtime.ts +564 -0
  505. package/src/runtime/root/write-fence.ts +50 -2
  506. package/src/runtime/safe-tooling/google-credential-store.ts +67 -22
  507. package/src/runtime/safe-tooling/google-oauth-broker.ts +25 -7
  508. package/src/runtime/safe-tooling/ios-development.ts +22 -8
  509. package/src/runtime/safe-tooling/job-summary.ts +1 -1
  510. package/src/runtime/safe-tooling/workspace-auth.ts +5 -2
  511. package/src/runtime/shared/atomic-text-file.ts +21 -0
  512. package/src/runtime/shared/bounded-child-supervisor.ts +9 -1
  513. package/src/runtime/shared/json-files.ts +8 -3
  514. package/src/runtime/shared/process-environment.ts +20 -9
  515. package/src/runtime/shared/response-budget.ts +1 -3
  516. package/src/runtime/standalone-recovery/controller-home-migration.ts +16 -24
  517. package/src/runtime/standalone-recovery/core.ts +3792 -417
  518. package/src/runtime/standalone-recovery/entry.ts +507 -45
  519. package/src/runtime/standalone-recovery/installer.ts +262 -148
  520. package/src/runtime/standalone-recovery/mcp-server.ts +29 -193
  521. package/src/runtime/standalone-recovery/operation-lock.ts +12 -2
  522. package/src/runtime/standalone-recovery/performance.ts +54 -16
  523. package/src/runtime/standalone-recovery/release.ts +53 -5
  524. package/src/runtime/standalone-recovery/service-labels.ts +5 -2
  525. package/src/runtime/standalone-recovery/watchdog-heartbeat.ts +5 -2
  526. package/src/runtime/workflow/schedules/browser-probe.ts +17 -6
  527. package/src/runtime/workflow/schedules/chatgpt-automation-migration.ts +11 -3
  528. package/src/runtime/workflow/schedules/engine.ts +166 -178
  529. package/src/runtime/workflow/schedules/pending-activation.ts +11 -4
  530. package/src/runtime/workflow/schedules/work-continuation.ts +95 -11
  531. package/src/runtime/workflows/runtime.ts +15 -19
  532. package/src/testing/test-governance.ts +5 -1
  533. package/supervisor/chatgpt-conversation.ts +23 -0
  534. package/supervisor/client.ts +218 -0
  535. package/supervisor/control-plane.ts +963 -0
  536. package/supervisor/entry.ts +15 -0
  537. package/supervisor/forge-validators.ts +147 -0
  538. package/supervisor/index.ts +5 -0
  539. package/supervisor/native-browser-adapter.ts +1151 -0
  540. package/supervisor/native-messaging/host.ts +58 -0
  541. package/supervisor/native-messaging/manifest.ts +26 -0
  542. package/supervisor/native-messaging/protocol.ts +27 -0
  543. package/supervisor/paths.ts +18 -0
  544. package/supervisor/protocol.ts +250 -0
  545. package/supervisor/server.ts +412 -0
  546. package/supervisor/store.ts +1870 -0
  547. package/supervisor/tsconfig.json +8 -0
  548. package/supervisor/types.ts +261 -0
  549. package/SKILL.md +0 -427
  550. package/adapters/chatgpt/controller-host.ts +0 -119
  551. package/adapters/mcp/controller-round-compatibility.ts +0 -184
  552. package/adapters/mcp/frozen-client-semantic-compatibility.ts +0 -292
  553. package/adapters/mcp/runtime-gateway/work-compat-adapter.ts +0 -502
  554. package/adapters/mcp/runtime-gateway/work-validation-reconciler.ts +0 -1
  555. package/adapters/mcp/toolset-selection.ts +0 -41
  556. package/agents/openai.yaml +0 -4
  557. package/assets/skill-hooks.json +0 -41
  558. package/assets/skill-version.json +0 -189
  559. package/assets/skills/claude-review/SKILL.md +0 -231
  560. package/assets/skills/codex-review/SKILL.md +0 -103
  561. package/assets/templates/helpers/check-skill-version.ts +0 -193
  562. package/packages/kernel/progression/api/index.ts +0 -2
  563. package/packages/kernel/progression/application/projector.ts +0 -211
  564. package/packages/kernel/progression/domain/types.ts +0 -116
  565. package/packages/kernel/progression/index.ts +0 -1
  566. package/packages/kernel/scheduler/application/continuation-service.ts +0 -212
  567. package/packages/kernel/scheduler/domain/continuation.ts +0 -38
  568. package/packages/kernel/scheduler/infrastructure/continuation-dispatch-store.ts +0 -38
  569. package/packages/kernel/work/domain/admission-policy.ts +0 -34
  570. package/scripts/benchmark-background-check-overlap.ts +0 -228
  571. package/scripts/benchmark-computer-hotpath.ts +0 -255
  572. package/scripts/benchmark-controller-hotpath.ts +0 -212
  573. package/scripts/benchmark-controller-round2.ts +0 -191
  574. package/scripts/benchmark-ios-agent-device.ts +0 -511
  575. package/scripts/benchmark-mcp-host.sh +0 -117
  576. package/scripts/benchmark-mcp-transport.ts +0 -169
  577. package/scripts/benchmark-operational-memory-activation.ts +0 -235
  578. package/scripts/benchmark-operational-shadow.ts +0 -28
  579. package/scripts/benchmark-quality-harness.ts +0 -146
  580. package/scripts/benchmark-route-session-concurrency.ts +0 -915
  581. package/scripts/benchmark-thin-harness-gateway-ab.ts +0 -632
  582. package/scripts/benchmark-thin-harness-mcp-e2e.ts +0 -498
  583. package/scripts/benchmark-thin-harness.ts +0 -251
  584. package/scripts/benchmark-typescript-navigation.ts +0 -186
  585. package/scripts/benchmark-work-efficiency.ts +0 -334
  586. package/scripts/build-controller-ui.ts +0 -28
  587. package/scripts/check-npm-release.sh +0 -32
  588. package/scripts/check-public-release-surface.sh +0 -19
  589. package/scripts/check-release-published.sh +0 -57
  590. package/scripts/check-release-readiness.sh +0 -37
  591. package/scripts/check-release-version.mjs +0 -74
  592. package/scripts/check-skill-version.ts +0 -5
  593. package/scripts/check-tarball-install-smoke.sh +0 -150
  594. package/scripts/ensure-codegraph.sh +0 -16
  595. package/scripts/package-source-archive.sh +0 -147
  596. package/scripts/public-release-files.txt +0 -39
  597. package/scripts/public-release.ts +0 -174
  598. package/scripts/publish-release-tarball.sh +0 -27
  599. package/scripts/route-nl-vs-ts-eval.ts +0 -679
  600. package/scripts/run-skill-hook.ts +0 -244
  601. package/scripts/stage-runtime-release.ts +0 -44
  602. package/scripts/sync-codex-installed-copies.sh +0 -182
  603. package/src/cli/commands/tools.ts +0 -167
  604. package/src/cli/controller/progress.ts +0 -656
  605. package/src/cli/controller/work-mode.ts +0 -181
  606. package/src/cli/local-bridge/console-assets.ts +0 -17
  607. package/src/cli/local-bridge/dashboard.ts +0 -17
  608. package/src/cli/local-bridge/frontend/src/App.tsx +0 -10
  609. package/src/cli/local-bridge/frontend/src/components/Button.tsx +0 -1
  610. package/src/cli/local-bridge/frontend/src/components/DetailPane.tsx +0 -3
  611. package/src/cli/local-bridge/frontend/src/components/SearchField.tsx +0 -1
  612. package/src/cli/local-bridge/frontend/src/components/SectionHeader.tsx +0 -1
  613. package/src/cli/local-bridge/frontend/src/components/Segmented.tsx +0 -1
  614. package/src/cli/local-bridge/frontend/src/components/StatusText.tsx +0 -3
  615. package/src/cli/local-bridge/frontend/src/design/icons.tsx +0 -11
  616. package/src/cli/local-bridge/frontend/src/design/tokens.css +0 -8
  617. package/src/cli/local-bridge/frontend/src/features/automations/AutomationsView.tsx +0 -153
  618. package/src/cli/local-bridge/frontend/src/features/capabilities/CapabilitiesView.tsx +0 -37
  619. package/src/cli/local-bridge/frontend/src/features/overview/OverviewView.tsx +0 -183
  620. package/src/cli/local-bridge/frontend/src/features/repositories/RepositoriesView.tsx +0 -2
  621. package/src/cli/local-bridge/frontend/src/features/system/SystemView.tsx +0 -2
  622. package/src/cli/local-bridge/frontend/src/features/work/WorkView.tsx +0 -4
  623. package/src/cli/local-bridge/frontend/src/lib/api.ts +0 -30
  624. package/src/cli/local-bridge/frontend/src/lib/format.ts +0 -4
  625. package/src/cli/local-bridge/frontend/src/lib/routes.ts +0 -7
  626. package/src/cli/local-bridge/frontend/src/main.tsx +0 -1
  627. package/src/cli/local-bridge/frontend/src/shell/AppShell.tsx +0 -1
  628. package/src/cli/local-bridge/frontend/src/shell/CommandBar.tsx +0 -2
  629. package/src/cli/local-bridge/frontend/src/shell/Sidebar.tsx +0 -4
  630. package/src/cli/local-bridge/frontend/src/styles.css +0 -28
  631. package/src/cli/local-bridge/frontend/src/types.ts +0 -15
  632. package/src/cli/local-bridge/frontend/src/vite-env.d.ts +0 -1
  633. package/src/cli/local-bridge/frontend/vite.config.ts +0 -27
  634. package/src/cli/local-bridge/ui-dist/app.css +0 -1
  635. package/src/cli/local-bridge/ui-dist/app.js +0 -11228
  636. package/src/cli/mcp/access-mode.ts +0 -2
  637. package/src/cli/mcp/access-tools.ts +0 -2
  638. package/src/cli/mcp/audit.ts +0 -2
  639. package/src/cli/mcp/auth.ts +0 -2
  640. package/src/cli/mcp/instructions.ts +0 -2
  641. package/src/cli/mcp/legacy-context.ts +0 -2
  642. package/src/cli/mcp/legacy-tool-service.ts +0 -2
  643. package/src/cli/mcp/multi-repository.ts +0 -2
  644. package/src/cli/mcp/oauth.ts +0 -2
  645. package/src/cli/mcp/openai-secure-tunnel.ts +0 -2
  646. package/src/cli/mcp/paths.ts +0 -2
  647. package/src/cli/mcp/policy.ts +0 -2
  648. package/src/cli/mcp/post-finalize-work-attribution.ts +0 -2
  649. package/src/cli/mcp/proxy-env.ts +0 -2
  650. package/src/cli/mcp/readiness-projection.ts +0 -2
  651. package/src/cli/mcp/redaction.ts +0 -2
  652. package/src/cli/mcp/repo.ts +0 -2
  653. package/src/cli/mcp/repository-tools.ts +0 -2
  654. package/src/cli/mcp/server.ts +0 -2
  655. package/src/cli/mcp/setup.ts +0 -2
  656. package/src/cli/mcp/tool-capability-cache.ts +0 -2
  657. package/src/cli/mcp/tool-contract.ts +0 -2
  658. package/src/cli/mcp/tools.ts +0 -2
  659. package/src/cli/mcp/toolset-names.ts +0 -2
  660. package/src/cli/mcp/toolset-selection.ts +0 -2
  661. package/src/cli/mcp/toolset.ts +0 -2
  662. package/src/cli/mcp/transports/http.ts +0 -2
  663. package/src/cli/mcp/transports/session-registry.ts +0 -2
  664. package/src/cli/mcp/transports/stdio.ts +0 -2
  665. package/src/cli/mcp/types.ts +0 -2
  666. package/src/cli/mcp/umbrella-tools.ts +0 -2
  667. package/src/cli/tools/codegraph.ts +0 -695
  668. package/src/core/adoption/helper-wrapper-plan.ts +0 -159
  669. package/src/runtime/context/codegraph-cache-boundary.ts +0 -255
  670. package/src/runtime/context/codegraph-read-provider.ts +0 -611
  671. package/src/runtime/context/codegraph-sidecar.cjs +0 -248
  672. package/src/runtime/control-plane/codegraph-cache-retention.ts +0 -164
  673. package/src/runtime/control-plane/execution/content-equivalent-commit-authority.ts +0 -169
  674. package/src/runtime/control-plane/execution/direct-canonical-work-reconciliation.ts +0 -85
  675. package/src/runtime/control-plane/execution/direct-edit-work-completion.ts +0 -655
  676. package/src/runtime/control-plane/execution/work-finalization-service.ts +0 -2850
  677. package/src/runtime/control-plane/execution/work-path-scope.ts +0 -37
  678. package/src/runtime/control-plane/execution/work-task-receipt.ts +0 -468
  679. package/src/runtime/control-plane/facade/controller-round-relay.ts +0 -3
  680. package/src/runtime/control-plane/facade/work-admission-policy.ts +0 -142
  681. package/src/runtime/control-plane/facade/work-implementation-review.ts +0 -2
  682. package/src/runtime/control-plane/facade/work-state-machine.ts +0 -2
  683. package/src/runtime/control-plane/facade/work-task-projection.ts +0 -66
  684. package/src/runtime/control-plane/routing/index.ts +0 -1
  685. package/src/runtime/control-plane/routing/route-policy.ts +0 -401
  686. package/src/runtime/control-plane/routing/workspace-admission.ts +0 -70
  687. package/src/runtime/gateway/mcp/execution-tools.ts +0 -2
  688. package/src/runtime/gateway/mcp/legacy-ios-tool-adapter.ts +0 -2
  689. package/src/runtime/gateway/mcp/persisted-check-process.ts +0 -2
  690. package/src/runtime/gateway/mcp/process-tools.ts +0 -2
  691. package/src/runtime/gateway/mcp/router.ts +0 -2
  692. package/src/runtime/gateway/mcp/runtime-tool-definitions.ts +0 -2
  693. package/src/runtime/gateway/mcp/runtime-tools.ts +0 -2
  694. package/src/runtime/gateway/mcp/work-validation-reconciler.ts +0 -2
  695. package/src/runtime/plugins/browser-provider-registry.ts +0 -2
@@ -43,11 +43,20 @@ function forbidBetween(path, startNeedle, endNeedle, expression, description) {
43
43
  }
44
44
  if (expression.test(source.slice(start, end))) failures.push(`${path} violates ${description}`);
45
45
  }
46
+ const GENERATED_SOURCE_DIRECTORY_NAMES = new Set([
47
+ 'node_modules',
48
+ 'dist',
49
+ 'build',
50
+ 'coverage',
51
+ 'target',
52
+ ]);
53
+
46
54
  function sourceFiles(directory) {
47
55
  const absolute = resolve(root, directory);
48
56
  if (!existsSync(absolute)) return [];
49
57
  const files = [];
50
58
  for (const entry of readdirSync(absolute, { withFileTypes: true })) {
59
+ if (entry.isDirectory() && GENERATED_SOURCE_DIRECTORY_NAMES.has(entry.name)) continue;
51
60
  const path = `${directory}/${entry.name}`;
52
61
  if (entry.isDirectory()) files.push(...sourceFiles(path));
53
62
  else if (entry.isFile() && path.endsWith('.ts')) files.push(path);
@@ -255,18 +264,24 @@ function requireExactShrinkingInventory(label, actual, allowed) {
255
264
  }
256
265
  }
257
266
 
258
- // Stage 4 boundary: rh_work is an ABI/translation adapter. Durable lifecycle
259
- // ownership stays in Kernel/application services and physical WorkHandle state
260
- // may not be persisted from the MCP adapter.
267
+ // Thin rh_work boundary: semantic Requirement/Plan/Work records and explicit
268
+ // launcher/schedule/workflow intent only. Repository execution, checks and Git
269
+ // delivery stay on their typed capability surfaces; old lifecycle verbs are gone.
261
270
  requireText('adapters/mcp/runtime-gateway/runtime-tools.ts', "if (name === 'rh_work') return callWorkAdapter(ctx, args);");
262
- requireText('adapters/mcp/runtime-gateway/controller-authority-adapter.ts', 'controllerTerminalizationAuthorityForInvocation');
263
- requireText('adapters/mcp/runtime-gateway/controller-authority-adapter.ts', 'assertControllerRoundInvocationAuthority');
264
- forbid('adapters/mcp/runtime-gateway/work-adapter.ts', /\b(?:transitionWorkHandle|writeWorkHandle|markWorkHandleFailed)\s*\(/, 'rh_work adapter must not persist WorkHandle lifecycle state; use the canonical completion/finalization authority');
265
- forbid('adapters/mcp/runtime-gateway/work-adapter.ts', /control-plane\/facade\/work-contract-store|kernel\/work\/infrastructure/, 'rh_work adapter must consume canonical Work application/API authority, not persistence infrastructure');
266
- forbid('adapters/mcp/runtime-gateway/work-adapter.ts', /\b(?:appendWorkEvidence|recordWorkCompletionReceipt|updateWorkContract)\s*\(/, 'rh_work adapter must not write Work lifecycle/evidence records directly');
267
- forbid('adapters/mcp/runtime-gateway/work-adapter.ts', /\b(?:createRequirement|resumeRetainedCancelledWorkContract|acceptRequirementOutcome)\s*\(/, 'rh_work adapter must delegate Requirement and retained-Work lifecycle transitions to canonical application authorities');
268
- forbid('adapters/mcp/runtime-gateway/work-adapter.ts', /function\s+(?:assert|evaluate|derive)[A-Za-z0-9_]*ImplementationReview/, 'rh_work adapter must not implement implementation-review policy authority');
269
- forbid('adapters/mcp/runtime-gateway/work-adapter.ts', /repositoryGit(?:Commit|FinishWorkflow|MergeBranch|DeleteBranch|RebaseOnto)\s*\(/, 'rh_work adapter must delegate physical Git delivery to canonical Work finalization authority');
271
+ requireText('adapters/mcp/runtime-gateway/work-controller-operations.ts', "const RH_WORK_CONTROLLER_OPERATIONS = new Set(['launcher_start']);");
272
+ requireText('adapters/mcp/runtime-gateway/work-adapter.ts', "if (operation === 'launcher_start')");
273
+ requireText('adapters/mcp/runtime-gateway/work-requirement-operations.ts', 'export async function callRhWorkRequirementOperation');
274
+ requireText('adapters/mcp/runtime-gateway/work-plan-operations.ts', 'export async function callRhWorkPlanOperation');
275
+ requireText('adapters/mcp/runtime-gateway/work-plan-operations.ts', 'export async function callRhWorkPlanCreateOperation');
276
+ requireText('adapters/mcp/runtime-gateway/work-adapter.ts', 'callRhWorkRequirementOperation(ctx, repository, operation, args)');
277
+ requireText('adapters/mcp/runtime-gateway/work-adapter.ts', 'callRhWorkPlanOperation(store, operation, args)');
278
+ requireText('adapters/mcp/runtime-gateway/work-adapter.ts', 'callRhWorkPlanCreateOperation(store, operation, args');
279
+ forbid('adapters/mcp/runtime-gateway/work-adapter.ts', /operation === ['"](?:continue|verify|review|finalize|stop|delegate|controller_get_owner|controller_claim|controller_disposition|controller_release)['"]/, 'thin rh_work must not route retired lifecycle/controller operations');
280
+ forbid('adapters/mcp/runtime-gateway/work-adapter.ts', /\b(?:transitionWorkHandle|writeWorkHandle|markWorkHandleFailed|executeWorkVerification|requestWorkImplementationReview)\b/, 'rh_work must not own mechanical execution, verification or review authority');
281
+ forbid('adapters/mcp/runtime-gateway/work-adapter.ts', /repositoryGit(?:Commit|FinishWorkflow|MergeBranch|DeleteBranch|RebaseOnto)\s*\(/, 'rh_work must not perform physical Git delivery');
282
+ forbid('adapters/mcp/runtime-gateway/work-adapter.ts', /control-plane\/facade\/work-contract-store|kernel\/work\/infrastructure/, 'rh_work must consume canonical semantic APIs instead of persistence infrastructure');
283
+ forbid('adapters/mcp/runtime-gateway/work-plan-operations.ts', /plan_approve|plan_accept_step|plan_supersede|approvePlanContractAsync|acceptPlanStepEvidence|supersedePlanContract/, 'retired Plan approval/acceptance/supersession APIs must not remain on the runtime surface');
284
+ forbid('src/runtime/control-plane/facade/plan-contract-store.ts', /approvePlanContract|approvePendingPlanRevision|supersedePlanContract|plan_revision_approved/, 'legacy Plan approval/supersession writers must stay retired');
270
285
 
271
286
  // #197 MCP mega-adapter decomposition. These are debt ledgers, not target
272
287
  // architecture: entries may only disappear. New domain-authority imports or
@@ -275,6 +290,7 @@ forbid('adapters/mcp/runtime-gateway/work-adapter.ts', /repositoryGit(?:Commit|F
275
290
  const MCP_GATEWAY_AUTHORITY_IMPORT_PATTERN = /(?:packages\/kernel\/|src\/runtime\/|src\/cli\/(?:repositories|editing)\/)/;
276
291
 
277
292
  function gatewayAuthorityImportInventoryFromSources(sources, importPattern = MCP_GATEWAY_AUTHORITY_IMPORT_PATTERN) {
293
+
278
294
  const ts = loadTypeScriptCompiler();
279
295
  if (!ts) return new Set();
280
296
  const records = new Set();
@@ -301,12 +317,27 @@ function runtimeToolSwitchCaseInventory(source) {
301
317
  return new Set([...source.slice(start).matchAll(/case\s+['"]([^'"]+)['"]\s*:/g)].map((match) => match[1]));
302
318
  }
303
319
 
320
+ const SUPERVISOR_CONCRETE_BROWSER_TRANSPORT_IMPORT_PATTERN = /(?:browser-macos-bridge|browser-adapter|chrome-extension|native-messaging)/;
321
+
322
+ function supervisorConcreteBrowserTransportImportsFromSources(sources) {
323
+ return gatewayAuthorityImportInventoryFromSources(sources, SUPERVISOR_CONCRETE_BROWSER_TRANSPORT_IMPORT_PATTERN);
324
+ }
325
+
326
+ const supervisorComputerBoundaryFixture = process.env.FORGE_SUPERVISOR_COMPUTER_BOUNDARY_FIXTURE;
327
+ if (supervisorComputerBoundaryFixture) {
328
+ const fixture = JSON.parse(supervisorComputerBoundaryFixture);
329
+ const sources = Array.isArray(fixture.sources) ? fixture.sources : [];
330
+ const actual = supervisorConcreteBrowserTransportImportsFromSources(sources);
331
+ if (actual.size > 0) {
332
+ console.error('[supervisor-computer-boundary-guardrail] FAILED');
333
+ for (const record of actual) console.error(`- Workflow Supervisor semantic code must depend on Computer target ports, never concrete Browser transports: ${record}`);
334
+ process.exit(1);
335
+ }
336
+ console.log('[supervisor-computer-boundary-guardrail] OK');
337
+ process.exit(0);
338
+ }
339
+
304
340
  const MCP_RUNTIME_GATEWAY_AUTHORITY_IMPORT_DEBT = new Set([
305
- 'adapters/mcp/runtime-gateway/router.ts::../../../src/cli/repositories/command-classifier',
306
- 'adapters/mcp/runtime-gateway/router.ts::../../../src/runtime/diagnostics/process-facade',
307
- 'adapters/mcp/runtime-gateway/router.ts::../../../src/runtime/execution/jobs/types',
308
- 'adapters/mcp/runtime-gateway/router.ts::../../../src/runtime/execution/process-runtime',
309
- 'adapters/mcp/runtime-gateway/router.ts::../../../src/runtime/execution/thin-harness',
310
341
  'adapters/mcp/runtime-gateway/runtime-tools.ts::../../../src/runtime/execution/process-runtime/check-result',
311
342
  ]);
312
343
 
@@ -349,6 +380,18 @@ requireExactShrinkingInventory(
349
380
  runtimeToolSwitchCaseInventory(text('adapters/mcp/runtime-gateway/runtime-tools.ts')),
350
381
  MCP_RUNTIME_TOOLS_SWITCH_CASE_DEBT,
351
382
  );
383
+ const supervisorSemanticSources = sourceFiles('supervisor')
384
+ .filter((path) => !path.startsWith('supervisor/native-messaging/'))
385
+ .map((path) => ({ path, source: text(path) }));
386
+ requireExactShrinkingDebt(
387
+ 'Workflow Supervisor concrete Browser transport imports',
388
+ supervisorConcreteBrowserTransportImportsFromSources(supervisorSemanticSources),
389
+ new Set(),
390
+ );
391
+ for (const path of supervisorSemanticSources.map((entry) => entry.path)) {
392
+ forbid(path, /\b(?:windowId|tabId|window\.name)\b/, 'Workflow Supervisor semantic code must not own provider tab/window identity; Computer target authority owns provider bindings');
393
+ }
394
+
352
395
 
353
396
  const MCP_PURE_TRANSPORT_FORBIDDEN_IMPORT_PATTERN = /(?:packages\/kernel\/|src\/runtime\/)/;
354
397
  requireExactShrinkingDebt(
@@ -360,57 +403,33 @@ requireExactShrinkingDebt(
360
403
  new Set(),
361
404
  );
362
405
 
363
- const FROZEN_CAPABILITY_PREFIX_FILES = [
364
- 'adapters/mcp/runtime-gateway/runtime-tools.ts',
365
- 'adapters/mcp/runtime-gateway/work-adapter.ts',
406
+ // Hard cutover: retired lifecycle decoders remain absent. One bounded
407
+ // frozen-session wire decoder may translate the pre-Thin semantic.v1 carrier
408
+ // and current-conversation enrollment into current owners because host MCP
409
+ // schemas can remain frozen across Runtime reconnect. That decoder owns no
410
+ // lifecycle or persistence and must not grow retired lifecycle carriers.
411
+ for (const path of [
412
+ 'adapters/mcp/runtime-gateway/work-controller-recovery-operations.ts',
366
413
  'adapters/mcp/controller-round-compatibility.ts',
367
414
  'adapters/mcp/frozen-client-semantic-compatibility.ts',
368
- ];
369
- const CANONICAL_FROZEN_SEMANTIC_PREFIX = 'semantic.v1:';
370
-
371
- function frozenCapabilityPrefixRecordsFromSources(sources) {
372
- const records = new Set();
373
- const protocolLiteral = /(['"`])([a-z][a-z0-9_-]*(?:\.[a-z0-9_-]+)+:)\1/g;
374
- for (const { path, source } of sources) {
375
- for (const match of source.matchAll(protocolLiteral)) {
376
- const prefix = match[2];
377
- if (prefix === CANONICAL_FROZEN_SEMANTIC_PREFIX) continue;
378
- records.add(`${path}::${prefix}`);
379
- }
380
- }
381
- return records;
382
- }
383
-
384
- const capabilityPrefixFixture = process.env.FORGE_CAPABILITY_PREFIX_GUARDRAIL_FIXTURE;
385
- if (capabilityPrefixFixture) {
386
- const fixture = JSON.parse(capabilityPrefixFixture);
387
- const actual = frozenCapabilityPrefixRecordsFromSources(Array.isArray(fixture.sources) ? fixture.sources : []);
388
- const allowed = new Set(Array.isArray(fixture.allowed) ? fixture.allowed : []);
389
- requireExactShrinkingInventory('frozen capability prefix fixture debt', actual, allowed);
390
- if (failures.length) {
391
- console.error('[frozen-capability-prefix-guardrail] FAILED');
392
- for (const failure of failures) console.error(`- ${failure}`);
393
- process.exit(1);
394
- }
395
- console.log(`[frozen-capability-prefix-guardrail] OK (${actual.size} debt entries)`);
396
- process.exit(0);
397
- }
398
-
399
- const LEGACY_FROZEN_CAPABILITY_PREFIX_DEBT = new Set([
400
- 'adapters/mcp/runtime-gateway/work-adapter.ts::controller.authority.recover:',
401
- 'adapters/mcp/runtime-gateway/work-adapter.ts::controller.provider.recover:',
402
- 'adapters/mcp/runtime-gateway/work-adapter.ts::plan.step.retry:',
403
- 'adapters/mcp/runtime-gateway/work-adapter.ts::schedule.delete:',
404
- 'adapters/mcp/runtime-gateway/work-adapter.ts::work.review:',
405
- 'adapters/mcp/controller-round-compatibility.ts::controller.disposition:',
406
- 'adapters/mcp/controller-round-compatibility.ts::controller.round:',
407
- 'adapters/mcp/controller-round-compatibility.ts::plan.obligations.v1:',
408
- ]);
409
- requireExactShrinkingInventory(
410
- 'legacy frozen capability prefix debt',
411
- frozenCapabilityPrefixRecordsFromSources(FROZEN_CAPABILITY_PREFIX_FILES.map((path) => ({ path, source: text(path) }))),
412
- LEGACY_FROZEN_CAPABILITY_PREFIX_DEBT,
415
+ ]) requireMissing(path);
416
+ requireText(
417
+ 'adapters/mcp/runtime-gateway/work-input-wire-migration.ts',
418
+ "const FROZEN_SEMANTIC_V1_PREFIX = 'semantic.v1:';",
419
+ );
420
+ requireText(
421
+ 'adapters/mcp/runtime-gateway/work-input-wire-migration.ts',
422
+ "const FROZEN_CURRENT_CONVERSATION_ENROLLMENT = 'controller.current_conversation.enroll';",
413
423
  );
424
+ forbid(
425
+ 'adapters/mcp/runtime-gateway/work-input-wire-migration.ts',
426
+ /schedule\.delete:|work\.review:|controller\.(?:authority|provider|disposition|round):|plan\.step\.retry:/,
427
+ 'the bounded frozen-session decoder must not restore retired lifecycle carriers',
428
+ );
429
+ for (const path of sourceFiles('adapters/mcp')) {
430
+ if (path === 'adapters/mcp/runtime-gateway/work-input-wire-migration.ts') continue;
431
+ forbid(path, /semantic\.v1:/, 'semantic.v1 frozen-session decoding must have exactly one transport owner');
432
+ }
414
433
 
415
434
  const SEMANTIC_AUTHORITY_CRITICAL_ROOTS = [
416
435
  'packages/kernel',
@@ -533,9 +552,7 @@ const SEMANTIC_STRING_AUTHORITY_DEBT = new Set([
533
552
  `packages/kernel/controller/domain/controller-round-transition-policy.ts::reason.startsWith('consecutive_failures:')`,
534
553
  `packages/kernel/controller/domain/controller-round-transition-policy.ts::reason.startsWith('repeated_state:')`,
535
554
  `packages/kernel/controller/domain/controller-round-transition-policy.ts::reason.startsWith('round_budget_exhausted:')`,
536
- `packages/kernel/scheduler/application/continuation-service.ts::error.message.startsWith('CONTROLLER_RELAY_ROUND_ALREADY_OPEN:')`,
537
- `src/cli/local-bridge/facade-api.ts::selection.reason.includes('Small')`,
538
- `src/cli/local-bridge/facade-api.ts::selection.reason.includes('small')`,
555
+ `packages/kernel/controller/application/continuation-service.ts::error.message.startsWith('CONTROLLER_RELAY_ROUND_ALREADY_OPEN:')`,
539
556
  `src/cli/local-bridge/job-store.ts::message.startsWith(\"LOCAL_JOB_ID_REQUIRED:\")`,
540
557
  `src/cli/local-bridge/job-store.ts::message.startsWith(\"LOCAL_JOB_PATH_INVALID:\")`,
541
558
  `src/cli/local-bridge/server.ts::message.startsWith(\"REPOSITORY_SELF_PROTECTED\")`,
@@ -546,14 +563,12 @@ const SEMANTIC_STRING_AUTHORITY_DEBT = new Set([
546
563
  `src/runtime/control-plane/execution/work-head-settlement.ts::error.message.includes('CONTROL_PLANE_REVISION_CONFLICT')`,
547
564
  `src/runtime/control-plane/facade/requirement-authority.ts::error.message.startsWith('REQUIREMENT_ALREADY_EXISTS:')`,
548
565
  `src/runtime/control-plane/global-scheduler/reconciliation.ts::message.includes(':')`,
549
- `src/runtime/control-plane/global-scheduler/reconciliation.ts::message.startsWith('WRITER_FENCED:')`,
550
566
  `src/runtime/control-plane/global-scheduler/scheduler.ts::error.message.startsWith('LOCK_HELD:')`,
551
567
  `src/runtime/control-plane/launcher/chatgpt-work-continuation.ts::error.message.includes(':')`,
552
568
  `src/runtime/control-plane/persistence/sqlite-store.ts::(error instanceof Error ? error.message : String(error)).startsWith('CONTROL_PLANE_SQLITE_BUSY:')`,
553
569
  `src/runtime/control-plane/persistence/sqlite-store.ts::/database is locked|SQLITE_BUSY/i.test(message)`,
554
570
  `src/runtime/control-plane/persistence/sqlite-store.ts::message.startsWith('CONTROL_PLANE_')`,
555
571
  `src/runtime/control-plane/persistence/sqlite-store.ts::message.startsWith('CONTROL_PLANE_SQLITE_CORRUPT:')`,
556
- `src/runtime/execution/jobs/store.ts::error.message.startsWith('WRITER_FENCED:')`,
557
572
  `src/runtime/execution/process-runtime/lightweight-managed.ts::error.message.startsWith('PROCESS_REQUEST_CONFLICT:')`,
558
573
  `src/runtime/execution/process-runtime/process-runner-entry.ts::message.startsWith('PROCESS_RUNNER_ALREADY_STARTED:')`,
559
574
  `src/runtime/execution/process-runtime/process-runner-entry.ts::message.startsWith('PROCESS_RUNNER_RECEIPT_CORRUPT:')`,
@@ -668,18 +683,14 @@ const required = [
668
683
  'src/runtime/execution/workers/worker-entry.ts',
669
684
  'src/runtime/execution/thin-harness/index.ts',
670
685
  'src/runtime/execution/thin-harness/execution-router.ts',
671
- 'src/runtime/control-plane/routing/route-policy.ts',
672
- 'src/runtime/control-plane/routing/workspace-admission.ts',
673
686
  'src/runtime/control-plane/facade/requirement-authority.ts',
674
687
  'src/runtime/control-plane/facade/repository-work-admission.ts',
675
688
  'src/runtime/control-plane/execution/retained-work-resume.ts',
676
689
  'src/runtime/control-plane/execution/work-handle-authority.ts',
677
690
  'src/runtime/control-plane/execution/work-verification-context.ts',
678
691
  'src/runtime/control-plane/execution/work-verification-service.ts',
679
- 'src/runtime/control-plane/execution/content-equivalent-commit-authority.ts',
680
692
  'src/runtime/control-plane/execution/implementation-review-content.ts',
681
693
  'packages/protocols/handoff/status.ts',
682
- 'packages/kernel/work/domain/admission-policy.ts',
683
694
  'packages/kernel/work/domain/implementation-review.ts',
684
695
  'packages/kernel/work/domain/state-machine.ts',
685
696
  'packages/kernel/identity/domain/scope.ts',
@@ -702,15 +713,12 @@ const required = [
702
713
  'packages/kernel/controller/infrastructure/controller-session-store.ts',
703
714
  'packages/kernel/controller/application/controller-service.ts',
704
715
  'packages/kernel/controller/api/index.ts',
705
- 'src/runtime/control-plane/facade/work-implementation-review.ts',
706
716
  'src/runtime/control-plane/execution/repository-work-attribution.ts',
707
717
  'src/runtime/control-plane/execution/work-completion-authority.ts',
708
718
  'src/runtime/control-plane/execution/work-evidence-policy.ts',
709
719
  'src/runtime/control-plane/execution/work-execution-support.ts',
710
- 'src/runtime/control-plane/execution/work-finalization-service.ts',
711
720
  'src/runtime/control-plane/execution/work-preparation-service.ts',
712
721
  'src/runtime/control-plane/execution/work-operation-service.ts',
713
- 'src/runtime/control-plane/facade/work-state-machine.ts',
714
722
  'src/runtime/evidence/process-check-execution.ts',
715
723
  'src/runtime/context/semantic-navigation-contract.ts',
716
724
  'packages/protocols/mcp/tool-contract.ts',
@@ -789,21 +797,106 @@ for (const { from, specifier } of stage7fMemoryImports) {
789
797
  failures.push(`Stage7F operational Memory store has an unauthorized active consumer: ${from} -> ${specifier}`);
790
798
  }
791
799
  }
792
- forbid('src/runtime/control-plane/persistence/operational-prior-store.ts', /context-plane|brain|pks|requirement-authority|plan-contract|work-state-machine|approval|authorization/, 'Stage7F operational Memory must remain mechanical derived state only');
800
+ forbid('src/runtime/control-plane/persistence/operational-prior-store.ts', /context-plane|brain|pks|requirement-authority|plan-contract|approval|authorization/, 'Stage7F operational Memory must remain mechanical derived state only');
793
801
  requireText('src/runtime/control-plane/persistence/operational-prior-store.ts', "OPERATIONAL_MEMORY_NAMESPACE = 'operational_memory_prior'");
794
802
  requireText('src/runtime/control-plane/persistence/operational-prior-store.ts', 'resolveCheckCompletionGraceWaitMs');
795
803
  requireText('src/runtime/execution/process-runtime/check-facade.ts', 'resolveCheckCompletionGraceWaitMs');
796
804
  for (const path of sourceFiles('src/runtime/control-plane')) {
797
805
  forbid(path, /(?:from\s+['"]|import\s*\(\s*['"])(?:\.\.\/)+gateway\//, 'control-plane domain/application code must not depend on Gateway transport');
798
806
  }
799
- requireText('src/runtime/control-plane/routing/route-policy.ts', "export function decideRoute");
800
- requireText('src/runtime/control-plane/routing/route-policy.ts', 'inputFingerprint');
801
- requireText('src/runtime/control-plane/routing/route-policy.ts', 'policyVersion');
807
+ for (const path of [
808
+ 'adapters/mcp/tool-mapping/repository-tools.ts',
809
+ 'adapters/mcp/tool-mapping/legacy-tool-service.ts',
810
+ 'adapters/mcp/runtime-gateway/runtime-observation-adapter.ts',
811
+ ]) {
812
+ forbid(path, /assessWorkMode|parseExplicitTaskMode|assess_work_mode|assess_work_request|recommendedMode\s*:/, 'production capability/context surfaces must not expose or infer engineering work modes');
813
+ }
814
+ // Engineering execution strategy belongs to the model. Forge must not carry a
815
+ // route/mode/driver vocabulary, a task-size or complexity heuristic, or a
816
+ // second router that decides Direct/Work/Goal, worker/provider, verify, review,
817
+ // or completion on the model's behalf.
818
+ requireMissing('src/runtime/control-plane/routing/route-policy.ts');
819
+ requireMissing('src/runtime/control-plane/routing/index.ts');
820
+ for (const path of [...sourceFiles('src'), ...sourceFiles('adapters'), ...sourceFiles('packages')]) {
821
+ forbid(
822
+ path,
823
+ /\bRouteExecutionMode\b|\bRouteWorkMode\b|\bRouteExecutionPath\b|\bExplicitTaskMode\b|\bWorkRouteDecisionSnapshot\b|\bWorkContractDriverPolicy\b|\bExecutionModeSelection\b|\bselectExecutionMode\b|\bmodeInput\b/,
824
+ 'Forge must not model engineering execution modes, work modes, execution paths, drivers, or mode selection',
825
+ );
826
+ forbid(
827
+ path,
828
+ /['"](?:direct_control|goal_workloop|handoff_only)['"]/,
829
+ 'retired engineering mode tokens must not return as typed Forge vocabulary',
830
+ );
831
+ forbid(
832
+ path,
833
+ /\bdirect_edit\b\s*\|\s*['"]bounded_work['"]|['"]bounded_work['"]\s*\|\s*['"]quick_agent['"]|['"]quick_agent['"]\s*\|\s*['"]issue_task['"]/,
834
+ 'retired work-mode vocabulary must not return',
835
+ );
836
+ }
837
+ forbid(
838
+ 'packages/kernel/work/domain/types.ts',
839
+ /\bmode:\s*ExecutionMode\b|\bdriver:\s*WorkContractDriverPolicy\b|routeDecision/,
840
+ 'WorkContract must persist no engineering-mode, driver, or route-decision authority',
841
+ );
842
+ for (const path of [...sourceFiles('src'), ...sourceFiles('adapters')]) {
843
+ forbid(
844
+ path,
845
+ /\bisSmallScopedTask\b|\bsmallScopedTask\b|\bdurableWorkRequired\b|\bcoordinationRequired\b|\bexplicitParallelMode\b|\bexpectedFiles\b|\bexpectedChangedLines\b|\brequiresInvestigation\b|\brequiresLongRunningChecks\b|\brequiresParallelism\b|\bindependentTaskCount\b|\bagentRequested\b|\broutingKey\(|\bproviderOrder\(|\bKIND_RANK\b/,
846
+ 'Forge must not infer engineering method, worker choice, or Work topology from task size, complexity, path classification, or semantic intent',
847
+ );
848
+ }
849
+ forbid(
850
+ 'src/runtime/plugins/store.ts',
851
+ /acceptSubmittedWorkContract|localSystemActionRequiresWork/,
852
+ 'plugin capability execution must not manufacture semantic Work from action risk',
853
+ );
854
+ forbid(
855
+ 'src/runtime/control-plane/facade/goal-workloop.ts',
856
+ /repositoryChangeIntent|directEditWithinBoundary|maxChangedFiles\s*<|maxChangedLines\s*</,
857
+ 'Work-kind classification must not be inferred from predicted scope size or a task-size threshold',
858
+ );
859
+ forbid(
860
+ 'src/runtime/control-plane/facade/goal-workloop.ts',
861
+ /linkedEngineeringBlockerWorkId|work-linked-engineering-blocker-/,
862
+ 'continuation must not manufacture child Work; an unrelated blocker names an explicitly created owning Work',
863
+ );
864
+ requireText('src/runtime/control-plane/facade/goal-workloop.ts', 'ENGINEERING_BLOCKER_LINKED_WORK_REQUIRED');
865
+ for (const path of [...sourceFiles('src'), ...sourceFiles('adapters')]) {
866
+ forbid(path, /operation:\s*['"](?:plan_approve|plan_accept_step|plan_supersede)['"]/, 'retired Plan approval/acceptance/supersession operations must not be advertised or suggested');
867
+ }
868
+ forbid(
869
+ 'src/runtime/control-plane/facade/rh-work-operation-contract.ts',
870
+ /plan_approve|plan_accept_step|plan_supersede/,
871
+ 'retired Plan lifecycle operations must not remain accepted rh_work ABI operations',
872
+ );
873
+ for (const path of [
874
+ 'src/runtime/control-plane/facade/goal-workloop.ts',
875
+ 'src/runtime/control-plane/facade/goal-workloop-access.ts',
876
+ 'src/cli/local-bridge/facade-api.ts',
877
+ 'src/cli/local-bridge/server.ts',
878
+ ]) {
879
+ forbid(path, /force_mode|forceMode/, 'retired mode-override tokens must not return as caller-visible input');
880
+ }
881
+ requireText('src/runtime/plugins/capability-authorization-grants.ts', 'migrateLegacyPluginCapabilityGrants');
882
+ requireText('src/runtime/plugins/capability-authorization-grants.ts', 'findActiveCanonicalGrant');
883
+ requireText('src/runtime/plugins/capability-authorization-grants.ts', 'legacyPluginGrantMigrationMarkerPath');
884
+ forbid(
885
+ 'src/runtime/plugins/capability-authorization-grants.ts',
886
+ /saveStore\(|writeJsonAtomic\(\s*pluginCapabilityAuthorizationGrantStorePath|writeFileSync/,
887
+ 'the legacy plugin capability authorization file is migration input only; the canonical Grant authority is the single writer',
888
+ );
889
+ for (const path of [
890
+ ...sourceFiles('src/runtime/control-plane'),
891
+ ...sourceFiles('adapters/mcp'),
892
+ ]) {
893
+ forbid(path, /directEditWithinBoundary|DirectEditBoundary/, 'task-size authorization shortcuts must not be reintroduced');
894
+ }
802
895
  requireText('src/runtime/control-plane/execution/work-verification-service.ts', 'runPersistedCheckViaProcessRuntime({');
803
896
  requireText('src/runtime/control-plane/execution/work-verification-service.ts', 'interactiveWaitMs: input.interactiveWaitMs ?? 0');
804
897
  requireText('src/runtime/control-plane/execution/work-verification-service.ts', 'checkContentRevision');
805
898
  requireText('src/runtime/control-plane/execution/work-verification-service.ts', 'observedGitHead');
806
- requireText('adapters/mcp/runtime-gateway/work-adapter.ts', 'executeWorkVerification({');
899
+ forbid('adapters/mcp/runtime-gateway/work-adapter.ts', /executeWorkVerification|recordWorkCheckEvidence/, 'rh_work must not execute or attribute repository checks');
807
900
  requireText('src/cli/local-bridge/facade-api.ts', 'executeWorkVerification({');
808
901
  forbid(
809
902
  'src/cli/local-bridge/facade-api.ts',
@@ -822,53 +915,43 @@ forbid(
822
915
  );
823
916
 
824
917
 
825
- // Kernel V2 B1/B2: Work lifecycle/review authority lives in packages/kernel/work.
826
- // Historical facade modules are compatibility-only re-exports. Gateway/finalizer
827
- // consume the Kernel API/domain instead of owning a parallel policy/store.
828
- requireText('packages/kernel/work/domain/implementation-review.ts', 'assertImplementationReviewPreDeliveryBoundary');
829
- requireText('packages/kernel/work/domain/implementation-review.ts', 'deriveImplementationReviewAcrossCommit');
830
- requireText('packages/kernel/work/domain/state-machine.ts', 'validateWorkSemanticTransition');
831
- requireText('packages/kernel/work/application/work-service.ts', 'transitionWorkContractPhase');
918
+ // Thin Work authority: semantic state is open/completed/cancelled. Review and
919
+ // verification may exist as evidence/capabilities, never as generic Work/Git
920
+ // admission authority. The old delivery/finalizer modules are intentionally gone.
921
+ requireText('packages/kernel/work/domain/types.ts', "export const SEMANTIC_WORK_STATES = ['open', 'completed', 'cancelled'] as const;");
922
+ requireText('packages/kernel/work/domain/types.ts', 'export type SemanticWorkState = (typeof SEMANTIC_WORK_STATES)[number];');
832
923
  requireText('packages/kernel/work/api/index.ts', "export * from '../application/work-service'");
833
- requireText('src/runtime/control-plane/execution/implementation-review-content.ts', 'implementationReviewContentFingerprint');
834
- requireText('src/runtime/control-plane/execution/implementation-review-content.ts', 'implementationReviewIndexFingerprint');
835
- requireText('packages/kernel/work/infrastructure/work-contract-store.ts', 'requestWorkImplementationReview');
836
- requireText('packages/kernel/work/infrastructure/work-contract-store.ts', 'recordWorkImplementationReview');
837
- requireText('packages/kernel/work/infrastructure/work-contract-store.ts', 'activateWorkContract');
838
- requireText('packages/kernel/work/infrastructure/work-contract-store.ts', 'failWorkContract');
839
- requireText('packages/kernel/work/infrastructure/work-contract-store.ts', 'cancelWorkContract');
840
- requireText('packages/kernel/work/infrastructure/work-contract-store.ts', 'recordWorkEvidenceState');
841
- requireText('packages/kernel/work/infrastructure/work-contract-store.ts', 'WORK_LIFECYCLE_REQUIRES_TRANSITION_API');
842
- requireText('packages/kernel/work/infrastructure/work-contract-store.ts', 'work_contract_schema_v3_migrated');
843
- forbid('packages/kernel/work/infrastructure/work-contract-store.ts', /phaseForStatusUpdate|dispatchStateForStatusUpdate/, 'Work status must not regain hidden phase/dispatch transition authority');
844
- forbid('packages/kernel/work/infrastructure/work-contract-store.ts', /phaseEvidence:\s*legacyPhaseEvidence\(/, 'new Work construction must not reuse legacy migration phase-evidence inference');
845
- requireText('src/runtime/control-plane/facade/work-contract-store.ts', '@deprecated Kernel V2 compatibility shim');
846
- requireText('src/runtime/control-plane/facade/work-state-machine.ts', '@deprecated Kernel V2 compatibility shim');
847
- requireText('src/runtime/control-plane/facade/work-implementation-review.ts', '@deprecated Kernel V2 compatibility shim');
848
- requireText('packages/kernel/work/domain/types.ts', "['implementation', 'verification', 'review', 'delivery', 'cleanup']");
849
924
  requireText('src/cli/repositories/selected-path-actions.ts', 'beforeCommitGuard');
850
- requireText('src/runtime/control-plane/execution/direct-edit-work-completion.ts', 'prepareReviewedDirectEditWorkCommit');
851
- requireText('src/runtime/control-plane/execution/direct-edit-work-completion.ts', 'completeReviewedDirectEditWorkAfterCommit');
852
- requireText('src/runtime/control-plane/execution/direct-edit-work-completion.ts', 'transferReviewedWorkAuthorityAcrossContentEquivalentCommit');
853
- requireText('src/runtime/control-plane/execution/work-verification-service.ts', 'planWorkVerificationAcrossContentEquivalentCommit');
925
+ requireMissing('src/runtime/control-plane/execution/direct-edit-work-completion.ts');
926
+ requireMissing('src/runtime/control-plane/execution/content-equivalent-commit-authority.ts');
927
+ requireMissing('src/runtime/control-plane/execution/work-finalization-service.ts');
928
+ forbid('adapters/mcp/runtime-gateway/work-adapter.ts', /ImplementationReview|executeWorkVerification|work_finalize/, 'rh_work must not regain review, verification, or finalization behavior authority');
929
+ forbid('src/cli/repositories/selected-path-actions.ts', /ImplementationReview|workRequiresImplementationReview|requestWorkImplementationReview/, 'repository Git safety must not depend on Work review methodology');
930
+
931
+ // The model-facing rh_work surface is the thin semantic ABI: the schema enum must
932
+ // come from the single operation registry, that registry's model list must not
933
+ // re-advertise legacy engineering lifecycle verbs, and the schema must not
934
+ // hand-write lifecycle-only inputs. Legacy verbs stay reachable only through the
935
+ // bounded server-side compatibility carrier, never as advertised model surface.
936
+ requireText('adapters/mcp/runtime-gateway/runtime-tool-definitions.ts', '[...RH_WORK_MODEL_OPERATIONS]');
854
937
  forbid(
855
- 'src/runtime/control-plane/execution/work-verification-service.ts',
856
- /export\s+function\s+transferWorkVerificationAcrossContentEquivalentCommit\s*\(/,
857
- 'content-equivalent verification planning must stay pure; authority persistence belongs to the atomic transfer owner',
858
- );
859
- requireText('src/runtime/control-plane/execution/content-equivalent-commit-authority.ts', 'transferReviewedWorkAuthorityAcrossContentEquivalentCommit');
860
- requireText('src/runtime/control-plane/execution/content-equivalent-commit-authority.ts', 'recordContentEquivalentCommitAuthorityTransfer');
861
- requireText('packages/kernel/work/infrastructure/work-contract-store.ts', 'recordContentEquivalentCommitAuthorityTransfer');
862
- requireText('src/runtime/control-plane/execution/edit-validation-coordinator.ts', 'workId: session.workId');
863
- requireText('src/runtime/control-plane/execution/edit-validation-coordinator.ts', 'verificationSnapshot: work ?');
864
- requireText('src/runtime/control-plane/execution/work-finalization-service.ts', 'assertPhysicalImplementationReviewGate');
865
- requireText('src/runtime/control-plane/execution/work-finalization-service.ts', 'assertPhysicalBranchCleanupImplementationReviewGate');
866
- requireText('src/runtime/control-plane/execution/work-finalization-service.ts', 'transferReviewedWorkAuthorityAcrossContentEquivalentCommit');
867
- requireText('adapters/mcp/runtime-gateway/runtime-tool-definitions.ts', 'review_decision');
868
- requireText('adapters/mcp/runtime-gateway/runtime-tool-definitions.ts', 'implementation_review_findings');
869
- requireText('adapters/mcp/runtime-gateway/work-adapter.ts', "operation === 'review'");
870
- requireText('adapters/mcp/runtime-gateway/work-adapter.ts', 'implementationReviewContentFingerprint');
871
- requireText('adapters/mcp/controller-round-compatibility.ts', "'review'");
938
+ 'adapters/mcp/runtime-gateway/runtime-tool-definitions.ts',
939
+ /review_decision|implementation_review_findings|review_rationale|requiredPlanStepId/,
940
+ 'the model-facing rh_work schema must not hand-write legacy lifecycle review inputs',
941
+ );
942
+ const rhWorkOperationContract = text('src/runtime/control-plane/facade/rh-work-operation-contract.ts');
943
+ const rhWorkModelOperations = (rhWorkOperationContract.match(/RH_WORK_MODEL_OPERATIONS = \[([\s\S]*?)\] as const/) ?? [])[1] ?? '';
944
+ if (!rhWorkModelOperations.trim()) {
945
+ failures.push('rh_work operation contract must define RH_WORK_MODEL_OPERATIONS as the thin model-facing ABI');
946
+ }
947
+ for (const legacyModelVerb of [
948
+ 'continue', 'verify', 'review', 'finalize', 'stop', 'delegate',
949
+ 'controller_claim', 'controller_release', 'controller_disposition', 'controller_get_owner',
950
+ ]) {
951
+ if (new RegExp(`['"]${legacyModelVerb}['"]`).test(rhWorkModelOperations)) {
952
+ failures.push(`RH_WORK_MODEL_OPERATIONS must not re-advertise the legacy engineering lifecycle verb: ${legacyModelVerb}`);
953
+ }
954
+ }
872
955
  requireText('packages/kernel/controller/infrastructure/controller-round-store.ts', 'readControllerRoundContextSnapshot');
873
956
  const controllerRoundTransitionPolicyPath = 'packages/kernel/controller/domain/controller-round-transition-policy.ts';
874
957
  if (existsSync(resolve(root, controllerRoundTransitionPolicyPath))) {
@@ -884,37 +967,29 @@ if (existsSync(resolve(root, controllerRoundTransitionPolicyPath))) {
884
967
  requireText('packages/kernel/controller/infrastructure/controller-round-store.ts', "blockedReason: 'provider_dispatch_outcome_unknown'");
885
968
  }
886
969
  requireText('src/runtime/control-plane/launcher/chatgpt-work-continuation.ts', 'CHATGPT_AUTOMATION_SUBMISSION_OUTCOME_UNKNOWN');
887
- requireText('adapters/chatgpt/controller-host.ts', 'CONTROLLER_HOST_PROVIDER_DISPATCH_OUTCOME_UNKNOWN');
888
- requireText('packages/kernel/scheduler/application/continuation-service.ts', 'outcomeUnknown: providerDispatchOutcomeUnknown');
970
+ requireMissing('adapters/chatgpt/controller-host.ts');
971
+ requireText('packages/kernel/controller/application/continuation-service.ts', 'const outcomeUnknown =');
972
+ requireText('packages/kernel/controller/application/continuation-service.ts', 'outcomeUnknown });');
889
973
  requireText('adapters/chatgpt/controller-round-host.ts', 'buildChatgptControllerRoundPrompt');
890
974
  requireText('adapters/chatgpt/controller-round-settlement-store.ts', 'recordChatgptControllerRoundSettlement');
891
975
  forbid('packages/kernel/controller/infrastructure/controller-round-store.ts', /browserSessionId|conversationUrl|recordControllerRoundTabSettlement|buildControllerRoundRelayPrompt|capability_id=/, 'Kernel ControllerRound must remain provider/transport neutral; ChatGPT/MCP rendering and settlement belong to adapters');
892
- requireText('src/runtime/control-plane/global-scheduler/maintenance.ts', "controllerTypes: ['chatgpt']");
893
- requireText('src/runtime/control-plane/facade/suggested-actions.ts', "case 'review'");
976
+ forbid(
977
+ 'src/runtime/control-plane/global-scheduler/maintenance.ts',
978
+ /beginControllerRoundProviderDispatch|runWorkChatgptContinuation|createChatgptControllerHost/,
979
+ 'Scheduler maintenance must never become a Work-bound ChatGPT provider writer',
980
+ );
894
981
  forbid(
895
982
  'adapters/mcp/runtime-gateway/runtime-tools.ts',
896
983
  /function\s+(?:assert|evaluate|derive)[A-Za-z0-9_]*ImplementationReview/,
897
984
  'Gateway transport must not implement implementation-review policy authority',
898
985
  );
899
- forbid(
900
- 'src/runtime/control-plane/execution/work-finalization-service.ts',
901
- /function\s+deriveImplementationReviewAcrossCommit/,
902
- 'Finalizer must consume the canonical Kernel Work review derivation instead of owning a second review authority',
903
- );
904
- for (const adapter of [
905
- 'src/cli/controller/work-mode.ts',
906
- 'src/runtime/control-plane/facade/types.ts',
907
- ]) {
908
- requireText(adapter, '@deprecated Compatibility adapter');
909
- requireText(adapter, 'decideRoute(');
910
- forbid(adapter, /expectedFiles\s*>|expectedChangedLines\s*>|KIND_RANK|providerOrder\s*\(/, 'delegate all routing thresholds and provider selection to Route Policy');
911
- }
912
- let routeAuthorityCount = 0;
986
+ requireMissing('src/runtime/control-plane/execution/work-finalization-service.ts');
987
+ requireMissing('src/cli/controller/work-mode.ts');
988
+ forbid('src/runtime/control-plane/facade/types.ts', /repeated_infrastructure_failure|codex_worker_requires_review/, 'Handoff compatibility types may represent only genuine human blockers');
913
989
  for (const path of sourceFiles('src')) {
914
- routeAuthorityCount += (text(path).match(/export function decideRoute\s*\(/g) ?? []).length;
990
+ forbid(path, /export function decideRoute\s*\(/, 'Route Policy was deleted; Forge must not regain an execution-strategy router');
915
991
  forbid(path, /requirePlanForGoalWorkloop\s*:\s*true/, 'never restore mandatory Plan gating in production');
916
992
  }
917
- if (routeAuthorityCount !== 1) failures.push(`exactly one decideRoute authority is required; found ${routeAuthorityCount}`);
918
993
  forbid(
919
994
  'src/runtime/control-plane/facade/goal-workloop.ts',
920
995
  /function\s+(?:evaluateWorkCompletionEvidence|evaluateWorkImplementationEvidence|verificationRecordAppliesToCurrentWorkspace)\s*\(/,
@@ -932,7 +1007,7 @@ for (const path of sourceFiles('src/runtime/control-plane')) {
932
1007
  // B2 ownership fence: production code may consume only the Kernel Work API/domain,
933
1008
  // never the retired facade store/state-machine or Kernel persistence implementation.
934
1009
  for (const path of sourceFiles('src')) {
935
- forbid(path, /(?:from\s+['"]|import\s*\(\s*['"])[^'"]*(?:work-contract-store|work-state-machine|work-implementation-review)['"]/, 'production source must consume packages/kernel/work instead of retired Work facade authority');
1010
+ forbid(path, /(?:from\s+['"]|import\s*\(\s*['"])[^'"]*(?:work-contract-store|work-implementation-review)['"]/, 'production source must consume packages/kernel/work instead of retired Work facade authority');
936
1011
  forbid(path, /packages\/kernel\/work\/infrastructure\/work-contract-store/, 'production source must consume the Work application/API boundary, not persistence infrastructure');
937
1012
  }
938
1013
  for (const record of genericWorkLifecycleMutationRecords([...sourceFiles('src'), ...sourceFiles('adapters')])) {
@@ -948,36 +1023,31 @@ forbid(
948
1023
  /\b(?:appendWorkEvidence|recordWorkCompletionReceipt)\s*\(/,
949
1024
  'MCP Gateway must submit Work application commands instead of writing lifecycle/evidence records directly',
950
1025
  );
951
- requireText('adapters/mcp/runtime-gateway/work-adapter.ts', 'completeRemoteEffectWorkFromProcessReceipt');
952
- requireText('src/runtime/control-plane/execution/work-finalization-service.ts', 'packages/kernel/work/api/index');
953
1026
  requireText('src/runtime/control-plane/facade/goal-workloop.ts', 'packages/kernel/work/api/index');
954
1027
  requireText('packages/kernel/work/domain/types.ts', 'predecessorWorkId?: string');
955
- requireText('src/runtime/control-plane/facade/goal-workloop.ts', 'PLAN_STEP_SEMANTIC_ACCEPTANCE_REQUIRED');
956
- requireText('src/runtime/control-plane/facade/goal-workloop.ts', 'PLAN_SUCCESSOR_STEP_RESOLUTION_REQUIRED');
957
- requireText('src/runtime/control-plane/facade/goal-workloop.ts', 'CONTINUATION_GOAL_COMPLETE');
1028
+ forbid('src/runtime/control-plane/facade/goal-workloop.ts', /PLAN_(?:STEP_|SUCCESSOR_|NOT_EXECUTABLE|EXECUTION_BASELINE)/, 'Work admission must not consult Plan item status, binding, dependency or approval state');
958
1029
  requireText('src/runtime/control-plane/facade/goal-workloop.ts', "requestedBy ?? 'chatgpt') === 'scheduler'");
959
1030
  // V2 Goal authority convergence: lifecycle enums are canonical Kernel Goal
960
- // domain facts; progression is a pure derived decision service and explicit
961
- // Controller goal_complete is the Requirement semantic acceptance boundary.
1031
+ // domain facts and explicit Controller goal_complete is the Requirement semantic
1032
+ // acceptance boundary. PlanStep progression is retired: Plan items are authored
1033
+ // working memory that never selects, gates or progresses Work.
962
1034
  requireText('packages/kernel/goal/domain/types.ts', 'export const REQUIREMENT_STATES');
963
1035
  requireText('packages/kernel/goal/domain/types.ts', 'export const PLAN_CONTRACT_STATUSES');
964
1036
  requireText('packages/kernel/goal/domain/types.ts', 'export const PLAN_STEP_STATUSES');
965
1037
  requireText('src/runtime/control-plane/persistence/requirement-store.ts', 'packages/kernel/goal/api/index');
966
1038
  requireText('src/runtime/control-plane/facade/types.ts', 'packages/kernel/goal/api/index');
967
- requireText('packages/kernel/progression/domain/types.ts', "from '../../goal/api/index'");
968
- requireText('packages/kernel/progression/domain/types.ts', "from '../../scheduler/api/index'");
969
- forbid('packages/kernel/progression/domain/types.ts', /export type Progression(?:RequirementState|PlanStatus|PlanStepStatus)\s*=/, 'Goal progression must consume canonical Goal lifecycle types instead of copying status unions');
970
- requireText('packages/kernel/progression/domain/types.ts', 'completionTargetRevision?: string');
971
- requireText('packages/kernel/progression/application/projector.ts', 'PLAN_FINALIZED_REQUIRES_REQUIREMENT_ACCEPTANCE');
972
- requireText('packages/kernel/progression/application/projector.ts', 'completionTargetRevision === snapshot.currentSourceRevision');
973
- requireText('src/runtime/control-plane/facade/requirement-authority.ts', 'acceptRequirementOutcome');
974
- requireText('src/runtime/control-plane/facade/requirement-authority.ts', 'REQUIREMENT_ACCEPTANCE_PLAN_INCOMPLETE');
975
- requireText('src/runtime/control-plane/facade/requirement-authority.ts', 'completeRequirementGoal');
976
- requireText('src/runtime/control-plane/facade/requirement-authority.ts', 'withPlanAdmissionLock');
1039
+ requireText('src/runtime/control-plane/persistence/requirement-store.ts', 'reviseRequirementSemantic');
1040
+ requireText('src/runtime/control-plane/facade/plan-contract-store.ts', 'revisePlanSemanticContext');
1041
+ requireText('docs/architecture/decisions/20260924-thin-semantic-working-context.md', 'only three cross-domain model-authored semantic records');
1042
+ requireText('docs/architecture/decisions/20260924-thin-semantic-working-context.md', 'semantic revision must be applied to the latest persisted aggregate inside the same storage transaction');
1043
+ forbid('src/runtime/control-plane/facade/requirement-authority.ts', /continueRequirement|acceptRequirementOutcome|completeRequirementGoal|requirement_semantic_acceptance|requirement_semantic_continue/, 'Requirement semantic state changes must use revisioned requirement_revise CAS only');
977
1044
  requireText('src/runtime/control-plane/facade/plan-contract-store.ts', 'PLAN_REQUIREMENT_TERMINAL');
978
- requireText('adapters/mcp/runtime-gateway/work-adapter.ts', 'completeRequirementGoal');
979
- forbid('adapters/mcp/runtime-gateway/runtime-tools.ts', /\bacceptRequirementOutcome\s*\(/, 'MCP transport must delegate Requirement-bound goal completion to the canonical Goal application boundary');
980
- requireText('adapters/mcp/runtime-gateway/work-adapter.ts', "disposition === 'goal_complete' && work.requirementId");
1045
+ forbid('adapters/mcp/runtime-gateway/work-controller-operations.ts', /completeRequirementGoal|requirementAcceptance/, 'Controller disposition must not complete or accept Requirement semantics');
1046
+ forbid('adapters/mcp/runtime-gateway/runtime-tools.ts', /\bacceptRequirementOutcome\s*\(/, 'MCP transport must never own Requirement semantic completion');
1047
+ forbid('src/runtime/control-plane/facade/rh-work-operation-contract.ts', /requirement_continue/, 'retired Requirement lifecycle compatibility operation must not remain accepted');
1048
+ requireText('adapters/mcp/tool-mapping/post-finalize-work-attribution.ts', 'semanticWorkState(work)');
1049
+ forbid('adapters/mcp/tool-mapping/post-finalize-work-attribution.ts', /isTerminalWorkContractStatus|lifecycleClosed|work\.status\s*!==?\s*['"]completed['"]/, 'post-completion readonly attribution must follow semantic Work state, not legacy lifecycle projections');
1050
+ forbid('adapters/mcp/runtime-gateway/work-controller-operations.ts', /goal_complete[^\n]{0,200}requirementId|requirementId[^\n]{0,200}goal_complete/, 'Controller goal_complete may settle continuation but must not own Requirement completion');
981
1051
  // B3 ControllerSession authority and provider-neutral host boundary.
982
1052
  requireText('packages/kernel/controller/domain/types.ts', 'export interface ControllerBinding');
983
1053
  requireText('packages/kernel/controller/domain/types.ts', 'export interface ControllerLease');
@@ -993,7 +1063,7 @@ forbid('packages/kernel/controller/application/controller-service.ts', /export\s
993
1063
  // and dispatches exclusively through ControllerHost.resume.
994
1064
  requireText('packages/kernel/scheduler/domain/schedule.ts', 'export interface RepositorySchedule');
995
1065
  requireText('packages/kernel/scheduler/domain/schedule.ts', 'export interface ScheduleOccurrence');
996
- requireText('packages/kernel/scheduler/infrastructure/schedule-store.ts', "'occurrences.json'");
1066
+ requireText('packages/kernel/scheduler/infrastructure/schedule-store.ts', "'occurrences'");
997
1067
  requireText('packages/kernel/scheduler/infrastructure/schedule-store.ts', 'saveScheduleDecision');
998
1068
  requireText('packages/kernel/scheduler/application/schedule-service.ts', 'createSchedule');
999
1069
  requireText('packages/kernel/scheduler/api/index.ts', "../application/schedule-service");
@@ -1005,20 +1075,158 @@ requireText('packages/kernel/scheduler/application/settlement.ts', 'applySchedul
1005
1075
  requireText('packages/kernel/scheduler/application/settlement.ts', 'applyScheduleRetryableFailure');
1006
1076
  requireText('packages/kernel/scheduler/application/settlement.ts', 'settleScheduledExecution');
1007
1077
  requireText('src/runtime/workflow/schedules/settlement.ts', '@deprecated Kernel V2 compatibility shim');
1008
- requireText('packages/kernel/scheduler/domain/continuation.ts', 'export interface ScheduledContinuationDispatch');
1009
- requireText('packages/kernel/scheduler/application/continuation-service.ts', 'resumeScheduledControllerContinuation');
1010
- requireText('packages/kernel/scheduler/application/continuation-service.ts', 'getRetainedControllerSession');
1011
- requireText('packages/kernel/scheduler/application/continuation-service.ts', 'getControllerWorkBinding');
1012
- requireText('packages/kernel/scheduler/application/continuation-service.ts', 'host.resume(bindingRecord.binding');
1013
- forbid('packages/kernel/scheduler/application/continuation-service.ts', /SCHEDULE_CONTINUATION_SESSION_DRIFT/, 'Scheduler continuation must not treat replaceable ControllerSession transport ids as durable continuation identity');
1014
- requireText('packages/kernel/scheduler/application/continuation-service.ts', 'SCHEDULE_CONTINUATION_OUTCOME_UNKNOWN');
1015
- requireText('packages/kernel/scheduler/application/continuation-service.ts', 'scheduler_continuation_prepare');
1016
- requireText('packages/kernel/scheduler/application/continuation-service.ts', 'scheduler_continuation_bind_round');
1017
- requireText('src/runtime/root/scheduled-controller-composition.ts', 'controllerHostForScheduledBinding');
1078
+ requireMissing('packages/kernel/scheduler/domain/continuation.ts');
1079
+ requireMissing('packages/kernel/scheduler/application/continuation-service.ts');
1080
+ requireMissing('packages/kernel/scheduler/infrastructure/continuation-dispatch-store.ts');
1081
+ requireText('packages/kernel/controller/application/continuation-service.ts', 'resumeControllerRoundOccurrence');
1082
+ requireText('packages/kernel/controller/application/continuation-service.ts', 'getRetainedControllerSession');
1083
+ requireText('packages/kernel/controller/application/continuation-service.ts', 'getControllerWorkBinding');
1084
+ requireText('packages/kernel/controller/application/continuation-service.ts', 'beginControllerRoundProviderDispatch');
1085
+ requireText('packages/kernel/controller/application/continuation-service.ts', 'host.resume(bindingRecord.binding');
1086
+ requireText('packages/kernel/controller/infrastructure/controller-round-store.ts', 'controller-provider-dispatch-start');
1087
+ requireText('packages/kernel/controller/domain/controller-round-transition-policy.ts', "type: 'provider_dispatch_started'");
1088
+ forbid('packages/kernel/controller/application/continuation-service.ts', /scheduler_continuation_dispatch|ScheduledContinuationDispatch/, 'Controller continuation must not recreate Scheduler-owned continuation lifecycle persistence');
1089
+ requireText('src/runtime/root/controller-progression-composition.ts', 'reconcileControllerProgression');
1090
+ requireText('src/runtime/root/controller-progression-composition.ts', 'ensureWorkflowSupervisorEnrollmentForWork');
1091
+ requireText('src/runtime/control-plane/global-scheduler/autonomous-continuation.ts', 'reconcileControllerProgression');
1092
+ requireText('src/runtime/workflow/schedules/engine.ts', 'reconcileControllerProgression');
1093
+ requireText('adapters/mcp/runtime-gateway/work-controller-operations.ts', 'reconcileControllerProgression');
1094
+ forbid(
1095
+ 'src/runtime/control-plane/launcher/chatgpt-round-continuation.ts',
1096
+ /beginControllerRoundProviderDispatch|runWorkChatgptContinuation|openChatgptControllerRoundFromSource|continueChatgptControllerRoundFromSource/,
1097
+ 'current-source compatibility may close an already-open legacy round but must never send or open a new Work-bound ChatGPT turn',
1098
+ );
1099
+ forbid(
1100
+ 'src/runtime/control-plane/launcher/chatgpt-work-continuation.ts',
1101
+ /runWorkChatgptContinuation|prepareWorkChatgptContinuationTransport/,
1102
+ 'Work-bound ChatGPT provider delivery is Workflow Supervisor-owned; this module may expose only standalone prompt and Browser settlement primitives',
1103
+ );
1104
+ requireText('src/runtime/root/scheduled-controller-composition.ts', 'CHATGPT_CONTROLLER_HOST_SUPERVISOR_OWNED');
1105
+ requireText('src/runtime/control-plane/launcher/thin-launcher.ts', 'LAUNCHER_CHATGPT_SUPERVISOR_OWNED');
1018
1106
  requireMissing('adapters/scheduler/controller-binding.ts');
1019
- requireText('adapters/chatgpt/controller-host.ts', 'createChatgptControllerHost');
1020
1107
  requireText('adapters/controller-process/controller-host.ts', 'createProcessControllerHost');
1021
- requireText('src/runtime/workflow/schedules/engine.ts', 'resumeScheduledControllerContinuation');
1108
+ requireText('src/runtime/workflow/schedules/engine.ts', 'workflow_supervisor_owns_outer_turn');
1109
+ requireText('src/runtime/root/workflow-supervisor-composition.ts', 'registerWorkflowSupervisorTask');
1110
+ requireText('src/runtime/root/workflow-supervisor-composition.ts', 'reserveWorkflowSupervisorEnrollment');
1111
+ requireText('src/runtime/root/workflow-supervisor-composition.ts', 'getWorkflowSupervisorTask(forgeHome, taskId)');
1112
+ requireText('src/runtime/root/workflow-supervisor-composition.ts', "stall.state === 'terminal'");
1113
+ requireText('supervisor/control-plane.ts', 'if (exhaustedLeaf && this.store.providerResumeExhausted(exhaustedLeaf.effectId)) sourceEffect = exhaustedLeaf;');
1114
+ requireText('supervisor/store.ts', "if (first.action !== 'CONTINUE' || second.action !== 'CONTINUE' || third.action !== 'DONE') continue;");
1115
+ requireText('supervisor/store.ts', 'const minimumRuntimeInstances = 2;');
1116
+ requireText('supervisor/store.ts', "kind = 'terminal_done'");
1117
+ requireText('supervisor/types.ts', "actions: ['CONTINUE', 'CONTINUE', 'DONE'];");
1118
+ requireText('src/runtime/root/workflow-supervisor-composition.ts', 'WORKFLOW_SUPERVISOR_TASK_REQUIREMENT_CONFLICT');
1119
+ requireText('supervisor/entry.ts', 'forgeWorkflowSupervisorValidators()');
1120
+ requireText('supervisor/store.ts', 'workflowSupervisorCompletionContractSha256');
1121
+ requireText('supervisor/store.ts', "'task_semantic_binding_revised'");
1122
+ requireText('supervisor/store.ts', 'WORKFLOW_SUPERVISOR_COMPLETION_CONTRACT_REVISION_CONFLICT');
1123
+ requireText('supervisor/store.ts', 'WORKFLOW_SUPERVISOR_SEMANTIC_BINDING_CONFLICT');
1124
+ requireText('supervisor/control-plane.ts', 'WORKFLOW_SUPERVISOR_SEMANTIC_BINDING_WORK_NOT_FOUND');
1125
+ requireText('supervisor/control-plane.ts', 'WORKFLOW_SUPERVISOR_SEMANTIC_BINDING_REQUIREMENT_NOT_FOUND');
1126
+ requireText('supervisor/client.ts', 'expected_completion_contract_sha256: input.expectedCompletionContractSha256');
1127
+ requireText('supervisor/server.ts', 'p.expected_completion_contract_sha256');
1128
+ requireText('adapters/mcp/runtime-gateway/runtime-tool-definitions.ts', 'expected_completion_contract_sha256');
1129
+ requireText('adapters/mcp/runtime-gateway/workflow-supervisor-adapter.ts', 'completionContractSha256: workflowSupervisorCompletionContractSha256(task.completionContract)');
1130
+ requireText('docs/architecture/CURRENT.md', 'An existing nonterminal unbound task may acquire one explicit Work or Requirement binding');
1131
+ forbid('supervisor/client.ts', /reserveWorkflowSupervisorSchedulerRecovery|reserve_scheduler_recovery/, 'Scheduler recovery is not a Supervisor RPC; reconciliation stays on the canonical effect ledger');
1132
+ forbid('supervisor/control-plane.ts', /reserveSchedulerRecovery/, 'Scheduler recovery must not regrow as a second Supervisor recovery authority');
1133
+ forbid('supervisor/server.ts', /reserve_scheduler_recovery/, 'Supervisor RPC surface must not expose retired Scheduler recovery authority');
1134
+ requireText('src/runtime/workflow/schedules/engine.ts', "const CONTROLLER_PROGRESSION_OPERATION = 'controller_progression';");
1135
+ requireText('packages/kernel/scheduler/application/eligibility.ts', 'return value >= min && value <= max && (value - min) % step === 0;');
1136
+ requireText('packages/kernel/scheduler/infrastructure/schedule-store.ts', "schedule.action.operation !== 'external_controller_wake' && schedule.action.operation !== 'controller_progression'");
1137
+ requireText('packages/kernel/scheduler/infrastructure/schedule-store.ts', 'const schedule: RepositorySchedule = { ...candidate, policy: boundedSchedulePolicy(candidate) };');
1138
+ requireText('packages/kernel/scheduler/infrastructure/schedule-store.ts', 'policy: boundedSchedulePolicy(candidate),');
1139
+ requireText('src/cli/local-bridge/console-automations.ts', "schedule.action.operation === 'external_controller_wake' || schedule.action.operation === 'controller_progression'");
1140
+ requireText('tests/runtime/rh-work-scheduler-adapter.test.ts', "cronDue('0 8 * * *', Date.parse('2026-10-17T00:00:00.000Z'), 'Asia/Shanghai')");
1141
+ requireText('tests/runtime/rh-work-scheduler-adapter.test.ts', "cronDue('0 8 * * *', Date.parse('2026-10-18T00:00:00.000Z'), 'Asia/Shanghai')");
1142
+ requireText('src/runtime/workflow/schedules/engine.ts', 'schedule.action.operation === CONTROLLER_PROGRESSION_OPERATION');
1143
+ requireText('src/runtime/workflow/schedules/work-continuation.ts', "const CONTROLLER_PROGRESSION_OPERATION = 'controller_progression';");
1144
+ requireText('src/runtime/workflow/schedules/pending-activation.ts', "const CONTROLLER_PROGRESSION_OPERATION = 'controller_progression';");
1145
+ requireText('src/runtime/workflow/schedules/pending-activation.ts', 'operation: CONTROLLER_PROGRESSION_OPERATION');
1146
+ requireText('src/runtime/plugins/gmail-adapter.ts', 'actualEmail !== configuredEmail');
1147
+ requireText('src/runtime/plugins/gmail-adapter.ts', "export const GMAIL_AUTOMATION_CAPABILITY_ID = 'scheduled-gmail-automation';");
1148
+ requireText('src/runtime/plugins/gmail-adapter.ts', "actionId: 'authorize_scheduled_gmail_automation'");
1149
+ requireText('src/runtime/plugins/gmail-adapter.ts', "requiredConfirmationText: 'authorize-scheduled-gmail-automation'");
1150
+ requireText('src/runtime/plugins/store.ts', 'if (action.requiredConfirmationText)');
1151
+ requireText('src/runtime/plugins/gmail-adapter.ts', "actionId: 'archive_scheduled_message'");
1152
+ requireText('src/runtime/plugins/gmail-adapter.ts', "actionId: 'send_owner_notification'");
1153
+ requireText('src/runtime/plugins/gmail-adapter.ts', 'to: [gmailAutomationMailbox(current)]');
1154
+ requireText('src/runtime/plugins/gmail-adapter.ts', 'requiresExplicitCapabilityGrant: true');
1155
+ requireText('src/runtime/plugins/gmail-adapter.ts', 'expiresInMinutes: GMAIL_AUTOMATION_GRANT_MINUTES');
1156
+ requireText('src/runtime/plugins/store.ts', 'if (action.requiresExplicitCapabilityGrant && !activeAuthorizationGrant)');
1157
+ requireText('src/runtime/plugins/store.ts', 'PLUGIN_CAPABILITY_GRANT_REQUIRED');
1158
+ requireText('src/runtime/root/workflow-supervisor-runtime.ts', 'notificationRequestId');
1159
+ requireText('src/runtime/root/workflow-supervisor-runtime.ts', 'export function recordUnknownSupervisorNotificationReceipt(');
1160
+ requireText('src/runtime/root/workflow-supervisor-runtime.ts', 'readPluginActionReceiptForRequest(controllerHome, input.requestId)');
1161
+ requireText('src/runtime/root/workflow-supervisor-runtime.ts', 'submitted.receipt');
1162
+ requireText('tests/runtime/thin-capability-substrate.test.ts', 'unknown Gmail Supervisor notification keeps one exact receipt');
1163
+ requireText('src/runtime/root/workflow-supervisor-runtime.ts', "notificationRequestId('stall', taskId, stall.state, stall.effectId)");
1164
+ requireText('src/runtime/root/workflow-supervisor-runtime.ts', 'getDirectActivity(controllerHome, stallActivityId(taskId))');
1165
+ requireText('packages/kernel/identity/infrastructure/activity-projection-store.ts', 'export function getDirectActivity(');
1166
+ requireText('src/runtime/root/workflow-supervisor-runtime.ts', "stall.state === 'retryable' && stall.generations >= stall.maxGenerations");
1167
+ requireText('src/runtime/root/workflow-supervisor-runtime.ts', 'workflow-supervisor.notification-auth:');
1168
+ requireText('supervisor/types.ts', "export type WorkflowSupervisorAction = 'CONTINUE' | 'WAIT' | 'DONE' | 'NEEDS_USER';");
1169
+ requireText('supervisor/types.ts', "state: 'waiting'; scheduleId: string; completionFingerprint: string");
1170
+ requireText('supervisor/protocol.ts', "scheduled_wake_schedule_id");
1171
+ requireText('supervisor/protocol.ts', "WORKFLOW_SUPERVISOR_WAIT_NOT_SCHEDULED");
1172
+ requireText('supervisor/store.ts', "scheduled-wake-bound:");
1173
+ requireText('supervisor/store.ts', "scheduled-wake-committed:");
1174
+ requireText('supervisor/store.ts', "completion_event.kind = 'assistant_completion'");
1175
+ requireText('supervisor/store.ts', "WORKFLOW_SUPERVISOR_SCHEDULED_WAKE_ALREADY_CONSUMED");
1176
+ requireText('supervisor/control-plane.ts', "action === 'WAIT'");
1177
+ requireText('supervisor/control-plane.ts', 'private async validateTerminalProposal');
1178
+ requireText('supervisor/control-plane.ts', "'scheduled_work_must_remain_open'");
1179
+ requireText('supervisor/protocol.ts', '不要用 DONE 或 NEEDS_USER 终结每日循环');
1180
+ requireText('supervisor/server.ts', "req.method === 'task_bind_scheduled_wake'");
1181
+ requireText('supervisor/server.ts', "req.method === 'task_wake_scheduled'");
1182
+ requireText('src/runtime/root/workflow-supervisor-composition.ts', 'bindWorkflowSupervisorScheduledWakeForWork');
1183
+ requireText('src/runtime/root/workflow-supervisor-composition.ts', 'scheduleOccurrenceId');
1184
+ requireText('src/runtime/workflow/schedules/engine.ts', 'scheduleOccurrenceId: occurrence.occurrenceId');
1185
+ requireText('adapters/mcp/runtime-gateway/scheduler-adapter.ts', 'bindWorkflowSupervisorScheduledWakeForWork');
1186
+ requireText('adapters/mcp/runtime-gateway/scheduler-adapter.ts', 'async function bindSupervisorWakeForSchedule');
1187
+ requireText('adapters/mcp/runtime-gateway/scheduler-adapter.ts', "operation === 'schedule_resume'");
1188
+ requireText('adapters/mcp/runtime-gateway/scheduler-adapter.ts', 'bindSupervisorWakeForSchedule(ctx, repository.repoId, saved)');
1189
+ requireText('src/runtime/root/workflow-supervisor-composition.ts', 'wakeWorkflowSupervisorScheduledTaskForWork');
1190
+ requireText('src/runtime/root/controller-progression-composition.ts', 'wakeWorkflowSupervisorScheduledTaskForWork');
1191
+ requireText('src/runtime/root/controller-progression-composition.ts', "if (wake.status === 'woken' && wake.taskId && wake.effectId)");
1192
+ requireText('src/runtime/root/controller-progression-composition.ts', "status: 'scheduled_supervisor_woken'");
1193
+ requireText('src/runtime/workflow/schedules/engine.ts', "progression.status === 'scheduled_supervisor_woken'");
1194
+ requireText('tests/runtime/rh-work-scheduler-adapter.test.ts', 'executes two distinct cron occurrences through the same durable WAIT task without pausing the Schedule');
1195
+ requireText('tests/runtime/rh-work-scheduler-adapter.test.ts', "schedule_request_id: 'schedule-daily-gmail-two-consecutive-occurrences'");
1196
+ requireText('tests/runtime/rh-work-scheduler-adapter.test.ts', "cron_expression: '0 8 * * *'");
1197
+ requireText('tests/runtime/rh-work-scheduler-adapter.test.ts', "2026-10-18@08:00[Asia/Shanghai]");
1198
+ requireText('tests/runtime/rh-work-scheduler-adapter.test.ts', '2026-11-01T00:00:00.000Z');
1199
+ requireText('tests/runtime/rh-work-scheduler-adapter.test.ts', "evaluateSchedule(controllerHome, created.data.schedule, false, { source: 'timer' })");
1200
+ requireText('src/runtime/workflow/schedules/engine.ts', "schedule.action.operation !== CONTROLLER_PROGRESSION_OPERATION");
1201
+ requireText('src/runtime/root/workflow-supervisor-runtime.ts', 'authorizationGrantRefs: [grant.grantId]');
1202
+ requireText('src/runtime/root/workflow-supervisor-runtime.ts', 'workflow-supervisor.notification-send-auth:');
1203
+ requireText('src/runtime/root/workflow-supervisor-runtime.ts', "creationReason: 'scheduled_gmail_notification_authorization_failed'");
1204
+ forbidBetween('src/runtime/plugins/gmail-adapter.ts', "actionId: 'send_owner_notification'", "actionId: 'modify_message_labels',", /\b(?:to|recipient|cc|bcc)\s*:/i, 'scheduled Gmail owner notification must not accept a caller-selected recipient');
1205
+ requireText('supervisor/forge-validators.ts', "requirement.state !== 'done'");
1206
+ requireText('supervisor/forge-validators.ts', 'validateSemanticCompletionBinding(task, proposal)');
1207
+ requireText('supervisor/forge-validators.ts', 'function validateWorkCompletion(');
1208
+ requireText('supervisor/forge-validators.ts', 'function validateRequirementCompletion(');
1209
+ requireText('adapters/mcp/runtime-gateway/runtime-tool-definitions.ts', "work_id: { type: 'string', minLength: 1, maxLength: 256");
1210
+ requireText('adapters/mcp/runtime-gateway/runtime-tool-definitions.ts', "requirement_id: { type: 'string', minLength: 1, maxLength: 256");
1211
+ requireText('adapters/mcp/runtime-gateway/workflow-supervisor-adapter.ts', 'WORKFLOW_SUPERVISOR_SEMANTIC_BINDING_AMBIGUOUS');
1212
+ requireText('adapters/mcp/runtime-gateway/workflow-supervisor-adapter.ts', 'WORKFLOW_SUPERVISOR_SEMANTIC_BINDING_REPO_REQUIRED');
1213
+ requireText('adapters/mcp/runtime-gateway/workflow-supervisor-adapter.ts', "...(workId ? { work_id: workId } : {})");
1214
+ requireText('adapters/mcp/runtime-gateway/workflow-supervisor-adapter.ts', "...(requirementId ? { requirement_id: requirementId } : {})");
1215
+ requireText('supervisor/forge-validators.ts', "requirement.state === 'waiting_for_user'");
1216
+ requireText('supervisor/native-browser-adapter.ts', "command.kind === 'recovery' && prepared.reasonCode === 'provider_recovery_stop_pending'");
1217
+ requireText('supervisor/native-browser-adapter.ts', 'provider-turn observation, not an infrastructure preparation failure');
1218
+ requireText('supervisor/store.ts', 'proofGeneration === ledger.lastGeneration');
1219
+ requireText('supervisor/store.ts', 'dispatch_generation: dispatch.lastGeneration');
1220
+ requireText('supervisor/store.ts', 'dispatch_generation: row?.dispatch_generation, pre_send_rejection: true');
1221
+ requireText('supervisor/store.ts', 'effect-dispatch-budget-refund:${effectId}:${proofGeneration}');
1222
+ requireText('supervisor/control-plane.ts', 'const recoveryStopPending = effect.kind === \'recovery\' && input.reason.trim() === \'provider_recovery_stop_pending\';');
1223
+ requireText('supervisor/native-browser-adapter.ts', "reasonCode: dispatch.reasonCode ?? 'COMPUTER_CHATGPT_DISPATCH_NOT_ATTEMPTED'");
1224
+ forbid('src/runtime/root/workflow-supervisor-composition.ts', /WorkflowSupervisorStore|supervisor\.sqlite|registerTask\(|reserveEffect\(/, 'Forge composition must access Supervisor state only through daemon RPC, never open its database or become a second writer');
1225
+ requireText('src/runtime/root/workflow-supervisor-composition.ts', 'workflowSupervisorBoundaryForWork');
1226
+ requireText('src/runtime/root/workflow-supervisor-composition.ts', '`forge:${repoId}:work:${workId}`');
1227
+ requireText('src/runtime/root/workflow-supervisor-composition.ts', 'registeredTask.taskId');
1228
+ forbid('src/runtime/root/workflow-supervisor-composition.ts', /forge:\$\{repoId\}:conversation:\$\{conversationId\}/, 'Supervisor task identity must remain conversation-stable through registration, not be recomputed from the current Work conversation');
1229
+ forbid('supervisor/client.ts', /task_has_effect|taskHasAnyEffect/, 'Supervisor boundary is derived from canonical Work+conversation facts; do not add a second ownership projection RPC');
1022
1230
  requireText('src/runtime/workflow/schedules/engine.ts', 'evaluateScheduleTriggerEligibility');
1023
1231
  requireText('src/runtime/workflow/schedules/engine.ts', 'evaluateScheduleOccurrenceAdmission');
1024
1232
  requireText('src/runtime/workflow/schedules/engine.ts', 'controller_session_id');
@@ -1040,22 +1248,31 @@ for (const path of sourceFiles('src')) {
1040
1248
  }
1041
1249
  const B7_KERNEL_INTERNAL_COMPATIBILITY_SHIMS = new Set([
1042
1250
  'src/runtime/control-plane/facade/controller-session-store.ts',
1043
- 'src/runtime/control-plane/facade/controller-round-relay.ts',
1044
1251
  'src/runtime/control-plane/facade/work-contract-store.ts',
1045
- 'src/runtime/control-plane/facade/work-state-machine.ts',
1046
- 'src/runtime/control-plane/facade/work-implementation-review.ts',
1047
1252
  'src/runtime/control-plane/facade/types.ts',
1048
1253
  'src/runtime/workflow/schedules/settlement.ts',
1049
1254
  'src/runtime/workflow/schedules/types.ts',
1050
1255
  ]);
1256
+ // The compatibility-shim ledger may only shrink. A shim with no remaining
1257
+ // importer at all is migration debt, not a boundary: delete the file and its
1258
+ // entry in the same slice instead of keeping an unused authority surface alive.
1259
+ // Shims that survive only because a test still imports them are bounded debt to
1260
+ // be removed together with that test, never a reason to keep production authority.
1261
+ const shimImportRecords = staticTypeScriptImportRecords([...productionTypeScriptFiles(), ...sourceFiles('tests')]);
1262
+ for (const shim of B7_KERNEL_INTERNAL_COMPATIBILITY_SHIMS) {
1263
+ const shimBasename = shim.slice(shim.lastIndexOf('/') + 1).replace(/\.ts$/, '');
1264
+ const importedBy = shimImportRecords.filter((record) => record.from !== shim
1265
+ && (record.specifier === `./${shimBasename}` || record.specifier.endsWith(`/${shimBasename}`)));
1266
+ if (importedBy.length === 0) {
1267
+ failures.push(`${shim} is a dead compatibility shim with no importer; delete it and remove its compatibility-shim entry`);
1268
+ }
1269
+ }
1051
1270
  for (const path of sourceFiles('src')) {
1052
1271
  if (B7_KERNEL_INTERNAL_COMPATIBILITY_SHIMS.has(path)) continue;
1053
1272
  forbid(path, /packages\/kernel\/[^'"/]+\/(?:domain|application|infrastructure)\//, 'active legacy Runtime code must consume Kernel public api/index surfaces; direct internals are compatibility-boundary-only');
1054
1273
  }
1055
1274
  requireText('src/runtime/control-plane/facade/types.ts', 'packages/kernel/work/domain/types');
1056
1275
  requireText('src/runtime/control-plane/facade/types.ts', 'packages/kernel/controller/domain/types');
1057
- requireText('src/runtime/control-plane/execution/work-finalization-service.ts', 'completeWorkWithReceipt(');
1058
- requireText('adapters/mcp/runtime-gateway/execution-tools.ts', 'resetFinalizationStagesForRequest');
1059
1276
  forbid(
1060
1277
  'src/runtime/plugins/browser-handoff-host.ts',
1061
1278
  /browser\/sessions|saveBrowserSession|writeBrowserSession|sessionPath/,
@@ -1087,6 +1304,12 @@ forbid(
1087
1304
  /\bcreateWorkContract\s*\(/,
1088
1305
  'keep the legacy MCP surface as translation over canonical Work admission authority',
1089
1306
  );
1307
+ requireMissing('src/runtime/control-plane/routing/workspace-admission.ts');
1308
+ forbid('packages/kernel/work/domain/types.ts', /requireHandoffOnAmbiguity|requireWorktree|directMainProhibited/, 'retired Work placement/handoff policy fields must not return as durable authority');
1309
+ forbid('adapters/mcp/runtime-gateway/work-adapter.ts', /require_handoff_on_ambiguity|require_worktree|direct_main_prohibited/, 'retired placement/handoff wire flags must not drive repository topology');
1310
+ requireText('adapters/mcp/runtime-gateway/work-adapter.ts', "rawConstraints.workspace_mode === 'current'\n ? 'current'\n : 'isolated'", 'repository-bound rh_work.start must default omitted placement to isolated execution');
1311
+ requireText('src/runtime/control-plane/execution/work-preparation-service.ts', 'WORK_PREPARE_PLACEMENT_CONFLICT', 'work_prepare must not silently reuse a conflicting existing WorkHandle placement');
1312
+ forbid('src/cli/controller/execution-policy.ts', /requiresHumanAcceptance|autoRunDeclaredChecks|autoCompleteAfterSuccessfulRun|requiresScopedPaths|requiresDiffEvidence|requiresAnyVerificationEvidence|requiresAcceptanceEvidence|READ_ONLY_INTENT|DESTRUCTIVE_INTENT|SENSITIVE_PATH_PATTERNS/, 'task risk/text/path classification must not decide workflow, placement, verification, scope, or acceptance authority');
1090
1313
  requireMissing('src/runtime/control-plane/daemon-entry.ts');
1091
1314
  requireMissing('scripts/smoke-runtime-control-plane.ts');
1092
1315
  requireMissing('src/cli/controller/lifecycle.ts');
@@ -1111,6 +1334,100 @@ requireMissing('src/runtime/bootstrap/runtime-authority.ts');
1111
1334
  requireMissing('src/runtime/bootstrap/activation-transaction.ts');
1112
1335
  requireMissing('src/runtime/bootstrap/stable-bootstrap.ts');
1113
1336
  requireMissing('src/runtime/supervisor');
1337
+ requireText('supervisor/store.ts', 'BEGIN IMMEDIATE');
1338
+ requireText('supervisor/forge-validators.ts', "work.semanticState === 'completed'");
1339
+ requireText('supervisor/forge-validators.ts', 'work.predecessorWorkId');
1340
+ requireText('supervisor/forge-validators.ts', 'work.supersedes ?? []');
1341
+ requireText('supervisor/forge-validators.ts', 'work.supersededBy ? [work.supersededBy]');
1342
+ requireText('supervisor/store.ts', 'completions_one_per_source_effect');
1343
+ requireText('supervisor/store.ts', 'WORKFLOW_SUPERVISOR_SOURCE_EFFECT_COMPLETION_CONFLICT');
1344
+ requireText('supervisor/paths.ts', 'resolveControllerHome');
1345
+ requireText('supervisor/paths.ts', "join(resolveWorkflowSupervisorForgeHome(controllerHome), 'supervisor')");
1346
+ forbid('supervisor/paths.ts', /control-plane\/persistence\/sqlite-store|workflow-run-store|packages\/kernel\/(?:work|controller)/, 'Workflow Supervisor path authority may share the canonical Controller Home root but must not depend on lower lifecycle persistence or Kernel authorities');
1347
+ forbid('supervisor/store.ts', /resolveControllerHome|FORGE_CONTROLLER_HOME|control-plane\/persistence\/sqlite-store|workflow-run-store|packages\/kernel\/(?:work|controller)/, 'Workflow Supervisor persistence must resolve its root only through supervisor/paths and remain a separate database authority');
1348
+ requireMissing('supervisor/service.ts');
1349
+ requireText('src/runtime/root/runtime.ts', 'startWorkflowSupervisorRuntime');
1350
+ requireText('src/runtime/root/runtime.ts', 'WORKFLOW_SUPERVISOR_STOPPED');
1351
+ requireText('src/runtime/root/workflow-supervisor-runtime.ts', 'startWorkflowSupervisorRuntime(controllerHome: string)');
1352
+ requireText('src/runtime/root/workflow-supervisor-runtime.ts', 'new WorkflowSupervisorStore(forgeHome, {');
1353
+ requireText('src/runtime/root/workflow-supervisor-runtime.ts', 'activeReleaseId: () => getRuntimeWriteClaim()?.releaseId');
1354
+ requireText('src/runtime/root/workflow-supervisor-runtime.ts', 'createWorkflowSupervisorServer');
1355
+ requireText('src/runtime/root/workflow-supervisor-runtime.ts', 'startWorkflowSupervisorNativeBrowserAdapter');
1356
+ requireText('supervisor/native-browser-adapter.ts', 'targetPort: ComputerChatgptConversationTargetPort;');
1357
+ requireText('src/runtime/root/workflow-supervisor-runtime.ts', 'const targetPort = extensionTargetPort;');
1358
+ forbid('src/runtime/root/workflow-supervisor-runtime.ts', /PreferredChatgptConversationTargetPort|MacOsChatgptConversationTargetPort|chatgpt-target-router/, 'Work-bound ChatGPT delivery uses one Chrome Extension target port, never a native fallback router');
1359
+ requireMissing('adapters/computer/chatgpt-target-router.ts');
1360
+ requireMissing('src/runtime/plugins/computer-chatgpt-macos-target.ts');
1361
+ requireMissing('src/runtime/plugins/browser-provider-registry.ts');
1362
+ requireText('src/runtime/plugins/browser-runtime.ts', 'options.providers.length !== 1');
1363
+ forbid('src/runtime/plugins/browser-runtime.ts', /excludedProviderIds|BrowserProviderUnavailableBeforeActionError/, 'Browser Runtime must not retry an action through another provider');
1364
+ forbid('supervisor/native-browser-adapter.ts', /MacOs|AppleEvents|browser-macos-bridge|\bwindowId\b|\btabId\b|window\.name/, 'Workflow Supervisor browser consumer must depend only on the provider-neutral Computer ChatGPT target port');
1365
+ forbid('supervisor/native-browser-adapter.ts', /supervisor\/store|sqlite|scheduler|packages\/kernel\/(?:work|controller)|control-plane\/persistence/, 'Native Supervisor browser adapter is transport-only and must not own durable lifecycle, Scheduler, Work, Controller, or persistence authority');
1366
+ requireText('src/runtime/root/workflow-supervisor-composition.ts', 'resolveWorkflowSupervisorForgeHome(options.controllerHome)');
1367
+ forbid('src/runtime/root/workflow-supervisor-runtime.ts', /createPlatformServiceManagerHost|launchd|systemd|startDetached/, 'Workflow Supervisor reuses the Canonical Runtime process lifecycle and must not own a second OS service');
1368
+ requireText('supervisor/entry.ts', "argument('--controller-home')");
1369
+ forbid('supervisor/entry.ts', /FORGE_HOME|--forge-home/, 'Workflow Supervisor foreground entry must use the canonical Controller Home authority rather than a second Forge-home root');
1370
+ requireText('supervisor/control-plane.ts', 'await this.validateTerminalProposal(task, parsed.proposal)');
1371
+ requireText('supervisor/protocol.ts', 'SUPERVISOR_BLOCK_END');
1372
+ requireText('supervisor/protocol.ts', 'validateSupervisorObjective(task.objective)');
1373
+ forbid('supervisor/protocol.ts', /objective:\s*task\.objective\.slice\(/, 'Supervisor must reject oversized objectives, never silently truncate them in rendered effects');
1374
+ requireText('supervisor/store.ts', 'validateSupervisorObjective(input.objective)');
1375
+ requireText('supervisor/store.ts', 'const objective = validateSupervisorObjective(input.objective)');
1376
+ requireText('supervisor/server.ts', 'createWorkflowSupervisorServer');
1377
+ forbid('supervisor/server.ts', /from ['"]\.\/store['"]|supervisor\.sqlite|BEGIN IMMEDIATE/, 'Supervisor transport must relay typed commands through the control plane and never own persistence');
1378
+ forbid('src/runtime/plugins/browser-macos-bridge.ts', /PLUGIN_BROWSER_NATIVE_PROCESS_AMBIGUOUS|pids\.length\s*!==\s*1/, 'Chrome GUI PID selection has one authority: Desktop Operator');
1379
+ requireText('src/runtime/plugins/browser-macos-bridge.ts', 'await assertMacOsBrowserApplicationRunning(request.product, timeoutMs)');
1380
+ requireText('adapters/computer/chrome-extension/manifest.json', 'nativeMessaging');
1381
+ requireText('adapters/computer/chrome-extension/background.js', 'computer_extension_claim');
1382
+ requireText('adapters/computer/chrome-extension/background.js', 'computer_extension_complete');
1383
+ requireText('adapters/computer/chrome-extension/background.js', "typeof observation.composerText === 'string'");
1384
+ requireText('adapters/computer/chrome-extension/background.js', "command.identity.namespace === 'chatgpt.bootstrap'");
1385
+ forbid('adapters/computer/chrome-extension/background.js', /if \(typeof observation\?\.url === 'string' && observation\.url\) return observation/, 'New bootstrap URL does not attest composer/model hydration before pre-send preparation');
1386
+ requireText('adapters/computer/chrome-extension/background.js', 'chrome.runtime.connectNative');
1387
+ forbid('adapters/computer/chrome-extension/background.js', /browser_begin_effect|browser_observe_effect|browser_poll|browser_tasks|browser_observe_assistant|task_register|reserve_enrollment/, 'Computer Chrome provider must not consume or mutate Workflow Supervisor effect authority; it executes only typed Computer target commands');
1388
+ requireText('adapters/computer/chrome-extension/content.js', 'ForgeComputerChatgptCore');
1389
+ requireText('adapters/computer/chrome-extension/content.js', "bootstrapTargetGuard: 'project-checked-before-send-v1'");
1390
+ requireText('adapters/computer/chrome-extension/content.js', 'exactComposerText(payload)');
1391
+ requireText('adapters/computer/chrome-extension/content.js', "return text.trim() ? text : '';");
1392
+ requireText('adapters/computer/chrome-extension/content.js', "blocks.every((block) => block.tagName === 'P')");
1393
+ requireText('adapters/computer/chrome-extension/content.js', "blocks.map((block) => {");
1394
+ requireText('adapters/computer/chrome-extension/background.js', 'resolveTarget(command.identity, false, command.providerBinding)');
1395
+ requireText('adapters/computer/chatgpt-extension-target.ts', "response.result.code === 'COMPUTER_CHATGPT_BOOTSTRAP_PINNED_TAB_MISSING'");
1396
+ requireText('adapters/computer/chatgpt-extension-target.ts', 'this.authority.withSurfaceLease(this.controllerHome, previous.targetId');
1397
+ requireText('adapters/computer/chatgpt-extension-target.ts', 'return await this.openBootstrap(projectUrl, bootstrapKey, false)');
1398
+ requireText('adapters/computer/chatgpt-extension-target.ts', 'if (pinned && !bootstrapMatch) continue;');
1399
+ requireText('adapters/computer/chatgpt-extension-target.ts', 'const candidate = pinned');
1400
+ requireText('adapters/computer/chatgpt-extension-target.ts', 'observed.ownerToken === binding.ownerToken');
1401
+ forbid('adapters/computer/chrome-extension/background.js', /resolveTarget\(command\.identity,\s*false\)\.catch/, 'Extension worker must recover a pinned bootstrap from the durable Computer binding, not its ephemeral in-worker Map');
1402
+ forbid('adapters/computer/chrome-extension/content.js', /core\.normalizeText\(payload\)/, 'Provider pre-send evidence must preserve whitespace in immutable effect payload');
1403
+ requireMissing('supervisor/chrome-extension');
1404
+ requireText('src/runtime/plugins/browser-adapter.ts', "browserMode: browserMode(raw.browserMode) ?? 'attach_preferred'");
1405
+ requireText('src/runtime/plugins/browser-adapter.ts', "nativeAttachMode: browserNativeAttachMode(raw.nativeAttachMode) ?? 'auto'");
1406
+ requireText('supervisor/native-messaging/host.ts', 'ALLOWED_BROWSER_METHODS');
1407
+ requireText('supervisor/native-messaging/host.ts', 'computer_extension_claim');
1408
+ forbid('supervisor/native-messaging/host.ts', /['"](?:browser_tasks|browser_poll|browser_begin_effect|browser_observe_effect|browser_observe_dispatch_failure|browser_observe_provider_turn|browser_observe_assistant|bootstrap_poll|bootstrap_project_url|bootstrap_begin_effect|bootstrap_observe_effect|bootstrap_bind_conversation)['"]/, 'Chrome Native Messaging transport must not expose Workflow Supervisor effect RPCs; extension traffic terminates at Computer target commands');
1409
+ requireText('supervisor/store.ts', 'recordEffectNotAppliedProof');
1410
+ requireText('supervisor/store.ts', 'preSendComposerObservation(effectId: string)');
1411
+ requireText('supervisor/store.ts', "if (value && typeof value === 'object' && !Array.isArray(value)) return value as Record<string, unknown>;");
1412
+ requireText('supervisor/native-browser-adapter.ts', 'function retiredBootstrapDraftReplacementPrompt(');
1413
+ requireText('supervisor/native-browser-adapter.ts', 'control.preSendComposerObservation(staleEffect.effectId)');
1414
+ requireText('supervisor/native-browser-adapter.ts', "retired?.terminal !== 'STOPPED'");
1415
+ requireText('supervisor/native-browser-adapter.ts', 'control.effectDispatchBudget(staleEffect.effectId).generations !== 0');
1416
+ requireText('adapters/computer/chrome-extension/content.js', 'FORGE_RETIRED_DRAFT_V1');
1417
+ requireText('docs/architecture/CURRENT.md', 'A STOPPED bootstrap draft may be replaced only from the canonical Supervisor ledger');
1418
+ requireText('supervisor/store.ts', 'tried.at(-1)?.eventId');
1419
+ requireText('supervisor/store.ts', 'WORKFLOW_SUPERVISOR_PRE_SEND_OPERATOR_REARM_EXHAUSTED');
1420
+ requireText('supervisor/store.ts', '`effect-dispatch:${effectId}:${generation}`');
1421
+ requireText('supervisor/control-plane.ts', 'PERSISTED_BROWSER_EVIDENCE_KEYS');
1422
+ requireText('supervisor/control-plane.ts', "reason: 'not_applied_proof_incomplete'");
1423
+ requireText('supervisor/server.ts', "if (!['applied','unknown'].includes(outcome))");
1424
+ forbid('adapters/computer/chrome-extension/background.js', /supervisor\.sqlite|BEGIN IMMEDIATE/, 'Computer Chrome provider must reconstruct provider bindings from live inventory and Computer target authority rather than browser shadow persistence');
1425
+ // Provider-local browser identity may persist; tasks and effects remain Supervisor-owned.
1426
+ forbid('adapters/computer/chrome-extension/content.js', /chrome\.storage|supervisor\.sqlite|BEGIN IMMEDIATE/, 'Computer Chrome content script must remain a page capability surface rather than durable authority');
1427
+ forbid('supervisor/native-messaging/host.ts', /task_register|reserve_enrollment|supervisor\.sqlite|BEGIN IMMEDIATE|bun:sqlite|node:sqlite|from ['"][^'"]*(?:store|control-plane)['"]/, 'Chrome Native Messaging host must remain a stateless browser-method relay and never own Supervisor persistence/lifecycle');
1428
+ forbid('adapters/computer/chrome-extension/background.js', /task_register|reserve_enrollment|supervisor\.sqlite|BEGIN IMMEDIATE/, 'Computer Chrome provider must never become durable workflow authority');
1429
+ forbid('adapters/computer/chrome-extension/content.js', /task_register|reserve_enrollment|supervisor\.sqlite|BEGIN IMMEDIATE|chrome\.storage/, 'Computer Chrome content script must observe/execute one exact page only and never own durable workflow state');
1430
+
1114
1431
  requireMissing('docs/architecture/current/stable-external-runtime-supervisor.md');
1115
1432
  requireMissing('docs/architecture/modules/controller-runtime/stable-supervisor.md');
1116
1433
  requireMissing('docs/operations/stable-external-runtime-supervisor.md');
@@ -1200,6 +1517,9 @@ forbid(
1200
1517
  );
1201
1518
 
1202
1519
  requireText('docs/architecture/CURRENT.md', 'Canonical Runtime is activated as one immutable whole release');
1520
+ requireText('src/runtime/root/release-execution-canary.ts', 'releaseScriptRequiresBun');
1521
+ forbid('src/runtime/root/package-runtime-release.ts', /ownsProcessRuntimeCanary|PROCESS_RUNTIME_RELEASE_CANARY_ARG/, 'package Runtime wrappers must delegate release canaries to the attested Process Runner/Check Runner implementation');
1522
+ requireText('scripts/migrate-windows-wsl-controller-home.ts', 'assertRuntimeReleaseExecutionCanaries(stagedRelease.manifestPath, destination);');
1203
1523
  requireText('docs/architecture/CURRENT.md', 'Runtime availability/recovery keeps Forge itself healthy');
1204
1524
  requireText('docs/architecture/CURRENT.md', 'Historical Issue/Task/Local Job and compatibility projections must not become second mutable authorities.');
1205
1525
  requireText('src/runtime/root/runtime.ts', 'export class CanonicalForgeRuntime');
@@ -1249,12 +1569,17 @@ requireText('src/runtime/root/service.ts', 'SuccessfulExit');
1249
1569
  requireText('src/runtime/root/service.ts', 'ThrottleInterval');
1250
1570
  requireText('src/runtime/root/service-runner.ts', 'activeRuntimeReleaseManifest');
1251
1571
  requireText('src/runtime/standalone-recovery/core.ts', 'restartPrimaryRuntime');
1572
+ forbid('src/runtime/standalone-recovery/core.ts', /\bopenSync\s*\([^,]+,\s*['"]wx['"]/, 'Recovery Core must not create a second exclusive mutation lock writer');
1252
1573
  requireText('src/runtime/standalone-recovery/core.ts', 'recoverPrimaryRuntime');
1253
1574
  requireText('src/runtime/standalone-recovery/core.ts', "action: 'restart_primary_runtime'");
1254
1575
  requireText('src/runtime/standalone-recovery/core.ts', 'restartAttempts >= maximumRestartAttempts');
1255
1576
  requireText('src/runtime/standalone-recovery/core.ts', 'rollbackPreviousLocked');
1256
1577
  requireText('src/runtime/standalone-recovery/entry.ts', "'restart_primary_runtime'");
1257
1578
  requireText('src/runtime/standalone-recovery/entry.ts', "'recover_primary_runtime'");
1579
+ requireText('src/runtime/standalone-recovery/core.ts', 'armPackageConnectorCutoverDrain');
1580
+ requireText('src/runtime/standalone-recovery/entry.ts', "parsed.result.detail.startsWith('RELEASE_SESSION_CUTOVER_DEFERRED_FOR_MCP_ACTIVITY')");
1581
+ forbid('src/runtime/standalone-recovery/entry.ts', /if\s*\(decision\.required\s*&&\s*decision\.action\s*===\s*['"]cutover['"]\)\s*\{\s*const gate = await probeReleaseCutoverReadiness/, 'Automatic Recovery must enter the canonical fenced drain transaction rather than block cutover before the drain can be armed');
1582
+
1258
1583
  forbid(
1259
1584
  'src/runtime/standalone-recovery/core.ts',
1260
1585
  /runtime-slots|active-slot|blue\/green|StableSupervisor|component rollback/i,
@@ -1265,6 +1590,39 @@ requireText('src/cli/commands/init-hook.ts', "['open', 'next']");
1265
1590
  requireText('src/cli/commands/init-hook.ts', "command(name)");
1266
1591
  requireText('src/cli/commands/init-hook.ts', "command('close')");
1267
1592
  requireText('src/cli/commands/init-hook.ts', "'.forge'");
1593
+ // CLI setup/adoption must use one process/environment implementation, not three writers.
1594
+ requireText('src/cli/commands/setup-execution.ts', 'export function withProcessEnv');
1595
+ requireText('src/cli/commands/setup-execution.ts', 'export function runSetupProcess');
1596
+ requireMissing('src/core/adoption/helper-wrapper-plan.ts');
1597
+ // Service and release persistence use one writer rather than five sibling
1598
+ // open/write/rename algorithms with incompatible temporary-file identities.
1599
+ requireText('src/runtime/shared/atomic-text-file.ts', 'export function writeAtomicTextFile');
1600
+ requireText('src/runtime/maintenance/cleanup.ts', 'RUNTIME_CLEANUP_GIT_SOURCE_PROTECTED');
1601
+ requireText('src/runtime/maintenance/cleanup.ts', 'protectsGitSource(candidate.path)');
1602
+ for (const path of [
1603
+ 'src/runtime/root/service.ts',
1604
+ 'src/runtime/root/package-connector-service.ts',
1605
+ 'src/runtime/root/package-runtime-service.ts',
1606
+ 'src/runtime/root/package-runtime-release.ts',
1607
+ 'src/cli/controller/systemd-user.ts',
1608
+ ]) {
1609
+ forbid(path, /^function\s+atomicWrite\s*\(/m, 'service/release text writes must reuse the shared atomic writer');
1610
+ requireText(path, 'writeAtomicTextFile');
1611
+ }
1612
+
1613
+ // Job recovery and Scheduler must not drift on delegated-operation replay safety.
1614
+ requireText('src/runtime/execution/jobs/child-reference.ts', 'export function isAgentDelegationJob');
1615
+ for (const path of ['src/runtime/control-plane/global-scheduler/reconciliation.ts', 'src/runtime/execution/jobs/receipt-recovery.ts']) {
1616
+ forbid(path, /^function\s+isAgentDelegationJob\s*\(/m, 'delegation classification must stay in the shared child-reference owner');
1617
+ }
1618
+ // Live and sampled Git snapshots share the same porcelain partitioning semantics.
1619
+ requireText('src/cli/repositories/structured-git.ts', 'export function splitRepositoryGitStatus');
1620
+ forbid('src/runtime/projections/git-status-sampler.ts', /^function\s+splitStatus\s*\(/m, 'Git projection must not duplicate the live porcelain parser');
1621
+ for (const path of ['src/cli/commands/init.ts', 'src/cli/commands/init-hook.ts', 'src/cli/commands/global-runtime.ts']) {
1622
+ forbid(path, /^function\s+(?:withProcessEnv|runProcess)(?:<|\()/m, 'setup commands must import their canonical synchronous process/environment owner');
1623
+ }
1624
+ requireText('src/cli/editing/edit-session.ts', 'export function findOccurrence');
1625
+ forbid('src/cli/repositories/safe-patch.ts', /^function\s+findOccurrence\s*\(/m, 'Safe Patch preflight must reuse Direct Edit anchor occurrence matching');
1268
1626
  requireText('src/cli/editing/edit-session.ts', 'beforeMode');
1269
1627
  requireText('src/cli/editing/edit-session.ts', 'afterMode');
1270
1628
  requireText('src/cli/editing/edit-session.ts', '{ mode: record.beforeMode }');
@@ -1318,19 +1676,23 @@ forbid(
1318
1676
  requireText('adapters/mcp/runtime-gateway/router.ts', 'executionJobCreationRetired');
1319
1677
  requireText('adapters/mcp/runtime-gateway/router.ts', "'EXECUTION_JOB_RETIRED'");
1320
1678
  requireText('adapters/mcp/runtime-gateway/execution-tools.ts', 'isDurableWorkOperation');
1321
- requireText('adapters/mcp/runtime-gateway/execution-tools.ts', "'work_execute'");
1679
+ forbid('adapters/mcp/runtime-gateway/execution-tools.ts', /'work_execute'/, 'A Work-bound execution helper must not be a second public command tool');
1680
+ requireText('adapters/mcp/tool-mapping/repository-tools.ts', "definition('execute_command'");
1681
+ requireText('adapters/mcp/toolset-names.ts', "'execute_command'");
1682
+ forbid('adapters/mcp/toolset-names.ts', /'process_exec'|'repository_command_execute'|'work_execute'/, 'Only execute_command is a public generic command entry');
1683
+ forbid('adapters/mcp/runtime-gateway/process-tools.ts', /definition\(\s*'process_exec'/, 'The host command must not re-expose a separate process_exec schema');
1684
+ forbid('adapters/mcp/tool-mapping/repository-tools.ts', /definition\('repository_command_preview'/, 'Command dry_run preview must use execute_command rather than a second tool');
1685
+ forbid('src/runtime/plugins/local-system-adapter.ts', /actionId:\s*'execute_command'/, 'Do not reintroduce a duplicate local_system generic terminal capability');
1322
1686
  requireText('adapters/mcp/runtime-gateway/execution-tools.ts', "'work_validate'");
1323
- requireText('adapters/mcp/runtime-gateway/execution-tools.ts', "'work_finalize'");
1687
+ forbid('adapters/mcp/runtime-gateway/execution-tools.ts', /work_finalize/, 'execution tools must not restore a Work finalization operation');
1324
1688
  requireText('src/runtime/execution/workers/executor.ts', 'executeWork(runtimeContext');
1325
1689
  requireText('src/runtime/execution/workers/executor.ts', 'validateWork(runtimeContext');
1326
- requireText('src/runtime/execution/workers/executor.ts', 'finalizeWork(runtimeContext');
1327
1690
  forbid(
1328
1691
  'src/runtime/execution/workers/executor.ts',
1329
1692
  /gateway\/mcp\/execution-tools|callExecutionTool\s*\(/,
1330
1693
  'Execution Worker must invoke control-plane Work application services directly, never MCP transport',
1331
1694
  );
1332
1695
  requireText('src/runtime/execution/workers/executor.ts', '__from_durable_worker');
1333
- requireText('adapters/mcp/runtime-gateway/work-compat-adapter.ts', 'managedProcessOperationDigest');
1334
1696
  forbid(
1335
1697
  'adapters/mcp/runtime-gateway/runtime-tools.ts',
1336
1698
  /\bcreateExecutionJob\b/,
@@ -1399,7 +1761,7 @@ forbid(
1399
1761
  );
1400
1762
  forbid('adapters/mcp/runtime-gateway/router.ts', /Use process_get \/ process_wait \/ process_logs/, 'Gateway follow-up instructions must use an always-exposed neutral Work facade');
1401
1763
  requireMatch(
1402
- 'adapters/mcp/runtime-gateway/router.ts',
1764
+ 'adapters/mcp/runtime-gateway/routing-policy.ts',
1403
1765
  /const DIRECT_REPOSITORY_TOOLS = new Set\(\[[\s\S]*?'repository_list'[\s\S]*?'repository_get'[\s\S]*?'repository_workbench'[\s\S]*?\]\);/,
1404
1766
  'declare DIRECT_REPOSITORY_TOOLS with repository_list, repository_get, and repository_workbench',
1405
1767
  );
@@ -1472,6 +1834,16 @@ requireText('src/runtime/control-plane/global-scheduler/scheduler.ts', 'persistS
1472
1834
  requireText('src/runtime/control-plane/global-scheduler/worker-attachment.ts', 'attachExecutionWorker');
1473
1835
  requireText('src/runtime/control-plane/global-scheduler/scheduler.ts', 'runSchedulerPeriodicCleanup');
1474
1836
  requireText('src/runtime/control-plane/global-scheduler/maintenance.ts', 'runSchedulerValidationReconciliation');
1837
+ requireMatch(
1838
+ 'src/runtime/control-plane/global-scheduler/maintenance.ts',
1839
+ /input\.runtimeCleanup\(input\.controllerHome,\s*\{\s*reason:\s*['"]periodic['"]/s,
1840
+ 'route periodic maintenance through the canonical Runtime cleanup owner',
1841
+ );
1842
+ requireText('src/runtime/control-plane/runtime-cleanup.ts', 'cleanupControllerReleaseHistory');
1843
+ requireText('src/runtime/control-plane/release-retention.ts', "releasePaths.add(releasePathFromAuthorityRecord(releasesRoot, parsed.active, 'active'))");
1844
+ requireText('src/runtime/control-plane/release-retention.ts', 'const connectorRelease = loadPackageConnectorReleaseProtection(controllerHome, releasesRoot);');
1845
+ requireText('src/runtime/control-plane/release-retention.ts', 'const databaseBackup = (previous as Record<string, unknown>).databaseBackup;');
1846
+ requireText('src/runtime/root/scheduler.ts', 'isolatePeriodicCleanup: true');
1475
1847
  requireText('src/runtime/control-plane/global-scheduler/scheduler.ts', 'planSchedulerSourceSampling');
1476
1848
  requireText('src/runtime/control-plane/global-scheduler/source-scan.ts', 'selectSchedulerSourceScanRepositories');
1477
1849
  requireText('src/runtime/control-plane/global-scheduler/scheduler.ts', 'runSchedulerDurableAdmission');
@@ -1508,7 +1880,7 @@ forbidBetween(
1508
1880
  /rebuildRepositoryProjection\s*\(/,
1509
1881
  'Projection rebuild must happen outside the Repo Actor mailbox lock',
1510
1882
  );
1511
- requireText('packages/kernel/scheduler/infrastructure/schedule-store.ts', "'occurrences.json'");
1883
+ requireText('packages/kernel/scheduler/infrastructure/schedule-store.ts', "'occurrences'");
1512
1884
  requireText('src/runtime/projections/git-status-sampler.ts', 'writeRepositoryGitStatusSample');
1513
1885
  requireText('src/runtime/projections/git-status-sampler.ts', 'readRepositoryGitStatusSample');
1514
1886
  requireText('adapters/mcp/tool-mapping/repository-tools.ts', 'readRepositoryGitStatusSample');
@@ -1523,13 +1895,9 @@ forbidBetween(
1523
1895
  requireText('src/runtime/control-plane/execution/session-store.ts', 'lastValidatedAt: now');
1524
1896
  requireText('src/runtime/control-plane/execution/validation.ts', 'warnings.push');
1525
1897
  requireText('src/runtime/control-plane/execution/work-handle-store.ts', "failed: ['validating', 'editing', 'committed', 'merged', 'cleaned', 'failed_terminal_cleanup']");
1526
- requireText('adapters/mcp/runtime-gateway/execution-tools.ts', "from '../../../src/runtime/control-plane/execution/work-finalization-service'");
1527
1898
  requireText('adapters/mcp/runtime-gateway/execution-tools.ts', "from '../../../src/runtime/control-plane/execution/work-preparation-service'");
1528
1899
  requireText('adapters/mcp/runtime-gateway/execution-tools.ts', "from '../../../src/runtime/control-plane/execution/work-operation-service'");
1529
- requireText('adapters/mcp/runtime-gateway/execution-tools.ts', 'Compatibility exports: implementation authority lives in control-plane execution.');
1530
- requireText('adapters/mcp/runtime-gateway/execution-tools.ts', 'resetFinalizationStagesForRequest,');
1531
1900
  requireText('adapters/mcp/runtime-gateway/execution-tools.ts', 'selectDefaultWorkValidationChecks');
1532
- requireText('adapters/mcp/runtime-gateway/work-adapter.ts', "callExecutionTool(ctx, 'work_finalize'");
1533
1901
  forbid(
1534
1902
  'adapters/mcp/runtime-gateway/runtime-tools.ts',
1535
1903
  /repositoryGit(?:Commit|FinishWorkflow|MergeBranch|DeleteBranch|RebaseOnto)\s*\(/,
@@ -1542,8 +1910,8 @@ forbid(
1542
1910
  );
1543
1911
  forbid(
1544
1912
  'adapters/mcp/runtime-gateway/execution-tools.ts',
1545
- /function\s+(?:prepareWork|adoptExistingWorkHead)\s*\(/,
1546
- 'MCP execution transport must delegate Work preparation/adoption to the control-plane application service',
1913
+ /function\s+prepareWork\s*\(/,
1914
+ 'MCP execution transport must delegate Work preparation to the control-plane application service',
1547
1915
  );
1548
1916
  forbid(
1549
1917
  'adapters/mcp/runtime-gateway/execution-tools.ts',
@@ -1556,29 +1924,39 @@ forbid(
1556
1924
  'MCP execution transport must not own managed-workspace or WorkContract preparation admission',
1557
1925
  );
1558
1926
  requireText('src/runtime/control-plane/execution/work-preparation-service.ts', 'export function prepareWork(');
1559
- requireText('src/runtime/control-plane/execution/work-preparation-service.ts', 'function adoptExistingWorkHead(');
1927
+ requireText('src/runtime/control-plane/execution/work-preparation-service.ts', "const useWorktree = isolation !== 'reuse';");
1928
+ forbid(
1929
+ 'src/runtime/control-plane/execution/work-preparation-service.ts',
1930
+ /adoptExistingWorkHead|WORK_HEAD_ADOPTION_/,
1931
+ 'Work preparation must keep the start revision frozen; changed source HEADs are never adopted during implementation',
1932
+ );
1933
+ forbid(
1934
+ 'src/runtime/control-plane/execution/work-handle-authority.ts',
1935
+ /alignRepositoryMutationBase|WORK_DIRECT_PRE_MUTATION_RECONCILIATION_/,
1936
+ 'Repository mutation authority must not advance a Work baseline to follow target-branch movement',
1937
+ );
1938
+ requireMissing('src/runtime/control-plane/execution/direct-canonical-work-reconciliation.ts');
1560
1939
  requireText('src/runtime/control-plane/execution/work-operation-service.ts', 'export async function executeWork(');
1561
1940
  requireText('src/runtime/control-plane/execution/work-operation-service.ts', 'export async function validateWork(');
1562
- requireText('src/runtime/control-plane/execution/work-finalization-service.ts', 'resetFinalizationStagesForRequest');
1563
- requireText('src/runtime/control-plane/execution/work-finalization-service.ts', 'finalizationComplete');
1564
- forbidBetween(
1565
- 'src/runtime/control-plane/execution/work-finalization-service.ts',
1566
- 'export async function finalizeWork(',
1567
- '// WORK_FINALIZATION_SERVICE_END',
1568
- /withControllerLock\([\s\S]{0,900}?(?:repositoryGitCommit|repositoryGitFinishWorkflow|runCleanup|repositoryGitDeleteBranch)/,
1569
- 'Work finalization must not hold the controller lock while committing, merging, deleting branches, or removing worktrees',
1570
- );
1941
+ requireMissing('src/runtime/control-plane/execution/work-finalization-service.ts');
1571
1942
  requireText('packages/kernel/scheduler/domain/schedule.ts', "'repository-event'");
1572
1943
  requireText('packages/kernel/scheduler/domain/schedule.ts', "'dependency-checkpoint'");
1573
1944
  requireText('packages/kernel/scheduler/infrastructure/schedule-store.ts', 'saveScheduleDecision');
1574
1945
  requireText('packages/kernel/scheduler/application/settlement.ts', 'backoffMinutes');
1575
1946
  requireText('src/runtime/release/release-gate.ts', 'releaseReady');
1576
- requireText('adapters/mcp/transports/http.ts', "'/ready'");
1577
- requireText('adapters/mcp/transports/http.ts', "'/repos/:repoId/health'");
1947
+ requireText('adapters/mcp/transports/http-observation.ts', "'/ready'");
1948
+ requireText('adapters/mcp/transports/http-observation.ts', "'/repos/:repoId/health'");
1578
1949
  requireText('src/runtime/control-plane/governance/external-effects.ts', 'EXTERNAL_EFFECT_AUTHORIZATION_REQUIRED');
1579
1950
  requireText('src/runtime/control-plane/governance/external-effects.ts', 'AUTOMATED_REQUIREMENT_REQUIRES_CANDIDATE');
1580
1951
  requireText('adapters/mcp/tool-mapping/tools.ts', "export * from './legacy-tool-service'");
1581
- requireText('src/cli/mcp/tools.ts', '@deprecated Kernel V2 compatibility shim');
1952
+ for (const retiredShim of [
1953
+ 'src/cli/mcp/access-tools.ts',
1954
+ 'src/cli/mcp/repository-tools.ts',
1955
+ 'src/cli/mcp/tools.ts',
1956
+ 'src/cli/mcp/toolset.ts',
1957
+ 'src/cli/mcp/toolset-names.ts',
1958
+ 'src/cli/mcp/toolset-selection.ts',
1959
+ ]) requireMissing(retiredShim);
1582
1960
 
1583
1961
  for (const path of [
1584
1962
  'adapters/mcp/runtime-gateway/router.ts',
@@ -1595,8 +1973,6 @@ for (const path of [
1595
1973
 
1596
1974
  requireText('scripts/run-governed-gate.ts', "label: 'source duplication'");
1597
1975
  requireText('scripts/run-governed-gate.ts', "args: ['scripts/check-source-duplication.mjs']");
1598
- requireText('scripts/run-governed-gate.ts', "label: 'controller UI bundle'");
1599
- requireText('scripts/run-governed-gate.ts', "args: ['run', 'check:controller-ui']");
1600
1976
  requireText('docs/architecture/CURRENT.md', '## State ownership');
1601
1977
  requireText('docs/architecture/CURRENT.md', '## Runtime and MCP boundary');
1602
1978
  requireText('docs/architecture/CURRENT.md', '## Testing and verification');
@@ -1698,11 +2074,12 @@ const B7_ALLOWED_KERNEL_LEGACY_EDGES = new Set([
1698
2074
  'packages/kernel/scheduler/infrastructure/schedule-store.ts -> src/runtime/control-plane/facade/handoff-inbox-store.ts',
1699
2075
  'packages/kernel/scheduler/infrastructure/schedule-store.ts -> src/runtime/shared/json-files.ts',
1700
2076
  'packages/kernel/scheduler/infrastructure/schedule-store.ts -> src/runtime/evidence/event-ledger.ts',
1701
- 'packages/kernel/scheduler/infrastructure/continuation-dispatch-store.ts -> src/cli/repositories/locks.ts',
1702
- 'packages/kernel/scheduler/infrastructure/continuation-dispatch-store.ts -> src/runtime/control-plane/persistence/sqlite-store.ts',
1703
2077
  ]);
1704
2078
  requireExactShrinkingDebt('Kernel -> legacy src dependency debt', b7KernelLegacyEdges, B7_ALLOWED_KERNEL_LEGACY_EDGES);
1705
2079
  const b7ProductionEdges = new Set(dependencyEdges(b7ProductionGraph));
2080
+ if (!b7ProductionEdges.has('src/runtime/standalone-recovery/core.ts -> src/runtime/standalone-recovery/operation-lock.ts')) {
2081
+ failures.push('Recovery Core must consume the single shared operation-lock authority');
2082
+ }
1706
2083
  for (const requiredEdge of [
1707
2084
  'packages/kernel/work/domain/types.ts -> packages/kernel/identity/api/index.ts',
1708
2085
  'packages/kernel/scheduler/domain/schedule.ts -> packages/kernel/identity/api/index.ts',
@@ -1734,7 +2111,243 @@ for (const [symbol, label] of b7UniqueMutationSymbols) {
1734
2111
  }
1735
2112
  if (count !== 1) failures.push(`${label} must have exactly one exported production owner; found ${count} for ${symbol}`);
1736
2113
  }
2114
+ // Thin Plan authority: Plan items are authored working memory. Work execution,
2115
+ // Plan admission and Plan revision must never re-acquire PlanStep execution
2116
+ // writers, Plan approval/acceptance gates or Plan-derived Work progression.
2117
+ const retiredPlanExecutionSymbols = [
2118
+ 'claimPlanStepForWork',
2119
+ 'completePlanStepForWork',
2120
+ 'acceptPlanStepEvidence',
2121
+ 'repairPlanStepForTechnicalRetry',
2122
+ 'repairDanglingPlanStepWorkBinding',
2123
+ 'replanActivePlanBoundWorkScope',
2124
+ 'retireTerminalPlanBoundWorkAuthorities',
2125
+ 'getPlanExecutionBaselineRevision',
2126
+ 'updatePlanContractWithExecutionBaseline',
2127
+ 'refreshPlanBoundWorkRevision',
2128
+ 'retirePlanBoundWorkContract',
2129
+ 'rebindPlanBoundWorkContract',
2130
+ ];
2131
+ for (const path of productionTypeScriptFiles()) {
2132
+ const source = text(path);
2133
+ for (const symbol of retiredPlanExecutionSymbols) {
2134
+ if (new RegExp(`\\b${symbol}\\b`).test(source)) failures.push(`${path} must not reintroduce retired PlanStep execution writer ${symbol}`);
2135
+ }
2136
+ }
2137
+ const retiredPlanGateCodes = /PLAN_STEP_(?:SEMANTIC_ACCEPTANCE_REQUIRED|TERMINAL_WORK_RECONCILIATION_REQUIRED|DEPENDENCIES_PENDING|ALREADY_ACTIVE|ALREADY_COMPLETED|MULTIPLE_PRIMARY_WORKS|BOUND_WORK_MISSING|REUSES_ACTIVE_WORK|WORK_CONTRACT_MISMATCH)|PLAN_NOT_EXECUTABLE|PLAN_EXECUTION_BASELINE_LOCKED|PLAN_OBLIGATION_CONTINUITY_REQUIRED|PLAN_STEP_SEMANTIC_ACCEPTANCE/;
2138
+ for (const path of [
2139
+ 'src/runtime/control-plane/facade/goal-workloop.ts',
2140
+ 'src/runtime/control-plane/facade/plan-contract-store.ts',
2141
+ 'src/runtime/control-plane/facade/requirement-authority.ts',
2142
+ 'src/runtime/control-plane/global-scheduler/autonomous-continuation.ts',
2143
+ 'adapters/mcp/runtime-gateway/work-plan-operations.ts',
2144
+ 'adapters/mcp/runtime-gateway/work-repair-adapter.ts',
2145
+ ]) {
2146
+ if (retiredPlanGateCodes.test(text(path))) failures.push(`${path} must not reintroduce a PlanStep execution gate`);
2147
+ }
2148
+ for (const path of ['packages/kernel/progression/api/index.ts']) requireMissing(path);
2149
+ for (const path of productionTypeScriptFiles()) {
2150
+ if (/packages\/kernel\/progression/.test(text(path))) failures.push(`${path} must not depend on the retired PlanStep progression engine`);
2151
+ }
2152
+ for (const retiredPath of [
2153
+ 'src/runtime/control-plane/execution/work-finalization-service.ts',
2154
+ 'src/runtime/control-plane/execution/direct-edit-work-completion.ts',
2155
+ 'src/runtime/control-plane/execution/content-equivalent-commit-authority.ts',
2156
+ 'adapters/mcp/controller-round-compatibility.ts',
2157
+ 'adapters/mcp/frozen-client-semantic-compatibility.ts',
2158
+ 'adapters/mcp/runtime-gateway/work-controller-recovery-operations.ts',
2159
+ 'adapters/mcp/runtime-gateway/work-plan-repair-operations.ts',
2160
+ ]) requireMissing(retiredPath);
2161
+ for (const path of [...sourceFiles('src'), ...sourceFiles('adapters')]) {
2162
+ forbid(path, /tool:\s*['"]rh_work['"][\s\S]{0,180}?operation:\s*['"](?:continue|verify|review|finalize|stop|plan_approve|plan_accept_step|controller_claim|controller_release|controller_disposition)['"]/, 'retired Work lifecycle operations must not return as current rh_work behavioral authority');
2163
+ }
2164
+ // Thin semantic Work lifecycle: Work is open/completed/cancelled and
2165
+ // work.complete is a mechanical durable close. Review findings are durable
2166
+ // observations, never a completion gate.
2167
+ requireText('packages/kernel/work/domain/types.ts', "export const SEMANTIC_WORK_STATES = ['open', 'completed', 'cancelled'] as const;");
2168
+ requireText('packages/kernel/work/domain/types.ts', 'export type SemanticWorkState = (typeof SEMANTIC_WORK_STATES)[number];');
2169
+ requireText('adapters/mcp/runtime-gateway/work-semantic-operations.ts', "const RH_WORK_SEMANTIC_OPERATIONS = new Set(['start', 'get', 'revise', 'complete']);");
2170
+ for (const path of [
2171
+ 'packages/kernel/work/domain/state-machine.ts',
2172
+ 'src/runtime/control-plane/execution/work-evidence-policy.ts',
2173
+ 'src/runtime/control-plane/facade/goal-workloop.ts',
2174
+ ]) {
2175
+ forbid(path, /READ_ONLY_REVIEW_CLEAN_SCOPE|cleanReadOnlyReviewEvidence|READ_ONLY_REVIEW_FINDINGS_BLOCK/, 'read-only review findings must not gate terminal completion');
2176
+ }
2177
+ // Work lifecycle collapse: semantic Work completion is one durable
2178
+ // expected_revision CAS close. Verify/review/finalize/delivery/cleanup are
2179
+ // mechanical facts owned elsewhere; they must never be wired back into the
2180
+ // semantic close path as a gate.
2181
+ for (const path of [
2182
+ 'adapters/mcp/runtime-gateway/work-semantic-operations.ts',
2183
+ ]) {
2184
+ forbid(path, /transitionWorkContractPhase|requestWorkImplementationReview|recordWorkImplementationReview|finalizeGoalWorkloop|verifyGoalWorkloop|reviewGoalWorkloop/, 'semantic Work completion must not invoke a mechanical lifecycle transition');
2185
+ forbid(path, /implementationReview|completionReceipt|dispatchState|evidenceState|ControllerRound|controllerRound/, 'semantic Work completion must not read mechanical lifecycle or controller authority');
2186
+ }
2187
+ forbidBetween(
2188
+ 'packages/kernel/work/infrastructure/work-contract-store.ts',
2189
+ 'export function reviseWorkSemanticContext(',
2190
+ 'export function getWorkContract(',
2191
+ /WORK_IMPLEMENTATION_REVIEW|WORK_COMPLETION_RECEIPT|WORK_VERIFICATION|WORK_CLEANUP|WORK_DELIVERY|WORK_FINALIZE/,
2192
+ 'the semantic close must not require review, verification, delivery, cleanup or finalize',
2193
+ );
2194
+ requireText('packages/kernel/work/infrastructure/work-contract-store.ts', 'WORK_REVISION_CONFLICT:');
2195
+ forbidBetween(
2196
+ 'packages/kernel/work/infrastructure/work-contract-store.ts',
2197
+ 'export function semanticWorkState(',
2198
+ 'export function workSemanticView(',
2199
+ /'failed'|'ready'|'blocked'|'running'/,
2200
+ 'semantic Work state must expose only open/completed/cancelled; execution vocabulary is not a semantic state',
2201
+ );
2202
+ // Controller de-authority: ordinary Work/capability execution is fenced by
2203
+ // semantic CAS plus concrete target/resource/effect owners, never by a
2204
+ // Work-wide ControllerSession lease. Explicit autonomous-continuation round
2205
+ // operations retain their narrow dispatch/effect authority until Slice 4.
2206
+ forbid(
2207
+ 'packages/kernel/work/domain/state-machine.ts',
2208
+ /WORK_PHASE_EVIDENCE_|WORK_COMPLETION_PHASE_/,
2209
+ 'legacy phase evidence must not regain semantic Work authority',
2210
+ );
2211
+ for (const path of [
2212
+ 'adapters/mcp/runtime-gateway/work-workflow-operations.ts',
2213
+ 'src/runtime/workflows/runtime.ts',
2214
+ ]) {
2215
+ forbid(path, /assertFacadeControllerRoundAuthority|getControllerSession|getControllerRoundRelay|controllerSessionAuthorityMatches|WORKFLOW_CONTROLLER_AUTHORITY|WORKFLOW_CONTROLLER_NOT_OWNER/, 'ordinary Workflow execution must not depend on Work-wide Controller authority');
2216
+ }
2217
+ forbid(
2218
+ 'adapters/mcp/runtime-gateway/work-adapter.ts',
2219
+ /claimNewFacadeWork|mintControllerSessionAuthority|resumeControllerSession|bindFacadeControllerOwnership|currentFacadeTerminalizationAuthority|currentTerminalCleanupAuthority|withControllerSessionTerminalizationFence/,
2220
+ 'ordinary Work start/continue/review/stop/finalize must not mint or require Work-wide Controller authority',
2221
+ );
2222
+ for (const path of [
2223
+ 'packages/kernel/work/domain/types.ts',
2224
+ 'packages/kernel/work/domain/execution-concurrency.ts',
2225
+ 'src/runtime/control-plane/concurrency/work-execution-concurrency.ts',
2226
+ 'src/runtime/execution/process-runtime/types.ts',
2227
+ ]) {
2228
+ forbid(path, /controller_release/, 'Work/Process concurrency must wake on concrete Work/resource/scheduler facts, not Controller ownership release');
2229
+ }
2230
+ for (const path of [
2231
+ 'src/runtime/control-plane/execution/work-execution-support.ts',
2232
+ 'src/runtime/control-plane/execution/work-operation-service.ts',
2233
+ 'src/runtime/control-plane/execution/work-terminal-cleanup.ts',
2234
+ 'src/runtime/control-plane/execution/work-preparation-service.ts',
2235
+ ]) {
2236
+ forbid(path, /assertWorkControllerOwnership|releasePreparedWorkOwnership|claimPreparedWorkOwnership|claimHeadAdoptionOwnership|withControllerSessionTerminalizationFence|getControllerSession|claimControllerSession|resumeControllerSession|releaseControllerSessionWithAuthority|releaseObservedControllerSession|controllerClaimed/, 'ordinary Work preparation/execution/finalization/cleanup must not use ControllerSession as authority');
2237
+ }
2238
+ forbid(
2239
+ 'src/runtime/recovery/maintenance-executor.ts',
2240
+ /withControllerSessionTerminalizationFence|listControllerSessions|getControllerSession|controllerWorkIds|controller_session/,
2241
+ 'stale Work maintenance must re-check concrete Work/source/resource facts instead of using ControllerSession as lifecycle authority',
2242
+ );
2243
+ requireText('src/runtime/control-plane/facade/handoff-inbox-store.ts', 'migrateLegacyHandoffInbox');
2244
+ requireText('src/runtime/control-plane/facade/handoff-inbox-store.ts', 'HANDOFF_LEGACY_STORE_READ_ONLY');
2245
+ requireText('src/runtime/control-plane/facade/handoff-inbox-store.ts', 'UserRequest owns the durable write');
2246
+ forbid('src/runtime/control-plane/facade/handoff-inbox-store.ts', /writeLegacyHandoffInboxStore|export function writeHandoffInboxStore/, 'legacy Handoff store must never remain a writable second authority');
2247
+ forbid('src/runtime/plugins/store.ts', /status:\s*terminalRemoteEffect\s*\?\s*['\"]completed['\"]/, 'plugin/effect delivery results must never claim semantic Work completion');
2248
+ requireText('src/runtime/plugins/store.ts', "semanticState: 'open' as const");
2249
+ for (const path of sourceFiles('src')) {
2250
+ forbid(path, /\bcancelWorkContract\s*\(/, 'runtime/maintenance code must never auto-cancel semantic Work; cancellation belongs to explicit semantic CAS');
2251
+ }
2252
+ requireText('src/runtime/control-plane/facade/goal-workloop.ts', "state: 'cancelled'");
2253
+ requireText('src/runtime/recovery/maintenance-executor.ts', "result: 'work_semantic_completion_required'");
2254
+ requireText('src/runtime/control-plane/execution/work-authority-reconciler.ts', "'semantic_work_open_ownerless'");
2255
+ forbid(
2256
+ 'packages/kernel/scheduler/infrastructure/schedule-store.ts',
2257
+ /repeated_infrastructure_failure|activeScheduleFailureHandoff|stableScheduleFailureHandoffId|resolveRecoveredScheduleFailureHandoffs/,
2258
+ 'mechanical Scheduler failures must remain runtime/backoff facts and must not create human-request authority',
2259
+ );
2260
+ {
2261
+ const workStoreSource = text('packages/kernel/work/infrastructure/work-contract-store.ts');
2262
+ const receiptWriterStart = workStoreSource.indexOf('export function recordWorkCompletionReceipt(');
2263
+ const receiptWriterEnd = workStoreSource.indexOf('\nexport interface AcceptSubmittedWorkInput', receiptWriterStart);
2264
+ const receiptWriter = receiptWriterStart >= 0 && receiptWriterEnd > receiptWriterStart
2265
+ ? workStoreSource.slice(receiptWriterStart, receiptWriterEnd)
2266
+ : '';
2267
+ if (!receiptWriter) fail('recordWorkCompletionReceipt writer not found');
2268
+ if (/status:\s*['"]completed['"]|dispatchState:\s*['"]terminal['"]|phase:\s*['"]cleanup['"]|WORK_IMPLEMENTATION_REVIEW_REQUIRED|transitionWorkContractPhase|requestWorkImplementationReview/.test(receiptWriter)) {
2269
+ fail('delivery/effect receipt recording must not terminalize Work or reintroduce review/lifecycle gates');
2270
+ }
2271
+ }
2272
+ forbid(
2273
+ 'src/runtime/control-plane/execution/work-completion-authority.ts',
2274
+ /completeRequirementFromWork|projectRequirementDeliveryFromCompletedWork|completeWorkWithReceipt/,
2275
+ 'delivery evidence must not auto-complete Work or Requirement',
2276
+ );
2277
+ for (const path of [
2278
+ 'adapters/mcp/runtime-gateway/work-adapter.ts',
2279
+ 'adapters/mcp/runtime-gateway/repository-compat-adapter.ts',
2280
+ 'src/runtime/control-plane/facade/goal-workloop.ts',
2281
+ ]) {
2282
+ forbid(path, /lifecycleClosed|finalStatus:\s*['"]completed['"]|directEditWorkCompletion/, 'mechanical delivery/finalize responses must not masquerade as semantic Work completion');
2283
+ }
2284
+ // Temporary migration assertion on automatic dispatch admission. Explicit
2285
+ // operator repair may reconstruct a historical dispatch-owner pre-click proof;
2286
+ // unknown observation reasons must never be automatic retry authority. Remove
2287
+ // this string fence when the existing effect admission contract is AST-fenced.
2288
+ forbidBetween(
2289
+ 'supervisor/store.ts',
2290
+ 'nextBrowserEffect(',
2291
+ 'effectDispatchBudget(',
2292
+ /composer_missing|send_button_missing|latestRetryEvidenceEventId/,
2293
+ 'dispatch generation may advance only from canonical effect_not_applied proof; effect_unknown never authorizes replay',
2294
+ );
2295
+ requireText('packages/kernel/controller/domain/controller-round-transition-policy.ts', "Pick<ControllerRoundRelayRecord, 'relayScopeId' | 'originWorkId' | 'roundCount'>");
2296
+ forbid(
2297
+ 'packages/kernel/controller/domain/controller-round-transition-policy.ts',
2298
+ /controllerRoundProviderEffectId[\s\S]{0,400}authorityId/,
2299
+ 'canonical continuation/provider effect identity must survive Controller authority rotation',
2300
+ );
2301
+ requireText('src/runtime/root/workflow-supervisor-composition.ts', 'reserveWorkflowSupervisorEnrollment(forgeHome, registeredTask.taskId, lowerLayer.providerEffectId)');
2302
+ requireText('src/runtime/root/workflow-supervisor-composition.ts', 'providerDispatchEffectId: effect.effectId');
2303
+ requireText('supervisor/protocol.ts', '(?:fx|crpe)_');
2304
+ // Cognitive Plane stays one advisory application path: all Controller tools expose the
2305
+ // same optional settlement metadata, the MCP server settles it after the primary
2306
+ // outcome, and Supervisor/external launchers consume Cognition-only projections.
2307
+ requireText('adapters/mcp/toolset.ts', 'injectCognitionSettlementFields(injectDurableCommandFields(definition))');
2308
+ requireText('adapters/mcp/server.ts', 'settleCognitionAfterTool(ctx, name, args, localResult)');
2309
+ forbid('adapters/mcp/runtime-gateway/runtime-tools.ts', /settleCognitionEnvelope/, 'cognition settlement belongs to the canonical all-tool MCP boundary, not the rh_* facade only');
2310
+ requireText('src/runtime/root/workflow-supervisor-composition.ts', 'renderCognitiveAttentionForWork');
2311
+ requireText('src/runtime/control-plane/launcher/thin-launcher.ts', 'renderCognitiveAttentionForWork');
2312
+ forbid('src/runtime/root/workflow-supervisor-composition.ts', /renderAssistantWorkContext/, 'Supervisor prompts may receive bounded Cognition, not the legacy lower-layer AssistantWorkContext blob');
2313
+ forbid('src/runtime/control-plane/launcher/thin-launcher.ts', /renderAssistantWorkContext/, 'external controller prompts may receive bounded Cognition, not the legacy lower-layer AssistantWorkContext blob');
2314
+ requireText('packages/kernel/cognition/application/activation-service.ts', 'structuredConceptAliasCueScore');
2315
+ requireText('packages/kernel/cognition/application/activation-service.ts', 'fairScopedRead');
2316
+ requireText('packages/kernel/cognition/application/activation-service.ts', 'seenFamilies');
2317
+
2318
+ for (const path of [
2319
+ 'adapters/mcp/runtime-gateway/work-learning-operations.ts',
2320
+ 'src/runtime/control-plane/persistence/experience-store.ts',
2321
+ ]) {
2322
+ forbid(path, /assertFacadeControllerRoundAuthority|controllerSessionAuthorityMatches|getControllerSession|EXPERIENCE_CONTROLLER_NOT_OWNER|EXPERIENCE_ROUND_AUTHORITY_MISMATCH|EXPERIENCE_CLAIM_AUTHORITY_MISMATCH/, 'advisory learning writes must use Work provenance and evidence, not Controller ownership');
2323
+ }
2324
+ forbid(
2325
+ 'src/cli/commands/brain-assistant.ts',
2326
+ /authority-env|BRAIN_CONTROLLER_AUTHORITY_REQUIRED|BRAIN_AUTHORITY_ENV_INVALID/,
2327
+ 'advisory experience CLI must not require a Controller capability',
2328
+ );
2329
+ // Retired Gateway/CLI forwarding aliases must not be reintroduced: adapter
2330
+ // definitions and execution-domain reconciliation own their canonical paths.
1737
2331
  for (const path of [
2332
+ 'adapters/mcp/runtime-gateway/work-validation-reconciler.ts',
2333
+ 'src/cli/mcp/access-mode.ts',
2334
+ 'src/cli/mcp/audit.ts',
2335
+ 'src/cli/mcp/auth.ts',
2336
+ 'src/cli/mcp/multi-repository.ts',
2337
+ 'src/cli/mcp/openai-secure-tunnel.ts',
2338
+ 'src/cli/mcp/paths.ts',
2339
+ 'src/cli/mcp/policy.ts',
2340
+ 'src/cli/mcp/readiness-projection.ts',
2341
+ 'src/cli/mcp/redaction.ts',
2342
+ 'src/cli/mcp/repo.ts',
2343
+ 'src/cli/mcp/server.ts',
2344
+ 'src/cli/mcp/setup.ts',
2345
+ 'src/cli/mcp/transports/http.ts',
2346
+ 'src/cli/mcp/transports/session-registry.ts',
2347
+ 'src/cli/mcp/types.ts',
2348
+ 'src/cli/mcp/oauth.ts',
2349
+ 'src/cli/mcp/tool-contract.ts',
2350
+ 'src/cli/mcp/transports/stdio.ts',
1738
2351
  'src/runtime/gateway/mcp/execution-tools.ts',
1739
2352
  'src/runtime/gateway/mcp/legacy-ios-tool-adapter.ts',
1740
2353
  'src/runtime/gateway/mcp/persisted-check-process.ts',
@@ -1743,21 +2356,10 @@ for (const path of [
1743
2356
  'src/runtime/gateway/mcp/runtime-tool-definitions.ts',
1744
2357
  'src/runtime/gateway/mcp/runtime-tools.ts',
1745
2358
  'src/runtime/gateway/mcp/work-validation-reconciler.ts',
1746
- ]) requireText(path, '@deprecated Kernel V2 compatibility shim');
1747
- for (const path of [
1748
- 'src/cli/mcp/access-tools.ts',
1749
- 'src/cli/mcp/legacy-context.ts',
1750
- 'src/cli/mcp/legacy-tool-service.ts',
1751
- 'src/cli/mcp/multi-repository.ts',
1752
- 'src/cli/mcp/repository-tools.ts',
1753
- 'src/cli/mcp/server.ts',
1754
- 'src/cli/mcp/tools.ts',
1755
- 'src/cli/mcp/toolset.ts',
1756
- ]) requireText(path, '@deprecated Kernel V2 compatibility shim');
2359
+ ]) requireMissing(path);
1757
2360
  requireText('src/runtime/control-plane/execution/work-execution-support.ts', 'packages/protocols/mcp/execution-context');
1758
2361
  requireText('src/runtime/control-plane/execution/work-preparation-service.ts', 'packages/protocols/mcp/execution-context');
1759
2362
  requireText('src/runtime/control-plane/execution/work-operation-service.ts', 'packages/protocols/mcp/execution-context');
1760
- requireText('src/runtime/control-plane/execution/work-finalization-service.ts', 'packages/protocols/mcp/execution-context');
1761
2363
  for (const path of [
1762
2364
  'adapters/mcp/transports/http.ts',
1763
2365
  'adapters/mcp/transports/session-registry.ts',
@@ -1797,13 +2399,6 @@ forbidBetween(
1797
2399
  /\b(?:pid|process|endpoint|url|tunnel|token)\b/i,
1798
2400
  'ForgeInstanceIdentity creation must remain independent of process and adapter transport/auth metadata',
1799
2401
  );
1800
- for (const path of [
1801
- 'src/cli/mcp/auth.ts',
1802
- 'src/cli/mcp/setup.ts',
1803
- 'src/cli/mcp/openai-secure-tunnel.ts',
1804
- ]) {
1805
- requireText(path, '@deprecated Kernel V2 compatibility shim');
1806
- }
1807
2402
  requireText('adapters/mcp/auth.ts', 'forgeInstanceId?: string');
1808
2403
  forbid('adapters/mcp/auth.ts', /server:\s*\{[\s\S]{0,512}?instanceId\??:\s*string/, 'MCP server process identity must not share semantic Forge instanceId naming');
1809
2404
  requireText('adapters/mcp/setup.ts', 'ensureForgeInstanceIdentity');
@@ -1814,7 +2409,7 @@ requireText('src/runtime/root/runtime.ts', 'readonly forgeInstanceId: string');
1814
2409
  requireText('src/runtime/root/runtime.ts', 'ensureForgeInstanceIdentity');
1815
2410
  requireText('src/runtime/root/entry.ts', 'forgeInstanceId: runtime.forgeInstanceId');
1816
2411
  requireText('adapters/mcp/transports/http.ts', 'forgeInstanceId: forgeInstance.instanceId');
1817
- requireText('adapters/mcp/transports/http.ts', 'controllerInstanceId: process.env.FORGE_MCP_INSTANCE_ID');
2412
+ requireText('adapters/mcp/transports/http-observation.ts', 'controllerInstanceId: process.env.FORGE_MCP_INSTANCE_ID');
1818
2413
  forbid('adapters/mcp/transports/http.ts', /\{\s*instanceId:\s*process\.env\.FORGE_MCP_INSTANCE_ID/, 'MCP process identity must not be exposed as semantic Forge instanceId');
1819
2414
  requireText('adapters/mcp/transports/http.ts', "adapterId: 'mcp-http'");
1820
2415
  requireText('adapters/mcp/transports/session-registry.ts', 'connectionId: string');
@@ -1824,6 +2419,43 @@ requireText('adapters/mcp/tunnels/openai-secure-tunnel.ts', 'credentialReference
1824
2419
  forbid('adapters/mcp/tunnels/openai-secure-tunnel.ts', /\bidentityMatches\b/, 'tunnel binding match must not masquerade as Forge semantic identity');
1825
2420
 
1826
2421
  // C0 Computer capability boundary: Browser and Desktop remain separate providers.
2422
+ // Controller-scoped plugins are owned by the serving ForgeInstance. A synthetic
2423
+ // RepositoryRecord must not reappear as a canonical execution or manifest path.
2424
+ const controllerRepoCallPattern = new RegExp(['controllerPlugin', 'Repository\\s*\\('].join(''));
2425
+ const legacyControllerRepoPattern = new RegExp(['CONTROLLER_SCOPE_REPO_ID|__controller__|controllerPlugin', 'Repository'].join(''));
2426
+ for (const path of productionTypeScriptFiles()) {
2427
+ forbid(path, controllerRepoCallPattern, 'production controller-plugin paths must not recreate a fake controller RepositoryRecord');
2428
+ }
2429
+ requireText('src/runtime/plugins/store.ts', 'const CONTROLLER_PLUGIN_SCOPE_KEY = FORGE_INSTANCE_SCOPE_KEY');
2430
+ requireText('src/runtime/plugins/store.ts', 'export function preflightPluginActionWorkBinding(');
2431
+ requireText('src/runtime/plugins/action-application.ts', 'preflightPluginActionWorkBinding(input.controllerHome, input.scope, action, input.request);');
2432
+ requireText('tests/runtime/external-plugin-store-integration.test.ts', 'rejects invalid Work kind without consuming the Process request id');
2433
+ forbidBetween(
2434
+ 'src/runtime/plugins/store.ts',
2435
+ 'function controllerPluginActionScope',
2436
+ 'function pluginActionExecutionFields',
2437
+ legacyControllerRepoPattern,
2438
+ 'the canonical controller action scope must use the ForgeInstance scope, not the legacy controller repository sentinel',
2439
+ );
2440
+ for (const [start, end, description] of [
2441
+ ['export function listControllerPluginManifests(', 'function getControllerPluginManifestForExecution', 'controller manifest listing'],
2442
+ ['export function getControllerPluginManifest(', 'function writeControllerRegistry', 'controller manifest lookup'],
2443
+ ['export function submitControllerPluginAction(', 'async function executePluginActionInScope', 'controller action submission'],
2444
+ ['export function executeControllerScopedPluginAction(', 'export function executeAssistantPluginAction', 'controller action execution'],
2445
+ ]) {
2446
+ forbidBetween(
2447
+ 'src/runtime/plugins/store.ts',
2448
+ start,
2449
+ end,
2450
+ legacyControllerRepoPattern,
2451
+ `${description} must not depend on the legacy controller repository sentinel`,
2452
+ );
2453
+ }
2454
+ // Legacy controller coordinates remain read-only migration/compatibility inputs
2455
+ // or explicit rejection paths; they are not allowed to become new write paths.
2456
+ requireText('src/runtime/plugins/store.ts', 'One-way read compatibility for pre-cutover controller receipts only.');
2457
+ requireText('adapters/mcp/runtime-gateway/plugin-adapter.ts', 'PLUGIN_CONTROLLER_REPOSITORY_SENTINEL_RETIRED');
2458
+ requireText('src/runtime/plugins/app-store-connect-adapter.ts', 'APP_STORE_CONNECT_LEGACY_CONTROLLER_SCOPE_WRITE_RETIRED');
1827
2459
  requireText('packages/protocols/computer/contract.ts', 'COMPUTER_BROWSER_AUTOMATION_CAPABILITY');
1828
2460
  requireText('packages/protocols/computer/contract.ts', 'ComputerRuntimeProviderCapabilityId');
1829
2461
  requireText('packages/plugin-runtime/computer/provider.ts', 'ComputerRuntimeProviderCapabilityId');
@@ -1837,16 +2469,60 @@ requireText('packages/protocols/computer/contract.ts', 'export interface Compute
1837
2469
  forbid('adapters/computer/desktop-operator-negotiation.ts', /interface\s+ComputerCapabilityAdvertisement/, 'Desktop Operator negotiation must consume the provider-neutral Computer capability advertisement contract instead of redefining it');
1838
2470
  requireText('packages/plugin-runtime/computer/provider.ts', 'export interface ComputerProvider');
1839
2471
  requireText('packages/plugin-runtime/computer/provider-registry.ts', 'export class ComputerProviderRegistry');
2472
+ requireText('src/runtime/plugins/computer-registration.ts', 'return executeIosPhysicalDeviceAction(input)');
2473
+ requireText('scripts/smoke-ios-physical-device.ts', "pluginId: 'computer'");
2474
+ requireText('scripts/smoke-ios-physical-device.ts', 'artifact?.sha256 !== screenshotSha256');
2475
+ requireText('scripts/smoke-ios-physical-device.ts', 'semanticPriceVerified: false');
2476
+ requireText('src/runtime/plugins/computer-registration.ts', 'observationReady: physicalReady, inputReady: physicalInputReady');
2477
+ requireText('src/runtime/plugins/computer-registration.ts', 'const hidStatus = physicalReady && context ? remoteXpcHidCachedStatus(context.controllerHome) : undefined;');
2478
+ requireText('src/runtime/plugins/ios/remote-xpc-hid.ts', 'probeHidToolchain(python)');
2479
+ requireText('src/runtime/plugins/ios/remote-xpc-hid.ts', "'--expected-version', IOS_HID_TOOLCHAIN_VERSION");
2480
+ requireText('scripts/install-ios-hid-toolchain.sh', 'pymobiledevice3==$version');
2481
+ requireText('src/runtime/plugins/ios/remote-xpc-hid.ts', 'return hidToolchainStatus(controllerHome, env, false);');
2482
+ requireText('src/runtime/plugins/ios/remote-xpc-hid.ts', 'return hidToolchainStatus(controllerHome, env, true);');
2483
+ requireText('src/runtime/plugins/ios-physical-device.ts', 'const confirmed = requireObservedPhysicalTargetForeground(state)');
2484
+ requireText('src/runtime/plugins/ios-physical-device.ts', 'const reusable = reusablePhysicalSession(input, selected, bundleId);');
2485
+ requireText('src/runtime/plugins/ios-physical-device.ts', "appendEvent(input, reusable.interactionId, 'app_activated'");
2486
+ requireText('src/runtime/plugins/ios-physical-device.ts', "state: 'deferred_to_first_input'");
2487
+ requireText('src/runtime/plugins/ios-physical-device.ts', 'input.args.prewarm_input === true && input.args.observe_after_open !== true');
2488
+ requireText('tests/runtime/ios-physical-device.test.ts', "it('reuses the same session but always reactivates its target app'");
2489
+ requireText('src/runtime/plugins/ios-physical-device.ts', "'IOS_DEVICE_LOCK_STATE_UNVERIFIED'");
2490
+ requireText('src/runtime/plugins/ios-physical-device.ts', "if (lockState.passcodeRequired === false) return;");
2491
+ requireText('src/runtime/plugins/ios-physical-device.ts', 'if (!selected.connected) {');
2492
+ requireText('src/runtime/plugins/ios-physical-device.ts', "'IOS_DEVICE_SCREENSHOT_INVALID'");
2493
+ requireText('src/runtime/plugins/ios-physical-device.ts', 'chmodSync(path, 0o700);');
2494
+ requireText('src/runtime/plugins/ios-physical-device.ts', 'if (file.isFile()) chmodSync(path, 0o600);');
2495
+ requireText('src/runtime/plugins/ios-physical-device.ts', 'state.lastScreenshot = undefined;');
2496
+ requireText('src/runtime/plugins/ios-physical-device.ts', 'try { unlinkSync(path); } catch');
2497
+ requireText('src/runtime/plugins/ios-physical-device.ts', 'PNG_CRC_TABLE');
2498
+ requireText('src/runtime/plugins/ios-physical-device.ts', 'sawImageData && length === 0 && end + 4 === image.length');
2499
+ requireText('src/runtime/plugins/ios-physical-device.ts', 'screenshotSha256, screenshotBytes: image.length');
2500
+ requireText('src/runtime/plugins/ios-physical-device.ts', "requiredConfirmationText: 'list-iphone-app-documents'");
2501
+ requireText('src/runtime/plugins/ios-physical-device.ts', "'IOS_DEVICE_DOCUMENT_LIST_UNVERIFIED'");
2502
+ requireText('src/runtime/plugins/ios-physical-device.ts', "listedNames.some((name) => typeof name !== 'string' || !name.trim())");
2503
+ requireText('src/runtime/plugins/ios-physical-device.ts', "requiredConfirmationText: 'export-iphone-app-document'");
2504
+ requireText('src/runtime/plugins/ios-physical-device.ts', "const indexPath = join(dir, 'index.json')");
2505
+ requireText('src/runtime/plugins/ios-physical-device.ts', 'const MAX_DOCUMENT_INDEX_BYTES = 512 * 1024;');
2506
+ requireText('src/runtime/plugins/ios-physical-device.ts', 'indexFile.size <= 0 || indexFile.size > MAX_DOCUMENT_INDEX_BYTES');
2507
+ requireText('src/runtime/plugins/ios-physical-device.ts', 'index.interactionId !== record.interactionId || !validEntries');
2508
+ requireText('src/runtime/plugins/ios-physical-device.ts', 'pngDisplayGeometry(bytes) !== undefined');
2509
+ requireText('src/runtime/plugins/ios-physical-device.ts', 'bytes.subarray(-2).toString(\'hex\') === \'ffd9\'');
2510
+ requireText('src/runtime/plugins/ios-physical-device.ts', 'bytes.readUInt32BE(0) >= 16 && bytes.readUInt32BE(0) <= bytes.length');
2511
+ requireText('src/runtime/plugins/ios-physical-device.ts', 'entries: [...entries, entry] }, { mode: 0o600 });');
2512
+ requireText('src/runtime/plugins/ios-physical-device.ts', 'organizedIndex: { localArtifact: indexPath, entryCount: entries.length + 1 }');
2513
+ requireText('src/runtime/plugins/ios-physical-device.ts', 'requireBundleId(input.args.bundle_id) !== state.bundleId');
2514
+ requireText('src/runtime/plugins/ios-physical-device.ts', "'--domain-type', 'appDataContainer', '--domain-identifier', state.bundleId");
2515
+ forbid('src/runtime/plugins/ios-physical-device.ts', /source:\s*'atomic_screenshot'/, 'bare iPhone screenshot IDs must never bypass explicit target-foreground confirmation');
2516
+ forbid('src/runtime/plugins/ios-adapter.ts', /\bexecuteIosPhysicalDeviceAction\b/, 'CoreDevice iPhone App mutations must have a single public Computer owner, not a retained iOS-adapter writer');
1840
2517
  requireText('adapters/computer/desktop-operator-contract.ts', 'DESKTOP_OPERATOR_PROVIDER_PLUGIN_ID');
1841
2518
  requireText('adapters/computer/desktop-operator-negotiation.ts', 'negotiateDesktopOperatorComputerHandshake');
1842
2519
  requireText('adapters/computer/desktop-operator-negotiation.ts', 'buildDesktopOperatorComputerInvocation');
1843
2520
  requireText('adapters/computer/desktop-operator-provider.ts', 'createDesktopOperatorComputerProvider');
1844
2521
  requireText('adapters/computer/desktop-operator-discovery.ts', 'ComputerProviderRegistrationLookup');
1845
2522
  requireText('adapters/computer/desktop-operator-discovery.ts', "source: 'registration'");
1846
- requireText('adapters/computer/desktop-operator-discovery.ts', "source: 'legacy_fallback'");
1847
- requireText('adapters/computer/desktop-operator-discovery.ts', "DesktopOperatorLegacyFallbackMode");
1848
2523
  requireText('adapters/computer/desktop-operator-discovery.ts', "PLUGIN_COMPUTER_PROVIDER_REGISTRATION_REQUIRED");
1849
- requireText('src/runtime/root/computer-composition.ts', "legacyFallback: 'unregistered_v0_2'");
2524
+ forbid('adapters/computer/desktop-operator-discovery.ts', /legacy_fallback|DesktopOperatorLegacyFallbackMode|unregistered_v0_2/, 'Computer provider discovery must not bypass canonical Desktop Operator registration with a legacy socket fallback');
2525
+ forbid('src/runtime/root/computer-composition.ts', /legacyFallback|unregistered_v0_2/, 'Computer Runtime composition must not enable an unregistered Desktop Operator compatibility provider');
1850
2526
  requireText('src/cli/commands/computer.ts', "new Command('computer')");
1851
2527
  requireText('src/cli/commands/computer.ts', 'installOfficialPlugin(COMPUTER_PROVIDER_PLUGIN_ID');
1852
2528
  requireText('src/cli/commands/computer.ts', 'provider release: independent');
@@ -1855,7 +2531,7 @@ requireText('src/cli/commands/computer.ts', 'readControllerStoredPluginManifest'
1855
2531
  requireText('src/cli/commands/computer.ts', 'syncControllerPluginManifest');
1856
2532
  requireText('src/cli/commands/computer.ts', 'removeControllerPluginManifestProjection');
1857
2533
  requireText('src/cli/commands/computer.ts', 'withOfficialPluginLifecycleLock');
1858
- forbid('src/cli/commands/computer.ts', /controllerPluginRepository\(|syncAssistantPluginRegistry|getAssistantPluginManifest\(/, 'Computer status/doctor must use Controller-scoped stored/targeted provider APIs rather than a fake repository or global execution-style manifest lookup');
2534
+ forbid('src/cli/commands/computer.ts', new RegExp(`${controllerRepoCallPattern.source}|syncAssistantPluginRegistry|getAssistantPluginManifest\\s*\\(`), 'Computer status/doctor must use Controller-scoped stored/targeted provider APIs rather than a fake repository or global execution-style manifest lookup');
1859
2535
  requireText('src/cli/commands/plugin.ts', 'external-plugin:${pluginId}');
1860
2536
  requireText('src/runtime/plugins/store.ts', 'export function readControllerStoredPluginManifest');
1861
2537
  requireText('src/runtime/plugins/store.ts', 'export function syncControllerPluginManifest');
@@ -1909,13 +2585,12 @@ forbid('packages/plugin-runtime/browser/provider-registry.ts', /AssistantPluginE
1909
2585
  requireText('packages/protocols/browser/session.ts', 'export interface BrowserSessionState');
1910
2586
  for (const path of [
1911
2587
  'src/runtime/plugins/browser-runtime-contract.ts',
1912
- 'src/runtime/plugins/browser-provider-registry.ts',
1913
2588
  'src/runtime/plugins/browser-session-types.ts',
1914
2589
  ]) {
1915
2590
  requireText(path, '@deprecated C0 compatibility shim');
1916
2591
  }
1917
2592
  for (const path of sourceFiles('src/runtime/plugins')) {
1918
- if (['src/runtime/plugins/browser-runtime-contract.ts', 'src/runtime/plugins/browser-provider-registry.ts', 'src/runtime/plugins/browser-session-types.ts'].includes(path)) continue;
2593
+ if (['src/runtime/plugins/browser-runtime-contract.ts', 'src/runtime/plugins/browser-session-types.ts'].includes(path)) continue;
1919
2594
  forbid(path, /from\s+['"]\.\/browser-(?:runtime-contract|provider-registry|session-types)['"]/, 'active Browser runtime code must consume plugin-runtime/protocol Browser contracts, not retired local owners');
1920
2595
  }
1921
2596
  // Computer SurfaceTarget is the only durable interaction-target authority. Browser
@@ -1930,6 +2605,8 @@ requireText('src/runtime/plugins/browser-session-authority.ts', 'findComputerBac
1930
2605
  requireText('src/runtime/plugins/browser-session-authority.ts', 'saveComputerBackedBrowserSession');
1931
2606
  forbid('src/runtime/plugins/browser-session-authority.ts', /\b(?:writeControlPlaneRecord|deleteControlPlaneRecord|withControlPlaneTransaction|createBrowserSessionAuthority|runtimeBrowserSessionAuthority)\b/, 'Browser compatibility facade must delegate semantic identity to Computer and cannot persist its own authority');
1932
2607
  requireText('src/runtime/plugins/browser-session-legacy-migration.ts', 'readLegacyBrowserSessionMigrationEntries');
2608
+ requireText('src/runtime/plugins/browser-session-store.ts', 'PLUGIN_BROWSER_SESSION_CONTEXT_REQUIRED');
2609
+ forbid('src/runtime/plugins/browser-session-store.ts', /writeJsonAtomic\(sessionPath|readLegacyBrowserSessionJson|rmSync\(sessionPath/, 'steady-state Browser session identity must never fall back to repository-local JSON outside Computer target authority');
1933
2610
  forbid('src/runtime/plugins/browser-session-legacy-migration.ts', /\b(?:writeControlPlaneRecord|deleteControlPlaneRecord|withControlPlaneTransaction|createBrowserSessionAuthority|runtimeBrowserSessionAuthority)\b/, 'legacy Browser migration may read retired state but cannot mutate or recreate Browser durable authority');
1934
2611
  requireText('src/runtime/root/browser-session-composition.ts', 'BrowserSessionExecutionContext');
1935
2612
  forbid('src/runtime/root/browser-session-composition.ts', /\b(?:createBrowserSessionAuthority|runtimeBrowserSessionAuthority|createRuntimeBrowserSessionPersistence)\b/, 'Browser Runtime composition may carry execution context but cannot compose a second durable interaction authority');
@@ -1953,6 +2630,11 @@ for (const path of sourceFiles('packages/workflow-runtime')) {
1953
2630
  forbid(path, /xiaohongshu|douyin|instagram|reddit|facebook/i, 'generic Workflow Runtime contracts must not own site/business choreography');
1954
2631
  forbid(path, /from\s+['"][^'"]*(?:src\/runtime|adapters)\//, 'Workflow Runtime package contracts must remain independent from Runtime/adapters implementation authority');
1955
2632
  }
2633
+ requireText('src/runtime/plugins/first-party-registry.ts', "from './computer-registration'");
2634
+ requireText('src/runtime/plugins/computer-registration.ts', 'buildBrowserPluginManifest(previousRevision, previousUpdatedAt, repoRoot, context, true)');
2635
+ requireText('src/runtime/plugins/computer-registration.ts', '__forge_computer_native_only: true');
2636
+ requireText('src/runtime/plugins/browser-adapter.ts', 'if (computerNativeOnly) return normalizeConfig({');
2637
+ requireText('src/runtime/plugins/browser-adapter.ts', 'if (computerNativeOnly) {');
1956
2638
  requireText('src/runtime/plugins/browser-registration.ts', 'export const browserPluginAdapter');
1957
2639
  requireText('src/runtime/plugins/first-party-registry.ts', "from './browser-registration'");
1958
2640
  forbid('src/runtime/plugins/first-party-registry.ts', /from\s+['"]\.\/browser-adapter['"]/, 'first-party registry must depend on the thin Browser registration entrypoint, not the action implementation');