diff --git a/plugins/ultraplan-local/commands/ultraexecute-local.md b/plugins/ultraplan-local/commands/ultraexecute-local.md index b411101..8ae778f 100644 --- a/plugins/ultraplan-local/commands/ultraexecute-local.md +++ b/plugins/ultraplan-local/commands/ultraexecute-local.md @@ -373,6 +373,25 @@ To run sequentially instead: /ultraexecute-local --fg {plan-path} Stop execution. Update progress with `status: "stopped"`. +**Also write `.session-state.local.json`** (Handover 7) — this surfaces the +stopped state to `/ultracontinue` so the next session can prompt the user to +clean the working tree before resuming. Write atomically alongside `progress.json`: + +```json +{ + "schema_version": 1, + "project": "{project_dir}", + "next_session_brief_path": "{project_dir}/brief.md", + "next_session_label": "{current session label, or 'Continue'}", + "status": "stopped", + "updated_at": "{ISO-8601 now}" +} +``` + +Verify with `node lib/validators/session-state-validator.mjs --json +{project_dir}/.session-state.local.json`. On validator failure, emit a warning +to stderr but do NOT block the stop; `progress.json` is still authoritative. + ### Check 2 — Plan file is tracked by git Run `git ls-files --error-unmatch {plan-path} 2>/dev/null`. If the plan file is @@ -751,6 +770,13 @@ Complete the prerequisite first, then re-run. ``` Update progress file with `status: "stopped"`. Stop execution. +**Also write `.session-state.local.json`** (Handover 7) with the same +`status: "stopped"` and `next_session_brief_path` pointing at the brief that +the failed entry-condition session was supposed to consume. This lets +`/ultracontinue` surface the stop in the next session. Use the same atomic +write pattern + validator check as Phase 2.55. On validator failure, warn +but do not block. + If the entry condition **passes**: ``` Entry condition: PASS @@ -1122,6 +1148,33 @@ Always produce a final report. Update progress file: `status` to `completed`/`failed`/`stopped`, `updated_at`, `summary`. +**Also atomically write `.session-state.local.json`** (Handover 7) at this +convergence point — every successful, failed, stopped, or partial run that +reaches Phase 8 must produce or refresh the state file. Schema: + +```json +{ + "schema_version": 1, + "project": "{project_dir}", + "next_session_brief_path": "{determined from Execution Strategy: next session's brief path, or current brief path if last session}", + "next_session_label": "{label of next session from Execution Strategy, or 'Complete' if last}", + "status": "{same as progress.json status — completed | failed | stopped | partial}", + "updated_at": "{ISO-8601 now}" +} +``` + +Use `lib/util/atomic-write.mjs` (`atomicWriteJson`) — same crash-safety as +`progress.json`. Then verify: `node lib/validators/session-state-validator.mjs +--json {project_dir}/.session-state.local.json`. On validator failure, warn +to stderr but do NOT block — Phase 8 must always reach the final report. + +This single insertion covers every multi-session execution path that +converges here (Path A: successful single session, Path B: `--session N` +explicit, Path C: compaction-survival recovery, Path D: standard plan +completion). Phase 2.55 and Phase 4 cover the early-stop paths E1/E2. +Phase 2.3 (validate exit) and Phase 5 (dry-run) intentionally do not write +— neither path is resumable. + ``` ## Ultraexecute Local Complete