Sessions & Context

MiMo Code persists every conversation as a session, retaining its message history and metadata. You can close the terminal and resume your work later. This page covers how sessions are stored, resumed, switched, and forked, as well as how the context window is managed through compaction.

Session storage

Session data is saved in MiMo Code's data directory, grouped by working directory.

$MIMOCODE_HOME/ ├── config/ ← global config files ├── data/ ← auth.json, session database ├── state/ └── cache/

Don't edit these files manually. Session state is managed by MiMo Code, and manual changes may make a session unrecoverable.

Starting and resuming sessions

Running MiMo Code creates a new session in the current directory.

1mimo

You can resume an existing session with the following flags:

1# Resume the most recent session in the current directory
2mimo --continue
3
4# Resume a specific session by ID
5mimo --session <id>
Flag Short Description
--continue -c Continue the last session
--session -s Session ID to continue
--fork Fork the session when continuing (use with --continue or --session)

Switching sessions in the TUI

Inside the TUI, you can switch between sessions using slash commands:

  • /new (alias /clear) — start a new session, discarding the current context. Keybind ctrl+x n.
  • /sessions (aliases /resume, /continue) — list and switch between sessions. Keybind ctrl+x l.

Listing sessions

Outside the TUI, use the session command to manage sessions.

1mimo session list
Flag Short Description
--max-count -n Limit to the most recent N sessions
--format Output format: table or json (default table)

Context compaction

Every model has a limited context window. As a conversation grows, the MiMo Code CLI automatically compacts earlier messages as the context approaches that limit to free up token space. You can also trigger it manually at any time:

1/compact

/compact has the alias /summarize and the keybind ctrl+x c.

Configuration

You can control context compaction behavior through the compaction option.

1{
2  "compaction": {
3    "auto": true,
4    "prune": true,
5    "reserved": 10000
6  }
7}
  • auto - Automatically compact the session when context is full (default: true).
  • prune - Remove old tool outputs to save tokens (default: true).
  • reserved - Token buffer for compaction. Leaves enough window to avoid overflow during compaction.

Forking sessions

Forking lets you derive an independent copy of a session to try new ideas without affecting the original. The two sessions are independent and don't affect each other.

1# Fork from the most recent session and continue
2mimo --continue --fork
3
4# Fork from a specific session
5mimo --session <id> --fork

Exporting and importing

You can export a session to JSON for archiving, sharing, or bug reports.

1mimo export [sessionID]

If you don't provide a session ID, you'll be prompted to choose from the available sessions.

You can then import session data from a local file or a MiMo Code share link.

1mimo import session.json
2mimo import https://opncd.ai/s/abc123