Gemini CLI: Session Export & Import

Gemini CLI

Gemini CLI v0.43.0 introduces session portability through a new /export-session slash command and a --session-file import flag. Users can now save an active conversation to a JSON file and restore it as a fresh session in a different context, enabling sharing, debugging handoffs, and multi-environment workflows. The feature is mutually exclusive with --resume and --session-id to avoid ambiguous startup states. This is one of the most frequently requested community features, tracked across multiple GitHub issues over the past year.


Session Export & Import Come to Gemini CLI in v0.43.0

Gemini CLI v0.43.0, released on May 22, 2026, ships one of the most-requested community features: the ability to export a live conversation session to a portable file and import it into a fresh session. The addition fundamentally changes how developers can share, document, and resume complex AI-assisted workflows.

Exporting a Session

A new slash command β€” /export-session <path> β€” saves the current conversation to disk in JSON format. The command displays a progress spinner while writing and outputs a confirmation once the file is saved. The JSON file captures the full conversation record: prompts, model responses, tool call history, and metadata.

The export is designed to be a clean snapshot. It strips out transient system messages such as update notifications, ensuring the exported file contains only the durable conversation content. This means exported sessions are reproducible regardless of CLI version-specific banners or status messages that were present at export time.

Importing a Session

On the import side, a new --session-file <path> CLI flag bootstraps a new session from a previously exported JSON file. The system reads the file and reconstitutes the conversation history as a new local session with a fresh session ID and a new storage path, maintaining data isolation from the original export.

The import uses "best-effort" parsing, making it resilient to minor structural changes across Gemini CLI versions. If the JSON schema evolves in a future release, older exported files will still load without hard failures.

Mutual Exclusivity and Safety

The --session-file, --resume, and --session-id startup flags are mutually exclusive. Passing more than one of these simultaneously raises an error, preventing ambiguous session states where the CLI would not know which conversation context to load.

Use Cases

Session export unlocks several workflows that were previously impossible:

  • Debugging handoffs: A developer can export a conversation mid-debug and share the JSON file with a colleague, who can pick up the exact same context in their own environment.
  • Documentation: Complex multi-step coding sessions can be exported for archival or inclusion in project runbooks.
  • Cross-machine continuity: A session started on one machine can be exported and imported on another, without relying on cloud sync or shared file systems.
  • Reproducible testing: AI-assisted test refinement sessions can be exported and replayed, ensuring the same model context is available across runs.

Why This Matters

Prior to v0.43.0, Gemini CLI sessions were device-local. The --resume flag allowed picking up a session on the same machine, but there was no way to transfer session context across machines or share it with another user. This was a significant gap for team-based workflows. The new export/import feature closes that gap without requiring any backend infrastructure β€” the JSON file is entirely self-contained.

Bug Fixes and Reliability Improvements

v0.43.0 also ships a broad set of fixes that improve day-to-day reliability: a chat corruption bug in the context manager has been resolved, the CLI now handles invalid custom plans directories gracefully, MCP list UX is improved in untrusted folders, and OAuth auth no longer silently hangs on headless Linux environments.