@moretea-labs/forge 1.6.0 → 1.7.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.
- package/AGENTS.md +4 -0
- package/CHANGELOG.md +39 -0
- package/CLAUDE.md +4 -0
- package/README.md +2 -2
- package/README.zh-CN.md +1 -1
- package/SKILL.md +2 -2
- package/THIRD_PARTY_NOTICES.md +1 -1
- package/agents/openai.yaml +1 -1
- package/assets/hooks/hook-input.sh +11 -8
- package/assets/hooks/lib/session-state.sh +10 -7
- package/assets/hooks/lib/workflow-state.sh +13 -177
- package/assets/hooks/post-tool-observer.sh +8 -2
- package/assets/hooks/prompt-guard.sh +5 -81
- package/assets/hooks/session-start-context.sh +56 -1
- package/assets/partials/05-workflow.partial.md +1 -1
- package/assets/partials-agents/02-operating-mode.partial.md +2 -0
- package/assets/partials-agents/03-orchestration.partial.md +1 -1
- package/assets/plugin-registry.v1.json +3 -3
- package/assets/reference-configs/document-generation.md +1 -1
- package/assets/reference-configs/harness-overview.md +1 -1
- package/assets/reference-configs/sprint-contracts.md +3 -3
- package/assets/skill-version.json +2 -2
- package/assets/templates/contract.template.md +2 -7
- package/assets/templates/helpers/capture-plan.sh +2 -2
- package/assets/templates/helpers/check-architecture-sync.sh +17 -0
- package/assets/templates/helpers/check-task-workflow.sh +4 -4
- package/assets/templates/helpers/contract-worktree.sh +1 -21
- package/assets/templates/helpers/ensure-task-workflow.sh +11 -36
- package/assets/templates/helpers/inspect-project-state.ts +8 -6
- package/assets/templates/helpers/migrate-project-template.sh +22 -45
- package/assets/templates/helpers/migrate-workflow-docs.ts +9 -7
- package/assets/templates/helpers/new-plan.sh +1 -1
- package/assets/templates/helpers/plan-to-todo.sh +12 -37
- package/assets/templates/helpers/ship-worktrees.sh +2 -29
- package/assets/templates/helpers/verify-contract.sh +1 -111
- package/assets/templates/helpers/verify-sprint.sh +3 -180
- package/assets/templates/helpers/workflow-contract.ts +5 -1
- package/assets/templates/plan.template.md +1 -1
- package/assets/templates/review.template.md +9 -34
- package/assets/workflow-contract.v1.json +10 -19
- package/docs/README.md +10 -10
- package/docs/architecture/CURRENT.md +178 -0
- package/docs/architecture/EVOLUTION.md +42 -0
- package/docs/architecture/current/README.md +4 -156
- package/docs/architecture/decisions/20260803-release-identity-binding-and-exit-policy.md +2 -2
- package/docs/architecture/decisions/20260823-immediate-controller-relay.md +53 -0
- package/docs/architecture/decisions/20260826-browser-runtime-v2.md +73 -0
- package/docs/architecture/history/README.md +7 -0
- package/docs/architecture/{chatgpt-handoff-facade.md → history/chatgpt-handoff-facade.md} +4 -0
- package/docs/architecture/{global-hook-runtime.md → history/global-hook-runtime.md} +7 -3
- package/docs/architecture/{ios-semantic-automation-provider-v2.md → history/ios-semantic-automation-provider-v2.md} +6 -2
- package/docs/architecture/history.md +3 -34
- package/docs/architecture/index.md +15 -98
- package/docs/architecture/modules/controller-runtime/transport-lifecycle.md +1 -1
- package/docs/architecture/reviews/2026-08-22-semantic-harness-convergence-acceptance.md +39 -0
- package/docs/architecture/versions/1.6.md +38 -0
- package/docs/architecture/versions/1.7.md +41 -0
- package/docs/forge-chatgpt-browser-engine.md +2 -2
- package/docs/forge-chatgpt-mcp-setup.md +4 -28
- package/docs/forge-chatgpt-supervised-automation.md +3 -3
- package/docs/forge-github-issue-launcher.md +1 -1
- package/docs/forge-plugin-management.md +1 -1
- package/docs/forge-runtime-self-healing-loop.md +1 -1
- package/docs/operations/controller-browser-plugin.md +26 -6
- package/docs/operations/controller-performance-and-502.md +143 -0
- package/docs/operations/controller-reliability-runbook.md +1 -1
- package/docs/operations/features.md +2 -2
- package/docs/operations/github-repository.md +1 -1
- package/docs/operations/homebrew.md +2 -2
- package/docs/operations/mcp-tool-exposure.md +5 -3
- package/docs/wiki/Architecture.md +6 -6
- package/docs/wiki/Implementation.md +2 -2
- package/docs/wiki/Integrations.md +2 -2
- package/docs/wiki/Work-Lifecycle.md +1 -1
- package/package.json +33 -11
- package/scripts/activate-source-baseline.ts +17 -13
- package/scripts/architecture-event.ts +2 -820
- package/scripts/architecture-queue.sh +2 -645
- package/scripts/archive-architecture-request.sh +2 -242
- package/scripts/archive-workflow.sh +1 -291
- package/scripts/benchmark-background-check-overlap.ts +228 -0
- package/scripts/benchmark-mcp-host.sh +117 -0
- package/scripts/benchmark-mcp-transport.ts +170 -0
- package/scripts/benchmark-quality-harness.ts +146 -0
- package/scripts/benchmark-route-session-concurrency.ts +207 -6
- package/scripts/benchmark-thin-harness-mcp-e2e.ts +7 -1
- package/scripts/benchmark-typescript-navigation.ts +186 -0
- package/scripts/benchmark-work-efficiency.ts +334 -0
- package/scripts/capability-config.ts +2 -392
- package/scripts/capability-resolver.ts +2 -503
- package/scripts/capture-plan.sh +1 -332
- package/scripts/check-agent-tooling.sh +2 -1558
- package/scripts/check-architecture-sync.sh +2 -371
- package/scripts/check-brain-manifest.sh +2 -253
- package/scripts/check-context-files.sh +2 -47
- package/scripts/check-deploy-sql-order.sh +2 -115
- package/scripts/check-mcp-compatibility.ts +14 -0
- package/scripts/check-runtime-architecture.mjs +349 -79
- package/scripts/check-skill-version.ts +3 -191
- package/scripts/check-source-duplication.mjs +61 -0
- package/scripts/check-stable-baseline.ts +92 -0
- package/scripts/check-task-sync.sh +2 -63
- package/scripts/check-task-workflow.sh +2 -1000
- package/scripts/codex-handoff-resume.sh +2 -267
- package/scripts/context-contract-sync.sh +2 -514
- package/scripts/contract-run.ts +2 -463
- package/scripts/contract-worktree.sh +1 -722
- package/scripts/ensure-task-workflow.sh +1 -1225
- package/scripts/host-temporary-cloud-mcp-e2e.sh +265 -0
- package/scripts/inspect-project-state.ts +4 -279
- package/scripts/install-standalone-recovery.ts +24 -0
- package/scripts/lib/project-init-lib.sh +22 -46
- package/scripts/lib/run-forge-helper.sh +19 -0
- package/scripts/lib/run-forge-helper.ts +26 -0
- package/scripts/migrate-project-template.sh +1 -1189
- package/scripts/migrate-workflow-docs.ts +4 -412
- package/scripts/new-plan.sh +1 -180
- package/scripts/new-spec.sh +1 -47
- package/scripts/new-sprint.sh +1 -46
- package/scripts/plan-to-todo.sh +1 -796
- package/scripts/prepare-codex-handoff.sh +2 -201
- package/scripts/prepare-handoff.sh +1 -78
- package/scripts/refresh-current-status.sh +2 -467
- package/scripts/run-governed-gate.ts +5 -1
- package/scripts/select-agent-context-blocks.sh +2 -64
- package/scripts/ship-worktrees.sh +1 -558
- package/scripts/smoke-ios-physical-device.ts +4 -2
- package/scripts/smoke-runtime-recovery.ts +1 -35
- package/scripts/smoke-schedule-engine.ts +1 -20
- package/scripts/sprint-backlog.sh +1 -834
- package/scripts/stage-runtime-release.ts +2 -1
- package/scripts/summarize-failures.sh +2 -123
- package/scripts/switch-plan.sh +1 -150
- package/scripts/sync-brain-docs.sh +2 -379
- package/scripts/sync-generated-authority.mjs +175 -0
- package/scripts/verify-contract.sh +2 -703
- package/scripts/verify-forge-runtime.sh +0 -1
- package/scripts/verify-sprint.sh +1 -677
- package/scripts/workflow-contract.ts +4 -205
- package/scripts/workstream-sync.sh +2 -261
- package/src/cli/agent-jobs/executor-health.ts +1 -1
- package/src/cli/commands/init-hook.ts +3 -3
- package/src/cli/commands/mcp.ts +9 -5
- package/src/cli/commands/plugin.ts +12 -3
- package/src/cli/commands/recovery.ts +25 -3
- package/src/cli/commands/runtime.ts +55 -3
- package/src/cli/commands/security.ts +12 -1
- package/src/cli/commands/setup-profile.ts +31 -21
- package/src/cli/controller/check-runner.ts +113 -5
- package/src/cli/controller/composite-result.ts +1 -1
- package/src/cli/controller/context/focus.ts +51 -0
- package/src/cli/controller/context/instruction-context.ts +114 -0
- package/src/cli/controller/context/known-paths.ts +76 -0
- package/src/cli/controller/context/query-planning.ts +110 -0
- package/src/cli/controller/context/rule-resolution.ts +532 -0
- package/src/cli/controller/context/source-materializer.ts +278 -0
- package/src/cli/controller/context/structural.ts +16 -0
- package/src/cli/controller/context/types.ts +286 -0
- package/src/cli/controller/context-pack.ts +828 -487
- package/src/cli/controller/launch-agents.ts +77 -2
- package/src/cli/controller/operational-plan.ts +2 -2
- package/src/cli/controller/work-mode.ts +6 -4
- package/src/cli/editing/edit-session.ts +60 -7
- package/src/cli/github/contracts.ts +16 -0
- package/src/cli/github/github.ts +135 -16
- package/src/cli/github/session.ts +2 -1
- package/src/cli/installer/managed-entries.ts +15 -1
- package/src/cli/local-bridge/console-automations.ts +54 -78
- package/src/cli/local-bridge/console-view-models.ts +1 -35
- package/src/cli/local-bridge/facade-api.ts +37 -264
- package/src/cli/local-bridge/frontend/src/App.tsx +3 -3
- package/src/cli/local-bridge/frontend/src/features/automations/AutomationsView.tsx +23 -13
- package/src/cli/local-bridge/frontend/src/features/capabilities/CapabilitiesView.tsx +37 -4
- package/src/cli/local-bridge/frontend/src/features/overview/OverviewView.tsx +6 -4
- package/src/cli/local-bridge/frontend/src/lib/api.ts +1 -6
- package/src/cli/local-bridge/frontend/src/lib/routes.ts +1 -1
- package/src/cli/local-bridge/frontend/src/shell/Sidebar.tsx +2 -2
- package/src/cli/local-bridge/frontend/src/styles.css +1 -1
- package/src/cli/local-bridge/frontend/src/types.ts +5 -8
- package/src/cli/local-bridge/job-store.ts +1 -490
- package/src/cli/local-bridge/server.ts +2 -515
- package/src/cli/local-bridge/ui-dist/app.css +1 -1
- package/src/cli/local-bridge/ui-dist/app.js +3703 -3757
- package/src/cli/mcp/auth.ts +5 -5
- package/src/cli/mcp/instructions.ts +3 -2
- package/src/cli/mcp/legacy-tool-service.ts +10 -222
- package/src/cli/mcp/multi-repository.ts +16 -5
- package/src/cli/mcp/oauth.ts +175 -26
- package/src/cli/mcp/post-finalize-work-attribution.ts +150 -0
- package/src/cli/mcp/repository-tools.ts +282 -146
- package/src/cli/mcp/server.ts +586 -116
- package/src/cli/mcp/tool-capability-cache.ts +1 -1
- package/src/cli/mcp/tool-contract.ts +14 -0
- package/src/cli/mcp/toolset-selection.ts +1 -1
- package/src/cli/mcp/toolset.ts +44 -7
- package/src/cli/mcp/transports/http.ts +124 -14
- package/src/cli/mcp/transports/session-registry.ts +43 -5
- package/src/cli/mcp/types.ts +3 -3
- package/src/cli/repositories/command-classifier.ts +103 -21
- package/src/cli/repositories/command-executor.ts +78 -526
- package/src/cli/repositories/command-process.ts +108 -0
- package/src/cli/repositories/command-scope.ts +99 -41
- package/src/cli/repositories/controller-home.ts +7 -8
- package/src/cli/repositories/git-command-executor.ts +2 -0
- package/src/cli/repositories/locks.ts +53 -16
- package/src/cli/repositories/repository-snapshot.ts +124 -0
- package/src/cli/repositories/selected-path-actions.ts +17 -9
- package/src/cli/repositories/structured-git.ts +118 -6
- package/src/cli/repository/inspector.ts +563 -65
- package/src/cli/repository/session-cache.ts +58 -17
- package/src/cli/v81-entry.ts +1 -4
- package/src/effects/fs-transaction.ts +85 -17
- package/src/runtime/context/codegraph-read-provider.ts +233 -2
- package/src/runtime/context/codegraph-sidecar.cjs +74 -40
- package/src/runtime/context/generic-lsp-provider.ts +355 -0
- package/src/runtime/context/lsp-client.ts +283 -0
- package/src/runtime/context/semantic-navigation-contract.ts +61 -0
- package/src/runtime/context/semantic-navigation.ts +223 -0
- package/src/runtime/context/swift-navigation.ts +565 -0
- package/src/runtime/context/typescript-navigation.ts +226 -0
- package/src/runtime/control-plane/dispatch-priority.ts +28 -0
- package/src/runtime/control-plane/execution/direct-edit-work-completion.ts +48 -16
- package/src/runtime/control-plane/execution/edit-validation-coordinator.ts +86 -24
- package/src/runtime/control-plane/execution/repository-work-attribution.ts +106 -0
- package/src/runtime/control-plane/execution/retained-work-resume.ts +203 -0
- package/src/runtime/control-plane/execution/session-store.ts +18 -0
- package/src/runtime/control-plane/execution/verification-evidence.ts +58 -3
- package/src/runtime/control-plane/execution/work-completion-authority.ts +58 -0
- package/src/runtime/control-plane/execution/work-evidence-policy.ts +200 -0
- package/src/runtime/control-plane/execution/work-execution-support.ts +386 -0
- package/src/runtime/control-plane/execution/work-finalization-service.ts +1913 -0
- package/src/runtime/control-plane/execution/work-handle-authority.ts +96 -0
- package/src/runtime/control-plane/execution/work-handle-store.ts +27 -2
- package/src/runtime/control-plane/execution/work-lifecycle-audit.ts +258 -0
- package/src/runtime/control-plane/execution/work-operation-service.ts +468 -0
- package/src/runtime/control-plane/execution/work-path-scope.ts +37 -0
- package/src/runtime/control-plane/execution/work-preparation-service.ts +479 -0
- package/src/runtime/control-plane/execution/work-process-evidence.ts +129 -0
- package/src/runtime/control-plane/execution/work-remote-delivery.ts +215 -0
- package/src/runtime/control-plane/execution/work-task-receipt.ts +22 -18
- package/src/runtime/control-plane/execution/work-terminal-cleanup.ts +156 -11
- package/src/runtime/control-plane/execution/work-validation-reconciler.ts +22 -14
- package/src/runtime/control-plane/execution/work-verification-context.ts +56 -0
- package/src/runtime/control-plane/execution/work-verification-service.ts +388 -0
- package/src/runtime/control-plane/execution/work-verification-snapshot.ts +90 -9
- package/src/runtime/control-plane/facade/capability-registry.ts +129 -25
- package/src/runtime/control-plane/facade/controller-round-relay.ts +1118 -0
- package/src/runtime/control-plane/facade/controller-session-store.ts +302 -12
- package/src/runtime/control-plane/facade/goal-workloop-access.ts +17 -1
- package/src/runtime/control-plane/facade/goal-workloop.ts +928 -190
- package/src/runtime/control-plane/facade/index.ts +3 -0
- package/src/runtime/control-plane/facade/plan-contract-store.ts +275 -42
- package/src/runtime/control-plane/facade/repository-work-admission.ts +147 -0
- package/src/runtime/control-plane/facade/requirement-authority.ts +83 -0
- package/src/runtime/control-plane/facade/semantic-admission.ts +205 -0
- package/src/runtime/control-plane/facade/suggested-actions.ts +5 -1
- package/src/runtime/control-plane/facade/types.ts +90 -10
- package/src/runtime/control-plane/facade/work-contract-store.ts +157 -261
- package/src/runtime/control-plane/facade/work-state-machine.ts +250 -0
- package/src/runtime/control-plane/generated-cache-retention.ts +271 -0
- package/src/runtime/control-plane/global-scheduler/config.ts +44 -0
- package/src/runtime/control-plane/global-scheduler/dispatch-capacity.ts +80 -0
- package/src/runtime/control-plane/global-scheduler/durable-admission.ts +46 -0
- package/src/runtime/control-plane/global-scheduler/maintenance.ts +152 -0
- package/src/runtime/control-plane/global-scheduler/projection-refresh.ts +84 -0
- package/src/runtime/control-plane/global-scheduler/reconciliation.ts +3 -3
- package/src/runtime/control-plane/global-scheduler/scheduler.ts +278 -543
- package/src/runtime/control-plane/global-scheduler/source-scan.ts +59 -0
- package/src/runtime/control-plane/global-scheduler/state.ts +88 -0
- package/src/runtime/control-plane/global-scheduler/worker-attachment.ts +57 -0
- package/src/runtime/control-plane/global-scheduler/worker-exit-decision.ts +38 -0
- package/src/runtime/control-plane/global-scheduler/worker-exit-reconciler.ts +175 -0
- package/src/runtime/control-plane/global-scheduler/worker-launch.ts +111 -0
- package/src/runtime/control-plane/global-scheduler/worker-lifecycle-store.ts +64 -0
- package/src/runtime/control-plane/global-scheduler/worker-lifecycle.ts +150 -0
- package/src/runtime/control-plane/global-scheduler/worker-process.ts +119 -0
- package/src/runtime/control-plane/global-scheduler/worker-stderr.ts +60 -0
- package/src/runtime/control-plane/launcher/chatgpt-work-binding-store.ts +63 -0
- package/src/runtime/control-plane/launcher/chatgpt-work-continuation.ts +365 -117
- package/src/runtime/control-plane/launcher/launch-reservation-store.ts +89 -0
- package/src/runtime/control-plane/launcher/thin-launcher.ts +244 -11
- package/src/runtime/control-plane/persistence/controller-home-migration.ts +487 -0
- package/src/runtime/control-plane/persistence/requirement-store.ts +0 -12
- package/src/runtime/control-plane/persistence/sqlite-store.ts +33 -2
- package/src/runtime/control-plane/release-retention.ts +62 -2
- package/src/runtime/control-plane/repo-actor/registry.ts +4 -2
- package/src/runtime/control-plane/routing/route-policy.ts +24 -21
- package/src/runtime/control-plane/routing/workspace-admission.ts +70 -0
- package/src/runtime/control-plane/runtime-status-client.ts +0 -2
- package/src/runtime/diagnostics/mcp-timing.ts +13 -0
- package/src/runtime/diagnostics/mcp-transport-benchmark.ts +129 -0
- package/src/runtime/diagnostics/performance.ts +24 -1
- package/src/runtime/evidence/event-ledger.ts +1 -1
- package/src/runtime/evidence/process-check-execution.ts +18 -0
- package/src/runtime/execution/jobs/child-reference.ts +6 -2
- package/src/runtime/execution/jobs/store.ts +58 -4
- package/src/runtime/execution/jobs/types.ts +1 -1
- package/src/runtime/execution/managed-workspace.ts +203 -1
- package/src/runtime/execution/process-runtime/check-facade.ts +51 -4
- package/src/runtime/execution/process-runtime/check-result.ts +88 -0
- package/src/runtime/execution/process-runtime/check-runner-sidecar.ts +7 -1
- package/src/runtime/execution/process-runtime/check-scheduling.ts +114 -0
- package/src/runtime/execution/process-runtime/command-facade.ts +367 -40
- package/src/runtime/execution/process-runtime/gc.ts +38 -6
- package/src/runtime/execution/process-runtime/lightweight-managed.ts +1201 -0
- package/src/runtime/execution/process-runtime/persisted-check.ts +51 -5
- package/src/runtime/execution/process-runtime/resource-claims.ts +10 -6
- package/src/runtime/execution/process-runtime/runtime.ts +53 -3
- package/src/runtime/execution/process-runtime/store.ts +1 -0
- package/src/runtime/execution/process-runtime/types.ts +4 -12
- package/src/runtime/execution/thin-harness/async-process.ts +12 -2
- package/src/runtime/execution/thin-harness/search-worker.ts +54 -5
- package/src/runtime/execution/work-activity.ts +21 -0
- package/src/runtime/execution/workers/executor.ts +18 -61
- package/src/runtime/gateway/mcp/execution-tools.ts +35 -1852
- package/src/runtime/gateway/mcp/legacy-ios-tool-adapter.ts +61 -0
- package/src/runtime/gateway/mcp/process-tools.ts +83 -37
- package/src/runtime/gateway/mcp/router.ts +186 -84
- package/src/runtime/gateway/mcp/runtime-tool-definitions.ts +565 -0
- package/src/runtime/gateway/mcp/runtime-tools.ts +2378 -1947
- package/src/runtime/plugins/app-store-connect-adapter.ts +216 -47
- package/src/runtime/plugins/browser-adapter.ts +2662 -829
- package/src/runtime/plugins/browser-automation-service.ts +10 -0
- package/src/runtime/plugins/browser-handoff-host.ts +2 -25
- package/src/runtime/plugins/browser-handoff.ts +110 -5
- package/src/runtime/plugins/browser-macos-bridge.ts +701 -63
- package/src/runtime/plugins/browser-manifest-surface.ts +603 -0
- package/src/runtime/plugins/browser-native-session-service.ts +222 -0
- package/src/runtime/plugins/browser-node-bridge.ts +6 -34
- package/src/runtime/plugins/browser-provider-registry.ts +109 -0
- package/src/runtime/plugins/browser-runtime-contract.ts +154 -0
- package/src/runtime/plugins/browser-runtime.ts +193 -0
- package/src/runtime/plugins/browser-session-authority.ts +332 -0
- package/src/runtime/plugins/browser-session-store.ts +121 -0
- package/src/runtime/plugins/browser-session-types.ts +98 -0
- package/src/runtime/plugins/capability-authorization-grants.ts +354 -0
- package/src/runtime/plugins/desktop-operator-registration.ts +10 -4
- package/src/runtime/plugins/external-adapter.ts +358 -3
- package/src/runtime/plugins/external-unix-socket.ts +7 -1
- package/src/runtime/plugins/first-party-registry.ts +2 -0
- package/src/runtime/plugins/github-adapter.ts +125 -0
- package/src/runtime/plugins/ios/agent-device-provider.ts +1 -1
- package/src/runtime/plugins/ios/agent-device-typed-provider.ts +52 -9
- package/src/runtime/plugins/ios/remote-xpc-hid.ts +1171 -0
- package/src/runtime/plugins/ios-adapter.ts +106 -16
- package/src/runtime/plugins/ios-agent-device.ts +234 -64
- package/src/runtime/plugins/ios-physical-device.ts +1143 -392
- package/src/runtime/plugins/lightweight-action.ts +153 -0
- package/src/runtime/plugins/local-system-adapter.ts +123 -6
- package/src/runtime/plugins/macos-capability-broker.ts +47 -9
- package/src/runtime/plugins/plugin-action-sidecar.ts +59 -0
- package/src/runtime/plugins/plugin-management-adapter.ts +49 -8
- package/src/runtime/plugins/resend-adapter.ts +1 -1
- package/src/runtime/plugins/store.ts +330 -33
- package/src/runtime/plugins/types.ts +38 -3
- package/src/runtime/plugins/xiaohongshu-publish.ts +515 -0
- package/src/runtime/projections/git-status-sampler.ts +16 -16
- package/src/runtime/projections/materialized-view.ts +28 -10
- package/src/runtime/recovery/maintenance-executor.ts +426 -25
- package/src/runtime/root/mcp-transport.ts +180 -10
- package/src/runtime/root/package-connector-service.ts +230 -10
- package/src/runtime/root/package-runtime-release.ts +143 -17
- package/src/runtime/root/package-runtime-service.ts +461 -22
- package/src/runtime/root/release-manifest.ts +144 -18
- package/src/runtime/root/release-materialize.ts +125 -32
- package/src/runtime/root/release-store.ts +48 -11
- package/src/runtime/root/runtime.ts +23 -5
- package/src/runtime/root/service.ts +100 -29
- package/src/runtime/root/types.ts +12 -0
- package/src/runtime/safe-tooling/ios-development.ts +321 -63
- package/src/runtime/shared/trusted-executable.ts +62 -0
- package/src/runtime/shared/trusted-node-executable.ts +48 -0
- package/src/runtime/standalone-recovery/core.ts +1079 -240
- package/src/runtime/standalone-recovery/entry.ts +100 -24
- package/src/runtime/standalone-recovery/installer.ts +20 -4
- package/src/runtime/standalone-recovery/service-labels.ts +2 -0
- package/src/runtime/standalone-recovery/watchdog-heartbeat.ts +160 -0
- package/src/runtime/workflow/schedules/browser-probe.ts +81 -3
- package/src/runtime/workflow/schedules/engine.ts +364 -202
- package/src/runtime/workflow/schedules/github-issue-watch.ts +158 -0
- package/src/runtime/workflow/schedules/settlement.ts +64 -17
- package/src/runtime/workflow/schedules/store.ts +209 -19
- package/src/runtime/workflow/schedules/types.ts +2 -4
- package/src/runtime/workflow/schedules/work-continuation.ts +26 -13
- package/src/testing/test-governance.ts +8 -40
- package/assets/reference-configs/heartbeat-triage.md +0 -57
- package/assets/templates/helpers/harness-trace-grade.sh +0 -150
- package/assets/templates/helpers/heartbeat-triage.sh +0 -361
- package/assets/templates/helpers/maintenance-triage.sh +0 -167
- package/docs/architecture/current/approved-target-architecture.zh-CN.md +0 -1501
- package/docs/architecture/current/architecture-invariants.md +0 -331
- package/docs/architecture/current/automation-and-schedule-engine.md +0 -459
- package/docs/architecture/current/codegraph-context-provider.md +0 -238
- package/docs/architecture/current/control-plane-authority-inventory.md +0 -94
- package/docs/architecture/current/controller-repository-decoupling.md +0 -148
- package/docs/architecture/current/dispatch-and-agent-strategy.md +0 -373
- package/docs/architecture/current/entity-model.md +0 -612
- package/docs/architecture/current/external-plugin-governance.md +0 -396
- package/docs/architecture/current/failure-recovery.md +0 -447
- package/docs/architecture/current/governance.md +0 -213
- package/docs/architecture/current/human-interaction-plane.md +0 -87
- package/docs/architecture/current/implementation-status.md +0 -128
- package/docs/architecture/current/job-and-run-lifecycle.md +0 -413
- package/docs/architecture/current/legacy-governance.md +0 -58
- package/docs/architecture/current/local-workspace-target-grants.md +0 -70
- package/docs/architecture/current/migration-roadmap.md +0 -105
- package/docs/architecture/current/multi-repository-execution.md +0 -371
- package/docs/architecture/current/operations-runbook.md +0 -45
- package/docs/architecture/current/peer-supercontroller-runtime.md +0 -32
- package/docs/architecture/current/personal-assistant-plugin-baseline.md +0 -206
- package/docs/architecture/current/repository-access-modes.md +0 -102
- package/docs/architecture/current/route-policy.md +0 -15
- package/docs/architecture/current/route-session-concurrency.md +0 -85
- package/docs/architecture/current/runtime-architecture-simplification.md +0 -214
- package/docs/architecture/current/runtime-directory-map.md +0 -49
- package/docs/architecture/current/runtime-health-and-resource-lifecycle.md +0 -85
- package/docs/architecture/current/scheduler-and-resource-claims.md +0 -422
- package/docs/architecture/current/session-aware-execution-and-authorization.md +0 -77
- package/docs/architecture/current/system-overview.md +0 -169
- package/docs/architecture/current/target-requirements-traceability.md +0 -202
- package/docs/architecture/current/thin-harness-governance-policy.md +0 -32
- package/docs/architecture/current/thin-harness-v1.md +0 -321
- package/docs/architecture/current/verification-and-release-gates.md +0 -391
- package/docs/forge-autonomous-goal-loop.md +0 -9
- package/docs/forge-provider-configuration.md +0 -7
- package/docs/operations/chatgpt-personal-assistant-runtime.md +0 -93
- package/docs/operations/gmail-assistant-routines.md +0 -186
- package/docs/operations/personal-assistant-operator-guide.md +0 -61
- package/docs/operations/provider-configuration.md +0 -31
- package/scripts/harness-trace-grade.sh +0 -150
- package/scripts/heartbeat-triage.sh +0 -361
- package/scripts/maintenance-triage.sh +0 -167
- package/src/cli/local-bridge/frontend/src/features/settings/SettingsView.tsx +0 -2
- package/src/cli/repositories/goal-registry.ts +0 -239
- package/src/runtime/assistant/action-proposals.ts +0 -279
- package/src/runtime/assistant/intent.ts +0 -395
- package/src/runtime/assistant/model-provider.ts +0 -460
- package/src/runtime/assistant/openapi.ts +0 -223
- package/src/runtime/assistant/policy.ts +0 -89
- package/src/runtime/assistant/readiness.ts +0 -258
- package/src/runtime/assistant/routine-runtime.ts +0 -477
- package/src/runtime/assistant/schedule-binding.ts +0 -171
- package/src/runtime/assistant/standing-grants.ts +0 -375
- package/src/runtime/assistant/store.ts +0 -243
- package/src/runtime/assistant/types.ts +0 -135
- package/src/runtime/control-plane/goal-loop/config-facade.ts +0 -700
- package/src/runtime/control-plane/goal-loop/config-store.ts +0 -570
- package/src/runtime/control-plane/goal-loop/config-types.ts +0 -213
- package/src/runtime/control-plane/goal-loop/executor-router.ts +0 -109
- package/src/runtime/control-plane/goal-loop/failure-taxonomy.ts +0 -149
- package/src/runtime/control-plane/goal-loop/goal-contract-store.ts +0 -304
- package/src/runtime/control-plane/goal-loop/goal-loop-engine.ts +0 -1001
- package/src/runtime/control-plane/goal-loop/handoff-packet.ts +0 -160
- package/src/runtime/control-plane/goal-loop/index.ts +0 -13
- package/src/runtime/control-plane/goal-loop/local-tools.ts +0 -290
- package/src/runtime/control-plane/goal-loop/policy-gates.ts +0 -203
- package/src/runtime/control-plane/goal-loop/provider-dispatch.ts +0 -93
- package/src/runtime/control-plane/goal-loop/provider-registry.ts +0 -545
- package/src/runtime/control-plane/goal-loop/types.ts +0 -378
- package/src/runtime/control-plane/startup-recovery.ts +0 -198
- package/src/runtime/gateway/mcp/resource-policy.ts +0 -186
- package/src/runtime/personal-assistant/gmail-triage-manager.ts +0 -231
- package/src/runtime/personal-assistant/reporting-runtime.ts +0 -344
- package/src/runtime/personal-assistant/triage-runtime.ts +0 -748
- package/src/runtime/workflow/findings/store.ts +0 -204
- package/src/runtime/workflow/findings/types.ts +0 -58
- package/src/runtime/workflow/portfolio/engine.ts +0 -20
- package/src/runtime/workflow/portfolio/store.ts +0 -185
- package/src/runtime/workflow/portfolio/types.ts +0 -29
package/AGENTS.md
CHANGED
|
@@ -43,6 +43,10 @@ Treat ChatGPT as the controller and Forge as its repository execution layer. Cha
|
|
|
43
43
|
|
|
44
44
|
## Operating Rules
|
|
45
45
|
|
|
46
|
+
- Default to end-to-end execution and minimize avoidable human intervention. Continue through reversible, policy-allowed setup, implementation, verification, cleanup, and delivery steps without asking the user to babysit the workflow; stop only at a genuinely user-only identity, legal/contract, financial authorization, strong-confirmation, or irreversible decision boundary.
|
|
47
|
+
- For authenticated browser work, preserve the user's existing browser identity: reuse the already-running signed-in Google Chrome via attach-preferred, native-auto, Chrome-only, fail-closed routing. Preserve its cookies, tokens, sessions, and settings; never silently launch or switch to a managed, isolated, Vivaldi, or otherwise unauthenticated browser/profile. Managed or isolated browser modes require an explicit task/action request. If the user Chrome cannot be attached safely, fail closed and surface the concrete blocker instead of creating a replacement login state.
|
|
48
|
+
- After a managed repository change is verified and committed/merged, push the delivered target branch to its configured remote promptly. Do not leave a successfully delivered commit only on local refs unless the user explicitly requested local-only delivery or the push is blocked by safety, permissions, authentication, or branch policy; surface the exact blocker when a push cannot complete.
|
|
49
|
+
- Treat the Google Cloud `forge-cloud` VM experiment as retired infrastructure. Do not restart or reuse that VM for Forge Cloud. Any future remote Forge maintainer must use a separately evaluated host/transport and must demonstrate better latency and reliability than the local Forge path before adoption.
|
|
46
50
|
- Sync `tasks/` whenever substantive repo changes are made.
|
|
47
51
|
- Use `tasks/notes/<plan-stem>.notes.md` only for non-obvious slice decisions, deviations, tradeoffs, and open questions; `<plan-stem>` is the active plan filename without `plan-` and `.md` (for example `20260531-0045-governance-workflow`). Do not use notes as durable memory or a task log, and archive/promote them deliberately when the slice closes.
|
|
48
52
|
- Treat hook execution as central-first: trusted repos run `~/.forge/hooks/` (bash shim) or the packaged CLI copy; this self-host repo pins `"hook_source": "repo"` in `.ai/harness/policy.json` so `.ai/hooks/` stays the live development runtime, with `assets/hooks/` as the product source mirrored on install. User-level `~/.claude/settings.json` and `~/.codex/hooks.json` are the host adapters.
|
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,45 @@ All notable public Forge changes are recorded here. Release entries are tied to
|
|
|
4
4
|
|
|
5
5
|
## Unreleased
|
|
6
6
|
|
|
7
|
+
## 1.7.1 - 2026-08-30
|
|
8
|
+
|
|
9
|
+
### Runtime and lifecycle stabilization
|
|
10
|
+
|
|
11
|
+
- Prevent effect-only Work from losing repository source deltas during finalization, and recognize successful trusted Work-bound `git push` Process receipts as remote-effect completion authority.
|
|
12
|
+
- Harden controller continuation and terminalization across MCP/session rollover while keeping unrelated conversations isolated, and add stable Requirement-backed business-goal identity so stale continuation cannot silently revive superseded goals.
|
|
13
|
+
- Add bounded post-deadline external Codex claim settlement plus precise Work checkout-mismatch diagnostics, preserving fail-closed fencing without false launcher timeouts.
|
|
14
|
+
|
|
15
|
+
### Browser and release closure
|
|
16
|
+
|
|
17
|
+
- Converge Browser/desktop automation on the signed Forge Desktop Operator boundary, retain Runtime packaging for the browser handoff host, and close historical capability/permission drift without granting privileged macOS access to Runtime.
|
|
18
|
+
- Re-run the full main, MCP compatibility, package, public-surface, open-source, tarball-install, Runtime Recovery, schedule, and tool-surface release contracts before publication.
|
|
19
|
+
|
|
20
|
+
## 1.7.0 - 2026-08-27
|
|
21
|
+
|
|
22
|
+
### Persistent autonomous control
|
|
23
|
+
|
|
24
|
+
- Add the durable Schedule → Work → ChatGPT conversation continuation contract, explicit round dispositions, effect-only Work/finalization semantics, and tab settlement after Controller release instead of immediately after prompt dispatch.
|
|
25
|
+
- Keep transient Browser/connector readiness failures on bounded backoff without permanently disabling schedules, while authentication, consent, destructive actions, and other hard boundaries remain fail-closed.
|
|
26
|
+
- Make real timer-origin continuation and the Continuous Evolution Supervisor a stable-release gate rather than treating schedule configuration alone as proof of autonomous operation.
|
|
27
|
+
|
|
28
|
+
### Browser Runtime V3
|
|
29
|
+
|
|
30
|
+
- Promote Browser Runtime V3 as the current browser architecture with one Controller Home BrowserSession authority, stable plugin-owned native tab identity, background-safe navigation, exact rebind, and explicit physical-input fallback.
|
|
31
|
+
- Harden native replacement with strict postconditions, HTTP(S) settlement that rejects transitional `about:*` pages, destination-origin authorization, and preservation of user-owned tabs.
|
|
32
|
+
- Improve Chrome/Vivaldi provider behavior, postcondition evidence, restart/rebind handling, and visual evidence integration without adding a second Browser authority.
|
|
33
|
+
|
|
34
|
+
### Capabilities, plugins, and iOS
|
|
35
|
+
|
|
36
|
+
- Add deterministic natural-intent capability discovery while keeping `plugin_action_execute` as the sole typed plugin executor and preserving the stable ChatGPT facade.
|
|
37
|
+
- Add controller-global plugin profiles with repository overlays, including reusable App Store Connect credential references without copying private-key contents into repository state or tool output.
|
|
38
|
+
- Add typed physical-device iOS build destinations and opt-in Xcode provisioning updates using file-backed App Store Connect key references, with bounded/redacted execution evidence.
|
|
39
|
+
|
|
40
|
+
### Runtime, recovery, and governance
|
|
41
|
+
|
|
42
|
+
- Continue converging Work/Plan/finalizer lifecycle authority, target-advancement validation, process/session fencing, source coherence, and whole-Runtime immutable activation/rollback under the independent Recovery boundary.
|
|
43
|
+
- Keep ChatGPT as the semantic controller and Forge as the deterministic execution/control plane, with Direct-first execution and durable Work/Plan state only where continuity, isolation, recovery, scheduling, or external effects require it.
|
|
44
|
+
- Tighten maintained architecture/documentation authority and capability-closure governance so stale Work or superseded design documents do not become parallel current truth.
|
|
45
|
+
|
|
7
46
|
## 1.6.0 - 2026-08-16
|
|
8
47
|
|
|
9
48
|
### Architecture V2 and execution governance
|
package/CLAUDE.md
CHANGED
|
@@ -43,6 +43,10 @@ Treat ChatGPT as the controller and Forge as its repository execution layer. Cha
|
|
|
43
43
|
|
|
44
44
|
## Operating Rules
|
|
45
45
|
|
|
46
|
+
- Default to end-to-end execution and minimize avoidable human intervention. Continue through reversible, policy-allowed setup, implementation, verification, cleanup, and delivery steps without asking the user to babysit the workflow; stop only at a genuinely user-only identity, legal/contract, financial authorization, strong-confirmation, or irreversible decision boundary.
|
|
47
|
+
- For authenticated browser work, preserve the user's existing browser identity: reuse the already-running signed-in Google Chrome via attach-preferred, native-auto, Chrome-only, fail-closed routing. Preserve its cookies, tokens, sessions, and settings; never silently launch or switch to a managed, isolated, Vivaldi, or otherwise unauthenticated browser/profile. Managed or isolated browser modes require an explicit task/action request. If the user Chrome cannot be attached safely, fail closed and surface the concrete blocker instead of creating a replacement login state.
|
|
48
|
+
- After a managed repository change is verified and committed/merged, push the delivered target branch to its configured remote promptly. Do not leave a successfully delivered commit only on local refs unless the user explicitly requested local-only delivery or the push is blocked by safety, permissions, authentication, or branch policy; surface the exact blocker when a push cannot complete.
|
|
49
|
+
- Treat the Google Cloud `forge-cloud` VM experiment as retired infrastructure. Do not restart or reuse that VM for Forge Cloud. Any future remote Forge maintainer must use a separately evaluated host/transport and must demonstrate better latency and reliability than the local Forge path before adoption.
|
|
46
50
|
- Sync `tasks/` whenever substantive repo changes are made.
|
|
47
51
|
- Use `tasks/notes/<plan-stem>.notes.md` only for non-obvious slice decisions, deviations, tradeoffs, and open questions; `<plan-stem>` is the active plan filename without `plan-` and `.md` (for example `20260531-0045-governance-workflow`). Do not use notes as durable memory or a task log, and archive/promote them deliberately when the slice closes.
|
|
48
52
|
- Treat hook execution as central-first: trusted repos run `~/.forge/hooks/` (bash shim) or the packaged CLI copy; this self-host repo pins `"hook_source": "repo"` in `.ai/harness/policy.json` so `.ai/hooks/` stays the live development runtime, with `assets/hooks/` as the product source mirrored on install. User-level `~/.claude/settings.json` and `~/.codex/hooks.json` are the host adapters.
|
package/README.md
CHANGED
|
@@ -58,7 +58,7 @@ Forge ships typed local/browser/desktop/iOS/GitHub/Gmail/Calendar/Tasks/App Stor
|
|
|
58
58
|
|
|
59
59
|
Local read/write grants are explicit and expiring; remote or destructive effects are distinguished from ordinary local work; high-impact actions require stronger confirmation. Full Access reduces repetitive prompts for normal work without removing the hard boundaries around secrets, destructive actions, and outside-workspace access. See [Security](SECURITY.md) and the [Security Model](docs/wiki/Security-Model.md).
|
|
60
60
|
|
|
61
|
-
**Docs:** [Wiki](docs/wiki/Home.md) · [Support](SUPPORT.md) · [Contributing](CONTRIBUTING.md) · [Changelog](CHANGELOG.md). Current stable release: `1.
|
|
61
|
+
**Docs:** [Wiki](docs/wiki/Home.md) · [Support](SUPPORT.md) · [Contributing](CONTRIBUTING.md) · [Changelog](CHANGELOG.md). Current stable release: `1.7.0`; stable installs use npm `latest`.
|
|
62
62
|
|
|
63
63
|
---
|
|
64
64
|
<a id="zh-cn"></a>
|
|
@@ -109,4 +109,4 @@ Forge 内置本机、Browser、Desktop、iOS、GitHub、Gmail、Calendar、Tasks
|
|
|
109
109
|
|
|
110
110
|
安全上,普通本地修改、远程影响、破坏性操作、密钥和工作区外访问是不同边界;Full Access 不会取消高风险确认。详见[安全说明](SECURITY.md)和[安全模型](docs/wiki/Security-Model.md)。
|
|
111
111
|
|
|
112
|
-
**文档:** [Wiki](docs/wiki/Home.md) · [支持](SUPPORT.md) · [贡献](CONTRIBUTING.md) · [更新日志](CHANGELOG.md)。当前稳定版为 `1.
|
|
112
|
+
**文档:** [Wiki](docs/wiki/Home.md) · [支持](SUPPORT.md) · [贡献](CONTRIBUTING.md) · [更新日志](CHANGELOG.md)。当前稳定版为 `1.7.0`,稳定安装使用 npm `latest`。
|
package/README.zh-CN.md
CHANGED
|
@@ -78,4 +78,4 @@ Forge 把读取、普通本地写入、远程操作、破坏性操作、工作
|
|
|
78
78
|
|
|
79
79
|
[中文文档中心](docs/README.zh-CN.md) · [Wiki](docs/wiki/Home.md) · [SUPPORT.md](SUPPORT.md) · [CONTRIBUTING.md](CONTRIBUTING.md) · [CHANGELOG.md](CHANGELOG.md)
|
|
80
80
|
|
|
81
|
-
当前稳定版本是 `1.
|
|
81
|
+
当前稳定版本是 `1.7.0`,稳定安装使用 npm `latest`。
|
package/SKILL.md
CHANGED
|
@@ -40,8 +40,8 @@ Automatic routing remains authoritative when the user does not provide a mode di
|
|
|
40
40
|
|
|
41
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
42
|
|
|
43
|
-
- `-plan` or `/plan`: force the reviewed planning path. Planning is read-only: inspect repository state and call `
|
|
44
|
-
- `-debug` or `/debug`: force evidence-first debugging. Reproduce or characterize the failure, then prefer `
|
|
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
45
|
|
|
46
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
47
|
|
package/THIRD_PARTY_NOTICES.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Third-party notices
|
|
2
2
|
|
|
3
|
-
This inventory covers the direct runtime and development dependencies declared by `@moretea-labs/forge@1.
|
|
3
|
+
This inventory covers the direct runtime and development dependencies declared by `@moretea-labs/forge@1.7.1`.
|
|
4
4
|
|
|
5
5
|
License values come from `package-lock.json` where available. For lock entries without a license field, the declared license was verified from package metadata during release preparation. This file is informational and does not replace the license text distributed by each dependency.
|
|
6
6
|
|
package/agents/openai.yaml
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
interface:
|
|
2
2
|
display_name: "forge"
|
|
3
3
|
short_description: "Operate Forge workflows for repository planning, execution, verification, migration, audit, and repair"
|
|
4
|
-
default_prompt: "Use Forge to inspect this repository, choose the smallest appropriate workflow, and carry
|
|
4
|
+
default_prompt: "Use Forge to inspect this repository, choose the smallest appropriate workflow, and carry the requested work through implementation, verification, cleanup, and delivery with bounded evidence while minimizing avoidable human intervention. Continue reversible policy-allowed steps autonomously and stop only at a genuinely user-only identity/legal/financial/strong-confirmation/irreversible boundary. For authenticated browser work, reuse the user's already-running signed-in Google Chrome with attach-preferred, native-auto, Chrome-only, fail-closed routing; preserve its cookies/tokens/sessions/settings and never silently launch or switch to a managed, isolated, Vivaldi, or otherwise unauthenticated profile unless the task explicitly requests that mode. After verified repository delivery, promptly push the committed/merged target branch to its configured remote unless the user explicitly requested local-only delivery or the push is blocked; report any blocker precisely."
|
|
@@ -26,10 +26,12 @@ hook_read_stdin_once() {
|
|
|
26
26
|
|
|
27
27
|
if [[ -t 0 ]]; then
|
|
28
28
|
HOOK_STDIN_JSON=""
|
|
29
|
+
export HOOK_STDIN_JSON
|
|
29
30
|
return
|
|
30
31
|
fi
|
|
31
32
|
|
|
32
33
|
HOOK_STDIN_JSON="$(cat 2>/dev/null || true)"
|
|
34
|
+
export HOOK_STDIN_JSON
|
|
33
35
|
}
|
|
34
36
|
|
|
35
37
|
hook_json_extract_with_bun() {
|
|
@@ -275,11 +277,6 @@ hook_get_session_id() {
|
|
|
275
277
|
local arg="${1:-}"
|
|
276
278
|
local parsed=""
|
|
277
279
|
|
|
278
|
-
if [[ -n "${HOOK_SESSION_ID:-}" ]]; then
|
|
279
|
-
printf '%s' "$HOOK_SESSION_ID"
|
|
280
|
-
return
|
|
281
|
-
fi
|
|
282
|
-
|
|
283
280
|
parsed="$(hook_json_get '.session_id' '')"
|
|
284
281
|
if [[ -n "$parsed" ]]; then
|
|
285
282
|
HOOK_SESSION_ID="$parsed"
|
|
@@ -296,13 +293,19 @@ hook_get_session_id() {
|
|
|
296
293
|
return
|
|
297
294
|
fi
|
|
298
295
|
|
|
299
|
-
if [[ -n "${
|
|
300
|
-
HOOK_SESSION_ID="${CLAUDE_SESSION_ID:-${CODEX_SESSION_ID:-}}"
|
|
301
|
-
export HOOK_SESSION_ID
|
|
296
|
+
if [[ -n "${HOOK_SESSION_ID:-}" ]]; then
|
|
302
297
|
printf '%s' "$HOOK_SESSION_ID"
|
|
303
298
|
return
|
|
304
299
|
fi
|
|
305
300
|
|
|
301
|
+
parsed="${CLAUDE_SESSION_ID:-${CODEX_SESSION_ID:-${SESSION_KEY:-}}}"
|
|
302
|
+
if [[ -n "$parsed" ]]; then
|
|
303
|
+
HOOK_SESSION_ID="$parsed"
|
|
304
|
+
export HOOK_SESSION_ID
|
|
305
|
+
printf '%s' "$parsed"
|
|
306
|
+
return
|
|
307
|
+
fi
|
|
308
|
+
|
|
306
309
|
printf '%s' ""
|
|
307
310
|
}
|
|
308
311
|
|
|
@@ -17,16 +17,15 @@ session_state_new_session_id() {
|
|
|
17
17
|
session_state_resolve_key() {
|
|
18
18
|
local session_id_file="$1"
|
|
19
19
|
local arg="${2:-}"
|
|
20
|
-
local session_key="
|
|
20
|
+
local session_key=""
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
# An event payload is more specific than ambient host state. This matters for
|
|
23
|
+
# forwarded or replayed hook input, where the parent process can belong to a
|
|
24
|
+
# different host session than the event being handled.
|
|
25
|
+
if declare -F hook_get_session_id >/dev/null 2>&1; then
|
|
23
26
|
session_key="$(hook_get_session_id "$arg")"
|
|
24
27
|
fi
|
|
25
28
|
|
|
26
|
-
if [[ -z "$session_key" ]]; then
|
|
27
|
-
session_key="${CLAUDE_SESSION_ID:-${CODEX_SESSION_ID:-${SESSION_KEY:-}}}"
|
|
28
|
-
fi
|
|
29
|
-
|
|
30
29
|
if [[ -n "$session_key" ]]; then
|
|
31
30
|
mkdir -p "$(dirname "$session_id_file")" 2>/dev/null || true
|
|
32
31
|
printf '%s\n' "$session_key" > "$session_id_file" 2>/dev/null || true
|
|
@@ -34,10 +33,14 @@ session_state_resolve_key() {
|
|
|
34
33
|
return
|
|
35
34
|
fi
|
|
36
35
|
|
|
37
|
-
if [[ -
|
|
36
|
+
if [[ -s "$session_id_file" ]]; then
|
|
38
37
|
session_key="$(cat "$session_id_file" 2>/dev/null || true)"
|
|
39
38
|
fi
|
|
40
39
|
|
|
40
|
+
if [[ -z "$session_key" ]]; then
|
|
41
|
+
session_key="${HOOK_SESSION_ID:-${CLAUDE_SESSION_ID:-${CODEX_SESSION_ID:-${SESSION_KEY:-}}}}"
|
|
42
|
+
fi
|
|
43
|
+
|
|
41
44
|
if [[ -z "$session_key" ]]; then
|
|
42
45
|
session_key="$(session_state_new_session_id)"
|
|
43
46
|
mkdir -p "$(dirname "$session_id_file")" 2>/dev/null || true
|
|
@@ -575,16 +575,21 @@ workflow_cleanup_candidate() {
|
|
|
575
575
|
[[ -e "$metadata" ]] || continue
|
|
576
576
|
slug="$(basename "$metadata" .json)"
|
|
577
577
|
[[ -n "$slug" ]] || continue
|
|
578
|
-
|
|
579
|
-
|
|
578
|
+
branch="${branch_prefix}${slug}"
|
|
579
|
+
# Controller metadata can outlive a terminal worktree after a Home
|
|
580
|
+
# migration. It is not cleanup work unless a Git branch or worktree still
|
|
581
|
+
# exists; otherwise it must never keep a fresh resume packet stale.
|
|
582
|
+
if git show-ref --verify --quiet "refs/heads/${branch}"; then
|
|
583
|
+
printf '%s\t%s\t\n' "$slug" "$branch"
|
|
584
|
+
return 0
|
|
585
|
+
fi
|
|
580
586
|
done
|
|
581
587
|
|
|
582
588
|
return 1
|
|
583
589
|
}
|
|
584
590
|
|
|
585
591
|
workflow_next_action() {
|
|
586
|
-
local active_plan task_state total done next_pending contract_file
|
|
587
|
-
local external_status external_state external_reviewer external_source external_message expected_source
|
|
592
|
+
local active_plan task_state total done next_pending contract_file checks_file checks_error
|
|
588
593
|
local target current_branch slug candidate branch worktree command message
|
|
589
594
|
|
|
590
595
|
active_plan="$(get_active_plan || true)"
|
|
@@ -602,38 +607,19 @@ workflow_next_action() {
|
|
|
602
607
|
fi
|
|
603
608
|
|
|
604
609
|
contract_file="$(workflow_active_contract || true)"
|
|
605
|
-
review_file="$(workflow_active_review || true)"
|
|
606
610
|
checks_file="$(workflow_checks_file)"
|
|
607
611
|
|
|
608
|
-
if [[ -z "$review_file" || ! -f "$review_file" ]]; then
|
|
609
|
-
printf 'review\t/review\tStage the completed module diff first; then run /review and record a sprint review before finishing this worktree.\n'
|
|
610
|
-
return 0
|
|
611
|
-
fi
|
|
612
|
-
|
|
613
|
-
if ! workflow_review_recommends_pass "$review_file"; then
|
|
614
|
-
printf 'review\t/review\tStage the completed module diff first; then run /review until %s records Recommendation: pass.\n' "$review_file"
|
|
615
|
-
return 0
|
|
616
|
-
fi
|
|
617
|
-
|
|
618
612
|
if [[ -z "$contract_file" || ! -f "$contract_file" ]]; then
|
|
619
613
|
printf 'check\t/check\tStage the completed module diff first; then regenerate the active sprint contract and run /review.\n'
|
|
620
614
|
return 0
|
|
621
615
|
fi
|
|
622
616
|
|
|
623
|
-
external_status="$(workflow_external_acceptance_status "$review_file")"
|
|
624
|
-
IFS=$'\t' read -r external_state external_reviewer external_source external_message <<< "$external_status"
|
|
625
|
-
if [[ "$external_state" != "pass" && "$external_state" != "manual_override" ]]; then
|
|
626
|
-
expected_source="$(workflow_external_acceptance_expected_source)"
|
|
627
|
-
printf 'check\t/check\tStage the completed module diff first; then %s Run external acceptance via %s and record ## External Acceptance Advice in %s.\n' "${external_message:-External acceptance is missing.}" "$expected_source" "$review_file"
|
|
628
|
-
return 0
|
|
629
|
-
fi
|
|
630
|
-
|
|
631
617
|
if [[ ! -f "$checks_file" ]]; then
|
|
632
618
|
printf 'review\t/review\tStage the completed module diff first; then run /review and verify-sprint so %s exists.\n' "$checks_file"
|
|
633
619
|
return 0
|
|
634
620
|
fi
|
|
635
621
|
|
|
636
|
-
if ! checks_error="$(workflow_checks_pass "$checks_file" "$contract_file"
|
|
622
|
+
if ! checks_error="$(workflow_checks_pass "$checks_file" "$contract_file")"; then
|
|
637
623
|
printf 'check\t/check\tStage the completed module diff first; then resolve check evidence: %s\n' "$checks_error"
|
|
638
624
|
return 0
|
|
639
625
|
fi
|
|
@@ -641,7 +627,7 @@ workflow_next_action() {
|
|
|
641
627
|
target="$(workflow_target_branch)"
|
|
642
628
|
current_branch="$(workflow_current_branch)"
|
|
643
629
|
if workflow_is_linked_worktree && [[ -n "$current_branch" && "$current_branch" != "$target" ]]; then
|
|
644
|
-
printf '
|
|
630
|
+
printf 'review\t/review\tCheck evidence passed. Freshly review user intent, affected domains, downstream consumers, and state transitions; then finish this contract worktree.\n'
|
|
645
631
|
return 0
|
|
646
632
|
fi
|
|
647
633
|
fi
|
|
@@ -1282,151 +1268,10 @@ workflow_write_run_summary() {
|
|
|
1282
1268
|
EOF_RUN
|
|
1283
1269
|
}
|
|
1284
1270
|
|
|
1285
|
-
workflow_review_recommends_pass() {
|
|
1286
|
-
local review_file="${1:-}"
|
|
1287
|
-
[[ -n "$review_file" && -f "$review_file" ]] || return 1
|
|
1288
|
-
grep -Eq '^> \*\*Recommendation\*\*:[[:space:]]*pass[[:space:]]*$' "$review_file"
|
|
1289
|
-
}
|
|
1290
|
-
|
|
1291
|
-
workflow_external_acceptance_expected_reviewer() {
|
|
1292
|
-
local host="${HOOK_HOST:-}"
|
|
1293
|
-
|
|
1294
|
-
if [[ -z "$host" ]]; then
|
|
1295
|
-
if [[ -n "${CODEX_RUN_ID:-}${CODEX_SESSION_ID:-}${CODEX_THREAD_ID:-}${CODEX_SHELL:-}${CODEX_INTERNAL_ORIGINATOR_OVERRIDE:-}" ]]; then
|
|
1296
|
-
host="codex"
|
|
1297
|
-
elif [[ -n "${CLAUDE_RUN_ID:-}${CLAUDE_SESSION_ID:-}" ]]; then
|
|
1298
|
-
host="claude"
|
|
1299
|
-
else
|
|
1300
|
-
host="claude"
|
|
1301
|
-
fi
|
|
1302
|
-
fi
|
|
1303
|
-
|
|
1304
|
-
if [[ "$host" == "codex" ]]; then
|
|
1305
|
-
printf 'Claude'
|
|
1306
|
-
else
|
|
1307
|
-
printf 'Codex'
|
|
1308
|
-
fi
|
|
1309
|
-
}
|
|
1310
|
-
|
|
1311
|
-
workflow_external_acceptance_source_for_reviewer() {
|
|
1312
|
-
local reviewer="${1:-}"
|
|
1313
|
-
case "$(printf '%s' "$reviewer" | tr '[:upper:]' '[:lower:]')" in
|
|
1314
|
-
claude) printf 'claude-review' ;;
|
|
1315
|
-
*) printf 'codex-review' ;;
|
|
1316
|
-
esac
|
|
1317
|
-
}
|
|
1318
|
-
|
|
1319
|
-
workflow_external_acceptance_expected_source() {
|
|
1320
|
-
local reviewer="${1:-}"
|
|
1321
|
-
reviewer="${reviewer:-$(workflow_external_acceptance_expected_reviewer)}"
|
|
1322
|
-
workflow_external_acceptance_source_for_reviewer "$reviewer"
|
|
1323
|
-
}
|
|
1324
|
-
|
|
1325
|
-
workflow_external_acceptance_section() {
|
|
1326
|
-
local review_file="${1:-}"
|
|
1327
|
-
[[ -n "$review_file" && -f "$review_file" ]] || return 1
|
|
1328
|
-
awk '
|
|
1329
|
-
/^##[[:space:]]+External Acceptance Advice[[:space:]]*$/ { in_section = 1; next }
|
|
1330
|
-
/^##[[:space:]]+/ && in_section { exit }
|
|
1331
|
-
in_section { print }
|
|
1332
|
-
' "$review_file"
|
|
1333
|
-
}
|
|
1334
|
-
|
|
1335
|
-
workflow_external_acceptance_field() {
|
|
1336
|
-
local section="${1:-}"
|
|
1337
|
-
local label="${2:-}"
|
|
1338
|
-
printf '%s\n' "$section" |
|
|
1339
|
-
sed -nE "s/^> \\*\\*${label}\\*\\*:[[:space:]]*([^[:space:]].*)[[:space:]]*$/\\1/p" |
|
|
1340
|
-
head -n 1 |
|
|
1341
|
-
sed -E 's/[[:space:]]+$//'
|
|
1342
|
-
}
|
|
1343
|
-
|
|
1344
|
-
workflow_external_acceptance_status() {
|
|
1345
|
-
local review_file="${1:-}"
|
|
1346
|
-
local expected_reviewer="${2:-}"
|
|
1347
|
-
local expected_source section acceptance reviewer source p1_blockers manual_override
|
|
1348
|
-
local acceptance_lc reviewer_lc source_lc expected_reviewer_lc expected_source_lc p1_lc
|
|
1349
|
-
|
|
1350
|
-
expected_reviewer="${expected_reviewer:-$(workflow_external_acceptance_expected_reviewer)}"
|
|
1351
|
-
expected_source="$(workflow_external_acceptance_expected_source "$expected_reviewer")"
|
|
1352
|
-
|
|
1353
|
-
if [[ -z "$review_file" || ! -f "$review_file" ]]; then
|
|
1354
|
-
printf 'missing\t-\t-\tExternal acceptance review file is missing: %s\n' "${review_file:-tasks/reviews/<slug>.review.md}"
|
|
1355
|
-
return 0
|
|
1356
|
-
fi
|
|
1357
|
-
|
|
1358
|
-
section="$(workflow_external_acceptance_section "$review_file" || true)"
|
|
1359
|
-
if [[ -z "$section" ]]; then
|
|
1360
|
-
printf 'missing\t-\t-\tExternal acceptance section is missing from %s.\n' "$review_file"
|
|
1361
|
-
return 0
|
|
1362
|
-
fi
|
|
1363
|
-
|
|
1364
|
-
acceptance="$(workflow_external_acceptance_field "$section" "External Acceptance")"
|
|
1365
|
-
reviewer="$(workflow_external_acceptance_field "$section" "External Reviewer")"
|
|
1366
|
-
source="$(workflow_external_acceptance_field "$section" "External Source")"
|
|
1367
|
-
p1_blockers="$(
|
|
1368
|
-
printf '%s\n' "$section" |
|
|
1369
|
-
sed -nE 's/^- P1 blockers:[[:space:]]*([^[:space:]].*)[[:space:]]*$/\1/p' |
|
|
1370
|
-
head -n 1 |
|
|
1371
|
-
sed -E 's/[[:space:]]+$//'
|
|
1372
|
-
)"
|
|
1373
|
-
manual_override="$(
|
|
1374
|
-
printf '%s\n' "$section" |
|
|
1375
|
-
sed -nE 's/^-?[[:space:]]*Manual Override:[[:space:]]*([^[:space:]].*)[[:space:]]*$/\1/p' |
|
|
1376
|
-
head -n 1 |
|
|
1377
|
-
sed -E 's/[[:space:]]+$//'
|
|
1378
|
-
)"
|
|
1379
|
-
|
|
1380
|
-
if [[ -n "$manual_override" ]]; then
|
|
1381
|
-
printf 'manual_override\t%s\t%s\tManual override recorded for external acceptance: %s\n' "${reviewer:--}" "${source:--}" "$manual_override"
|
|
1382
|
-
return 0
|
|
1383
|
-
fi
|
|
1384
|
-
|
|
1385
|
-
acceptance_lc="$(printf '%s' "$acceptance" | tr '[:upper:]' '[:lower:]')"
|
|
1386
|
-
reviewer_lc="$(printf '%s' "$reviewer" | tr '[:upper:]' '[:lower:]')"
|
|
1387
|
-
source_lc="$(printf '%s' "$source" | tr '[:upper:]' '[:lower:]')"
|
|
1388
|
-
expected_reviewer_lc="$(printf '%s' "$expected_reviewer" | tr '[:upper:]' '[:lower:]')"
|
|
1389
|
-
expected_source_lc="$(printf '%s' "$expected_source" | tr '[:upper:]' '[:lower:]')"
|
|
1390
|
-
p1_lc="$(printf '%s' "$p1_blockers" | tr '[:upper:]' '[:lower:]')"
|
|
1391
|
-
|
|
1392
|
-
if [[ "$acceptance_lc" != "pass" ]]; then
|
|
1393
|
-
printf 'fail\t%s\t%s\tExternal acceptance is %s; expected pass from %s via %s.\n' "${reviewer:--}" "${source:--}" "${acceptance:-missing}" "$expected_reviewer" "$expected_source"
|
|
1394
|
-
return 0
|
|
1395
|
-
fi
|
|
1396
|
-
|
|
1397
|
-
if [[ "$reviewer_lc" != "$expected_reviewer_lc" ]]; then
|
|
1398
|
-
printf 'fail\t%s\t%s\tExternal reviewer is %s; expected %s.\n' "${reviewer:--}" "${source:--}" "${reviewer:-missing}" "$expected_reviewer"
|
|
1399
|
-
return 0
|
|
1400
|
-
fi
|
|
1401
|
-
|
|
1402
|
-
if [[ "$source_lc" != "$expected_source_lc" ]]; then
|
|
1403
|
-
printf 'fail\t%s\t%s\tExternal source is %s; expected %s.\n' "${reviewer:--}" "${source:--}" "${source:-missing}" "$expected_source"
|
|
1404
|
-
return 0
|
|
1405
|
-
fi
|
|
1406
|
-
|
|
1407
|
-
if [[ "$p1_lc" != "none" ]]; then
|
|
1408
|
-
printf 'fail\t%s\t%s\tExternal acceptance has P1 blockers: %s\n' "${reviewer:--}" "${source:--}" "${p1_blockers:-missing}"
|
|
1409
|
-
return 0
|
|
1410
|
-
fi
|
|
1411
|
-
|
|
1412
|
-
printf 'pass\t%s\t%s\tExternal acceptance passed.\n' "$reviewer" "$source"
|
|
1413
|
-
}
|
|
1414
|
-
|
|
1415
|
-
workflow_external_acceptance_pass() {
|
|
1416
|
-
local review_file="${1:-}"
|
|
1417
|
-
local expected_reviewer="${2:-}"
|
|
1418
|
-
local row status
|
|
1419
|
-
|
|
1420
|
-
row="$(workflow_external_acceptance_status "$review_file" "$expected_reviewer")"
|
|
1421
|
-
status="${row%%$'\t'*}"
|
|
1422
|
-
[[ "$status" == "pass" || "$status" == "manual_override" ]]
|
|
1423
|
-
}
|
|
1424
|
-
|
|
1425
1271
|
workflow_checks_pass() {
|
|
1426
1272
|
local checks_file="${1:-}"
|
|
1427
1273
|
local contract_file="${2:-}"
|
|
1428
|
-
local
|
|
1429
|
-
local status source exit_code check_contract check_review
|
|
1274
|
+
local status source exit_code check_contract
|
|
1430
1275
|
|
|
1431
1276
|
if [[ -z "$checks_file" || ! -s "$checks_file" ]]; then
|
|
1432
1277
|
echo "Structured checks file is missing or empty: ${checks_file:-"(none)"}"
|
|
@@ -1438,7 +1283,6 @@ workflow_checks_pass() {
|
|
|
1438
1283
|
source="$(jq -r '.source // empty' "$checks_file" 2>/dev/null || true)"
|
|
1439
1284
|
exit_code="$(jq -r '.exit_code // empty' "$checks_file" 2>/dev/null || true)"
|
|
1440
1285
|
check_contract="$(jq -r '.contract.file // .contract // empty' "$checks_file" 2>/dev/null || true)"
|
|
1441
|
-
check_review="$(jq -r '.review.file // .review // empty' "$checks_file" 2>/dev/null || true)"
|
|
1442
1286
|
|
|
1443
1287
|
if [[ "$status" != "pass" ]]; then
|
|
1444
1288
|
echo "Structured checks are not passing in $checks_file (status=${status:-missing})."
|
|
@@ -1456,10 +1300,6 @@ workflow_checks_pass() {
|
|
|
1456
1300
|
echo "Structured checks are stale for contract ${check_contract:-missing}; expected $contract_file."
|
|
1457
1301
|
return 1
|
|
1458
1302
|
fi
|
|
1459
|
-
if [[ -n "$review_file" && "$check_review" != "$review_file" ]]; then
|
|
1460
|
-
echo "Structured checks are stale for review ${check_review:-missing}; expected $review_file."
|
|
1461
|
-
return 1
|
|
1462
|
-
fi
|
|
1463
1303
|
return 0
|
|
1464
1304
|
fi
|
|
1465
1305
|
|
|
@@ -1479,10 +1319,6 @@ workflow_checks_pass() {
|
|
|
1479
1319
|
echo "Structured checks do not reference current contract $contract_file."
|
|
1480
1320
|
return 1
|
|
1481
1321
|
fi
|
|
1482
|
-
if [[ -n "$review_file" ]] && ! grep -Fq "\"file\":\"$review_file\"" "$checks_file" && ! grep -Fq "\"file\": \"$review_file\"" "$checks_file"; then
|
|
1483
|
-
echo "Structured checks do not reference current review $review_file."
|
|
1484
|
-
return 1
|
|
1485
|
-
fi
|
|
1486
1322
|
}
|
|
1487
1323
|
|
|
1488
1324
|
workflow_contract_allows_path() {
|
|
@@ -1512,7 +1348,7 @@ workflow_contract_allows_path() {
|
|
|
1512
1348
|
section="allowed_paths"
|
|
1513
1349
|
continue
|
|
1514
1350
|
;;
|
|
1515
|
-
exit_criteria:|files_exist:|tests_pass:|commands_succeed:|files_contain:|artifacts_exist
|
|
1351
|
+
exit_criteria:|files_exist:|tests_pass:|commands_succeed:|files_contain:|artifacts_exist:)
|
|
1516
1352
|
section=""
|
|
1517
1353
|
continue
|
|
1518
1354
|
;;
|
|
@@ -47,9 +47,15 @@ case "$tool_name" in
|
|
|
47
47
|
;;
|
|
48
48
|
esac
|
|
49
49
|
|
|
50
|
-
|
|
50
|
+
# An event source is explicit evidence. Inherited host variables are only a
|
|
51
|
+
# fallback for payloads that omit it, such as local compatibility shims.
|
|
52
|
+
if [[ "$session_source" =~ [Cc]odex ]]; then
|
|
51
53
|
host="codex"
|
|
52
|
-
elif [[
|
|
54
|
+
elif [[ "$session_source" =~ [Cc]laude ]]; then
|
|
55
|
+
host="claude"
|
|
56
|
+
elif [[ -n "${CODEX_SESSION_ID:-${CODEX_AGENT_NAME:-}}" ]]; then
|
|
57
|
+
host="codex"
|
|
58
|
+
elif [[ -n "${CLAUDE_SESSION_ID:-${CLAUDE_AGENT_NAME:-}}" ]]; then
|
|
53
59
|
host="claude"
|
|
54
60
|
fi
|
|
55
61
|
|
|
@@ -139,7 +139,7 @@ plan_evidence_contract_error() {
|
|
|
139
139
|
fi
|
|
140
140
|
|
|
141
141
|
local label line value
|
|
142
|
-
for label in "State/progress path" "Verification evidence" "Evaluator rubric" "Stop condition" "Rollback surface"; do
|
|
142
|
+
for label in "State/progress path" "Verification evidence" "Impact review|Evaluator rubric" "Stop condition" "Rollback surface"; do
|
|
143
143
|
line="$(printf '%s\n' "$section" | grep -Ei "^[[:space:]]*-[[:space:]]*(\\*\\*)?${label}(\\*\\*)?[[:space:]]*:" | head -1 || true)"
|
|
144
144
|
if [[ -z "$line" ]]; then
|
|
145
145
|
echo "missing field: ${label}"
|
|
@@ -656,7 +656,6 @@ emit_forge_route_hint() {
|
|
|
656
656
|
|
|
657
657
|
if pg_fact REVIEW_RELEASE; then
|
|
658
658
|
echo "[ForgeRoute] Review/release intent detected. Use /review first; use /release only after review evidence is clear."
|
|
659
|
-
emit_external_acceptance_prompt review
|
|
660
659
|
emit_cross_review_hint merge
|
|
661
660
|
fi
|
|
662
661
|
}
|
|
@@ -684,50 +683,6 @@ emit_cross_review_hint() {
|
|
|
684
683
|
esac
|
|
685
684
|
}
|
|
686
685
|
|
|
687
|
-
emit_external_acceptance_prompt() {
|
|
688
|
-
local mode="${1:-review}"
|
|
689
|
-
local expected_reviewer expected_source command active_plan_local contract_file_local review_file checks_file
|
|
690
|
-
|
|
691
|
-
expected_reviewer="$(workflow_external_acceptance_expected_reviewer)"
|
|
692
|
-
expected_source="$(workflow_external_acceptance_expected_source "$expected_reviewer")"
|
|
693
|
-
if [ "$expected_source" = "claude-review" ]; then
|
|
694
|
-
command="/claude-review"
|
|
695
|
-
else
|
|
696
|
-
command="codex-review"
|
|
697
|
-
fi
|
|
698
|
-
|
|
699
|
-
active_plan_local="$(get_active_plan || true)"
|
|
700
|
-
contract_file_local="$(workflow_active_contract || true)"
|
|
701
|
-
review_file="$(workflow_active_review || true)"
|
|
702
|
-
checks_file="$(workflow_checks_file)"
|
|
703
|
-
|
|
704
|
-
echo "[ExternalAcceptance] Review/release intent detected. Start peer acceptance in parallel with local /review and focused checks."
|
|
705
|
-
echo "[ExternalAcceptance] Mode: $mode"
|
|
706
|
-
echo "[ExternalAcceptance] Current active plan: ${active_plan_local:-"(none)"}"
|
|
707
|
-
echo "[ExternalAcceptance] Current contract: ${contract_file_local:-"(none)"}"
|
|
708
|
-
echo "[ExternalAcceptance] Current review: ${review_file:-tasks/reviews/<slug>.review.md}"
|
|
709
|
-
echo "[ExternalAcceptance] Current checks: $checks_file"
|
|
710
|
-
echo "[ExternalAcceptance] Peer reviewer: $expected_reviewer via $command"
|
|
711
|
-
echo "[ExternalAcceptance] Diff scope for peer: branch diff against target, staged diff, unstaged diff, and untracked files."
|
|
712
|
-
cat <<EOF_EXTERNAL_ACCEPTANCE
|
|
713
|
-
[ExternalAcceptance] Prompt to send with $command:
|
|
714
|
-
Review the current sprint for acceptance only. Do not run Forge /review or local checks. Do not edit files. Do not write files. Inspect the diff scope, contract, review evidence, and checks evidence, then return only a Markdown block that can be pasted into ${review_file:-tasks/reviews/<slug>.review.md}.
|
|
715
|
-
|
|
716
|
-
## External Acceptance Advice
|
|
717
|
-
> **External Acceptance**: pass
|
|
718
|
-
> **External Reviewer**: $expected_reviewer
|
|
719
|
-
> **External Source**: $expected_source
|
|
720
|
-
> **External Started**: YYYY-MM-DDTHH:MM:SS+0800
|
|
721
|
-
> **External Completed**: YYYY-MM-DDTHH:MM:SS+0800
|
|
722
|
-
|
|
723
|
-
- P1 blockers: none
|
|
724
|
-
- P2 advisories:
|
|
725
|
-
- Acceptance checklist: pass
|
|
726
|
-
|
|
727
|
-
If the peer CLI is unavailable, record **External Acceptance**: unavailable and include the failure reason. That does not satisfy the completion gate unless a Manual Override: line with a concrete reason is also recorded.
|
|
728
|
-
EOF_EXTERNAL_ACCEPTANCE
|
|
729
|
-
}
|
|
730
|
-
|
|
731
686
|
# --- Action rendering ---
|
|
732
687
|
# Plan/spec/contract prompt gates are advisory (exit 0): pre-edit-guard.sh
|
|
733
688
|
# enforces the same state deterministically at the edit boundary. Done-claim
|
|
@@ -786,7 +741,7 @@ render_prompt_guard_action() {
|
|
|
786
741
|
evidence_contract_block)
|
|
787
742
|
echo "[EvidenceContractGuard] Advisory: plan Evidence Contract is incomplete in $active_plan:"
|
|
788
743
|
printf '%s\n' "$evidence_error"
|
|
789
|
-
echo "[EvidenceContractGuard] Fill ## Evidence Contract with state/progress path, verification evidence,
|
|
744
|
+
echo "[EvidenceContractGuard] Fill ## Evidence Contract with state/progress path, verification evidence, impact review, stop condition, and rollback surface before implementation."
|
|
790
745
|
exit 0
|
|
791
746
|
;;
|
|
792
747
|
plan_execution_scaffold_advice)
|
|
@@ -833,7 +788,7 @@ render_prompt_guard_action() {
|
|
|
833
788
|
hook_structured_error \
|
|
834
789
|
"EvidenceContractGuard" \
|
|
835
790
|
"Done intent detected without a complete plan Evidence Contract." \
|
|
836
|
-
"Fill ## Evidence Contract with state/progress path, verification evidence,
|
|
791
|
+
"Fill ## Evidence Contract with state/progress path, verification evidence, impact review, stop condition, and rollback surface before marking work done." \
|
|
837
792
|
"quality_gate"
|
|
838
793
|
exit 2
|
|
839
794
|
;;
|
|
@@ -962,38 +917,7 @@ if [ "$done_intent" -eq 1 ]; then
|
|
|
962
917
|
echo "[ContractGuard] verify-contract.sh not found at scripts/verify-contract.sh (degraded mode: skipping strict verification)."
|
|
963
918
|
fi
|
|
964
919
|
|
|
965
|
-
|
|
966
|
-
if [ -z "$review_file" ] || [ ! -f "$review_file" ]; then
|
|
967
|
-
echo "[ReviewGuard] Missing sprint review: ${review_file:-tasks/reviews/<slug>.review.md}"
|
|
968
|
-
hook_structured_error \
|
|
969
|
-
"ReviewGuard" \
|
|
970
|
-
"Done intent detected without a sprint review artifact." \
|
|
971
|
-
"Run Forge /review after verification and record the evaluator recommendation in tasks/reviews/<slug>.review.md before marking work done." \
|
|
972
|
-
"quality_gate"
|
|
973
|
-
exit 2
|
|
974
|
-
fi
|
|
975
|
-
|
|
976
|
-
if ! workflow_review_recommends_pass "$review_file"; then
|
|
977
|
-
echo "[ReviewGuard] Sprint review does not recommend pass: $review_file"
|
|
978
|
-
hook_structured_error \
|
|
979
|
-
"ReviewGuard" \
|
|
980
|
-
"Sprint review is missing a passing recommendation." \
|
|
981
|
-
"Run Forge /review with fresh verification evidence and record a pass recommendation before marking work done." \
|
|
982
|
-
"quality_gate"
|
|
983
|
-
exit 2
|
|
984
|
-
fi
|
|
985
|
-
|
|
986
|
-
external_status="$(workflow_external_acceptance_status "$review_file")"
|
|
987
|
-
IFS=$'\t' read -r external_state external_reviewer external_source external_message <<< "$external_status"
|
|
988
|
-
if [ "$external_state" != "pass" ] && [ "$external_state" != "manual_override" ]; then
|
|
989
|
-
echo "[ExternalAcceptanceGuard] ${external_message:-External acceptance is missing.}"
|
|
990
|
-
hook_structured_error \
|
|
991
|
-
"ExternalAcceptanceGuard" \
|
|
992
|
-
"${external_message:-External acceptance is missing from $review_file.}" \
|
|
993
|
-
"Run peer acceptance via $(workflow_external_acceptance_expected_source) and record ## External Acceptance Advice in $review_file before marking work done." \
|
|
994
|
-
"quality_gate"
|
|
995
|
-
exit 2
|
|
996
|
-
fi
|
|
920
|
+
echo "[Review] Before declaring completion, freshly re-evaluate user intent, affected domains, downstream consumers, and missing state transitions."
|
|
997
921
|
|
|
998
922
|
checks_file="$(workflow_checks_file)"
|
|
999
923
|
if [ ! -f "$checks_file" ]; then
|
|
@@ -1006,7 +930,7 @@ if [ "$done_intent" -eq 1 ]; then
|
|
|
1006
930
|
exit 2
|
|
1007
931
|
fi
|
|
1008
932
|
|
|
1009
|
-
if ! checks_error="$(workflow_checks_pass "$checks_file" "$contract_file"
|
|
933
|
+
if ! checks_error="$(workflow_checks_pass "$checks_file" "$contract_file")"; then
|
|
1010
934
|
echo "[EvidenceGuard] $checks_error"
|
|
1011
935
|
hook_structured_error \
|
|
1012
936
|
"EvidenceGuard" \
|