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.
MIMOCODE_HOME is an absolute path to a single profile root holding the config/, data/, state/, and cache/ subdirectories; setting it overrides all four XDG base directories.
Don't edit these files manually. Session state is managed by MiMo Code, and manual changes may make a session unrecoverable.
When uninstalling, use mimo uninstall --keep-data to keep session data and snapshots. Learn more.
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) |
--continue and --session cannot both specify a new session source at once; --forkmust be used together with one of them.
See the full list of CLI flags in Command Line.
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.See the full list of slash commands in Slash Commands.
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.
Compaction is performed by a hidden Compaction agent that compresses long context into a smaller summary.
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.To disable automatic compaction entirely, set the environment variable MIMOCODE_DISABLE_AUTOCOMPACT=true. Learn more.
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.
When running through the HTTP interface, you can also fork an existing session at a specific message..
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.
Exported files may contain sensitive information (code, command output, paths, etc.). Review the contents before sharing.
To share a session live via a link, see Share.