Skip to content

cursor-cli: wire session resume with chat ID persistence #747

@mafredri

Description

@mafredri

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.
  • After feat(coder/modules/agentapi): add state persistence #736 lands: enable_state_persistence = true.

Investigation needed first

The exact mechanism for capturing chat IDs is undocumented. Before implementation, test:

  1. Parse cursor-agent ls output for the most recent chat ID.
  2. Monitor ~/.cursor/chats/ for new entries after launch.
  3. 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions