Problem
Cursor CLI supports cursor-agent --resume [chatId] and agent resume, but the module always starts fresh. Unlike the other agents, resume requires a chat ID from the prior session, and the module has no mechanism to capture or persist one.
--type cursor is already present. No --type change needed.
Desired outcome
- On cold start: Cursor starts normally. The chat ID from the new session is captured and persisted.
- On warm start: Cursor resumes the prior session using the stored chat ID. The task prompt (currently a positional arg) is not re-sent.
- Expose
enable_state_persistence in main.tf (default true) and pass it through to the module "agentapi" block so the Coder UI preserves chat history across restarts, matching the agent's resumed session.
Investigation needed first
The exact mechanism for capturing chat IDs is undocumented. Before implementation, test:
- Parse
cursor-agent ls output for the most recent chat ID.
- Monitor
~/.cursor/chats/ for new entries after launch.
- Capture from process stdout.
Also verify:
- What happens when
--resume <chatId> is called with an invalid or missing ID?
- Does
--resume work in non-interactive/headless mode (as launched by agentapi)?
- The format of
~/.cursor/chats/ is undocumented and may change without notice.
If no reliable capture mechanism exists, this ticket is blocked.
Version bump
minor
Refs coder/internal#1258
Problem
Cursor CLI supports
cursor-agent --resume [chatId]andagent resume, but the module always starts fresh. Unlike the other agents, resume requires a chat ID from the prior session, and the module has no mechanism to capture or persist one.--type cursoris already present. No--typechange needed.Desired outcome
enable_state_persistenceinmain.tf(defaulttrue) and pass it through to themodule "agentapi"block so the Coder UI preserves chat history across restarts, matching the agent's resumed session.Investigation needed first
The exact mechanism for capturing chat IDs is undocumented. Before implementation, test:
cursor-agent lsoutput for the most recent chat ID.~/.cursor/chats/for new entries after launch.Also verify:
--resume <chatId>is called with an invalid or missing ID?--resumework in non-interactive/headless mode (as launched by agentapi)?~/.cursor/chats/is undocumented and may change without notice.If no reliable capture mechanism exists, this ticket is blocked.
Version bump
minorRefs coder/internal#1258