@moretea-labs/forge 1.8.0 → 1.8.1

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 (528) hide show
  1. package/AGENTS.md +70 -7
  2. package/CHANGELOG.md +14 -0
  3. package/CLAUDE.md +17 -2
  4. package/CONTRIBUTING.md +3 -2
  5. package/THIRD_PARTY_NOTICES.md +1 -1
  6. package/adapters/chatgpt/browser-delivery-host.ts +7 -1
  7. package/adapters/chatgpt/browser-delivery-runtime.ts +529 -56
  8. package/adapters/chatgpt/controller-binding-store.ts +101 -22
  9. package/adapters/chatgpt/controller-round-host.ts +15 -25
  10. package/adapters/chatgpt/controller-round-settlement-store.ts +58 -4
  11. package/adapters/chatgpt/provider-delivery.ts +228 -1
  12. package/adapters/chatgpt/work-conversation-binding-store.ts +79 -53
  13. package/adapters/computer/chatgpt-extension-target.ts +463 -0
  14. package/adapters/computer/chatgpt-target-router.ts +103 -0
  15. package/adapters/computer/chrome-extension/background.js +385 -0
  16. package/adapters/computer/chrome-extension/content.js +378 -0
  17. package/adapters/computer/chrome-extension/core.js +24 -0
  18. package/adapters/computer/chrome-extension/manifest.json +30 -0
  19. package/adapters/computer/desktop-operator-discovery.ts +11 -31
  20. package/adapters/computer/interaction-target-authority.ts +142 -18
  21. package/adapters/mcp/auth.ts +0 -1
  22. package/adapters/mcp/instructions.ts +5 -4
  23. package/adapters/mcp/multi-repository.ts +3 -19
  24. package/adapters/mcp/oauth.ts +73 -0
  25. package/adapters/mcp/paths.ts +4 -1
  26. package/adapters/mcp/runtime-gateway/automation-receipt-adapter.ts +87 -0
  27. package/adapters/mcp/runtime-gateway/bounded-result-runtime.ts +62 -0
  28. package/adapters/mcp/runtime-gateway/cognition-settlement.ts +201 -0
  29. package/adapters/mcp/runtime-gateway/context-adapter.ts +411 -73
  30. package/adapters/mcp/runtime-gateway/context-pack-sidecar.ts +91 -0
  31. package/adapters/mcp/runtime-gateway/controller-authority-adapter.ts +20 -5
  32. package/adapters/mcp/runtime-gateway/core-capability-adapter.ts +258 -0
  33. package/adapters/mcp/runtime-gateway/engineering-preconditions.ts +10 -27
  34. package/adapters/mcp/runtime-gateway/engineering-tool-contract.ts +15 -0
  35. package/adapters/mcp/runtime-gateway/execution-tools.ts +8 -42
  36. package/adapters/mcp/runtime-gateway/gateway-execution-adapter.ts +2 -1
  37. package/adapters/mcp/runtime-gateway/plugin-adapter.ts +117 -45
  38. package/adapters/mcp/runtime-gateway/process-tools.ts +190 -22
  39. package/adapters/mcp/runtime-gateway/protected-computer-adapter.ts +16 -4
  40. package/adapters/mcp/runtime-gateway/recovery-adapter.ts +69 -52
  41. package/adapters/mcp/runtime-gateway/repository-compat-adapter.ts +4 -35
  42. package/adapters/mcp/runtime-gateway/result-adapter.ts +10 -4
  43. package/adapters/mcp/runtime-gateway/router.ts +18 -504
  44. package/adapters/mcp/runtime-gateway/routing-policy.ts +499 -0
  45. package/adapters/mcp/runtime-gateway/runtime-observation-adapter.ts +14 -65
  46. package/adapters/mcp/runtime-gateway/runtime-readiness-observation.ts +218 -0
  47. package/adapters/mcp/runtime-gateway/runtime-tool-definitions.ts +113 -173
  48. package/adapters/mcp/runtime-gateway/runtime-tools.ts +15 -5
  49. package/adapters/mcp/runtime-gateway/scheduler-adapter.ts +1 -0
  50. package/adapters/mcp/runtime-gateway/shared-adapter.ts +20 -0
  51. package/adapters/mcp/runtime-gateway/status-inbox-adapter.ts +358 -266
  52. package/adapters/mcp/runtime-gateway/typescript-navigation-sidecar.ts +136 -0
  53. package/adapters/mcp/runtime-gateway/work-adapter.ts +261 -3122
  54. package/adapters/mcp/runtime-gateway/work-controller-operations.ts +257 -0
  55. package/adapters/mcp/runtime-gateway/work-detail-projection.ts +60 -0
  56. package/adapters/mcp/runtime-gateway/work-input-wire-migration.ts +246 -0
  57. package/adapters/mcp/runtime-gateway/work-learning-operations.ts +145 -0
  58. package/adapters/mcp/runtime-gateway/work-list-projection.ts +38 -0
  59. package/adapters/mcp/runtime-gateway/work-plan-operations.ts +382 -0
  60. package/adapters/mcp/runtime-gateway/work-repair-adapter.ts +308 -0
  61. package/adapters/mcp/runtime-gateway/work-requirement-operations.ts +148 -0
  62. package/adapters/mcp/runtime-gateway/work-semantic-operations.ts +263 -0
  63. package/adapters/mcp/runtime-gateway/work-workflow-operations.ts +113 -0
  64. package/adapters/mcp/runtime-gateway/workflow-supervisor-adapter.ts +156 -0
  65. package/adapters/mcp/server.ts +67 -23
  66. package/adapters/mcp/setup.ts +1 -3
  67. package/adapters/mcp/tool-mapping/legacy-tool-service.ts +44 -170
  68. package/adapters/mcp/tool-mapping/post-finalize-work-attribution.ts +4 -9
  69. package/adapters/mcp/tool-mapping/repository-tools.ts +133 -142
  70. package/adapters/mcp/toolset-names.ts +5 -0
  71. package/adapters/mcp/toolset.ts +6 -5
  72. package/adapters/mcp/transports/http-observation.ts +365 -0
  73. package/adapters/mcp/transports/http.ts +154 -677
  74. package/adapters/mcp/transports/oauth-http.ts +322 -0
  75. package/adapters/mcp/transports/session-registry.ts +6 -0
  76. package/adapters/mcp/tunnels/openai-secure-tunnel.ts +89 -5
  77. package/assets/plugin-registry.v1.json +6 -4
  78. package/assets/reference-configs/agentic-development-flow.md +25 -0
  79. package/assets/reference-configs/global-working-rules.md +19 -0
  80. package/assets/skill-version.json +2 -2
  81. package/docs/architecture/CURRENT.md +111 -41
  82. package/docs/architecture/decisions/20260803-release-identity-binding-and-exit-policy.md +14 -5
  83. package/docs/architecture/decisions/20260823-immediate-controller-relay.md +6 -3
  84. package/docs/architecture/decisions/20260907-assistant-learning-loop.md +2 -0
  85. package/docs/architecture/decisions/20260907-controller-round-transition-policy.md +19 -4
  86. package/docs/architecture/decisions/20260916-workflow-supervisor-authority.md +249 -0
  87. package/docs/architecture/decisions/20260917-cognitive-memory-foundation.md +82 -0
  88. package/docs/architecture/decisions/20260918-stable-candidate-release-lifecycle.md +221 -0
  89. package/docs/architecture/decisions/20260919-autonomous-work-liveness.md +62 -0
  90. package/docs/architecture/decisions/20260924-thin-semantic-working-context.md +72 -0
  91. package/docs/architecture/decisions/20261001-supervisor-turn-authority.md +237 -0
  92. package/docs/architecture/decisions/20261005-forge-v3-desktop-client-boundary.md +77 -0
  93. package/docs/architecture/domains/verification.md +1 -0
  94. package/docs/architecture/domains/workflow-engine.md +6 -0
  95. package/docs/architecture/modules/controller-runtime/transport-lifecycle.md +1 -1
  96. package/docs/forge-plugin-management.md +2 -2
  97. package/docs/operations/controller-performance-and-502.md +17 -0
  98. package/docs/operations/controller-reliability-runbook.md +2 -2
  99. package/docs/operations/features.md +1 -1
  100. package/docs/operations/features.zh-CN.md +1 -1
  101. package/docs/operations/homebrew.md +2 -2
  102. package/docs/operations/mcp-tool-exposure.md +2 -0
  103. package/docs/operations/releasing.md +2 -0
  104. package/docs/operations/standalone-disaster-recovery.md +14 -6
  105. package/docs/wiki/Implementation.md +1 -1
  106. package/package.json +25 -14
  107. package/packages/kernel/cognition/api/index.ts +6 -0
  108. package/packages/kernel/cognition/application/activation-service.ts +451 -0
  109. package/packages/kernel/cognition/application/consolidation-service.ts +185 -0
  110. package/packages/kernel/cognition/application/legacy-experience-adapter.ts +38 -0
  111. package/packages/kernel/cognition/application/memory-service.ts +64 -0
  112. package/packages/kernel/cognition/domain/learning.ts +106 -0
  113. package/packages/kernel/cognition/domain/memory.ts +254 -0
  114. package/packages/kernel/controller/api/index.ts +1 -0
  115. package/packages/kernel/controller/application/continuation-service.ts +281 -0
  116. package/packages/kernel/controller/application/controller-round-service.ts +12 -0
  117. package/packages/kernel/controller/domain/controller-round-transition-policy.ts +242 -21
  118. package/packages/kernel/controller/domain/controller-round.ts +4 -1
  119. package/packages/kernel/controller/domain/execution-quality.ts +3 -1
  120. package/packages/kernel/controller/infrastructure/controller-round-store.ts +689 -103
  121. package/packages/kernel/controller/infrastructure/controller-session-store.ts +297 -71
  122. package/packages/kernel/controller/ports/controller-host.ts +2 -0
  123. package/packages/kernel/identity/api/index.ts +10 -0
  124. package/packages/kernel/identity/domain/activity-projection.ts +43 -0
  125. package/packages/kernel/identity/domain/capability-broker.ts +60 -0
  126. package/packages/kernel/identity/domain/grant.ts +72 -0
  127. package/packages/kernel/identity/domain/owned-resource.ts +116 -0
  128. package/packages/kernel/identity/domain/user-request.ts +93 -0
  129. package/packages/kernel/identity/infrastructure/activity-projection-store.ts +77 -0
  130. package/packages/kernel/identity/infrastructure/capability-broker.ts +81 -0
  131. package/packages/kernel/identity/infrastructure/grant-store.ts +284 -0
  132. package/packages/kernel/identity/infrastructure/owned-resource-store.ts +259 -0
  133. package/packages/kernel/identity/infrastructure/user-request-store.ts +182 -0
  134. package/packages/kernel/scheduler/api/index.ts +0 -2
  135. package/packages/kernel/scheduler/application/schedule-service.ts +3 -0
  136. package/packages/kernel/scheduler/application/settlement.ts +0 -15
  137. package/packages/kernel/scheduler/domain/schedule.ts +87 -0
  138. package/packages/kernel/scheduler/infrastructure/schedule-store.ts +153 -133
  139. package/packages/kernel/work/api/index.ts +3 -2
  140. package/packages/kernel/work/application/work-service.ts +17 -42
  141. package/packages/kernel/work/domain/current-task-lineage.ts +104 -0
  142. package/packages/kernel/work/domain/engineering-design.ts +10 -5
  143. package/packages/kernel/work/domain/engineering-profile.ts +8 -12
  144. package/packages/kernel/work/domain/evaluation-promotion-receipt.ts +186 -0
  145. package/packages/kernel/work/domain/execution-concurrency.ts +19 -26
  146. package/packages/kernel/work/domain/execution-snapshot.ts +0 -31
  147. package/packages/kernel/work/domain/implementation-review.ts +14 -331
  148. package/packages/kernel/work/domain/objective-graph.ts +119 -0
  149. package/packages/kernel/work/domain/project-engineering-contract.ts +23 -1
  150. package/packages/kernel/work/domain/repository-completion-receipt.ts +1 -1
  151. package/packages/kernel/work/domain/state-machine.ts +25 -63
  152. package/packages/kernel/work/domain/types.ts +57 -51
  153. package/packages/kernel/work/infrastructure/work-contract-store.ts +819 -728
  154. package/packages/kernel/work/ports/work-contract-store.ts +5 -2
  155. package/packages/plugin-runtime/browser/session-authority.ts +2 -1
  156. package/packages/plugin-runtime/computer/chatgpt-identity.ts +24 -0
  157. package/packages/plugin-runtime/computer/conversation-target.ts +143 -0
  158. package/packages/plugin-runtime/computer/index.ts +2 -0
  159. package/packages/plugin-runtime/computer/target-authority.ts +26 -1
  160. package/packages/plugin-runtime/external/unix-jsonl-transport.ts +142 -18
  161. package/packages/protocols/computer/contract.ts +27 -1
  162. package/scripts/activate-source-baseline.ts +7 -9
  163. package/scripts/canary-controller-semantic-wait.ts +12 -24
  164. package/scripts/check-mcp-compatibility.ts +48 -136
  165. package/scripts/check-runtime-architecture.mjs +622 -217
  166. package/scripts/forge-local-recovery-helper.mjs +93 -15
  167. package/scripts/lib/project-init-lib.sh +3 -0
  168. package/scripts/open-source-audit-allowlist.txt +1 -2
  169. package/scripts/run-bounded-command.mjs +5 -0
  170. package/scripts/run-governed-gate.ts +0 -1
  171. package/scripts/run-mobile-monitor-bridge.ts +0 -1
  172. package/scripts/smoke-control-plane-failure-domain.ts +94 -0
  173. package/scripts/smoke-mcp-http-runtime.ts +5 -0
  174. package/scripts/smoke-runtime-recovery.ts +12 -43
  175. package/scripts/smoke-schedule-engine.ts +23 -15
  176. package/scripts/smoke-unattended-transport-recovery.ts +223 -0
  177. package/scripts/smoke-user-request-continuation-restart.ts +232 -0
  178. package/scripts/smoke-workflow-supervisor-chrome-adapter.ts +92 -0
  179. package/scripts/smoke-workflow-supervisor-process-restart.ts +276 -0
  180. package/scripts/smoke-workflow-supervisor-restart-recovery.ts +150 -0
  181. package/scripts/smoke-workflow-supervisor.ts +103 -0
  182. package/scripts/verify-forge-runtime.sh +2 -1
  183. package/src/cli/agent-jobs/executor-health.ts +11 -34
  184. package/src/cli/agent-jobs/integration.ts +18 -49
  185. package/src/cli/agent-jobs/job-manager.ts +7 -3
  186. package/src/cli/commands/brain-assistant.ts +27 -13
  187. package/src/cli/commands/brain.ts +13 -15
  188. package/src/cli/commands/chatgpt.ts +1 -163
  189. package/src/cli/commands/recovery.ts +135 -121
  190. package/src/cli/commands/runtime.ts +3 -3
  191. package/src/cli/commands/setup-profile.ts +8 -0
  192. package/src/cli/controller/check-runner.ts +13 -2
  193. package/src/cli/controller/completion-backlog.ts +3 -3
  194. package/src/cli/controller/completion-orchestrator.ts +4 -43
  195. package/src/cli/controller/completion-target.ts +3 -72
  196. package/src/cli/controller/context/source-materializer.ts +81 -100
  197. package/src/cli/controller/context-pack.ts +10 -8
  198. package/src/cli/controller/execution-completion.ts +4 -7
  199. package/src/cli/controller/execution-policy.ts +36 -153
  200. package/src/cli/controller/governance.ts +2 -3
  201. package/src/cli/controller/issue-store.ts +4 -99
  202. package/src/cli/controller/launch-agents.ts +59 -18
  203. package/src/cli/controller/operational-plan.ts +24 -51
  204. package/src/cli/controller/runtime-config.ts +5 -1
  205. package/src/cli/controller/stuck-state-migration.ts +2 -3
  206. package/src/cli/controller/systemd-user.ts +39 -1
  207. package/src/cli/editing/edit-session.ts +1 -7
  208. package/src/cli/local-bridge/console-automations.ts +18 -13
  209. package/src/cli/local-bridge/console-view-models.ts +3 -12
  210. package/src/cli/local-bridge/facade-api.ts +64 -191
  211. package/src/cli/local-bridge/server.ts +24 -147
  212. package/src/cli/local-bridge/types.ts +0 -1
  213. package/src/cli/mcp/oauth-client-retirement.ts +74 -0
  214. package/src/cli/repositories/command-executor.ts +29 -23
  215. package/src/cli/repositories/command-scope.ts +35 -16
  216. package/src/cli/repositories/controller-home.ts +48 -0
  217. package/src/cli/repositories/ephemeral-workspace.ts +20 -30
  218. package/src/cli/repositories/git-command-executor.ts +2 -2
  219. package/src/cli/repositories/registry.ts +77 -11
  220. package/src/cli/repositories/structured-git.ts +62 -2
  221. package/src/cli/repository/session-cache.ts +92 -6
  222. package/src/runtime/context/assistant-context.ts +20 -7
  223. package/src/runtime/context/assistant-work-context.ts +89 -27
  224. package/src/runtime/context/automatic-learning.ts +565 -0
  225. package/src/runtime/context/cognitive-attention.ts +173 -0
  226. package/src/runtime/context/cognitive-skill-canary.ts +158 -0
  227. package/src/runtime/context/context-closure.ts +46 -9
  228. package/src/runtime/context/context-pack-process.ts +103 -0
  229. package/src/runtime/context/context-plane.ts +1 -9
  230. package/src/runtime/context/direct-controller-learning.ts +298 -0
  231. package/src/runtime/context/semantic-navigation-contract.ts +9 -0
  232. package/src/runtime/context/semantic-navigation.ts +6 -34
  233. package/src/runtime/context/typescript-navigation-process.ts +145 -0
  234. package/src/runtime/context/typescript-navigation.ts +89 -3
  235. package/src/runtime/control-plane/cleanup-artifact-retention.ts +212 -9
  236. package/src/runtime/control-plane/concurrency/work-execution-concurrency.ts +9 -47
  237. package/src/runtime/control-plane/execution/controller-authority-recovery.ts +34 -4
  238. package/src/runtime/control-plane/execution/edit-validation-coordinator.ts +29 -20
  239. package/src/runtime/control-plane/execution/execution-identity.ts +23 -3
  240. package/src/runtime/control-plane/execution/repository-work-attribution.ts +7 -30
  241. package/src/runtime/control-plane/execution/retained-work-resume.ts +206 -199
  242. package/src/runtime/control-plane/execution/session-store.ts +31 -1
  243. package/src/runtime/control-plane/execution/validation.ts +6 -8
  244. package/src/runtime/control-plane/execution/work-authority-reconciler.ts +13 -42
  245. package/src/runtime/control-plane/execution/work-check-evidence.ts +137 -0
  246. package/src/runtime/control-plane/execution/work-completion-authority.ts +30 -85
  247. package/src/runtime/control-plane/execution/work-delivery-service.ts +497 -0
  248. package/src/runtime/control-plane/execution/work-evidence-policy.ts +12 -50
  249. package/src/runtime/control-plane/execution/work-execution-support.ts +50 -149
  250. package/src/runtime/control-plane/execution/work-handle-authority.ts +188 -109
  251. package/src/runtime/control-plane/execution/work-handle-store.ts +19 -43
  252. package/src/runtime/control-plane/execution/work-head-settlement.ts +53 -20
  253. package/src/runtime/control-plane/execution/work-lifecycle-audit.ts +52 -29
  254. package/src/runtime/control-plane/execution/work-operation-service.ts +43 -27
  255. package/src/runtime/control-plane/execution/work-preparation-service.ts +126 -266
  256. package/src/runtime/control-plane/execution/work-remote-delivery.ts +2 -3
  257. package/src/runtime/control-plane/execution/work-revision-diff.ts +39 -0
  258. package/src/runtime/control-plane/execution/work-terminal-cleanup.ts +173 -186
  259. package/src/runtime/control-plane/execution/work-validation-reconciler.ts +28 -84
  260. package/src/runtime/control-plane/execution/work-verification-service.ts +406 -50
  261. package/src/runtime/control-plane/execution/work-verification-snapshot.ts +5 -1
  262. package/src/runtime/control-plane/facade/capability-registry.ts +362 -37
  263. package/src/runtime/control-plane/facade/check-normalization.ts +3 -9
  264. package/src/runtime/control-plane/facade/codex-delegation.ts +10 -11
  265. package/src/runtime/control-plane/facade/controller-connection.ts +135 -0
  266. package/src/runtime/control-plane/facade/goal-workloop-access.ts +1 -20
  267. package/src/runtime/control-plane/facade/goal-workloop.ts +281 -1753
  268. package/src/runtime/control-plane/facade/handoff-inbox-application.ts +12 -25
  269. package/src/runtime/control-plane/facade/handoff-inbox-store.ts +256 -52
  270. package/src/runtime/control-plane/facade/index.ts +0 -1
  271. package/src/runtime/control-plane/facade/operation-digest.ts +12 -15
  272. package/src/runtime/control-plane/facade/plan-contract-store.ts +451 -991
  273. package/src/runtime/control-plane/facade/policy-gate.ts +0 -23
  274. package/src/runtime/control-plane/facade/repository-work-admission.ts +12 -22
  275. package/src/runtime/control-plane/facade/requirement-authority.ts +102 -199
  276. package/src/runtime/control-plane/facade/requirement-board.ts +3 -3
  277. package/src/runtime/control-plane/facade/rh-work-operation-contract.ts +51 -14
  278. package/src/runtime/control-plane/facade/self-healing-loop.ts +18 -53
  279. package/src/runtime/control-plane/facade/suggested-actions.ts +15 -18
  280. package/src/runtime/control-plane/facade/types.ts +49 -108
  281. package/src/runtime/control-plane/facade/work-continuation.ts +8 -8
  282. package/src/runtime/control-plane/generated-cache-retention.ts +97 -1
  283. package/src/runtime/control-plane/global-scheduler/autonomous-continuation.ts +248 -0
  284. package/src/runtime/control-plane/global-scheduler/durable-admission.ts +1 -1
  285. package/src/runtime/control-plane/global-scheduler/maintenance.ts +239 -112
  286. package/src/runtime/control-plane/global-scheduler/reconciliation.ts +2 -1
  287. package/src/runtime/control-plane/global-scheduler/scheduler.ts +66 -40
  288. package/src/runtime/control-plane/global-scheduler/wake-signal.ts +42 -2
  289. package/src/runtime/control-plane/governance/access-policy.ts +19 -2
  290. package/src/runtime/control-plane/governance/authorization.ts +20 -3
  291. package/src/runtime/control-plane/launcher/chatgpt-round-continuation.ts +63 -300
  292. package/src/runtime/control-plane/launcher/chatgpt-work-continuation.ts +28 -300
  293. package/src/runtime/control-plane/launcher/local-conversation-controller.ts +238 -0
  294. package/src/runtime/control-plane/launcher/provider-mcp-bootstrap.ts +5 -2
  295. package/src/runtime/control-plane/launcher/thin-launcher.ts +96 -240
  296. package/src/runtime/control-plane/persistence/cognition-store.ts +820 -0
  297. package/src/runtime/control-plane/persistence/experience-store.ts +162 -29
  298. package/src/runtime/control-plane/persistence/requirement-store.ts +216 -74
  299. package/src/runtime/control-plane/persistence/sqlite-store.ts +113 -6
  300. package/src/runtime/control-plane/release-retention.ts +135 -47
  301. package/src/runtime/control-plane/repository-namespace-retention.ts +2 -2
  302. package/src/runtime/control-plane/runtime-cleanup.ts +290 -21
  303. package/src/runtime/control-plane/workspace/project-onboarding.ts +80 -0
  304. package/src/runtime/control-plane/workspace/semantic-sync-service.ts +19 -5
  305. package/src/runtime/control-plane/workspace/workspace-store.ts +169 -0
  306. package/src/runtime/diagnostics/incident-repair.ts +313 -146
  307. package/src/runtime/diagnostics/mcp-timing.ts +114 -0
  308. package/src/runtime/evidence/artifact-store.ts +158 -40
  309. package/src/runtime/evidence/evidence-store.ts +112 -8
  310. package/src/runtime/evidence/output-handle-index.ts +225 -0
  311. package/src/runtime/evidence/result-store.ts +158 -44
  312. package/src/runtime/execution/jobs/store.ts +3 -4
  313. package/src/runtime/execution/managed-workspace.ts +57 -0
  314. package/src/runtime/execution/process-runtime/check-facade.ts +1 -1
  315. package/src/runtime/execution/process-runtime/check-result-retention.ts +2 -2
  316. package/src/runtime/execution/process-runtime/check-result.ts +105 -1
  317. package/src/runtime/execution/process-runtime/check-runner-sidecar.ts +18 -8
  318. package/src/runtime/execution/process-runtime/command-facade.ts +79 -27
  319. package/src/runtime/execution/process-runtime/gc.ts +15 -2
  320. package/src/runtime/execution/process-runtime/handle-index.ts +176 -0
  321. package/src/runtime/execution/process-runtime/host-command-lane.ts +139 -0
  322. package/src/runtime/execution/process-runtime/index.ts +3 -0
  323. package/src/runtime/execution/process-runtime/lightweight-managed.ts +251 -72
  324. package/src/runtime/execution/process-runtime/persisted-check.ts +3 -3
  325. package/src/runtime/execution/process-runtime/process-runner-entry.ts +47 -5
  326. package/src/runtime/execution/process-runtime/process-scope.ts +160 -0
  327. package/src/runtime/execution/process-runtime/resource-claims.ts +65 -61
  328. package/src/runtime/execution/process-runtime/runtime.ts +35 -2
  329. package/src/runtime/execution/process-runtime/store.ts +30 -2
  330. package/src/runtime/execution/process-runtime/types.ts +6 -1
  331. package/src/runtime/execution/workers/executor.ts +2 -6
  332. package/src/runtime/platform/service-inventory.ts +130 -0
  333. package/src/runtime/platform/service-manager.ts +8 -0
  334. package/src/runtime/plugins/action-application.ts +85 -28
  335. package/src/runtime/plugins/app-store-connect-adapter.ts +38 -14
  336. package/src/runtime/plugins/browser-adapter.ts +757 -34
  337. package/src/runtime/plugins/browser-automation-service.ts +23 -3
  338. package/src/runtime/plugins/browser-macos-bridge.ts +321 -29
  339. package/src/runtime/plugins/browser-manifest-surface.ts +45 -11
  340. package/src/runtime/plugins/browser-native-session-service.ts +63 -13
  341. package/src/runtime/plugins/browser-registration.ts +16 -0
  342. package/src/runtime/plugins/browser-runtime.ts +14 -1
  343. package/src/runtime/plugins/browser-session-authority.ts +2 -2
  344. package/src/runtime/plugins/browser-session-store.ts +46 -76
  345. package/src/runtime/plugins/capability-authorization-grants.ts +258 -62
  346. package/src/runtime/plugins/computer-chatgpt-browser-adapter-installer.ts +219 -0
  347. package/src/runtime/plugins/computer-chatgpt-macos-target.ts +891 -0
  348. package/src/runtime/plugins/computer-registration.ts +222 -11
  349. package/src/runtime/plugins/desktop-operator-external-policy.ts +36 -4
  350. package/src/runtime/plugins/desktop-operator-registration.ts +12 -4
  351. package/src/runtime/plugins/external-adapter.ts +42 -6
  352. package/src/runtime/plugins/external-registration.ts +21 -1
  353. package/src/runtime/plugins/gmail-adapter.ts +23 -2
  354. package/src/runtime/plugins/google-calendar-adapter.ts +2 -2
  355. package/src/runtime/plugins/google-shared.ts +14 -7
  356. package/src/runtime/plugins/google-tasks-adapter.ts +2 -2
  357. package/src/runtime/plugins/ios-adapter.ts +1 -1
  358. package/src/runtime/plugins/lightweight-action.ts +208 -2
  359. package/src/runtime/plugins/local-system-adapter.ts +12 -2
  360. package/src/runtime/plugins/managed-process-adapter.ts +12 -5
  361. package/src/runtime/plugins/plugin-action-sidecar.ts +17 -13
  362. package/src/runtime/plugins/plugin-management-adapter.ts +1 -1
  363. package/src/runtime/plugins/store.ts +602 -428
  364. package/src/runtime/plugins/types.ts +20 -0
  365. package/src/runtime/plugins/xiaohongshu-publish.ts +16 -0
  366. package/src/runtime/projections/invalidation.ts +7 -3
  367. package/src/runtime/projections/materialized-view.ts +80 -36
  368. package/src/runtime/recovery/actions.ts +3 -3
  369. package/src/runtime/recovery/capability-action-application.ts +46 -45
  370. package/src/runtime/recovery/lifecycle-inventory.ts +29 -29
  371. package/src/runtime/recovery/maintenance-executor.ts +374 -123
  372. package/src/runtime/recovery/store.ts +29 -11
  373. package/src/runtime/release/release-coordinator.ts +296 -0
  374. package/src/runtime/release/release-session.ts +716 -0
  375. package/src/runtime/release/release-state-migration.ts +25 -0
  376. package/src/runtime/resources/leases/store.ts +56 -25
  377. package/src/runtime/root/computer-composition.ts +191 -6
  378. package/src/runtime/root/controller-progression-composition.ts +192 -0
  379. package/src/runtime/root/controller-round-composition.ts +20 -1
  380. package/src/runtime/root/deployment-topology.ts +106 -0
  381. package/src/runtime/root/entry.ts +4 -3
  382. package/src/runtime/root/known-good-recovery.ts +184 -0
  383. package/src/runtime/root/local-bridge.ts +0 -1
  384. package/src/runtime/root/mcp-transport.ts +111 -18
  385. package/src/runtime/root/ownership.ts +261 -9
  386. package/src/runtime/root/package-connector-service.ts +105 -19
  387. package/src/runtime/root/package-runtime-release.ts +117 -18
  388. package/src/runtime/root/package-runtime-service.ts +17 -11
  389. package/src/runtime/root/release-execution-canary.ts +44 -12
  390. package/src/runtime/root/release-loader.ts +90 -8
  391. package/src/runtime/root/release-manifest.ts +80 -6
  392. package/src/runtime/root/release-materialize.ts +372 -28
  393. package/src/runtime/root/release-store.ts +395 -36
  394. package/src/runtime/root/runtime-lane.ts +191 -0
  395. package/src/runtime/root/runtime.ts +159 -27
  396. package/src/runtime/root/scheduled-controller-composition.ts +28 -3
  397. package/src/runtime/root/service-runner.ts +2 -2
  398. package/src/runtime/root/service.ts +36 -33
  399. package/src/runtime/root/status.ts +48 -0
  400. package/src/runtime/root/types.ts +32 -3
  401. package/src/runtime/root/workflow-supervisor-composition.ts +493 -0
  402. package/src/runtime/root/workflow-supervisor-runtime.ts +209 -0
  403. package/src/runtime/root/write-fence.ts +50 -2
  404. package/src/runtime/safe-tooling/google-credential-store.ts +76 -21
  405. package/src/runtime/safe-tooling/google-oauth-broker.ts +25 -7
  406. package/src/runtime/safe-tooling/workspace-auth.ts +1 -1
  407. package/src/runtime/shared/bounded-child-supervisor.ts +9 -1
  408. package/src/runtime/shared/process-environment.ts +20 -9
  409. package/src/runtime/shared/response-budget.ts +1 -3
  410. package/src/runtime/standalone-recovery/controller-home-migration.ts +16 -24
  411. package/src/runtime/standalone-recovery/core.ts +3702 -342
  412. package/src/runtime/standalone-recovery/entry.ts +469 -39
  413. package/src/runtime/standalone-recovery/installer.ts +262 -148
  414. package/src/runtime/standalone-recovery/mcp-server.ts +29 -193
  415. package/src/runtime/standalone-recovery/operation-lock.ts +1 -1
  416. package/src/runtime/standalone-recovery/performance.ts +54 -16
  417. package/src/runtime/standalone-recovery/release.ts +53 -5
  418. package/src/runtime/standalone-recovery/service-labels.ts +5 -2
  419. package/src/runtime/standalone-recovery/watchdog-heartbeat.ts +5 -2
  420. package/src/runtime/workflow/schedules/browser-probe.ts +17 -6
  421. package/src/runtime/workflow/schedules/chatgpt-automation-migration.ts +10 -3
  422. package/src/runtime/workflow/schedules/engine.ts +138 -172
  423. package/src/runtime/workflow/schedules/work-continuation.ts +44 -5
  424. package/src/runtime/workflows/runtime.ts +15 -19
  425. package/src/testing/test-governance.ts +5 -1
  426. package/supervisor/chatgpt-conversation.ts +23 -0
  427. package/supervisor/client.ts +201 -0
  428. package/supervisor/control-plane.ts +868 -0
  429. package/supervisor/entry.ts +15 -0
  430. package/supervisor/forge-validators.ts +80 -0
  431. package/supervisor/index.ts +5 -0
  432. package/supervisor/native-browser-adapter.ts +786 -0
  433. package/supervisor/native-messaging/host.ts +39 -0
  434. package/supervisor/native-messaging/manifest.ts +26 -0
  435. package/supervisor/native-messaging/protocol.ts +27 -0
  436. package/supervisor/paths.ts +18 -0
  437. package/supervisor/protocol.ts +202 -0
  438. package/supervisor/server.ts +404 -0
  439. package/supervisor/store.ts +1451 -0
  440. package/supervisor/tsconfig.json +8 -0
  441. package/supervisor/types.ts +255 -0
  442. package/adapters/chatgpt/controller-host.ts +0 -119
  443. package/adapters/mcp/controller-round-compatibility.ts +0 -184
  444. package/adapters/mcp/frozen-client-semantic-compatibility.ts +0 -292
  445. package/adapters/mcp/runtime-gateway/work-compat-adapter.ts +0 -502
  446. package/packages/kernel/progression/api/index.ts +0 -2
  447. package/packages/kernel/progression/application/projector.ts +0 -211
  448. package/packages/kernel/progression/domain/types.ts +0 -116
  449. package/packages/kernel/progression/index.ts +0 -1
  450. package/packages/kernel/scheduler/application/continuation-service.ts +0 -212
  451. package/packages/kernel/scheduler/domain/continuation.ts +0 -38
  452. package/packages/kernel/scheduler/infrastructure/continuation-dispatch-store.ts +0 -38
  453. package/packages/kernel/work/domain/admission-policy.ts +0 -34
  454. package/scripts/benchmark-background-check-overlap.ts +0 -228
  455. package/scripts/benchmark-computer-hotpath.ts +0 -255
  456. package/scripts/benchmark-controller-hotpath.ts +0 -212
  457. package/scripts/benchmark-controller-round2.ts +0 -191
  458. package/scripts/benchmark-ios-agent-device.ts +0 -511
  459. package/scripts/benchmark-mcp-host.sh +0 -117
  460. package/scripts/benchmark-mcp-transport.ts +0 -169
  461. package/scripts/benchmark-operational-memory-activation.ts +0 -235
  462. package/scripts/benchmark-operational-shadow.ts +0 -28
  463. package/scripts/benchmark-quality-harness.ts +0 -146
  464. package/scripts/benchmark-route-session-concurrency.ts +0 -915
  465. package/scripts/benchmark-thin-harness-gateway-ab.ts +0 -632
  466. package/scripts/benchmark-thin-harness-mcp-e2e.ts +0 -498
  467. package/scripts/benchmark-thin-harness.ts +0 -251
  468. package/scripts/benchmark-typescript-navigation.ts +0 -186
  469. package/scripts/benchmark-work-efficiency.ts +0 -334
  470. package/scripts/build-controller-ui.ts +0 -28
  471. package/scripts/check-npm-release.sh +0 -32
  472. package/scripts/check-public-release-surface.sh +0 -19
  473. package/scripts/check-release-published.sh +0 -57
  474. package/scripts/check-release-readiness.sh +0 -37
  475. package/scripts/check-release-version.mjs +0 -74
  476. package/scripts/check-tarball-install-smoke.sh +0 -150
  477. package/scripts/package-source-archive.sh +0 -147
  478. package/scripts/public-release-files.txt +0 -39
  479. package/scripts/public-release.ts +0 -174
  480. package/scripts/publish-release-tarball.sh +0 -27
  481. package/scripts/route-nl-vs-ts-eval.ts +0 -679
  482. package/scripts/stage-runtime-release.ts +0 -44
  483. package/src/cli/controller/progress.ts +0 -656
  484. package/src/cli/controller/work-mode.ts +0 -181
  485. package/src/cli/local-bridge/console-assets.ts +0 -17
  486. package/src/cli/local-bridge/dashboard.ts +0 -17
  487. package/src/cli/local-bridge/frontend/src/App.tsx +0 -10
  488. package/src/cli/local-bridge/frontend/src/components/Button.tsx +0 -1
  489. package/src/cli/local-bridge/frontend/src/components/DetailPane.tsx +0 -3
  490. package/src/cli/local-bridge/frontend/src/components/SearchField.tsx +0 -1
  491. package/src/cli/local-bridge/frontend/src/components/SectionHeader.tsx +0 -1
  492. package/src/cli/local-bridge/frontend/src/components/Segmented.tsx +0 -1
  493. package/src/cli/local-bridge/frontend/src/components/StatusText.tsx +0 -3
  494. package/src/cli/local-bridge/frontend/src/design/icons.tsx +0 -11
  495. package/src/cli/local-bridge/frontend/src/design/tokens.css +0 -8
  496. package/src/cli/local-bridge/frontend/src/features/automations/AutomationsView.tsx +0 -153
  497. package/src/cli/local-bridge/frontend/src/features/capabilities/CapabilitiesView.tsx +0 -37
  498. package/src/cli/local-bridge/frontend/src/features/overview/OverviewView.tsx +0 -183
  499. package/src/cli/local-bridge/frontend/src/features/repositories/RepositoriesView.tsx +0 -2
  500. package/src/cli/local-bridge/frontend/src/features/system/SystemView.tsx +0 -2
  501. package/src/cli/local-bridge/frontend/src/features/work/WorkView.tsx +0 -4
  502. package/src/cli/local-bridge/frontend/src/lib/api.ts +0 -30
  503. package/src/cli/local-bridge/frontend/src/lib/format.ts +0 -4
  504. package/src/cli/local-bridge/frontend/src/lib/routes.ts +0 -7
  505. package/src/cli/local-bridge/frontend/src/main.tsx +0 -1
  506. package/src/cli/local-bridge/frontend/src/shell/AppShell.tsx +0 -1
  507. package/src/cli/local-bridge/frontend/src/shell/CommandBar.tsx +0 -2
  508. package/src/cli/local-bridge/frontend/src/shell/Sidebar.tsx +0 -4
  509. package/src/cli/local-bridge/frontend/src/styles.css +0 -28
  510. package/src/cli/local-bridge/frontend/src/types.ts +0 -15
  511. package/src/cli/local-bridge/frontend/src/vite-env.d.ts +0 -1
  512. package/src/cli/local-bridge/frontend/vite.config.ts +0 -27
  513. package/src/cli/local-bridge/ui-dist/app.css +0 -1
  514. package/src/cli/local-bridge/ui-dist/app.js +0 -11228
  515. package/src/runtime/control-plane/execution/content-equivalent-commit-authority.ts +0 -169
  516. package/src/runtime/control-plane/execution/direct-canonical-work-reconciliation.ts +0 -85
  517. package/src/runtime/control-plane/execution/direct-edit-work-completion.ts +0 -655
  518. package/src/runtime/control-plane/execution/work-finalization-service.ts +0 -2850
  519. package/src/runtime/control-plane/execution/work-path-scope.ts +0 -37
  520. package/src/runtime/control-plane/execution/work-task-receipt.ts +0 -468
  521. package/src/runtime/control-plane/facade/controller-round-relay.ts +0 -3
  522. package/src/runtime/control-plane/facade/work-admission-policy.ts +0 -142
  523. package/src/runtime/control-plane/facade/work-implementation-review.ts +0 -2
  524. package/src/runtime/control-plane/facade/work-state-machine.ts +0 -2
  525. package/src/runtime/control-plane/facade/work-task-projection.ts +0 -66
  526. package/src/runtime/control-plane/routing/index.ts +0 -1
  527. package/src/runtime/control-plane/routing/route-policy.ts +0 -401
  528. package/src/runtime/control-plane/routing/workspace-admission.ts +0 -70
@@ -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,51 @@ 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('supervisor/entry.ts', 'forgeWorkflowSupervisorValidators()');
1112
+ forbid('supervisor/client.ts', /reserveWorkflowSupervisorSchedulerRecovery|reserve_scheduler_recovery/, 'Scheduler recovery is not a Supervisor RPC; reconciliation stays on the canonical effect ledger');
1113
+ forbid('supervisor/control-plane.ts', /reserveSchedulerRecovery/, 'Scheduler recovery must not regrow as a second Supervisor recovery authority');
1114
+ forbid('supervisor/server.ts', /reserve_scheduler_recovery/, 'Supervisor RPC surface must not expose retired Scheduler recovery authority');
1115
+ requireText('supervisor/forge-validators.ts', "requirement.state !== 'done'");
1116
+ requireText('supervisor/forge-validators.ts', "requirement.state === 'waiting_for_user'");
1117
+ 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');
1118
+ requireText('src/runtime/root/workflow-supervisor-composition.ts', 'workflowSupervisorBoundaryForWork');
1119
+ requireText('src/runtime/root/workflow-supervisor-composition.ts', '`forge:${repoId}:work:${workId}`');
1120
+ requireText('src/runtime/root/workflow-supervisor-composition.ts', 'registeredTask.taskId');
1121
+ 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');
1122
+ 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
1123
  requireText('src/runtime/workflow/schedules/engine.ts', 'evaluateScheduleTriggerEligibility');
1023
1124
  requireText('src/runtime/workflow/schedules/engine.ts', 'evaluateScheduleOccurrenceAdmission');
1024
1125
  requireText('src/runtime/workflow/schedules/engine.ts', 'controller_session_id');
@@ -1040,22 +1141,31 @@ for (const path of sourceFiles('src')) {
1040
1141
  }
1041
1142
  const B7_KERNEL_INTERNAL_COMPATIBILITY_SHIMS = new Set([
1042
1143
  'src/runtime/control-plane/facade/controller-session-store.ts',
1043
- 'src/runtime/control-plane/facade/controller-round-relay.ts',
1044
1144
  '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
1145
  'src/runtime/control-plane/facade/types.ts',
1048
1146
  'src/runtime/workflow/schedules/settlement.ts',
1049
1147
  'src/runtime/workflow/schedules/types.ts',
1050
1148
  ]);
1149
+ // The compatibility-shim ledger may only shrink. A shim with no remaining
1150
+ // importer at all is migration debt, not a boundary: delete the file and its
1151
+ // entry in the same slice instead of keeping an unused authority surface alive.
1152
+ // Shims that survive only because a test still imports them are bounded debt to
1153
+ // be removed together with that test, never a reason to keep production authority.
1154
+ const shimImportRecords = staticTypeScriptImportRecords([...productionTypeScriptFiles(), ...sourceFiles('tests')]);
1155
+ for (const shim of B7_KERNEL_INTERNAL_COMPATIBILITY_SHIMS) {
1156
+ const shimBasename = shim.slice(shim.lastIndexOf('/') + 1).replace(/\.ts$/, '');
1157
+ const importedBy = shimImportRecords.filter((record) => record.from !== shim
1158
+ && (record.specifier === `./${shimBasename}` || record.specifier.endsWith(`/${shimBasename}`)));
1159
+ if (importedBy.length === 0) {
1160
+ failures.push(`${shim} is a dead compatibility shim with no importer; delete it and remove its compatibility-shim entry`);
1161
+ }
1162
+ }
1051
1163
  for (const path of sourceFiles('src')) {
1052
1164
  if (B7_KERNEL_INTERNAL_COMPATIBILITY_SHIMS.has(path)) continue;
1053
1165
  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
1166
  }
1055
1167
  requireText('src/runtime/control-plane/facade/types.ts', 'packages/kernel/work/domain/types');
1056
1168
  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
1169
  forbid(
1060
1170
  'src/runtime/plugins/browser-handoff-host.ts',
1061
1171
  /browser\/sessions|saveBrowserSession|writeBrowserSession|sessionPath/,
@@ -1087,6 +1197,10 @@ forbid(
1087
1197
  /\bcreateWorkContract\s*\(/,
1088
1198
  'keep the legacy MCP surface as translation over canonical Work admission authority',
1089
1199
  );
1200
+ requireMissing('src/runtime/control-plane/routing/workspace-admission.ts');
1201
+ forbid('packages/kernel/work/domain/types.ts', /requireHandoffOnAmbiguity|requireWorktree|directMainProhibited/, 'retired Work placement/handoff policy fields must not return as durable authority');
1202
+ 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');
1203
+ 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
1204
  requireMissing('src/runtime/control-plane/daemon-entry.ts');
1091
1205
  requireMissing('scripts/smoke-runtime-control-plane.ts');
1092
1206
  requireMissing('src/cli/controller/lifecycle.ts');
@@ -1111,6 +1225,55 @@ requireMissing('src/runtime/bootstrap/runtime-authority.ts');
1111
1225
  requireMissing('src/runtime/bootstrap/activation-transaction.ts');
1112
1226
  requireMissing('src/runtime/bootstrap/stable-bootstrap.ts');
1113
1227
  requireMissing('src/runtime/supervisor');
1228
+ requireText('supervisor/store.ts', 'BEGIN IMMEDIATE');
1229
+ requireText('supervisor/store.ts', 'completions_one_per_source_effect');
1230
+ requireText('supervisor/store.ts', 'WORKFLOW_SUPERVISOR_SOURCE_EFFECT_COMPLETION_CONFLICT');
1231
+ requireText('supervisor/paths.ts', 'resolveControllerHome');
1232
+ requireText('supervisor/paths.ts', "join(resolveWorkflowSupervisorForgeHome(controllerHome), 'supervisor')");
1233
+ 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');
1234
+ 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');
1235
+ requireMissing('supervisor/service.ts');
1236
+ requireText('src/runtime/root/runtime.ts', 'startWorkflowSupervisorRuntime');
1237
+ requireText('src/runtime/root/runtime.ts', 'WORKFLOW_SUPERVISOR_STOPPED');
1238
+ requireText('src/runtime/root/workflow-supervisor-runtime.ts', 'startWorkflowSupervisorRuntime(controllerHome: string)');
1239
+ requireText('src/runtime/root/workflow-supervisor-runtime.ts', 'new WorkflowSupervisorStore(forgeHome, {');
1240
+ requireText('src/runtime/root/workflow-supervisor-runtime.ts', 'activeReleaseId: () => getRuntimeWriteClaim()?.releaseId');
1241
+ requireText('src/runtime/root/workflow-supervisor-runtime.ts', 'createWorkflowSupervisorServer');
1242
+ requireText('src/runtime/root/workflow-supervisor-runtime.ts', 'startWorkflowSupervisorNativeBrowserAdapter');
1243
+ requireText('supervisor/native-browser-adapter.ts', 'targetPort: ComputerChatgptConversationTargetPort;');
1244
+ 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');
1245
+ 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');
1246
+ requireText('src/runtime/root/workflow-supervisor-composition.ts', 'resolveWorkflowSupervisorForgeHome(options.controllerHome)');
1247
+ 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');
1248
+ requireText('supervisor/entry.ts', "argument('--controller-home')");
1249
+ 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');
1250
+ requireText('supervisor/control-plane.ts', 'await validator(task, parsed.proposal)');
1251
+ requireText('supervisor/protocol.ts', 'SUPERVISOR_BLOCK_END');
1252
+ requireText('supervisor/server.ts', 'createWorkflowSupervisorServer');
1253
+ forbid('supervisor/server.ts', /from ['"]\.\/store['"]|supervisor\.sqlite|BEGIN IMMEDIATE/, 'Supervisor transport must relay typed commands through the control plane and never own persistence');
1254
+ requireText('adapters/computer/chrome-extension/manifest.json', 'nativeMessaging');
1255
+ requireText('adapters/computer/chrome-extension/background.js', 'computer_extension_claim');
1256
+ requireText('adapters/computer/chrome-extension/background.js', 'computer_extension_complete');
1257
+ requireText('adapters/computer/chrome-extension/background.js', 'chrome.runtime.connectNative');
1258
+ 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');
1259
+ requireText('adapters/computer/chrome-extension/content.js', 'ForgeComputerChatgptCore');
1260
+ requireMissing('supervisor/chrome-extension');
1261
+ requireText('src/runtime/plugins/browser-adapter.ts', "browserMode: browserMode(raw.browserMode) ?? 'managed_persistent'");
1262
+ requireText('src/runtime/plugins/browser-adapter.ts', "nativeAttachMode: browserNativeAttachMode(raw.nativeAttachMode) ?? 'disabled'");
1263
+ requireText('supervisor/native-messaging/host.ts', 'ALLOWED_BROWSER_METHODS');
1264
+ requireText('supervisor/native-messaging/host.ts', 'computer_extension_claim');
1265
+ 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');
1266
+ requireText('supervisor/store.ts', 'recordEffectNotAppliedProof');
1267
+ requireText('supervisor/store.ts', '`effect-dispatch:${effectId}:${generation}`');
1268
+ requireText('supervisor/control-plane.ts', 'PERSISTED_BROWSER_EVIDENCE_KEYS');
1269
+ requireText('supervisor/control-plane.ts', "reason: 'not_applied_proof_incomplete'");
1270
+ requireText('supervisor/server.ts', "if (!['applied','unknown'].includes(outcome))");
1271
+ forbid('adapters/computer/chrome-extension/background.js', /chrome\.storage|supervisor\.sqlite|BEGIN IMMEDIATE/, 'Computer Chrome provider must reconstruct provider bindings from live inventory and Computer target authority rather than browser shadow persistence');
1272
+ 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');
1273
+ 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');
1274
+ forbid('adapters/computer/chrome-extension/background.js', /task_register|reserve_enrollment|supervisor\.sqlite|BEGIN IMMEDIATE|chrome\.storage/, 'Computer Chrome provider must never become durable workflow authority');
1275
+ 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');
1276
+
1114
1277
  requireMissing('docs/architecture/current/stable-external-runtime-supervisor.md');
1115
1278
  requireMissing('docs/architecture/modules/controller-runtime/stable-supervisor.md');
1116
1279
  requireMissing('docs/operations/stable-external-runtime-supervisor.md');
@@ -1320,17 +1483,15 @@ requireText('adapters/mcp/runtime-gateway/router.ts', "'EXECUTION_JOB_RETIRED'")
1320
1483
  requireText('adapters/mcp/runtime-gateway/execution-tools.ts', 'isDurableWorkOperation');
1321
1484
  requireText('adapters/mcp/runtime-gateway/execution-tools.ts', "'work_execute'");
1322
1485
  requireText('adapters/mcp/runtime-gateway/execution-tools.ts', "'work_validate'");
1323
- requireText('adapters/mcp/runtime-gateway/execution-tools.ts', "'work_finalize'");
1486
+ forbid('adapters/mcp/runtime-gateway/execution-tools.ts', /work_finalize/, 'execution tools must not restore a Work finalization operation');
1324
1487
  requireText('src/runtime/execution/workers/executor.ts', 'executeWork(runtimeContext');
1325
1488
  requireText('src/runtime/execution/workers/executor.ts', 'validateWork(runtimeContext');
1326
- requireText('src/runtime/execution/workers/executor.ts', 'finalizeWork(runtimeContext');
1327
1489
  forbid(
1328
1490
  'src/runtime/execution/workers/executor.ts',
1329
1491
  /gateway\/mcp\/execution-tools|callExecutionTool\s*\(/,
1330
1492
  'Execution Worker must invoke control-plane Work application services directly, never MCP transport',
1331
1493
  );
1332
1494
  requireText('src/runtime/execution/workers/executor.ts', '__from_durable_worker');
1333
- requireText('adapters/mcp/runtime-gateway/work-compat-adapter.ts', 'managedProcessOperationDigest');
1334
1495
  forbid(
1335
1496
  'adapters/mcp/runtime-gateway/runtime-tools.ts',
1336
1497
  /\bcreateExecutionJob\b/,
@@ -1399,7 +1560,7 @@ forbid(
1399
1560
  );
1400
1561
  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
1562
  requireMatch(
1402
- 'adapters/mcp/runtime-gateway/router.ts',
1563
+ 'adapters/mcp/runtime-gateway/routing-policy.ts',
1403
1564
  /const DIRECT_REPOSITORY_TOOLS = new Set\(\[[\s\S]*?'repository_list'[\s\S]*?'repository_get'[\s\S]*?'repository_workbench'[\s\S]*?\]\);/,
1404
1565
  'declare DIRECT_REPOSITORY_TOOLS with repository_list, repository_get, and repository_workbench',
1405
1566
  );
@@ -1508,7 +1669,7 @@ forbidBetween(
1508
1669
  /rebuildRepositoryProjection\s*\(/,
1509
1670
  'Projection rebuild must happen outside the Repo Actor mailbox lock',
1510
1671
  );
1511
- requireText('packages/kernel/scheduler/infrastructure/schedule-store.ts', "'occurrences.json'");
1672
+ requireText('packages/kernel/scheduler/infrastructure/schedule-store.ts', "'occurrences'");
1512
1673
  requireText('src/runtime/projections/git-status-sampler.ts', 'writeRepositoryGitStatusSample');
1513
1674
  requireText('src/runtime/projections/git-status-sampler.ts', 'readRepositoryGitStatusSample');
1514
1675
  requireText('adapters/mcp/tool-mapping/repository-tools.ts', 'readRepositoryGitStatusSample');
@@ -1523,13 +1684,9 @@ forbidBetween(
1523
1684
  requireText('src/runtime/control-plane/execution/session-store.ts', 'lastValidatedAt: now');
1524
1685
  requireText('src/runtime/control-plane/execution/validation.ts', 'warnings.push');
1525
1686
  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
1687
  requireText('adapters/mcp/runtime-gateway/execution-tools.ts', "from '../../../src/runtime/control-plane/execution/work-preparation-service'");
1528
1688
  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
1689
  requireText('adapters/mcp/runtime-gateway/execution-tools.ts', 'selectDefaultWorkValidationChecks');
1532
- requireText('adapters/mcp/runtime-gateway/work-adapter.ts', "callExecutionTool(ctx, 'work_finalize'");
1533
1690
  forbid(
1534
1691
  'adapters/mcp/runtime-gateway/runtime-tools.ts',
1535
1692
  /repositoryGit(?:Commit|FinishWorkflow|MergeBranch|DeleteBranch|RebaseOnto)\s*\(/,
@@ -1542,8 +1699,8 @@ forbid(
1542
1699
  );
1543
1700
  forbid(
1544
1701
  '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',
1702
+ /function\s+prepareWork\s*\(/,
1703
+ 'MCP execution transport must delegate Work preparation to the control-plane application service',
1547
1704
  );
1548
1705
  forbid(
1549
1706
  'adapters/mcp/runtime-gateway/execution-tools.ts',
@@ -1556,25 +1713,28 @@ forbid(
1556
1713
  'MCP execution transport must not own managed-workspace or WorkContract preparation admission',
1557
1714
  );
1558
1715
  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(');
1716
+ requireText('src/runtime/control-plane/execution/work-preparation-service.ts', "const useWorktree = isolation !== 'reuse';");
1717
+ forbid(
1718
+ 'src/runtime/control-plane/execution/work-preparation-service.ts',
1719
+ /adoptExistingWorkHead|WORK_HEAD_ADOPTION_/,
1720
+ 'Work preparation must keep the start revision frozen; changed source HEADs are never adopted during implementation',
1721
+ );
1722
+ forbid(
1723
+ 'src/runtime/control-plane/execution/work-handle-authority.ts',
1724
+ /alignRepositoryMutationBase|WORK_DIRECT_PRE_MUTATION_RECONCILIATION_/,
1725
+ 'Repository mutation authority must not advance a Work baseline to follow target-branch movement',
1726
+ );
1727
+ requireMissing('src/runtime/control-plane/execution/direct-canonical-work-reconciliation.ts');
1560
1728
  requireText('src/runtime/control-plane/execution/work-operation-service.ts', 'export async function executeWork(');
1561
1729
  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
- );
1730
+ requireMissing('src/runtime/control-plane/execution/work-finalization-service.ts');
1571
1731
  requireText('packages/kernel/scheduler/domain/schedule.ts', "'repository-event'");
1572
1732
  requireText('packages/kernel/scheduler/domain/schedule.ts', "'dependency-checkpoint'");
1573
1733
  requireText('packages/kernel/scheduler/infrastructure/schedule-store.ts', 'saveScheduleDecision');
1574
1734
  requireText('packages/kernel/scheduler/application/settlement.ts', 'backoffMinutes');
1575
1735
  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'");
1736
+ requireText('adapters/mcp/transports/http-observation.ts', "'/ready'");
1737
+ requireText('adapters/mcp/transports/http-observation.ts', "'/repos/:repoId/health'");
1578
1738
  requireText('src/runtime/control-plane/governance/external-effects.ts', 'EXTERNAL_EFFECT_AUTHORIZATION_REQUIRED');
1579
1739
  requireText('src/runtime/control-plane/governance/external-effects.ts', 'AUTOMATED_REQUIREMENT_REQUIRES_CANDIDATE');
1580
1740
  requireText('adapters/mcp/tool-mapping/tools.ts', "export * from './legacy-tool-service'");
@@ -1595,8 +1755,6 @@ for (const path of [
1595
1755
 
1596
1756
  requireText('scripts/run-governed-gate.ts', "label: 'source duplication'");
1597
1757
  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
1758
  requireText('docs/architecture/CURRENT.md', '## State ownership');
1601
1759
  requireText('docs/architecture/CURRENT.md', '## Runtime and MCP boundary');
1602
1760
  requireText('docs/architecture/CURRENT.md', '## Testing and verification');
@@ -1698,8 +1856,6 @@ const B7_ALLOWED_KERNEL_LEGACY_EDGES = new Set([
1698
1856
  'packages/kernel/scheduler/infrastructure/schedule-store.ts -> src/runtime/control-plane/facade/handoff-inbox-store.ts',
1699
1857
  'packages/kernel/scheduler/infrastructure/schedule-store.ts -> src/runtime/shared/json-files.ts',
1700
1858
  '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
1859
  ]);
1704
1860
  requireExactShrinkingDebt('Kernel -> legacy src dependency debt', b7KernelLegacyEdges, B7_ALLOWED_KERNEL_LEGACY_EDGES);
1705
1861
  const b7ProductionEdges = new Set(dependencyEdges(b7ProductionGraph));
@@ -1734,6 +1890,221 @@ for (const [symbol, label] of b7UniqueMutationSymbols) {
1734
1890
  }
1735
1891
  if (count !== 1) failures.push(`${label} must have exactly one exported production owner; found ${count} for ${symbol}`);
1736
1892
  }
1893
+ // Thin Plan authority: Plan items are authored working memory. Work execution,
1894
+ // Plan admission and Plan revision must never re-acquire PlanStep execution
1895
+ // writers, Plan approval/acceptance gates or Plan-derived Work progression.
1896
+ const retiredPlanExecutionSymbols = [
1897
+ 'claimPlanStepForWork',
1898
+ 'completePlanStepForWork',
1899
+ 'acceptPlanStepEvidence',
1900
+ 'repairPlanStepForTechnicalRetry',
1901
+ 'repairDanglingPlanStepWorkBinding',
1902
+ 'replanActivePlanBoundWorkScope',
1903
+ 'retireTerminalPlanBoundWorkAuthorities',
1904
+ 'getPlanExecutionBaselineRevision',
1905
+ 'updatePlanContractWithExecutionBaseline',
1906
+ 'refreshPlanBoundWorkRevision',
1907
+ 'retirePlanBoundWorkContract',
1908
+ 'rebindPlanBoundWorkContract',
1909
+ ];
1910
+ for (const path of productionTypeScriptFiles()) {
1911
+ const source = text(path);
1912
+ for (const symbol of retiredPlanExecutionSymbols) {
1913
+ if (new RegExp(`\\b${symbol}\\b`).test(source)) failures.push(`${path} must not reintroduce retired PlanStep execution writer ${symbol}`);
1914
+ }
1915
+ }
1916
+ 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/;
1917
+ for (const path of [
1918
+ 'src/runtime/control-plane/facade/goal-workloop.ts',
1919
+ 'src/runtime/control-plane/facade/plan-contract-store.ts',
1920
+ 'src/runtime/control-plane/facade/requirement-authority.ts',
1921
+ 'src/runtime/control-plane/global-scheduler/autonomous-continuation.ts',
1922
+ 'adapters/mcp/runtime-gateway/work-plan-operations.ts',
1923
+ 'adapters/mcp/runtime-gateway/work-repair-adapter.ts',
1924
+ ]) {
1925
+ if (retiredPlanGateCodes.test(text(path))) failures.push(`${path} must not reintroduce a PlanStep execution gate`);
1926
+ }
1927
+ for (const path of ['packages/kernel/progression/api/index.ts']) requireMissing(path);
1928
+ for (const path of productionTypeScriptFiles()) {
1929
+ if (/packages\/kernel\/progression/.test(text(path))) failures.push(`${path} must not depend on the retired PlanStep progression engine`);
1930
+ }
1931
+ for (const retiredPath of [
1932
+ 'src/runtime/control-plane/execution/work-finalization-service.ts',
1933
+ 'src/runtime/control-plane/execution/direct-edit-work-completion.ts',
1934
+ 'src/runtime/control-plane/execution/content-equivalent-commit-authority.ts',
1935
+ 'adapters/mcp/controller-round-compatibility.ts',
1936
+ 'adapters/mcp/frozen-client-semantic-compatibility.ts',
1937
+ 'adapters/mcp/runtime-gateway/work-controller-recovery-operations.ts',
1938
+ 'adapters/mcp/runtime-gateway/work-plan-repair-operations.ts',
1939
+ ]) requireMissing(retiredPath);
1940
+ for (const path of [...sourceFiles('src'), ...sourceFiles('adapters')]) {
1941
+ 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');
1942
+ }
1943
+ // Thin semantic Work lifecycle: Work is open/completed/cancelled and
1944
+ // work.complete is a mechanical durable close. Review findings are durable
1945
+ // observations, never a completion gate.
1946
+ requireText('packages/kernel/work/domain/types.ts', "export const SEMANTIC_WORK_STATES = ['open', 'completed', 'cancelled'] as const;");
1947
+ requireText('packages/kernel/work/domain/types.ts', 'export type SemanticWorkState = (typeof SEMANTIC_WORK_STATES)[number];');
1948
+ requireText('adapters/mcp/runtime-gateway/work-semantic-operations.ts', "const RH_WORK_SEMANTIC_OPERATIONS = new Set(['start', 'get', 'revise', 'complete']);");
1949
+ for (const path of [
1950
+ 'packages/kernel/work/domain/state-machine.ts',
1951
+ 'src/runtime/control-plane/execution/work-evidence-policy.ts',
1952
+ 'src/runtime/control-plane/facade/goal-workloop.ts',
1953
+ ]) {
1954
+ forbid(path, /READ_ONLY_REVIEW_CLEAN_SCOPE|cleanReadOnlyReviewEvidence|READ_ONLY_REVIEW_FINDINGS_BLOCK/, 'read-only review findings must not gate terminal completion');
1955
+ }
1956
+ // Work lifecycle collapse: semantic Work completion is one durable
1957
+ // expected_revision CAS close. Verify/review/finalize/delivery/cleanup are
1958
+ // mechanical facts owned elsewhere; they must never be wired back into the
1959
+ // semantic close path as a gate.
1960
+ for (const path of [
1961
+ 'adapters/mcp/runtime-gateway/work-semantic-operations.ts',
1962
+ ]) {
1963
+ forbid(path, /transitionWorkContractPhase|requestWorkImplementationReview|recordWorkImplementationReview|finalizeGoalWorkloop|verifyGoalWorkloop|reviewGoalWorkloop/, 'semantic Work completion must not invoke a mechanical lifecycle transition');
1964
+ forbid(path, /implementationReview|completionReceipt|dispatchState|evidenceState|ControllerRound|controllerRound/, 'semantic Work completion must not read mechanical lifecycle or controller authority');
1965
+ }
1966
+ forbidBetween(
1967
+ 'packages/kernel/work/infrastructure/work-contract-store.ts',
1968
+ 'export function reviseWorkSemanticContext(',
1969
+ 'export function getWorkContract(',
1970
+ /WORK_IMPLEMENTATION_REVIEW|WORK_COMPLETION_RECEIPT|WORK_VERIFICATION|WORK_CLEANUP|WORK_DELIVERY|WORK_FINALIZE/,
1971
+ 'the semantic close must not require review, verification, delivery, cleanup or finalize',
1972
+ );
1973
+ requireText('packages/kernel/work/infrastructure/work-contract-store.ts', 'WORK_REVISION_CONFLICT:');
1974
+ forbidBetween(
1975
+ 'packages/kernel/work/infrastructure/work-contract-store.ts',
1976
+ 'export function semanticWorkState(',
1977
+ 'export function workSemanticView(',
1978
+ /'failed'|'ready'|'blocked'|'running'/,
1979
+ 'semantic Work state must expose only open/completed/cancelled; execution vocabulary is not a semantic state',
1980
+ );
1981
+ // Controller de-authority: ordinary Work/capability execution is fenced by
1982
+ // semantic CAS plus concrete target/resource/effect owners, never by a
1983
+ // Work-wide ControllerSession lease. Explicit autonomous-continuation round
1984
+ // operations retain their narrow dispatch/effect authority until Slice 4.
1985
+ forbid(
1986
+ 'packages/kernel/work/domain/state-machine.ts',
1987
+ /WORK_PHASE_EVIDENCE_|WORK_COMPLETION_PHASE_/,
1988
+ 'legacy phase evidence must not regain semantic Work authority',
1989
+ );
1990
+ for (const path of [
1991
+ 'adapters/mcp/runtime-gateway/work-workflow-operations.ts',
1992
+ 'src/runtime/workflows/runtime.ts',
1993
+ ]) {
1994
+ forbid(path, /assertFacadeControllerRoundAuthority|getControllerSession|getControllerRoundRelay|controllerSessionAuthorityMatches|WORKFLOW_CONTROLLER_AUTHORITY|WORKFLOW_CONTROLLER_NOT_OWNER/, 'ordinary Workflow execution must not depend on Work-wide Controller authority');
1995
+ }
1996
+ forbid(
1997
+ 'adapters/mcp/runtime-gateway/work-adapter.ts',
1998
+ /claimNewFacadeWork|mintControllerSessionAuthority|resumeControllerSession|bindFacadeControllerOwnership|currentFacadeTerminalizationAuthority|currentTerminalCleanupAuthority|withControllerSessionTerminalizationFence/,
1999
+ 'ordinary Work start/continue/review/stop/finalize must not mint or require Work-wide Controller authority',
2000
+ );
2001
+ for (const path of [
2002
+ 'packages/kernel/work/domain/types.ts',
2003
+ 'packages/kernel/work/domain/execution-concurrency.ts',
2004
+ 'src/runtime/control-plane/concurrency/work-execution-concurrency.ts',
2005
+ 'src/runtime/execution/process-runtime/types.ts',
2006
+ ]) {
2007
+ forbid(path, /controller_release/, 'Work/Process concurrency must wake on concrete Work/resource/scheduler facts, not Controller ownership release');
2008
+ }
2009
+ for (const path of [
2010
+ 'src/runtime/control-plane/execution/work-execution-support.ts',
2011
+ 'src/runtime/control-plane/execution/work-operation-service.ts',
2012
+ 'src/runtime/control-plane/execution/work-terminal-cleanup.ts',
2013
+ 'src/runtime/control-plane/execution/work-preparation-service.ts',
2014
+ ]) {
2015
+ 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');
2016
+ }
2017
+ forbid(
2018
+ 'src/runtime/recovery/maintenance-executor.ts',
2019
+ /withControllerSessionTerminalizationFence|listControllerSessions|getControllerSession|controllerWorkIds|controller_session/,
2020
+ 'stale Work maintenance must re-check concrete Work/source/resource facts instead of using ControllerSession as lifecycle authority',
2021
+ );
2022
+ requireText('src/runtime/control-plane/facade/handoff-inbox-store.ts', 'migrateLegacyHandoffInbox');
2023
+ requireText('src/runtime/control-plane/facade/handoff-inbox-store.ts', 'HANDOFF_LEGACY_STORE_READ_ONLY');
2024
+ requireText('src/runtime/control-plane/facade/handoff-inbox-store.ts', 'UserRequest owns the durable write');
2025
+ forbid('src/runtime/control-plane/facade/handoff-inbox-store.ts', /writeLegacyHandoffInboxStore|export function writeHandoffInboxStore/, 'legacy Handoff store must never remain a writable second authority');
2026
+ forbid('src/runtime/plugins/store.ts', /status:\s*terminalRemoteEffect\s*\?\s*['\"]completed['\"]/, 'plugin/effect delivery results must never claim semantic Work completion');
2027
+ requireText('src/runtime/plugins/store.ts', "semanticState: 'open' as const");
2028
+ for (const path of sourceFiles('src')) {
2029
+ forbid(path, /\bcancelWorkContract\s*\(/, 'runtime/maintenance code must never auto-cancel semantic Work; cancellation belongs to explicit semantic CAS');
2030
+ }
2031
+ requireText('src/runtime/control-plane/facade/goal-workloop.ts', "state: 'cancelled'");
2032
+ requireText('src/runtime/recovery/maintenance-executor.ts', "result: 'work_semantic_completion_required'");
2033
+ requireText('src/runtime/control-plane/execution/work-authority-reconciler.ts', "'semantic_work_open_ownerless'");
2034
+ forbid(
2035
+ 'packages/kernel/scheduler/infrastructure/schedule-store.ts',
2036
+ /repeated_infrastructure_failure|activeScheduleFailureHandoff|stableScheduleFailureHandoffId|resolveRecoveredScheduleFailureHandoffs/,
2037
+ 'mechanical Scheduler failures must remain runtime/backoff facts and must not create human-request authority',
2038
+ );
2039
+ {
2040
+ const workStoreSource = text('packages/kernel/work/infrastructure/work-contract-store.ts');
2041
+ const receiptWriterStart = workStoreSource.indexOf('export function recordWorkCompletionReceipt(');
2042
+ const receiptWriterEnd = workStoreSource.indexOf('\nexport interface AcceptSubmittedWorkInput', receiptWriterStart);
2043
+ const receiptWriter = receiptWriterStart >= 0 && receiptWriterEnd > receiptWriterStart
2044
+ ? workStoreSource.slice(receiptWriterStart, receiptWriterEnd)
2045
+ : '';
2046
+ if (!receiptWriter) fail('recordWorkCompletionReceipt writer not found');
2047
+ if (/status:\s*['"]completed['"]|dispatchState:\s*['"]terminal['"]|phase:\s*['"]cleanup['"]|WORK_IMPLEMENTATION_REVIEW_REQUIRED|transitionWorkContractPhase|requestWorkImplementationReview/.test(receiptWriter)) {
2048
+ fail('delivery/effect receipt recording must not terminalize Work or reintroduce review/lifecycle gates');
2049
+ }
2050
+ }
2051
+ forbid(
2052
+ 'src/runtime/control-plane/execution/work-completion-authority.ts',
2053
+ /completeRequirementFromWork|projectRequirementDeliveryFromCompletedWork|completeWorkWithReceipt/,
2054
+ 'delivery evidence must not auto-complete Work or Requirement',
2055
+ );
2056
+ for (const path of [
2057
+ 'adapters/mcp/runtime-gateway/work-adapter.ts',
2058
+ 'adapters/mcp/runtime-gateway/repository-compat-adapter.ts',
2059
+ 'src/runtime/control-plane/facade/goal-workloop.ts',
2060
+ ]) {
2061
+ forbid(path, /lifecycleClosed|finalStatus:\s*['"]completed['"]|directEditWorkCompletion/, 'mechanical delivery/finalize responses must not masquerade as semantic Work completion');
2062
+ }
2063
+ // Temporary migration assertion on automatic dispatch admission. Explicit
2064
+ // operator repair may reconstruct a historical dispatch-owner pre-click proof;
2065
+ // unknown observation reasons must never be automatic retry authority. Remove
2066
+ // this string fence when the existing effect admission contract is AST-fenced.
2067
+ forbidBetween(
2068
+ 'supervisor/store.ts',
2069
+ 'nextBrowserEffect(',
2070
+ 'effectDispatchBudget(',
2071
+ /composer_missing|send_button_missing|latestRetryEvidenceEventId/,
2072
+ 'dispatch generation may advance only from canonical effect_not_applied proof; effect_unknown never authorizes replay',
2073
+ );
2074
+ requireText('packages/kernel/controller/domain/controller-round-transition-policy.ts', "Pick<ControllerRoundRelayRecord, 'relayScopeId' | 'originWorkId' | 'roundCount'>");
2075
+ forbid(
2076
+ 'packages/kernel/controller/domain/controller-round-transition-policy.ts',
2077
+ /controllerRoundProviderEffectId[\s\S]{0,400}authorityId/,
2078
+ 'canonical continuation/provider effect identity must survive Controller authority rotation',
2079
+ );
2080
+ requireText('src/runtime/root/workflow-supervisor-composition.ts', 'reserveWorkflowSupervisorEnrollment(forgeHome, registeredTask.taskId, lowerLayer.providerEffectId)');
2081
+ requireText('src/runtime/root/workflow-supervisor-composition.ts', 'providerDispatchEffectId: effect.effectId');
2082
+ requireText('supervisor/protocol.ts', '(?:fx|crpe)_');
2083
+ // Cognitive Plane stays one advisory application path: all Controller tools expose the
2084
+ // same optional settlement metadata, the MCP server settles it after the primary
2085
+ // outcome, and Supervisor/external launchers consume Cognition-only projections.
2086
+ requireText('adapters/mcp/toolset.ts', 'injectCognitionSettlementFields(injectAutomationEnvelopeFields(injectDurableCommandFields(definition)))');
2087
+ requireText('adapters/mcp/server.ts', 'settleCognitionAfterTool(ctx, name, args, localResult)');
2088
+ forbid('adapters/mcp/runtime-gateway/runtime-tools.ts', /settleCognitionEnvelope/, 'cognition settlement belongs to the canonical all-tool MCP boundary, not the rh_* facade only');
2089
+ requireText('src/runtime/root/workflow-supervisor-composition.ts', 'renderCognitiveAttentionForWork');
2090
+ requireText('src/runtime/control-plane/launcher/thin-launcher.ts', 'renderCognitiveAttentionForWork');
2091
+ forbid('src/runtime/root/workflow-supervisor-composition.ts', /renderAssistantWorkContext/, 'Supervisor prompts may receive bounded Cognition, not the legacy lower-layer AssistantWorkContext blob');
2092
+ forbid('src/runtime/control-plane/launcher/thin-launcher.ts', /renderAssistantWorkContext/, 'external controller prompts may receive bounded Cognition, not the legacy lower-layer AssistantWorkContext blob');
2093
+ requireText('packages/kernel/cognition/application/activation-service.ts', 'structuredConceptAliasCueScore');
2094
+ requireText('packages/kernel/cognition/application/activation-service.ts', 'fairScopedRead');
2095
+ requireText('packages/kernel/cognition/application/activation-service.ts', 'seenFamilies');
2096
+
2097
+ for (const path of [
2098
+ 'adapters/mcp/runtime-gateway/work-learning-operations.ts',
2099
+ 'src/runtime/control-plane/persistence/experience-store.ts',
2100
+ ]) {
2101
+ 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');
2102
+ }
2103
+ forbid(
2104
+ 'src/cli/commands/brain-assistant.ts',
2105
+ /authority-env|BRAIN_CONTROLLER_AUTHORITY_REQUIRED|BRAIN_AUTHORITY_ENV_INVALID/,
2106
+ 'advisory experience CLI must not require a Controller capability',
2107
+ );
1737
2108
  for (const path of [
1738
2109
  'src/runtime/gateway/mcp/execution-tools.ts',
1739
2110
  'src/runtime/gateway/mcp/legacy-ios-tool-adapter.ts',
@@ -1757,7 +2128,6 @@ for (const path of [
1757
2128
  requireText('src/runtime/control-plane/execution/work-execution-support.ts', 'packages/protocols/mcp/execution-context');
1758
2129
  requireText('src/runtime/control-plane/execution/work-preparation-service.ts', 'packages/protocols/mcp/execution-context');
1759
2130
  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
2131
  for (const path of [
1762
2132
  'adapters/mcp/transports/http.ts',
1763
2133
  'adapters/mcp/transports/session-registry.ts',
@@ -1814,7 +2184,7 @@ requireText('src/runtime/root/runtime.ts', 'readonly forgeInstanceId: string');
1814
2184
  requireText('src/runtime/root/runtime.ts', 'ensureForgeInstanceIdentity');
1815
2185
  requireText('src/runtime/root/entry.ts', 'forgeInstanceId: runtime.forgeInstanceId');
1816
2186
  requireText('adapters/mcp/transports/http.ts', 'forgeInstanceId: forgeInstance.instanceId');
1817
- requireText('adapters/mcp/transports/http.ts', 'controllerInstanceId: process.env.FORGE_MCP_INSTANCE_ID');
2187
+ requireText('adapters/mcp/transports/http-observation.ts', 'controllerInstanceId: process.env.FORGE_MCP_INSTANCE_ID');
1818
2188
  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
2189
  requireText('adapters/mcp/transports/http.ts', "adapterId: 'mcp-http'");
1820
2190
  requireText('adapters/mcp/transports/session-registry.ts', 'connectionId: string');
@@ -1824,6 +2194,40 @@ requireText('adapters/mcp/tunnels/openai-secure-tunnel.ts', 'credentialReference
1824
2194
  forbid('adapters/mcp/tunnels/openai-secure-tunnel.ts', /\bidentityMatches\b/, 'tunnel binding match must not masquerade as Forge semantic identity');
1825
2195
 
1826
2196
  // C0 Computer capability boundary: Browser and Desktop remain separate providers.
2197
+ // Controller-scoped plugins are owned by the serving ForgeInstance. A synthetic
2198
+ // RepositoryRecord must not reappear as a canonical execution or manifest path.
2199
+ const controllerRepoCallPattern = new RegExp(['controllerPlugin', 'Repository\\s*\\('].join(''));
2200
+ const legacyControllerRepoPattern = new RegExp(['CONTROLLER_SCOPE_REPO_ID|__controller__|controllerPlugin', 'Repository'].join(''));
2201
+ for (const path of productionTypeScriptFiles()) {
2202
+ forbid(path, controllerRepoCallPattern, 'production controller-plugin paths must not recreate a fake controller RepositoryRecord');
2203
+ }
2204
+ requireText('src/runtime/plugins/store.ts', 'const CONTROLLER_PLUGIN_SCOPE_KEY = FORGE_INSTANCE_SCOPE_KEY');
2205
+ forbidBetween(
2206
+ 'src/runtime/plugins/store.ts',
2207
+ 'function controllerPluginActionScope',
2208
+ 'function pluginActionExecutionFields',
2209
+ legacyControllerRepoPattern,
2210
+ 'the canonical controller action scope must use the ForgeInstance scope, not the legacy controller repository sentinel',
2211
+ );
2212
+ for (const [start, end, description] of [
2213
+ ['export function listControllerPluginManifests(', 'function getControllerPluginManifestForExecution', 'controller manifest listing'],
2214
+ ['export function getControllerPluginManifest(', 'function writeControllerRegistry', 'controller manifest lookup'],
2215
+ ['export function submitControllerPluginAction(', 'async function executePluginActionInScope', 'controller action submission'],
2216
+ ['export function executeControllerScopedPluginAction(', 'export function executeAssistantPluginAction', 'controller action execution'],
2217
+ ]) {
2218
+ forbidBetween(
2219
+ 'src/runtime/plugins/store.ts',
2220
+ start,
2221
+ end,
2222
+ legacyControllerRepoPattern,
2223
+ `${description} must not depend on the legacy controller repository sentinel`,
2224
+ );
2225
+ }
2226
+ // Legacy controller coordinates remain read-only migration/compatibility inputs
2227
+ // or explicit rejection paths; they are not allowed to become new write paths.
2228
+ requireText('src/runtime/plugins/store.ts', 'One-way read compatibility for pre-cutover controller receipts only.');
2229
+ requireText('adapters/mcp/runtime-gateway/plugin-adapter.ts', 'PLUGIN_CONTROLLER_REPOSITORY_SENTINEL_RETIRED');
2230
+ requireText('src/runtime/plugins/app-store-connect-adapter.ts', 'APP_STORE_CONNECT_LEGACY_CONTROLLER_SCOPE_WRITE_RETIRED');
1827
2231
  requireText('packages/protocols/computer/contract.ts', 'COMPUTER_BROWSER_AUTOMATION_CAPABILITY');
1828
2232
  requireText('packages/protocols/computer/contract.ts', 'ComputerRuntimeProviderCapabilityId');
1829
2233
  requireText('packages/plugin-runtime/computer/provider.ts', 'ComputerRuntimeProviderCapabilityId');
@@ -1843,10 +2247,9 @@ requireText('adapters/computer/desktop-operator-negotiation.ts', 'buildDesktopOp
1843
2247
  requireText('adapters/computer/desktop-operator-provider.ts', 'createDesktopOperatorComputerProvider');
1844
2248
  requireText('adapters/computer/desktop-operator-discovery.ts', 'ComputerProviderRegistrationLookup');
1845
2249
  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
2250
  requireText('adapters/computer/desktop-operator-discovery.ts', "PLUGIN_COMPUTER_PROVIDER_REGISTRATION_REQUIRED");
1849
- requireText('src/runtime/root/computer-composition.ts', "legacyFallback: 'unregistered_v0_2'");
2251
+ 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');
2252
+ forbid('src/runtime/root/computer-composition.ts', /legacyFallback|unregistered_v0_2/, 'Computer Runtime composition must not enable an unregistered Desktop Operator compatibility provider');
1850
2253
  requireText('src/cli/commands/computer.ts', "new Command('computer')");
1851
2254
  requireText('src/cli/commands/computer.ts', 'installOfficialPlugin(COMPUTER_PROVIDER_PLUGIN_ID');
1852
2255
  requireText('src/cli/commands/computer.ts', 'provider release: independent');
@@ -1855,7 +2258,7 @@ requireText('src/cli/commands/computer.ts', 'readControllerStoredPluginManifest'
1855
2258
  requireText('src/cli/commands/computer.ts', 'syncControllerPluginManifest');
1856
2259
  requireText('src/cli/commands/computer.ts', 'removeControllerPluginManifestProjection');
1857
2260
  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');
2261
+ 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
2262
  requireText('src/cli/commands/plugin.ts', 'external-plugin:${pluginId}');
1860
2263
  requireText('src/runtime/plugins/store.ts', 'export function readControllerStoredPluginManifest');
1861
2264
  requireText('src/runtime/plugins/store.ts', 'export function syncControllerPluginManifest');
@@ -1930,6 +2333,8 @@ requireText('src/runtime/plugins/browser-session-authority.ts', 'findComputerBac
1930
2333
  requireText('src/runtime/plugins/browser-session-authority.ts', 'saveComputerBackedBrowserSession');
1931
2334
  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
2335
  requireText('src/runtime/plugins/browser-session-legacy-migration.ts', 'readLegacyBrowserSessionMigrationEntries');
2336
+ requireText('src/runtime/plugins/browser-session-store.ts', 'PLUGIN_BROWSER_SESSION_CONTEXT_REQUIRED');
2337
+ 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
2338
  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
2339
  requireText('src/runtime/root/browser-session-composition.ts', 'BrowserSessionExecutionContext');
1935
2340
  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');