Skip to content

feat: persist and restore AI agent session IDs across restarts #343

@jerome-benoit

Description

@jerome-benoit

Research on CLI options done with AI assistance. Concept and use cases are human-driven.

Problem

AI agents like Claude Code and OpenCode have their own internal session IDs that persist conversation history. When tmux sessions restart (laptop reboot, agent upgrade, container rebuild), users lose continuity because AOE doesn't track these agent session IDs.

Use Cases

  1. Laptop restart - Resume exact conversation state after reboot
  2. Agent upgrade - Update agent binary across all AOE sessions while preserving conversations
  3. Session recovery - Restore accidentally killed sessions

Agent Support

Both Claude Code and OpenCode support session resume:

Agent Resume Flag Example
Claude Code -r / --resume claude --resume abc123-def456
OpenCode -s / --session opencode --session abc123

Proposed Approach

  1. Add agent_session_id: Option<String> to session storage
  2. Capture session ID after agent launch (parse output or read agent's session files)
  3. Pass resume flag on subsequent launches when session ID is known
  4. Add keybinding for "restart with session resume"

Questions

  • Should this be automatic or opt-in?
  • How to handle sandboxed sessions with different config paths?
  • Which agents to prioritize?

Happy to discuss the approach before diving into implementation details.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions