@moretea-labs/forge 1.8.1 → 1.8.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (328) hide show
  1. package/AGENTS.md +5 -2
  2. package/CHANGELOG.md +20 -0
  3. package/README.en.md +24 -3
  4. package/README.md +10 -6
  5. package/README.zh-CN.md +5 -3
  6. package/THIRD_PARTY_NOTICES.md +1 -2
  7. package/adapters/chatgpt/browser-delivery-runtime.ts +5 -3
  8. package/adapters/chatgpt/provider-delivery.ts +1 -1
  9. package/adapters/chatgpt/work-conversation-binding-store.ts +20 -1
  10. package/adapters/computer/chatgpt-extension-target.ts +295 -50
  11. package/adapters/computer/chrome-extension/background.js +227 -71
  12. package/adapters/computer/chrome-extension/content.js +181 -157
  13. package/adapters/computer/chrome-extension/manifest.json +3 -1
  14. package/adapters/computer/desktop-operator-provider.ts +18 -6
  15. package/adapters/computer/interaction-target-authority.ts +39 -9
  16. package/adapters/mcp/access-mode.ts +18 -39
  17. package/adapters/mcp/auth.ts +2 -6
  18. package/adapters/mcp/instructions.ts +2 -2
  19. package/adapters/mcp/multi-repository.ts +7 -28
  20. package/adapters/mcp/runtime-gateway/context-adapter.ts +79 -40
  21. package/adapters/mcp/runtime-gateway/context-pack-sidecar.ts +7 -15
  22. package/adapters/mcp/runtime-gateway/execution-tools.ts +7 -13
  23. package/adapters/mcp/runtime-gateway/plugin-adapter.ts +16 -3
  24. package/adapters/mcp/runtime-gateway/process-tools.ts +3 -21
  25. package/adapters/mcp/runtime-gateway/router.ts +3 -5
  26. package/adapters/mcp/runtime-gateway/routing-policy.ts +17 -10
  27. package/adapters/mcp/runtime-gateway/runtime-observation-adapter.ts +1 -1
  28. package/adapters/mcp/runtime-gateway/runtime-tool-definitions.ts +14 -9
  29. package/adapters/mcp/runtime-gateway/runtime-tools.ts +1 -5
  30. package/adapters/mcp/runtime-gateway/scheduler-adapter.ts +36 -1
  31. package/adapters/mcp/runtime-gateway/status-inbox-adapter.ts +58 -4
  32. package/adapters/mcp/runtime-gateway/typescript-navigation-sidecar.ts +7 -3
  33. package/adapters/mcp/runtime-gateway/work-adapter.ts +16 -16
  34. package/adapters/mcp/runtime-gateway/work-input-wire-migration.ts +0 -17
  35. package/adapters/mcp/runtime-gateway/work-semantic-operations.ts +69 -12
  36. package/adapters/mcp/runtime-gateway/workflow-supervisor-adapter.ts +26 -2
  37. package/adapters/mcp/server.ts +24 -3
  38. package/adapters/mcp/setup.ts +4 -10
  39. package/adapters/mcp/tool-mapping/access-tools.ts +0 -6
  40. package/adapters/mcp/tool-mapping/legacy-tool-service.ts +672 -2935
  41. package/adapters/mcp/tool-mapping/post-finalize-work-attribution.ts +1 -1
  42. package/adapters/mcp/tool-mapping/repository-tools.ts +52 -86
  43. package/adapters/mcp/toolset-names.ts +11 -42
  44. package/adapters/mcp/toolset.ts +16 -90
  45. package/{src/cli → adapters}/mcp/transports/AGENTS.md +5 -5
  46. package/{src/cli → adapters}/mcp/transports/CLAUDE.md +5 -5
  47. package/adapters/mcp/transports/http-observation.ts +18 -6
  48. package/adapters/mcp/transports/http-post-lifecycle.ts +19 -0
  49. package/adapters/mcp/transports/http.ts +54 -14
  50. package/adapters/mcp/types.ts +0 -6
  51. package/assets/hooks/lib/session-state.sh +0 -38
  52. package/assets/hooks/post-bash.sh +1 -1
  53. package/assets/hooks/post-tool-observer.sh +0 -5
  54. package/assets/hooks/prompt-guard.sh +0 -55
  55. package/assets/partials/04-project-structure.partial.md +1 -1
  56. package/assets/partials/07-footer.partial.md +1 -1
  57. package/assets/partials-agents/02-operating-mode.partial.md +1 -1
  58. package/assets/partials-agents/08-deep-docs.partial.md +1 -1
  59. package/assets/reference-configs/agentic-development-flow.md +1 -1
  60. package/assets/reference-configs/external-tooling.md +0 -76
  61. package/assets/reference-configs/release-deploy.md +1 -1
  62. package/assets/templates/helpers/architecture-queue.sh +1 -1
  63. package/assets/templates/helpers/check-agent-tooling.sh +1 -327
  64. package/assets/templates/helpers/check-task-workflow.sh +1 -1
  65. package/assets/templates/helpers/ensure-task-workflow.sh +0 -14
  66. package/assets/templates/helpers/migrate-project-template.sh +2 -2
  67. package/assets/workflow-contract.v1.json +0 -2
  68. package/docs/README.md +5 -2
  69. package/docs/architecture/CURRENT.md +114 -30
  70. package/docs/architecture/decisions/20260904-ios-device-migration-baseline.md +42 -0
  71. package/docs/architecture/decisions/20260918-stable-candidate-release-lifecycle.md +15 -2
  72. package/docs/architecture/decisions/20260924-thin-semantic-working-context.md +4 -2
  73. package/docs/architecture/decisions/20261001-supervisor-turn-authority.md +109 -4
  74. package/docs/architecture/decisions/20261009-exact-code-context-discovery.md +19 -0
  75. package/docs/architecture/decisions/20261009-generated-xcode-cache-retention.md +37 -0
  76. package/docs/architecture/decisions/20261011-autonomous-continuation-convergence.md +597 -0
  77. package/docs/architecture/decisions/20261017-edit-session-finalization-reconciliation.md +17 -0
  78. package/docs/architecture/decisions/20261019-retire-host-skills.md +16 -0
  79. package/docs/architecture/diagrams/agentic-dev-plugin-architecture.html +1 -1
  80. package/docs/architecture/domains/public-surface.md +3 -5
  81. package/docs/architecture/domains/verification.md +5 -5
  82. package/docs/architecture/modules/controller-runtime/transport-lifecycle.md +2 -2
  83. package/docs/architecture/requests/2026-09-04-computer-plugin-workflow-taxonomy.md +4 -4
  84. package/docs/architecture/reviews/20261015-code-search-runtime-acceptance.md +75 -0
  85. package/docs/forge-plugin-management.md +14 -2
  86. package/docs/operations/controller-browser-plugin.md +23 -0
  87. package/docs/operations/features.md +6 -7
  88. package/docs/operations/features.zh-CN.md +1 -1
  89. package/docs/operations/github-repository.md +4 -4
  90. package/docs/operations/github-semantic-release-projection.md +20 -0
  91. package/docs/operations/homebrew.md +2 -2
  92. package/docs/operations/mcp-tool-exposure.md +13 -54
  93. package/docs/operations/runtime-performance-diagnostics.md +8 -0
  94. package/docs/operations/standalone-disaster-recovery.md +1 -1
  95. package/docs/tutorials/01-install-and-start.zh-CN.md +1 -1
  96. package/docs/tutorials/03-first-repository-task.md +2 -0
  97. package/docs/wiki/Computer-and-Plugins.md +78 -0
  98. package/docs/wiki/Computer-and-Plugins.zh-CN.md +88 -0
  99. package/docs/wiki/Home.md +16 -2
  100. package/docs/wiki/Implementation.md +24 -12
  101. package/docs/wiki/Installation.md +28 -32
  102. package/docs/wiki/Integrations.md +4 -0
  103. package/docs/wiki/Quick-Start.md +35 -22
  104. package/docs/wiki/Releases-and-Upgrades.md +15 -25
  105. package/docs/wiki/_Sidebar.md +5 -1
  106. package/package.json +1 -12
  107. package/packages/kernel/controller/infrastructure/controller-session-store.ts +63 -38
  108. package/packages/kernel/identity/infrastructure/activity-projection-store.ts +10 -0
  109. package/packages/kernel/scheduler/application/eligibility.ts +4 -1
  110. package/packages/kernel/scheduler/infrastructure/schedule-store.ts +13 -10
  111. package/packages/kernel/work/application/work-service.ts +1 -0
  112. package/packages/kernel/work/domain/repository-completion-receipt.ts +1 -1
  113. package/packages/kernel/work/domain/state-machine.ts +9 -2
  114. package/packages/kernel/work/infrastructure/work-contract-store.ts +28 -1
  115. package/packages/plugin-runtime/browser/provider-registry.ts +12 -36
  116. package/packages/plugin-runtime/computer/conversation-target.ts +17 -7
  117. package/scripts/assemble-template.ts +11 -72
  118. package/scripts/check-mcp-compatibility.ts +55 -74
  119. package/scripts/check-package-identity.mjs +0 -5
  120. package/scripts/check-runtime-architecture.mjs +305 -28
  121. package/scripts/init-project.sh +0 -46
  122. package/scripts/install-ios-hid-toolchain.sh +60 -0
  123. package/scripts/install-standalone-recovery.ts +1 -1
  124. package/scripts/lib/project-init-lib.sh +3 -3
  125. package/scripts/migrate-windows-wsl-controller-home.ts +2 -0
  126. package/scripts/open-source-audit-allowlist.txt +0 -1
  127. package/scripts/run-governed-gate.ts +2 -0
  128. package/scripts/smoke-ios-physical-device.ts +38 -10
  129. package/scripts/smoke-mcp-http-runtime.ts +7 -8
  130. package/scripts/smoke-mcp-tool-surface.ts +27 -41
  131. package/scripts/smoke-workflow-supervisor-chrome-adapter.ts +6 -3
  132. package/scripts/sync-generated-authority.mjs +0 -1
  133. package/src/cli/agent-jobs/executor-health.ts +1 -1
  134. package/src/cli/agent-jobs/integration.ts +2 -2
  135. package/src/cli/chatgpt-browser/file-policy.ts +2 -2
  136. package/src/cli/commands/doctor.ts +1 -143
  137. package/src/cli/commands/global-runtime.ts +3 -196
  138. package/src/cli/commands/init-hook.ts +6 -23
  139. package/src/cli/commands/init.ts +3 -252
  140. package/src/cli/commands/mcp.ts +0 -5
  141. package/src/cli/commands/prompt-guard-decision.ts +0 -2
  142. package/src/cli/commands/recovery.ts +2 -14
  143. package/src/cli/commands/repository.ts +17 -1
  144. package/src/cli/commands/setup-execution.ts +41 -0
  145. package/src/cli/controller/completion-orchestrator.ts +1 -1
  146. package/src/cli/controller/composite-operations.ts +1 -1
  147. package/src/cli/controller/context/instruction-context.ts +1 -1
  148. package/src/cli/controller/context/known-paths.ts +2 -2
  149. package/src/cli/controller/context/query-planning.ts +11 -4
  150. package/src/cli/controller/context/rule-resolution.ts +2 -2
  151. package/src/cli/controller/context/source-materializer.ts +2 -2
  152. package/src/cli/controller/context/structural-provider.ts +84 -0
  153. package/src/cli/controller/context/structural.ts +6 -6
  154. package/src/cli/controller/context/types.ts +8 -9
  155. package/src/cli/controller/context-pack.ts +97 -76
  156. package/src/cli/controller/operational-plan.ts +1 -1
  157. package/src/cli/controller/systemd-user.ts +4 -10
  158. package/src/cli/editing/edit-session.ts +17 -5
  159. package/src/cli/github/github.ts +4 -4
  160. package/src/cli/github/semantic-projection.ts +174 -0
  161. package/src/cli/hook/prompt-intents.ts +0 -9
  162. package/src/cli/index.ts +1 -43
  163. package/src/cli/local-bridge/connector-freshness.ts +1 -12
  164. package/src/cli/local-bridge/console-automations.ts +1 -1
  165. package/src/cli/local-bridge/console-view-models.ts +1 -1
  166. package/src/cli/local-bridge/facade-api.ts +0 -2
  167. package/src/cli/repositories/command-classifier.ts +0 -9
  168. package/src/cli/repositories/command-scope.ts +2 -2
  169. package/src/cli/repositories/locks.ts +20 -0
  170. package/src/cli/repositories/registry.ts +2 -1
  171. package/src/cli/repositories/safe-patch.ts +2 -12
  172. package/src/cli/repositories/structured-git.ts +39 -3
  173. package/src/cli/repository/inspector.ts +185 -343
  174. package/src/effects/process-runner.ts +17 -1
  175. package/src/runtime/context/generic-lsp-provider.ts +1 -1
  176. package/src/runtime/context/semantic-navigation-contract.ts +7 -0
  177. package/src/runtime/context/semantic-navigation.ts +1 -1
  178. package/src/runtime/control-plane/cleanup-artifact-retention.ts +4 -4
  179. package/src/runtime/control-plane/execution/work-delivery-service.ts +150 -31
  180. package/src/runtime/control-plane/execution/work-handle-authority.ts +12 -4
  181. package/src/runtime/control-plane/execution/work-handle-store.ts +53 -1
  182. package/src/runtime/control-plane/execution/work-operation-service.ts +20 -10
  183. package/src/runtime/control-plane/execution/work-preparation-service.ts +108 -4
  184. package/src/runtime/control-plane/execution/work-process-evidence.ts +2 -2
  185. package/src/runtime/control-plane/execution/work-terminal-cleanup.ts +28 -13
  186. package/src/runtime/control-plane/execution/work-validation-reconciler.ts +5 -1
  187. package/src/runtime/control-plane/execution/work-verification-snapshot.ts +1 -1
  188. package/src/runtime/control-plane/facade/capability-registry.ts +2 -0
  189. package/src/runtime/control-plane/facade/work-continuation.ts +1 -1
  190. package/src/runtime/control-plane/generated-cache-retention.ts +114 -63
  191. package/src/runtime/control-plane/global-scheduler/maintenance.ts +20 -8
  192. package/src/runtime/control-plane/global-scheduler/reconciliation.ts +1 -11
  193. package/src/runtime/control-plane/governance/external-effects.ts +1 -1
  194. package/src/runtime/control-plane/launcher/chatgpt-work-continuation.ts +1 -0
  195. package/src/runtime/control-plane/runtime-cleanup.ts +12 -93
  196. package/src/runtime/evidence/sensitive-output.ts +22 -2
  197. package/src/runtime/execution/jobs/child-reference.ts +11 -0
  198. package/src/runtime/execution/jobs/receipt-recovery.ts +1 -11
  199. package/src/runtime/execution/process-runtime/command-facade.ts +3 -3
  200. package/src/runtime/execution/process-runtime/runtime.ts +20 -16
  201. package/src/runtime/execution/thin-harness/execution-router.ts +16 -16
  202. package/src/runtime/execution/thin-harness/fast-executor.ts +2 -2
  203. package/src/runtime/execution/thin-harness/search-worker.ts +2 -2
  204. package/src/runtime/execution/workers/executor.ts +1 -2
  205. package/src/runtime/maintenance/cleanup.ts +41 -5
  206. package/src/runtime/plugins/action-application.ts +12 -1
  207. package/src/runtime/plugins/app-store-connect-adapter.ts +252 -4
  208. package/src/runtime/plugins/browser-adapter.ts +381 -313
  209. package/src/runtime/plugins/browser-macos-bridge.ts +114 -112
  210. package/src/runtime/plugins/browser-manifest-surface.ts +2 -1
  211. package/src/runtime/plugins/browser-registration.ts +2 -0
  212. package/src/runtime/plugins/browser-runtime.ts +26 -35
  213. package/src/runtime/plugins/computer-chatgpt-browser-adapter-installer.ts +11 -2
  214. package/src/runtime/plugins/computer-registration.ts +76 -9
  215. package/src/runtime/plugins/github-adapter.ts +30 -3
  216. package/src/runtime/plugins/gmail-adapter.ts +166 -1
  217. package/src/runtime/plugins/google-shared.ts +10 -5
  218. package/src/runtime/plugins/ios/remote-xpc-hid.ts +70 -30
  219. package/src/runtime/plugins/ios-adapter.ts +45 -40
  220. package/src/runtime/plugins/ios-agent-device.ts +54 -4
  221. package/src/runtime/plugins/ios-device-ownership.ts +103 -0
  222. package/src/runtime/plugins/ios-physical-device.ts +497 -79
  223. package/src/runtime/plugins/local-system-adapter.ts +1 -99
  224. package/src/runtime/plugins/store.ts +80 -7
  225. package/src/runtime/plugins/types.ts +4 -0
  226. package/src/runtime/projections/git-status-sampler.ts +2 -19
  227. package/src/runtime/recovery/actions.ts +1 -1
  228. package/src/runtime/recovery/lifecycle-inventory.ts +1 -11
  229. package/src/runtime/recovery/probe.ts +2 -2
  230. package/src/runtime/release/release-coordinator.ts +20 -4
  231. package/src/runtime/root/controller-progression-composition.ts +67 -5
  232. package/src/runtime/root/package-connector-service.ts +123 -11
  233. package/src/runtime/root/package-runtime-release.ts +6 -18
  234. package/src/runtime/root/package-runtime-service.ts +7 -13
  235. package/src/runtime/root/release-execution-canary.ts +18 -5
  236. package/src/runtime/root/release-manifest.ts +0 -34
  237. package/src/runtime/root/release-materialize.ts +0 -78
  238. package/src/runtime/root/runtime.ts +1 -2
  239. package/src/runtime/root/scheduled-controller-composition.ts +2 -1
  240. package/src/runtime/root/service.ts +90 -11
  241. package/src/runtime/root/types.ts +0 -6
  242. package/src/runtime/root/workflow-supervisor-composition.ts +207 -19
  243. package/src/runtime/root/workflow-supervisor-runtime.ts +365 -10
  244. package/src/runtime/safe-tooling/google-credential-store.ts +1 -11
  245. package/src/runtime/safe-tooling/ios-development.ts +22 -8
  246. package/src/runtime/safe-tooling/job-summary.ts +1 -1
  247. package/src/runtime/safe-tooling/workspace-auth.ts +4 -1
  248. package/src/runtime/shared/atomic-text-file.ts +21 -0
  249. package/src/runtime/shared/json-files.ts +8 -3
  250. package/src/runtime/standalone-recovery/core.ts +189 -174
  251. package/src/runtime/standalone-recovery/entry.ts +62 -30
  252. package/src/runtime/standalone-recovery/operation-lock.ts +11 -1
  253. package/src/runtime/workflow/schedules/chatgpt-automation-migration.ts +1 -0
  254. package/src/runtime/workflow/schedules/engine.ts +36 -14
  255. package/src/runtime/workflow/schedules/pending-activation.ts +11 -4
  256. package/src/runtime/workflow/schedules/work-continuation.ts +51 -6
  257. package/supervisor/client.ts +31 -14
  258. package/supervisor/control-plane.ts +210 -115
  259. package/supervisor/forge-validators.ts +88 -21
  260. package/supervisor/native-browser-adapter.ts +393 -28
  261. package/supervisor/native-messaging/host.ts +21 -2
  262. package/supervisor/protocol.ts +74 -26
  263. package/supervisor/server.ts +16 -8
  264. package/supervisor/store.ts +476 -57
  265. package/supervisor/types.ts +19 -13
  266. package/SKILL.md +0 -427
  267. package/adapters/computer/chatgpt-target-router.ts +0 -103
  268. package/adapters/mcp/runtime-gateway/automation-receipt-adapter.ts +0 -87
  269. package/adapters/mcp/runtime-gateway/work-validation-reconciler.ts +0 -1
  270. package/adapters/mcp/toolset-selection.ts +0 -41
  271. package/agents/openai.yaml +0 -4
  272. package/assets/skill-hooks.json +0 -41
  273. package/assets/skill-version.json +0 -189
  274. package/assets/skills/claude-review/SKILL.md +0 -231
  275. package/assets/skills/codex-review/SKILL.md +0 -103
  276. package/assets/templates/helpers/check-skill-version.ts +0 -193
  277. package/scripts/check-skill-version.ts +0 -5
  278. package/scripts/ensure-codegraph.sh +0 -16
  279. package/scripts/run-skill-hook.ts +0 -244
  280. package/scripts/sync-codex-installed-copies.sh +0 -182
  281. package/src/cli/commands/tools.ts +0 -167
  282. package/src/cli/mcp/access-mode.ts +0 -2
  283. package/src/cli/mcp/access-tools.ts +0 -2
  284. package/src/cli/mcp/audit.ts +0 -2
  285. package/src/cli/mcp/auth.ts +0 -2
  286. package/src/cli/mcp/instructions.ts +0 -2
  287. package/src/cli/mcp/legacy-context.ts +0 -2
  288. package/src/cli/mcp/legacy-tool-service.ts +0 -2
  289. package/src/cli/mcp/multi-repository.ts +0 -2
  290. package/src/cli/mcp/oauth.ts +0 -2
  291. package/src/cli/mcp/openai-secure-tunnel.ts +0 -2
  292. package/src/cli/mcp/paths.ts +0 -2
  293. package/src/cli/mcp/policy.ts +0 -2
  294. package/src/cli/mcp/post-finalize-work-attribution.ts +0 -2
  295. package/src/cli/mcp/proxy-env.ts +0 -2
  296. package/src/cli/mcp/readiness-projection.ts +0 -2
  297. package/src/cli/mcp/redaction.ts +0 -2
  298. package/src/cli/mcp/repo.ts +0 -2
  299. package/src/cli/mcp/repository-tools.ts +0 -2
  300. package/src/cli/mcp/server.ts +0 -2
  301. package/src/cli/mcp/setup.ts +0 -2
  302. package/src/cli/mcp/tool-capability-cache.ts +0 -2
  303. package/src/cli/mcp/tool-contract.ts +0 -2
  304. package/src/cli/mcp/tools.ts +0 -2
  305. package/src/cli/mcp/toolset-names.ts +0 -2
  306. package/src/cli/mcp/toolset-selection.ts +0 -2
  307. package/src/cli/mcp/toolset.ts +0 -2
  308. package/src/cli/mcp/transports/http.ts +0 -2
  309. package/src/cli/mcp/transports/session-registry.ts +0 -2
  310. package/src/cli/mcp/transports/stdio.ts +0 -2
  311. package/src/cli/mcp/types.ts +0 -2
  312. package/src/cli/mcp/umbrella-tools.ts +0 -2
  313. package/src/cli/tools/codegraph.ts +0 -695
  314. package/src/core/adoption/helper-wrapper-plan.ts +0 -159
  315. package/src/runtime/context/codegraph-cache-boundary.ts +0 -255
  316. package/src/runtime/context/codegraph-read-provider.ts +0 -611
  317. package/src/runtime/context/codegraph-sidecar.cjs +0 -248
  318. package/src/runtime/control-plane/codegraph-cache-retention.ts +0 -164
  319. package/src/runtime/gateway/mcp/execution-tools.ts +0 -2
  320. package/src/runtime/gateway/mcp/legacy-ios-tool-adapter.ts +0 -2
  321. package/src/runtime/gateway/mcp/persisted-check-process.ts +0 -2
  322. package/src/runtime/gateway/mcp/process-tools.ts +0 -2
  323. package/src/runtime/gateway/mcp/router.ts +0 -2
  324. package/src/runtime/gateway/mcp/runtime-tool-definitions.ts +0 -2
  325. package/src/runtime/gateway/mcp/runtime-tools.ts +0 -2
  326. package/src/runtime/gateway/mcp/work-validation-reconciler.ts +0 -2
  327. package/src/runtime/plugins/browser-provider-registry.ts +0 -2
  328. package/src/runtime/plugins/computer-chatgpt-macos-target.ts +0 -891
@@ -1,8 +1,7 @@
1
- export type WorkflowSupervisorAction = 'CONTINUE' | 'DONE' | 'NEEDS_USER';
2
- export type WorkflowSupervisorState = 'running' | 'done' | 'needs_user';
1
+ export type WorkflowSupervisorAction = 'CONTINUE' | 'WAIT' | 'DONE' | 'NEEDS_USER';
2
+ export type WorkflowSupervisorState = 'running' | 'waiting' | 'done' | 'needs_user';
3
3
  export type WorkflowSupervisorTerminalState = 'DONE' | 'NEEDS_USER' | 'STOPPED';
4
4
  /** Machine receipt attached to Forge MCP calls made by an autonomous ChatGPT turn. */
5
- export type WorkflowSupervisorAutomationStatus = 'working' | 'continue' | 'done' | 'needs_user';
6
5
  export type WorkflowEffectKind = 'enrollment' | 'continuation' | 'correction' | 'recovery';
7
6
  export type WorkflowEffectOutcome = 'applied' | 'not_applied' | 'unknown';
8
7
 
@@ -32,12 +31,8 @@ export interface WorkflowSupervisorTurnEnvelope {
32
31
  role: 'advisory';
33
32
  projection: string;
34
33
  };
35
- automation: {
36
- automation_task_id: string;
37
- automation_type: 'autonomous_continuation';
38
- intermediate_status: 'working';
39
- final_statuses: ['continue', 'done', 'needs_user'];
40
- };
34
+ /** Final assistant reply receipt. No intermediate MCP call can end a turn. */
35
+ receipt: { challenge: string };
41
36
  }
42
37
 
43
38
  export interface WorkflowSupervisorProposal {
@@ -95,9 +90,9 @@ export interface WorkflowSupervisorContinuationProof {
95
90
  taskId: string;
96
91
  conversationId: string;
97
92
  activeReleaseId: string;
98
- actions: ['CONTINUE', 'CONTINUE'];
99
- completionFingerprints: [string, string];
100
- sourceEffectIds: [string, string];
93
+ actions: ['CONTINUE', 'CONTINUE', 'DONE'];
94
+ completionFingerprints: [string, string, string];
95
+ sourceEffectIds: [string, string, string];
101
96
  runtimeInstanceIds: string[];
102
97
  firstCommittedAt: string;
103
98
  lastCommittedAt: string;
@@ -144,12 +139,21 @@ export interface WorkflowContractValidation {
144
139
  * delivery queue with no durable projection; this makes that state visible and
145
140
  * names the exact operator action that can move the task forward.
146
141
  */
142
+ export interface WorkflowSupervisorPreflightComposerObservation {
143
+ /** Diagnostic of the existing editor before Send, never a draft writer or replay authority. */
144
+ chars: number;
145
+ fingerprint: string;
146
+ classification: 'empty' | 'current_effect' | 'other_effect' | 'unattributed' | 'unavailable';
147
+ selectorVersion?: string;
148
+ }
149
+
147
150
  export type WorkflowSupervisorTaskStall =
148
151
  | { state: 'terminal' }
149
152
  | { state: 'deliverable'; effectId: string; mode: 'send' | 'reconcile'; generation: number }
150
- | { state: 'spaced'; effectId?: string; reason: 'retry_spacing' | 'unknown_observation_spacing' | 'awaiting_completion_receipt' | 'pre_send_infrastructure_blocked' }
153
+ | { state: 'spaced'; effectId?: string; reason: 'retry_spacing' | 'unknown_observation_spacing' | 'awaiting_completion_receipt' | 'pre_send_infrastructure_blocked'; preflightReasonCode?: string; preflightComposerObservation?: WorkflowSupervisorPreflightComposerObservation }
151
154
  | { state: 'retryable'; effectId: string; generations: number; maxGenerations: number }
152
155
  | { state: 'provider_resume_exhausted'; effectId: string }
156
+ | { state: 'waiting'; scheduleId: string; completionFingerprint: string }
153
157
  | { state: 'inert' };
154
158
 
155
159
  export interface WorkflowSupervisorValidators {
@@ -165,6 +169,8 @@ export interface WorkflowSupervisorLifecycleHooks {
165
169
  projectScopeForTask?(task: WorkflowSupervisorTask): WorkflowSupervisorProjectScope | undefined;
166
170
  /** Build the one bounded enrollment task for a newly discovered project conversation. */
167
171
  discoveredConversationTask?(conversation: WorkflowSupervisorDiscoveredConversation, scope: WorkflowSupervisorProjectScope): WorkflowSupervisorTaskInput | undefined;
172
+ /** Exact Work-owned terminal transition, projected into the one Supervisor stop-event writer. */
173
+ terminalWorkStopReasonForTask?(task: WorkflowSupervisorTask): string | undefined;
168
174
  /** Admission for a new send only. Never suppress observation of an already-started effect. */
169
175
  browserTaskActive?(task: WorkflowSupervisorTask): boolean;
170
176
  /** Mechanical provenance attached to outbound effect dispatch evidence. */
package/SKILL.md DELETED
@@ -1,427 +0,0 @@
1
- ---
2
- name: forge
3
- description: Single canonical skill for operating forge CLI, controller, hooks, planning, repair, verification, and delivery workflows
4
- when_to_use: "forge, initialize repo-local agentic development harness, scaffold new project with forge, migrate repo-local agentic development harness, audit repo-local agentic development harness, repair repo-local agentic development harness"
5
- ---
6
-
7
- # Forge
8
-
9
- Forge is the CLI, Runtime, and hook automation product for repo-local agentic development. This skill is the single host-discoverable router for the versioned workflow engine and CLI commands.
10
-
11
- Product boundary:
12
-
13
- - internal engine: CLI plus hook-backed tasks-first harness
14
- - contract ID: tasks-first-harness-v1
15
- - canonical skill, CLI, and package name: `forge`
16
- - new-project creation surface: `forge scaffold`
17
-
18
- Retired project-skill and project-initializer staging paths are not recognized, synchronized, or cleaned up by current tooling. Historical markers in long-migrated repositories are inert evidence.
19
-
20
- The skill should not carry the whole workflow contract in prose. It should:
21
-
22
- 1. inspect the repository
23
- 2. classify the workflow state
24
- 3. choose the correct path
25
- 4. rely on the repo contract, migration scripts, and tests for enforcement
26
-
27
- ## Forge execution runtime
28
-
29
- Treat ChatGPT as the controller and Forge as its repository execution layer. ChatGPT chooses how to inspect, plan, edit, verify, or delegate. Forge provides deterministic repository tools and does not impose an Agent-first workflow.
30
-
31
- - Direct Edit is the default for understood work. One session may accept many patch batches, keep revision history, create savepoints, run checks, roll back selected revisions, and finalize one aggregate localized diff.
32
- - Tasks describe objectives, scope, checks, and acceptance criteria. They do not permanently bind Codex, Claude, or GitHub Copilot. The executor is selected when each Run starts.
33
- - Agents are optional implementation tools for broad exploration, large refactors, or compile/test/fix loops. They receive a high-level implementation contract; ChatGPT still reviews the result and decides what happens next.
34
- - Ordinary local risk levels are metadata, not permission gates. There is no approval queue and no `approve_risk` handshake. Only an explicitly destructive or irreversible operation requires authorization in the same request.
35
- - The Controller UI is hierarchical: Overview, Work, Activity, and Settings. Work is organized as Issue -> Task -> Execution instead of exposing every technical record as a top-level destination.
36
- - Hard runtime boundaries remain for secrets, credentials, Git internals, concurrent write conflicts, out-of-scope writes when a scope is declared, and remote or irreversible side effects.
37
- ## Explicit mode directives
38
-
39
- Automatic routing remains authoritative when the user does not provide a mode directive. In particular, understood bounded work still defaults to Direct Edit; adding explicit modes must not make ordinary requests Plan-first, Agent-first, Issue-first.
40
-
41
- A leading mode directive is an opt-in instruction to ChatGPT's Forge router. It applies only to the current request, is removed from the objective before execution, and never bypasses permissions, Runtime authority, protected-path rules, approvals, or destructive/remote-write confirmation.
42
-
43
- - `-plan` or `/plan`: force the reviewed planning path. Planning is read-only: inspect repository state and call `rh_context` search with `structural_context=required` so CodeGraph symbol/reference/dependency/impact evidence is used when the index is ready; load only relevant architecture/ADR/design/README material, then create or revise the existing PlanContract. Review the PlanContract before approval. Do not start mutation until the reviewed plan is approved and execution is explicitly bound to an approved plan step. If CodeGraph is unavailable or stale, keep the degraded evidence warning visible and use bounded current-source context instead of pretending graph coverage exists.
44
- - `-debug` or `/debug`: force evidence-first debugging. Reproduce or characterize the failure, then prefer repeated `rh_context` search with `structural_context=auto` to isolate callers, dependencies, and the smallest causal surface before patching and focused verification. The directive does not force an Agent or durable Work; existing routing still chooses Direct, bounded Work, or an optional worker from the actual scope and risk.
45
-
46
- A bare directive with no objective should return/explain that mode's working contract and must not mutate repository state. Mode directives are not sticky across turns unless the user repeats them or explicitly asks to continue the same active Plan/Work.
47
-
48
- ## When to use
49
-
50
- - install or refresh the CLI+hooks workflow in an existing repo
51
- - create a new project or module scaffold only when the user asks for a new product/module skeleton, then attach the harness
52
- - migrate an older repo to the current tasks-first harness
53
- - audit drift between prompts, hooks, scripts, and repo-local contract files
54
- - repair broken task-sync, workflow-contract, or handoff surfaces
55
-
56
- ## When not to use
57
-
58
- - runtime bug debugging inside an already healthy AI workflow
59
- - generic project scaffolding unrelated to AI routing or repo-local workflow contracts
60
- - using scaffold to adopt an existing repo; choose the canonical router's init,
61
- migrate, upgrade, or repair path instead
62
- - ordinary product feature work
63
-
64
- ## Controller direct-change rule
65
-
66
- When this skill is used to operate the Controller itself, prefer a bounded direct edit for known small documentation, configuration, or code changes. The expected chain is `read_repository_file -> begin_edit_session -> apply_patch -> get_edit_session_diff -> verify_edit_session -> finalize_edit_session`. Create an Issue only when investigation, dependencies, broad scope, parallelism, long-running verification, or elevated risk requires durable orchestration. Issue creation alone is never a completed result.
67
-
68
- ## Router Protocol
69
-
70
- Always start with structured inspection, not prompt guessing.
71
-
72
- ### Step 1. Inspect first
73
-
74
- Run:
75
-
76
- - `bun scripts/inspect-project-state.ts --repo <path> --format text`
77
- - fallback: `node --loader ./src/runtime/shared/node-ts-loader.mjs scripts/inspect-project-state.ts --repo <path> --format text`
78
-
79
- Read the result fields:
80
-
81
- - `mode`
82
- - `legacy_contract_version`
83
- - `drift_signals`
84
- - `required_decisions`
85
- - `safe_defaults`
86
-
87
- ### Step 2. Choose one path
88
-
89
- Classify the request into one canonical workflow path before running checks or
90
- edits. The CLI subcommands are execution surfaces, not separate skills. For
91
- example, pre-merge or release readiness uses the check path, while broken task
92
- sync, hook routing, handoff, context, policy, or helper surfaces use repair.
93
-
94
- 1. **Scaffold**
95
- - use only when creating a new project, app, or module skeleton
96
- - use `forge scaffold`
97
- - choose the A-K project catalog entry, then optional `ai_native_profile`
98
- - attach the harness after the project structure exists
99
- - do not use this path for existing-repo adoption
100
- 2. **Initialize**
101
- - use when the repo has no meaningful tasks-first workflow yet
102
- 3. **Migrate**
103
- - use when the repo has legacy workflow docs, missing contract manifest, or stale harness artifacts
104
- 4. **Audit**
105
- - use when the repo mostly works but the user wants drift analysis and enforcement review
106
- 5. **Repair**
107
- - use when the repo has a current contract surface but broken task-sync, hooks, or handoff behavior
108
- ### Step 3. Prefer engine actions over prompt-only fixes
109
-
110
- Default order:
111
-
112
- 1. for new projects, scaffold the requested project/module shape first
113
- 2. migrate legacy docs if needed
114
- 3. install or refresh workflow contract artifacts
115
- 4. sync hooks, helpers, and templates
116
- 5. merge the guidance-only `external_tooling` profile into `.ai/harness/policy.json`
117
- 6. verify the repo-local contract
118
-
119
- Do not treat hooks as the primary source of truth. The repo contract lives in repo files.
120
-
121
- ## Core Engine Surfaces
122
-
123
- The single machine-readable contract source is:
124
-
125
- - `assets/workflow-contract.v1.json`
126
-
127
- The installed runtime copy inside a repo is:
128
-
129
- - `.ai/harness/workflow-contract.json`
130
-
131
- The main engine entrypoints are:
132
-
133
- - `scripts/inspect-project-state.ts`
134
- - `scripts/migrate-workflow-docs.ts`
135
- - `scripts/migrate-project-template.sh`
136
- - `scripts/check-agent-tooling.sh`
137
- - `scripts/check-task-workflow.sh`
138
- - `scripts/create-project-dirs.sh`
139
-
140
- ## CLI Workflow Surface
141
-
142
- `forge` is the only host-discoverable skill. Planning, review, execution,
143
- maintenance, verification, delivery, browser consultation, and setup remain CLI
144
- commands or controller capabilities selected by this router. Do not install one
145
- skill per command.
146
-
147
- Choose the smallest applicable path:
148
-
149
- - planning: plan, PRD, review, sprint, or bounded goal preparation
150
- - lifecycle: init, scaffold, migrate, upgrade, or capability configuration
151
- - maintenance: architecture, deploy-readiness, handoff, repair, or check
152
- - execution and delivery: direct controller work, automated workflow, or ship
153
- - consultation: ChatGPT browser/GPT Pro setup and consult commands, preserving
154
- the existing credential, session, and user-consent boundaries
155
-
156
- The implementation authority remains in the CLI, controller tools, scripts,
157
- hooks, and versioned contract files. Add a separate skill only when it represents
158
- a genuinely independent knowledge domain with a non-overlapping trigger and
159
- safety model; a CLI alias is not sufficient justification.
160
-
161
- ## Plan Index
162
-
163
- Keep A-K as stable scaffold codes, but route them as stack-family handles, not
164
- product prescriptions. Choose by frontend shell, backend/runtime boundary,
165
- deployment target, data authority, and sidecar needs first. Product domains
166
- such as finance, CRM, Web3, healthcare, and commerce are overlays.
167
-
168
- Core Plans (A-F), routed as stack families:
169
- - Plan A: Astro-first SSR/content shell. Use Astro for SSR, content, docs,
170
- marketing, and mostly-static app shells with islands where needed.
171
- - Plan B: Vite 8 client-only app shell. Use Vite + React + TanStack
172
- Router/Query plus shadcn/Radix-style UI for dense interactive apps and
173
- internal tools that do not need crawler-visible SSR landing HTML.
174
- - Plan C: TanStack Start Workers webapp. Prefer TanStack Start + Vite +
175
- Cloudflare Workers when the same React webapp needs public SEO/SSR at `/`
176
- and authenticated or browser-heavy workspace routes under `/app`. Use
177
- route-level `ssr: false` for `/app`; Next.js is not a default recommendation.
178
- - Plan D: Shared frontend/backend monorepo. Prefer Bun workspaces with apps,
179
- packages, shared contracts, a Hono gateway, and optional Turborepo only when
180
- repo scale needs orchestration.
181
- - Plan E: Cloudflare edge web stack. Prefer Workers for TanStack Start SSR
182
- webapps, Pages only for static/client-only assets or content shells, and R2,
183
- KV, Queues, Durable Objects, and Hyperdrive where they fit. Do not default to
184
- D1; use Postgres/Supabase or SQLite/Turso unless the D1 tradeoff is explicit.
185
- - Plan F: Mobile/realtime companion. Use Expo Router on React Native New
186
- Architecture, with NativeWind where useful and explicit voice/media/realtime
187
- boundaries when needed.
188
-
189
- Custom Presets (G-K), routed as sidecar/runtime families:
190
- - Plan G: Python research/data/agent sidecar. Use `uv`, FastAPI or Pydantic AI,
191
- DuckDB/Polars, evals, and artifact storage behind the app gateway.
192
- - Plan H: Go high-concurrency or financial sidecar. Use Go/Gin or narrow Go
193
- workers for market data, FIX/RFQ, fan-out, infra adapters, and TS-adjacent
194
- high-concurrency services.
195
- - Plan I: Local-first or lightweight SQL stack. Use SQLite, Turso/libSQL,
196
- Turso Sync for new local-first sync work, Loro or other sync primitives, and
197
- explicit replication/ownership contracts.
198
- - Plan J: Rust native/performance sidecar. Use Rust for parsers, indexing,
199
- sandboxing, native kernels, and low-latency tools when the team can support
200
- the operational complexity.
201
- - Plan K: Fully custom configuration. Use when the stack cannot be expressed as
202
- a composition of the families above.
203
-
204
- Agent runtimes that need stable Node APIs, long-lived processes, local tools,
205
- or heavier sidecars should default to VPS deployment behind the Hono gateway,
206
- not Cloudflare Workers. Cloudflare remains the preferred web/edge delivery
207
- surface, not the mandatory agent execution environment.
208
-
209
- ## AI-native scaffold overlay
210
-
211
- `forge scaffold` keeps A-K as the stack-family catalog and uses
212
- `ai_native_profile` as a separate overlay axis. The default profile is `none`,
213
- so generated output stays on the selected family unless the user asks for agentic
214
- runtime behavior. Use an overlay only when the generated app needs agent UI,
215
- streaming protocol, tool boundary, sidecar, shared state, approvals, artifacts,
216
- or observability.
217
-
218
- Supported profile IDs live in `assets/initializer-question-pack.v4.json`.
219
- Current stack guidance:
220
-
221
- - Use Astro for SSR/content/docs shells and Vite 8 for rich interactive
222
- surfaces. Prefer a shared monorepo over disconnected frontend/backend repos.
223
- - Use TanStack Start + Vite + Cloudflare Workers when a SaaS webapp needs
224
- public landing SEO/SSR and a client-heavy workspace in the same product
225
- surface. Keep `/` SSR/prerender-capable and `/app` client-only.
226
- - Do not scaffold `apps/marketing` plus `apps/web` as the default answer to
227
- SEO/SSR. Treat a static marketing app as explicit legacy/rollback or content
228
- scope, not as the normal SaaS webapp split.
229
- - Use React Router Framework Mode or Vike only as fallback evaluations if the
230
- Start + Workers thin scaffold gate fails. Do not default to Next.js.
231
- - Use Expo Router for mobile and keep React Native New Architecture
232
- compatibility visible in the scaffold.
233
- - Use assistant-ui or AI SDK UI for chat and generative UI primitives; use
234
- AG-UI when the frontend and backend need a durable event stream for runs,
235
- tools, shared state, interrupts, approvals, replay, or multimodal updates.
236
- - Use Bun/Hono as the default app-facing agent gateway. The gateway owns auth,
237
- policy, run IDs, tool contracts, approval state, streaming, and telemetry
238
- before any model framework or sidecar runs.
239
- - Prefer Cloudflare for web and edge delivery, but keep agent runtimes on VPS
240
- when they need Node compatibility, local tools, long-lived workers, or heavier
241
- sidecars. D1 is opt-in, not the default database.
242
- - Use MCP or narrow HTTP jobs for tools and sidecars. Do not let MCP servers,
243
- model providers, or agent frameworks become product authority.
244
- - Keep orchestration swappable: AI SDK for simple provider/tool streaming;
245
- OpenAI Agents SDK, Mastra, LangGraph, Pydantic AI, or a custom runner only
246
- when the product needs multi-step state, handoffs, memory, evals, approvals,
247
- or durable execution.
248
- - Prefer Postgres or Supabase for durable app authority. Use SQLite or
249
- Turso/libSQL for lightweight, local-first, edge, or embedded workloads.
250
- Treat object storage, queues, Redis, vector stores, ClickHouse,
251
- Temporal/Inngest/BullMQ/Trigger.dev, and OpenTelemetry as opt-in capability
252
- boundaries, not mandatory scaffold defaults.
253
-
254
- Generated structure overlays currently exist for:
255
-
256
- - `runtime-console`: assistant-ui/AG-UI run console, Bun/Hono agent gateway,
257
- run store, contracts, approvals, artifacts, replay, and telemetry
258
- - `product-copilot`: in-product copilot panel, AG-UI app-domain events, product
259
- context loaders, business action tools, authorization, and approval policies
260
- - `sidecar-kernel`: Bun/Hono app gateway with Python, Go, or Rust kernels behind
261
- MCP tools or narrow HTTP jobs
262
- - `collaborative-editor`: editor surface with document contracts, CRDT/sync
263
- ownership, and user-visible agent action boundaries
264
-
265
- Do not turn AI-native overlays into more lettered plans. Do not make A2UI,
266
- specific model providers, vector DBs, workflow engines, tracing vendors, or
267
- sidecar languages mandatory defaults.
268
-
269
- Scaffold is not an existing-repo adoption path. If the target already has a
270
- product tree, use `forge adopt`, `forge setup`,
271
- `forge upgrade`, or `forge repair` and preserve the existing app
272
- shape. `create-project-dirs`, `hooks-init`, and `docs-init` remain internal
273
- steps behind public commands, not standalone user-facing scaffold aliases.
274
-
275
- ## Migration Rules
276
-
277
- For legacy repos, migrate old document surfaces before refreshing templates.
278
-
279
- Legacy paths include:
280
-
281
- - `docs/plan.md`
282
- - `docs/TODO.md`
283
- - `docs/PROGRESS.md`
284
- - `docs/contract.md`
285
- - `docs/review.md`
286
- - `docs/handoff.md`
287
- - `HANDOFF.md`
288
-
289
- Use:
290
-
291
- - `bun scripts/migrate-workflow-docs.ts --repo <path> --dry-run`
292
- - `bun scripts/migrate-workflow-docs.ts --repo <path> --apply`
293
-
294
- Migration defaults:
295
-
296
- - preserve user-authored content
297
- - archive uncertain legacy content instead of guessing
298
- - remove repo-local Skill Factory and auto-memory surfaces when present
299
- - archive legacy `docs/PROGRESS.md` content; do not regenerate it as a default workflow surface
300
- - keep `tasks/todos.md` limited to deferred medium/long-term goals, including the tradeoff and revisit trigger
301
- - move hidden contracts and deep findings into topic-scoped `docs/researches/*.md`
302
- - distill repeated corrections into `tasks/lessons.md`
303
- - merge missing `external_tooling` defaults into `.ai/harness/policy.json` without overwriting explicit user values
304
- - keep Waza, gstack, gbrain, Mermaid, and cross-review host skills optional; detect them but never make normal Forge execution depend on them
305
- - `forge install` bootstraps only Forge-owned runtime and host adapters by default; install third-party host skills only with `--with-external-skills`
306
- - Forge task routing uses `/direct`, `/plan`, `/debug`, `/review`, `/release`, and `/scale`; optional host skills may refine those workflows when already installed
307
- - distinguish the bundled CodeGraph read backend used by `rh_context` from an optional global CodeGraph CLI/MCP integration; missing global CLI is not Runtime unready
308
-
309
- ## Repo-Local Contract
310
-
311
- Preserve these semantics:
312
-
313
- - `plans/` is the timestamped plan catalog; `.ai/harness/active-plan` selects the active plan, with `.claude/.active-plan` as a legacy fallback during transition
314
- - `plans/plan-*.md` must carry a workflow inventory before implementation: active plan, owning worktree, contract, review, notes, deferred ledger, checks, run snapshots, scope owner, switching rule, and worktree isolation path
315
- - `tasks/todos.md` is the deferred-goal ledger; active execution stays in the plan's `## Task Breakdown`
316
- - `tasks/lessons.md` stores correction-derived rules
317
- - `docs/researches/*.md` stores deep repo findings and hidden contracts by topic
318
- - `tasks/contracts/` and `tasks/reviews/` are completion gates
319
- - `tasks/contracts/*.contract.md` must repeat the workflow inventory and make `allowed_paths` the edit-scope authority
320
- - `tasks/workstreams/` stores durable capability progress
321
- - `docs/CHANGELOG.md` stores release history
322
- - `assets/hooks/` is the installable hook product source; `.ai/hooks/` is a full live runtime only in repos that pin `"hook_source": "repo"`
323
- - user-level `~/.claude/settings.json` and `~/.codex/hooks.json` are the host adapter surfaces; repo-local `.claude/hooks/`, `.claude/settings.json`, and `.codex/hooks.json` are legacy cleanup targets
324
-
325
- ## Hook Workflow Protocol
326
-
327
- When the task mentions hooks, hook workflow, Codex hook detection, or hook-based
328
- automation, treat it as a runtime-harness slice, not a generic config edit.
329
-
330
- Map the route first:
331
-
332
- 1. `assets/hooks/` is the installable source.
333
- 2. The active runtime resolves central-first through `forge-hook`; `.ai/hooks/`
334
- is a full repo-local implementation only when `"hook_source": "repo"` is pinned.
335
- 3. User-level `~/.claude/settings.json` and `~/.codex/hooks.json` are adapters
336
- that dispatch to the packaged `forge-hook` entry or the equivalent `forge hook` CLI route.
337
- 4. Codex also requires the user-level hook config to be trusted in Codex Settings before it
338
- executes.
339
- 5. Generated `.claude/hooks/`, repo-local `.claude/settings.json`, and repo-local
340
- `.codex/hooks.json` are legacy cleanup targets; preserve only user-authored
341
- `custom-*.sh` hooks.
342
-
343
- Trace one real event before changing behavior, for example:
344
-
345
- `UserPromptSubmit -> adapter -> forge-hook -> prompt-guard.sh -> plan
346
- or advisory output`
347
-
348
- or:
349
-
350
- `PostToolUse(Edit|Write) -> adapter -> forge-hook ->
351
- post-edit-guard.sh -> architecture drift, brain sync, contract verification,
352
- task handoff`
353
-
354
- For Codex hook failures, debug in this order: user-level `~/.codex/hooks.json`,
355
- Codex Settings trust, `forge-hook` resolution, the active target hook
356
- script, then `.ai/harness/events.jsonl` or `.claude/.trace.jsonl` evidence.
357
-
358
- Hooks are accelerators and guards. They do not replace `plans/`, `tasks/`,
359
- contracts, reviews, policy, checks, or handoff artifacts. Heavy workflows such as
360
- autoresearch must not silently run as background hook mutations. The retired
361
- `autoresearch-advisory.sh` hook is not part of `.ai/hooks`, user-level adapters,
362
- or installable hook templates. If autoresearch evidence is needed, the agent
363
- runs it explicitly and keeps local run products under ignored `autoresearch/`
364
- when they must remain in the workspace.
365
-
366
- Verify hook workflow changes with hook-specific evidence:
367
-
368
- - default hook asset parity between `assets/hooks/` and `.ai/hooks/`, with
369
- no self-host-only hook exclusions
370
- - `bun test tests/hook-runtime.test.ts tests/workflow-contract.test.ts`
371
- - `bash scripts/check-task-sync.sh`
372
- - `bash scripts/check-task-workflow.sh --strict`
373
- - `bun scripts/inspect-project-state.ts --repo . --format text`
374
- - `.ai/harness/checks/latest.json`, `.ai/harness/events.jsonl`, or handoff readback
375
-
376
- ## Output Ownership
377
-
378
- This skill may create or update:
379
-
380
- - `AGENTS.md`
381
- - `AGENTS.md`
382
- - `.ai/hooks/*`
383
- - `.claude/settings.json`
384
- - `.codex/hooks.json`
385
- - `.claude/templates/*`
386
- - `docs/spec.md`
387
- - `docs/reference-configs/*.md`
388
- - `tasks/todos.md`
389
- - `tasks/lessons.md`
390
- - `docs/researches/*`
391
- - `tasks/contracts/*`
392
- - `tasks/reviews/*`
393
- - `tasks/workstreams/*`
394
- - `deploy/README.md`
395
- - `deploy/sql/*` for ordered deployment SQL files
396
- - `.ai/harness/*`
397
- - helper scripts under `scripts/`
398
-
399
- ## Verification
400
-
401
- When changing the engine, migration path, contract manifest, or self-hosted workflow, run:
402
-
403
- ```bash
404
- bun run check:task
405
- bash scripts/check-deploy-sql-order.sh
406
- bash scripts/check-task-sync.sh
407
- bash scripts/check-task-workflow.sh --strict
408
- bash scripts/migrate-project-template.sh --repo . --dry-run
409
- ```
410
-
411
- The self-host repository uses content-addressed test governance: ordinary
412
- verification runs the affected/task gate, and `bun run check:main` reuses that
413
- focused receipt without expanding to the full suite. Full testing is an
414
- explicit manual diagnostic, not an ordinary, CI, or release gate.
415
-
416
- For migration-focused work, also inspect and dry-run legacy doc migration explicitly:
417
-
418
- ```bash
419
- bun scripts/inspect-project-state.ts --repo . --format text
420
- bun scripts/migrate-workflow-docs.ts --repo . --dry-run
421
- ```
422
-
423
- ## Iteration Notes
424
-
425
- - Keep this file short; detailed policy belongs in `docs/reference-configs/`
426
- - Keep stack-specific detail in assets and references, not in this skill body
427
- - If the contract changes, update templates, migration, checks, and tests together
@@ -1,103 +0,0 @@
1
- import type {
2
- ComputerChatgptConversationIdentity,
3
- ComputerChatgptConversationInventory,
4
- ComputerChatgptConversationObservationOptions,
5
- ComputerChatgptConversationTarget,
6
- ComputerChatgptConversationTargetPort,
7
- ComputerChatgptTargetIdentity,
8
- ComputerChatgptTargetResult,
9
- } from '../../packages/plugin-runtime/computer';
10
-
11
- function identityOf(target: ComputerChatgptConversationTarget): ComputerChatgptTargetIdentity {
12
- return target.identity;
13
- }
14
-
15
- export class PreferredChatgptConversationTargetPort implements ComputerChatgptConversationTargetPort {
16
- constructor(
17
- private readonly primary: ComputerChatgptConversationTargetPort,
18
- private readonly compatibility: ComputerChatgptConversationTargetPort,
19
- ) {}
20
-
21
- private wrap(primaryTarget: ComputerChatgptConversationTarget, compatibilityTarget?: ComputerChatgptConversationTarget, nativeCompatibility = false): ComputerChatgptConversationTarget {
22
- const identity = identityOf(primaryTarget);
23
- return {
24
- targetId: primaryTarget.targetId,
25
- identity,
26
- observe: async (options?: ComputerChatgptConversationObservationOptions) => {
27
- try { return await primaryTarget.observe(options); }
28
- catch (primaryError) {
29
- if (compatibilityTarget) return await compatibilityTarget.observe(options);
30
- if (identity.namespace === 'chatgpt.conversation') {
31
- const fallback = await this.compatibility.ensureExact(identity);
32
- if (fallback.state === 'ready') return await fallback.target.observe(options);
33
- }
34
- throw primaryError;
35
- }
36
- },
37
- prepare: async (prompt, options) => await primaryTarget.prepare(prompt,
38
- nativeCompatibility && options?.reasoning ? { ...options, reasoning: undefined } : options),
39
- // Only the explicitly selected native fallback lacks a verified reasoning selector.
40
- // Preserve a single sender and every other dispatch option; never retry a
41
- // possibly submitted effect through a different provider.
42
- dispatch: async (prompt, options) => await primaryTarget.dispatch(prompt,
43
- nativeCompatibility && options?.reasoning ? { ...options, reasoning: undefined } : options),
44
- };
45
- }
46
-
47
- async inventory(): Promise<ComputerChatgptConversationInventory> {
48
- const [primary, compatibility] = await Promise.all([
49
- this.primary.inventory().catch(() => ({ conversations: [], complete: false, unavailableProviders: ['primary'] })),
50
- this.compatibility.inventory().catch(() => ({ conversations: [], complete: false, unavailableProviders: ['compatibility'] })),
51
- ]);
52
- const byId = new Map<string, ComputerChatgptConversationInventory['conversations'][number]>();
53
- for (const entry of compatibility.conversations) byId.set(entry.conversationId, entry);
54
- for (const entry of primary.conversations) byId.set(entry.conversationId, entry);
55
- return {
56
- conversations: [...byId.values()],
57
- complete: primary.complete || compatibility.complete,
58
- unavailableProviders: [...new Set([...primary.unavailableProviders, ...compatibility.unavailableProviders])],
59
- };
60
- }
61
-
62
- async ensureExact(identity: ComputerChatgptConversationIdentity): Promise<ComputerChatgptTargetResult> {
63
- const primary = await this.primary.ensureExact(identity);
64
- if (primary.state === 'ready') return { ...primary, target: this.wrap(primary.target) };
65
- // An extension that is not connected has made no browser mutation. Reuse
66
- // the already available native browser target rather than stranding a due
67
- // Supervisor continuation behind an optional transport.
68
- if (primary.failure.failoverSafe === true) {
69
- const compatibility = await this.compatibility.ensureExact(identity);
70
- if (compatibility.state === 'ready') return { ...compatibility, target: this.wrap(compatibility.target, undefined, true) };
71
- }
72
- return primary;
73
- }
74
-
75
- async openBootstrap(projectUrl: string, bootstrapKey: string): Promise<ComputerChatgptTargetResult> {
76
- const primary = await this.primary.openBootstrap(projectUrl, bootstrapKey);
77
- return primary.state === 'ready' ? { ...primary, target: this.wrap(primary.target) } : primary;
78
- }
79
-
80
- async findBySubmittedMarker(marker: string, bootstrapKey?: string, betweenObservations?: () => Promise<void>): Promise<ComputerChatgptTargetResult[]> {
81
- const primary = await this.primary.findBySubmittedMarker(marker, bootstrapKey, betweenObservations);
82
- if (primary.length > 0) return primary.map((result) => result.state === 'ready' ? { ...result, target: this.wrap(result.target) } : result);
83
- return (await this.compatibility.findBySubmittedMarker(marker, bootstrapKey, betweenObservations))
84
- .map((result) => result.state === 'ready' ? { ...result, target: this.wrap(result.target, undefined, true) } : result);
85
- }
86
-
87
- async promoteBootstrap(targetId: string, identity: ComputerChatgptConversationIdentity): Promise<ComputerChatgptTargetResult> {
88
- const primary = await this.primary.promoteBootstrap(targetId, identity);
89
- return primary.state === 'ready' ? { ...primary, target: this.wrap(primary.target) } : primary;
90
- }
91
-
92
- async cleanup(activeResourceKeys: readonly string[]): Promise<void> {
93
- await Promise.allSettled([this.primary.cleanup(activeResourceKeys), this.compatibility.cleanup(activeResourceKeys)]);
94
- }
95
-
96
- async release(targetId: string): Promise<void> {
97
- await Promise.allSettled([this.primary.release(targetId), this.compatibility.release(targetId)]);
98
- }
99
-
100
- async close(): Promise<void> {
101
- await Promise.allSettled([this.primary.close(), this.compatibility.close()]);
102
- }
103
- }