Step 1 of 5
Implement persistent sessions
Sessions turn a script into a tool people trust with long work.
Add session persistence to the harness. Each session stores: a generated ID and user-friendly title (derived from the first task), the full message history, todo/plan state, the working directory, model and config snapshot, timestamps, and status (active, completed, escalated, cancelled). Store as JSON files under a sessions directory (or SQLite if already available). Implement: session creation on run start, incremental saving after every turn (crash-safe), `list` showing recent sessions with title/status/age, and `show <id>` printing a readable transcript summary. Verify a killed process leaves a loadable session file.
Expected after this step
Crash-safe session persistence with list and show commands.
Should not happen
- ✕Resume that replays a chat log but loses tool state and working directory
- ✕Config spread across hardcoded values nobody can override
- ✕First run failing cryptically on a missing API key
- ✕Session files leaking API keys into plaintext on disk
Verify before continuing
Do not move on until every check is true. The complete button stays locked until then.
Do not continue if…
- !Resume that replays a chat log but loses tool state and working directory
- !Config spread across hardcoded values nobody can override
- !First run failing cryptically on a missing API key
- !Session files leaking API keys into plaintext on disk
If the AI messes this up
Use this when the AI fakes progress or breaks the feature. It forces a real fix.
Sessions only save on clean exit. Move the save into the turn loop (write temp + rename for atomicity) so any crash loses at most the in-flight turn.