Gemini CLI memory: context files, and where the context ends
Gemini CLI is generous with context files and refreshingly scriptable. Memory between runs still means files, because that is what a stateless CLI has.
Google. Sources checked 2026-09-25.
How Gemini CLI handles memory today
Gemini CLI uses GEMINI.md context files with hierarchical loading: global from the home directory, project root, and subdirectories, so instructions follow the directory tree. It also supports MCP servers, which is how external tools and memory providers plug in.
Context files are instructions. They are loaded fresh every run and carry no record of previous sessions unless a human maintains that record by hand.
What Gemini CLI forgets
A fresh process every run means a fresh memory every run.
- Conversation history between invocations. Close the session and the working context is gone.
- Accumulated decisions that were never written into GEMINI.md, which is most of them.
- Detail under summarization in long sessions, where older turns get condensed.
- Cross-tool continuity with the rest of your stack.
The fix with MemoryRouter
Gemini CLI supports MCP servers. Point it at MemoryRouter and the CLI gets recall and store tools over a vault shared with your other tools.
- 1
Add the server to your Gemini CLI settings
Register the remote MCP endpoint in the CLI MCP settings file. The transport is streamable HTTP with OAuth.
Gemini CLI settings.json
{ "mcpServers": { "memoryrouter": { "httpUrl": "https://mcp.memoryrouter.ai/mcp" } } } - 2
Authenticate and select a vault
The CLI walks you through the OAuth flow on first use.
- 3
Ask for memory explicitly at first
Tool calls are model-directed. Prompt with "check memoryrouter for the decisions about this module" until it becomes a habit.
Works with Gemini CLI over MCP and with every other tool you connect. 14-day free trial.
Related
Gemini CLI memory FAQ
Sources
Sources checked 2026-09-25. Tool behavior changes; check the vendor docs before relying on a detail.