# Approved Plan Continuity Hard Gate ## 中文說明 這個 repo 目前聚焦兩條與 continuity 直接相關的成果: - **approved plan continuity hard-gate** - **auto-next obligation gate** 目標是避免以下兩種 failure: 1. **continuity failure / auto-next break** - 任務已完成 - 下一步已知 - 但沒有真的 dispatch 下一顆 task - 流程卻還是被當成正常收尾 2. **task-boundary stop / 口頭續跑** - 同一份 approved plan 內其實應該 auto-next - 但主代理停在 task boundary - 用 checkpoint / 口頭回報 / session metadata 取代真正 dispatch ## 目前已完成 ### A. Continuity hard-gate - continuity evaluator - receipt validator 最小欄位驗證 - `derivedAction` / `nextDerivedAction` 納入 continuity 判定 - `dry_run_dispatch` 不得冒充真 receipt - fake receipt 不得放行 - hook integration 已接入 `hooks/force-recall/handler.ts` ### B. Auto-next obligation gate - 新 failure reason:`missing_auto_next_dispatch` - 同一份 approved plan 中,若: - 當前 task 已完成 - 下一顆 task 已知 - `sameApprovedPlan=true` - `taskBoundaryStop=true` - 非 `waiting_user` / `blocked` / `pending_verification` - 非 `highRiskStop` - 且沒有真實 next dispatch receipt - ⇒ 直接 fail,不得停在 boundary 等主人再說「繼續」 - receipt linkage hardening:receipt 現在要對到要求的 next-task handoff,而不是只要存在就算過 - 新增最小 linkage 欄位:`nextTaskId` - checkpoint / session metadata / stale receipt / dry-run planner intent 不得冒充 auto-next dispatch proof ## 驗證狀態 - `node scripts/test_approved_plan_continuity_gate.mjs` → `17 passed / 0 failed` - `node scripts/test_force_recall_long_task_preflight.mjs` → PASS - `node --check hooks/force-recall/handler.ts` → PASS - `node --check scripts/approved_plan_continuity_gate.mjs` → PASS - `node --check scripts/approved_plan_dispatch_binding.mjs` → PASS ## 目前限制 - 目前仍主要鎖在 continuity / force-recall 路徑,不是所有 entry points。 - `sameApprovedPlan` 的上游證據仍可再更硬。 - continuity plugin MVP 仍在後續產品化中,尚未整理成可直接讓其他 OpenClaw 安裝的插件包。 ## 下一步 1. continuity 收尾覆核 2. 回到 continuity plugin MVP 3. 把目前 continuity 內核抽成可安裝、可設定、可測試、可依雙語 README 套用的插件 MVP --- ## English Description This repository currently focuses on two continuity-related hardening slices: - **approved plan continuity hard-gate** - **auto-next obligation gate** It prevents two core failure classes: 1. **continuity failure / auto-next break** 2. **task-boundary stop disguised as progress** ## Current State ### A. Continuity hard-gate - continuity evaluator - minimum receipt validation - `derivedAction` / `nextDerivedAction` continuity handling - `dry_run_dispatch` rejected as real receipt - fake receipt rejected - hook integration in `hooks/force-recall/handler.ts` ### B. Auto-next obligation gate - explicit failure reason: `missing_auto_next_dispatch` - task-boundary stop is now treated as continuity failure when same-plan auto-next is obligatory - receipt linkage hardening via `nextTaskId` - checkpoint / session metadata / stale receipt / dry-run intent can no longer stand in for real auto-next dispatch proof ## Validation - continuity gate tests passing - force-recall preflight passing - syntax checks passing ## Current Limitations - scoped mainly to the continuity / force-recall path - upstream `sameApprovedPlan` evidence can still be hardened further - plugin packaging is still pending