Repository navigation
Closed
coder/coder
#22222Description
Scope: Research and document how each AI agent module handles state persistence to inform implementation of pause/resume functionality.
Deliverables:
- Compatibility matrix documenting state persistence support for all 11 AI agent modules
- Documentation of state storage mechanisms for each agent (file paths, formats, flags)
- UX considerations and limitations for each agent type
- Recommendations for module configuration defaults
Agents to research (11 total):
coder/modules/claude-code- Known:--continueflag +.claude/directory (full support baseline)coder/modules/aidercoder/modules/goosecoder/modules/amazon-qcoder-labs/modules/auggiecoder-labs/modules/codexcoder-labs/modules/copilotcoder-labs/modules/cursor-clicoder-labs/modules/geminicoder-labs/modules/opencodecoder-labs/modules/sourcegraph-amp
Research questions for each agent:
- Does the agent have native session persistence?
- Where does it store state (file paths, formats)?
- Does it have resume/continue flags?
- What happens when state files are present vs. absent on startup?
- What UX issues arise when AgentAPI shows history but agent has no memory?
Compatibility levels (from RFC):
- Full support: Session persistence + resume flag + status reporting
- Partial support: Status reporting only, context lost on resume
- No support: Agent cannot persist state
Acceptance criteria:
- All 11 agents researched and documented
- Compatibility matrix created showing support level for each agent
- State storage mechanisms documented (paths, formats, flags)
- UX considerations documented for each compatibility level
- Recommendations provided for
enable_state_persistencedefaults per agent - Template requirements documented (persistent storage needs)
Blocks:
- Registry: AgentAPI base module shutdown script and state persistence #1257
- Registry: Propagate agentapi changes to AI agent modules #1258
References:
- PRD: Start/Pause/Resume the Task Workspace
- RFC: Tasks: Start/Pause/Resume Lifecycle: AI Agent Compatibility (lines 184-197)
Metadata
Metadata
Assignees
Labels
No labels
Activity
mafredri commentedon Feb 20, 2026
Compatibility matrix and storage guidelines draft PR available at: coder/coder#22222
mafredri commentedon Feb 20, 2026
Implementation guide for bringing each AI agent module to full pause/resume support.
enable_state_persistence,state_file_path,pid_file_pathto the agentapi base module.Status
coder/modules/claude-codecoder-labs/modules/codex--type codexcoder-labs/modules/copilotcoder-labs/modules/opencodecontinuedefault totruecoder-labs/modules/auggietrue, add--typecoder/modules/aiderreport_tasksdefault, fix--typeconditionalcoder/modules/goose--resume, add--typecoder-labs/modules/gemini--resume, add--typecoder/modules/amazon-q--resume, add--type. Deprecated upstream.coder-labs/modules/cursor-cli--resumewith chat ID capturecoder-labs/modules/sourcegraph-ampamp threads continuewith thread ID capturePriority 1: Default changes (Trivial)
OpenCode
File:
registry/coder-labs/modules/opencode/main.tf, line 116The module's
start.shalready handles this: whenARG_CONTINUE=true, it passes--continueto opencode. No script changes needed.File:
registry/coder-labs/modules/opencode/scripts/start.sh(no changes, for reference)ARG_CONTINUE=${ARG_CONTINUE:-false}(receives from main.tf)OPENCODE_ARGS+=(--continue)(already wired)Copilot (minor)
File:
registry/coder-labs/modules/copilot/scripts/start.sh,check_existing_session()functionCurrently checks only the legacy path:
Update to also check the new path (v0.0.342+):
Alternatively, simplify by always passing
--continuesince Copilot gracefully starts a new session when none exists.Auggie
File:
registry/coder-labs/modules/auggie/main.tfTwo variables need default changes:
The module's
start.shalready handlescontinue_previous_conversation: when true, it passes--continueto auggie (line 83). No script changes needed for the default flip.Caveat: Headless
--continuebehavior is unverified. Test in an agentapi-wrapped workspace before shipping.Priority 2: Resume flag wiring (Small)
Goose
File:
registry/coder/modules/goose/scripts/start.shCurrent launch (line 33-35):
agentapi server --term-width 67 --term-height 1190 -- \ bash -c "$(printf '%q ' "$GOOSE_CMD" "${GOOSE_ARGS[@]}")"Required changes:
--resume --name "coder-task"instead of--instructions--name "coder-task"to create a named sessionNote: Prompt re-delivery -- when resuming, skip
--instructionsto avoid re-sending the task prompt into an active conversation.Gemini
File:
registry/coder-labs/modules/gemini/scripts/start.shCurrent launch (last 2 lines):
agentapi server --term-width 67 --term-height 1190 -- \ bash -c "$(printf '%q ' gemini "${GEMINI_ARGS[@]}")"Required changes:
--resumeCritical: The
--resume "latest"flag causes a dead loop when called with no existing sessions. The existence check is mandatory, not optional.Amazon Q
File:
registry/coder/modules/amazon-q/scripts/start.shCurrent launch (last line):
Required changes:
--resumeflag on resume, skip prompt re-deliveryWarning: Amazon Q Developer CLI is deprecated in favor of Kiro CLI. Assess longevity before investing significant effort.
Aider (status reporting only)
File:
registry/coder/modules/aider/main.tf, line 45File:
registry/coder/modules/aider/scripts/start.sh,start_agentapi()functionCurrent code has a conditional
--typebug (lines 46-49):Fix: add
--type aiderto the else branch:agentapi server --type aider --term-width=67 --term-height=1190 -- aider --model $ARG_MODEL --yes-alwaysNo resume work: Aider lacks viable session resume.
--restore-chat-historyis lossy and crashes on large histories. Blocked on upstream.Priority 3: Resume with ID capture (Medium)
Cursor CLI
File:
registry/coder-labs/modules/cursor-cli/scripts/start.shCurrent launch (line 67):
Cursor supports
--resume [chatId]andagent resume, but requires a chat ID from the prior session. The module needs:cursor-agent lsoutput for the most recent chat~/.cursor/chats/for new directories$HOME/.cursor-cli-module/last-chat-id)--resume <chatId>Open question: Exact mechanism for capturing chat ID. Requires testing
cursor-agent lsoutput format and~/.cursor/chats/directory structure.Sourcegraph Amp
File:
registry/coder-labs/modules/sourcegraph-amp/scripts/start.shAmp stores threads entirely server-side. Resume requires a thread ID.
AMP_THREAD_IDenv var (if Amp sets it)--stream-jsonoutput parsingamp threads listafter first run$HOME/.amp-module/last-thread-id)amp threads continue <threadId>instead of piping prompt toampConstraint: Requires network connectivity to Sourcegraph servers. Air-gapped environments cannot use thread resume.
Priority 4:
--typeflag cleanupModules launching
agentapi serverwithout--type:coder/modules/goose/scripts/start.sh:33agentapi server --term-width 67 ...--type goosecoder/modules/amazon-q/scripts/start.sh:66agentapi server ${ARG_SERVER_PARAMETERS} --term-width 67 ...--type amazon-qcoder-labs/modules/gemini/scripts/start.sh:76agentapi server --term-width 67 ...--type geminicoder-labs/modules/codex/scripts/start.sh:216agentapi server --term-width 67 ...--type codexcoder-labs/modules/auggie/scripts/start.sh:101agentapi server --term-width 67 ...--type auggieAdditionally, Aider conditionally omits
--type aider(see Priority 2 above).These should be bundled with the resume flag changes for each module.
Cross-cutting: Prompt re-delivery on resume
Several modules pass
ai_prompt/task_prompton every startup viaagentapi -Ior as a CLI argument. When resume is added, the prompt must be conditionally skipped to avoid re-sending the task into an already-active conversation.--instructions "$PROMPT_FILE"arg togoose run--instructionswhen resuming--prompt-interactive "$PROMPT"arg togemini--prompt-interactivewhen resumingARGSarray--instruction "$PROMPT"arg toauggie--instructionwhen resumingagentapi -I "$PROMPT"-Iwhen resuming with--continueModules that already handle this correctly:
check_existing_session()returns true (uses--continuewithout-I).Not actionable (blocked on upstream)
Aider session resume
Aider's
--restore-chat-historyflag reads from.aider.chat.history.mdin the working directory. This is not viable for production use:Aider also lacks MCP support (TODO at
registry/coder/modules/aider/scripts/start.sh:53). Status reporting relies on text-based output parsing via--type aider.What to monitor: MCP support in Aider-AI/aider. When added, implement
coder_report_taskMCP tool config and re-evaluate session persistence.Recommendation: Keep
enable_state_persistence = falsefor Aider. It is the only agent where this is the correct long-term setting.docs: add task lifecycle and agent compatibility pages (#22222)