Persistent agent sessions currently lose in-memory conversation state when the process/service restarts, because agentd only persists event logs and forwards new prompts over FIFO. Design + implement restart-safe session state so persistent agents resume with prior context, not a fresh conversation. Scope should cover agent runtime state snapshotting, restore path on startup, compatibility/version checks, and recovery behavior when snapshot is missing/corrupt.
Design note (corrected):
Proposed MVP: use existing checkpoint/resume plumbing to persist full AgentState for each persistent agent and auto-restore on restart.
Why:
Plan: 1) Persist stable snapshot each completed turn
2) Auto-restore on startup in persistent wrapper
3) Lifecycle
4) Hardening (follow-up)
Likely files:
Acceptance test:
Implemented restart-safe persistent session restore in commit a711c7bf.
What changed:
Validation:
Manual acceptance test (live): 1) create/start temporary persistent agent resume-smoke 2) send prompt A: remember APPLE-739 3) observed checkpoint files: init.json + session-latest.json under ~/.local/state/agentd-agents/checkpoints/resume-smoke/ 4) restart agent; verified process argv contains --resume .../session-latest.json 5) send prompt B asking for remembered code; assistant returned APPLE-739 6) agentd rm resume-smoke removed env/fifo/checkpoint runtime artifacts
Proposed design (MVP): use existing agent checkpoint/resume plumbing to persist full AgentState per persistent session and auto-restore on restart.
Why this approach:
Design: 1) Persist a stable session snapshot every completed turn
2) Auto-restore on persistent process startup
3) Keep lifecycle semantics simple
4) Hardening (follow-up)
Scope/files likely touched:
Acceptance test: