# Session resume docs: claude --resume and codex resume anywhere

The gateway keeps a copy of each conversation that goes through it. One command rebuilds that copy as a native Claude Code or Codex session on any machine, and the client's own resume command opens it.

## Key facts

What it is

One command that rebuilds the gateway's copy of a conversation as a native Claude Code or Codex session.

Who it is for

Developers who move between machines, or between Claude Code and Codex.

Clients

Claude Code, opened with `claude --resume`, and Codex, opened with `codex resume`. The Codex writer was tested with Codex 0.156.1.

Measured result

Not a cost feature, and not measured on its own. For the gateway as a whole, see [Benchmarks](https://context-mode.com/docs/benchmarks#pooled).

Limits

Resume brings back message text, tool names and a summary before the latest 200 messages, not every tool output. The command expires after 15 minutes.

## What is saved

Each request to `gateway.context-mode.com` adds its new messages to the copy of your workspace. A workspace is one project and one worktree. Each session in it is kept apart. Saving happens before the gateway changes anything, and the request that goes to the model is the same with or without it.

per session the latest 200 messages

older messages a summary, updated every 20 messages by a model on Cloudflare Workers AI. Your Claude or OpenAI account is not used.

text each text block, cut at 6,000 characters

tool calls the tool's name only, shown as `(tool: Bash)`. Tool output is not replayed.

removed text the client adds on its own, such as Claude Code's system reminders

Sessions that went direct to Anthropic or OpenAI are not saved. Connect each machine with `npx @context-mode/cli`, as in the [quick start](https://context-mode.com/docs/quick-start).

## Resume on another machine

1. Open [Sessions](https://console.context-mode.com/app/resume) in the console. Each workspace shows its saved turns, its last topic and when it was last used.
2. Click **Open in Claude Code** or **Open in Codex**. The buttons are off for a workspace with no saved turns.
3. Copy the command. It works for 15 minutes.
4. On the other machine, go to the project folder and paste it. You need `curl`, Node.js and the client installed.

The console fills in the host and the token. The command has this shape:

```
curl -fsSL https://<host>/cm-resume.mjs -o /tmp/cm-resume.mjs \
  && node /tmp/cm-resume.mjs --gw https://<host> --handoff 'scope=…&t=…' --launch
```

The script downloads the copy, writes a session file for the folder you are in, and starts `claude --resume <id>` or `codex resume <id>`. The project can sit at a different path than on the first machine. Nothing keeps running after the client exits.

## Where the file goes

| Client | File written | Opened with |
| --- | --- | --- |
| Claude Code | `~/.claude/projects/<folder>/<id>.jsonl` | `claude --resume <id>` |
| Codex | `~/.codex/sessions/YYYY/MM/DD/rollout-<time>-<id>.jsonl` (under `$CODEX_HOME` if set) | `codex resume <id>` |

Both are the client's own file format. The Codex writer was tested with Codex 0.156.1 through `codex exec resume`.

## Switch between Claude Code and Codex

The copy belongs to the workspace, whichever client wrote it. A conversation from Claude Code opens in Codex, and a Codex conversation opens in Claude Code.

## One workspace, one conversation

The console hands off a whole workspace. The script joins its 50 most recent sessions into one conversation, oldest message first. The console has no picker for a single session.

## Access

The command carries a token that expires after 15 minutes and reads only your own account's workspaces. No API key or admin key is in it. Until it expires, anyone who has the command can read that conversation, so do not paste it into a shared channel.

## Cost

On the first request after a resume, the client sends the rebuilt conversation to the model, as it does with any resumed session. A long history adds tokens to that request.

## Compared with built-in resume

|  | Context Mode | `claude --resume` | `codex resume` | Claude Code in the cloud |
| --- | --- | --- | --- | --- |
| Where sessions live | the gateway | this computer | this computer | cloud infrastructure, for sessions that run there |
| On another machine | one command | copy the file yourself | copy the file yourself | open it in a browser, the phone or the Desktop app; `--teleport` pulls it into a terminal. From the CLI, "you can't push an existing terminal session to the cloud". |
| Local file deleted | rebuilt from the copy | session gone | session gone | not affected: the session runs in the cloud |
| Other client | Claude Code or Codex | no | no | Claude Code only |
| What comes back | message text, tool names, a summary before the latest 200 messages | the whole local file | the whole local file | the cloud session |

Context Mode brings back a local session when its file is on another machine or gone, in Claude Code or Codex, with one command. Built-in resume brings back more detail, because it reads the full file with tool output. [Claude Code in the cloud](https://code.claude.com/docs/en/claude-code-on-the-web) runs the session on cloud infrastructure, so it is on every device from the start; it is for Pro, Max and Team plans and some Enterprise seats, and it covers Claude Code only.

## FAQ

### Can I start in Claude Code and finish in Codex?

Yes. The copy belongs to the workspace, whichever client wrote it.

### Does it bring back every tool output?

No. It brings back message text, tool names and a summary before the latest 200 messages.

### Can I share the command?

No. Until it expires after 15 minutes, anyone who has it can read that conversation.

Compared with other tools: see the [landscape](https://context-mode.com/docs/landscape#sessions).

[Quick start →](https://context-mode.com/docs/quick-start) [Session resume](https://context-mode.com/session-resume) [Benchmarks](https://context-mode.com/docs/benchmarks)
