Session restore in Coterm
Terminal workflows survive interruptions better when the app can reconstruct the shape of your work. Coterm now treats the workspace layout as durable state instead of something tied to one app process.
The important boundary is live process state. coterm restores what it owns and what supported tools expose through their own resume APIs. It does not checkpoint arbitrary terminal processes.
If you are looking for how to restore Claude Code, OpenCode, opencode, Codex, Gemini CLI, Antigravity CLI, Grok Build CLI, Amp, Cursor CLI, Rovo Dev, Copilot, CodeBuddy, Factory, Qoder, or Hermes Agent sessions after a terminal crash, install coterm hooks and keep agent resume enabled.
What always comes back
After a normal relaunch, coterm restores the app-level session snapshot:
- Window, workspace, and pane layout
- Working directories
- Terminal scrollback, best effort
- Browser URL and navigation history
Agent sessions need hooks
Claude Code, Codex, Grok Build CLI, OpenCode, Pi, Amp, Cursor CLI, Gemini CLI, Antigravity CLI, Rovo Dev, Hermes Agent, Copilot, CodeBuddy, Factory, and Qoder can resume when coterm has a native session ID. For most agents, install the integration with coterm hooks setup.
coterm hooks setupThe setup command installs supported agents whose binaries are on PATH and skips the rest. Claude Code is handled by the coterm Claude wrapper when Claude integration is enabled in Settings.
How it works
coterm writes a JSON session snapshot under Application Support with the window tree, workspace metadata, pane layout, terminal cwd, scrollback replay data, and browser navigation state.
Agent hooks write session mappings under ~/.coterm. On restore, coterm rebuilds the UI first. If automatic agent resume is enabled, it launches each supported agent with that agent's native resume command and the saved session ID.
What stays out of scope
tmux, vim, shells, and unsupported tools reopen as normal terminals unless they have a coterm integration that records a safe native resume command. That keeps restore predictable and avoids replaying stale prompts or secrets.
Read the session restore docs for setup commands, supported agents, and troubleshooting.