> sessions & context
A session is the running conversation plus the files and memory the agent has in view. Gemini CLI saves sessions automatically per project so you can resume them, and it assembles context from @ file references, GEMINI.md instruction files, and loaded memory. Sessions live under ~/.gemini/tmp/<project_hash>/chats/ and are keyed to the directory you launched from.
// sessions & context
7 commands$ gemini --resume$ gemini --list-sessions$ /chat save before-refactor$ @src/auth.ts explain the bug on line 42$ /init$ /memory show$ printf '*.log\napikeys.txt\n/packages/\n' > .geminiignore// faq
How do I resume a previous Gemini CLI conversation?
Run gemini --resume (or -r) with no argument to reload the most recent session for the current project, restoring the full chat history and memory. Resume a specific one by index (gemini --resume 1) or UUID, and see the list with gemini --list-sessions.
Where are Gemini CLI sessions stored and how long do they last?
They are stored as files under ~/.gemini/tmp/<project_hash>/chats/, where the hash is derived from your project's root path, so they are project-specific. Sessions are retained for 30 days by default, after which they and their logs are cleaned up automatically.
What is a GEMINI.md file and how does it load?
GEMINI.md holds standing instructions the agent reads every session. Files merge by precedence: global ~/.gemini/GEMINI.md, then GEMINI.md files from the workspace up to the repo root, then any in subdirectories, with deeper files overriding shallower ones. Inspect the merged result with /memory show and regenerate a starter file with /init.
How do I add a specific file to the conversation?
Prefix its path with @, as in @src/main.ts fix the bug. @ on a directory includes the whole tree while respecting .gitignore and .geminiignore. To pull in every workspace file at once, launch with the -a (--all-files) flag instead.
How do I stop Gemini from reading certain files?
Create a .geminiignore file in the project root using .gitignore syntax; matching paths are excluded from @ inclusion, tool discovery, and context. Note it only hides files from the CLI — they stay visible to Git and everything else, so it is not a substitute for keeping secrets out of the repo.