GC-201c · Module 2
Session Management & Persistence
3 min read
Gemini CLI sessions persist across terminal restarts. The /chat command accesses your session history — previous conversations are stored locally and can be resumed. /chat resume picks up where you left off, restoring the conversation context. This is critical for multi-day tasks where closing your terminal should not mean losing your progress. The session system also supports sharing: /chat share exports a session as markdown or JSON for team documentation.
Session management strategy matters for complex projects. The best pattern: one session per task, clear session boundaries, explicit session names or descriptions. When a task is complete, export the session for documentation if it produced valuable insights, then start fresh for the next task. Do not let sessions become long-running catch-all conversations — context quality degrades and the model starts conflating unrelated decisions.
# View session history
/chat
# Resume a specific previous session
/chat resume
# Export session as documentation
/chat share --format markdown > sessions/auth-refactor-2026-04.md
/chat share --format json > sessions/auth-refactor-2026-04.json
# Start fresh for a new task
/clear
# Use /compact to manage long-running sessions
/compact
Do This
- Use one session per task with clear boundaries
- Export sessions that capture important decisions or complex debugging
- Use /chat resume for multi-day tasks instead of starting fresh
Avoid This
- Run a single session for days across unrelated tasks
- Let valuable debugging sessions disappear when the terminal closes
- Start fresh every time when resuming would preserve important context