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 data is saved in MiMo Code's data directory, grouped by working directory.
Don't edit these files manually. Session state is managed by MiMo Code, and manual changes may make a session unrecoverable.
Running MiMo Code creates a new session in the current directory.
You can resume an existing session with the following flags:
| 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) |
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.Outside the TUI, use the session command to manage sessions.
| Flag | Short | Description |
|---|---|---|
--max-count |
-n |
Limit to the most recent N sessions |
--format |
Output format: table or json (default table) |
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:
/compact has the alias /summarize and the keybind ctrl+x c.
You can control context compaction behavior through the compaction option.
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 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.
You can export a session to JSON for archiving, sharing, or bug reports.
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.