Grok CLI guide: session storage

Where Grok CLI stores its sessions

Grok is the odd one of the three: a session is not a file, it is a directory. The CLI writes several files per session, including a summary index it keeps current as the conversation runs, so nothing has to scan a transcript head to know what a session is about.

xAI

On Grok CLI

The root

Sessions live under $GROK_HOME/sessions, where $GROK_HOME defaults to ~/.grok.

A directory per session

The layout is sessions/<encoded-project-path>/<uuidv7>/. The outer directory groups by project, the inner one is the session, and a UUIDv7 sorts chronologically because its leading bits are a timestamp.

What is inside

Each session directory holds summary.json, updates.jsonl, chat_history.jsonl, rewind_points.jsonl and signals.json. The transcript is split across more than one of these, so reading only chat_history gives you a partial view.

summary.json is the authority

The project path shown for a session should come from info.cwd inside summary.json, never from decoding the group directory name. When a path is too long to encode into a directory name, Grok falls back to a shorter slug, and at that point the directory name no longer round-trips.

Keep auth.json out of any copy

The Grok home directory holds auth.json at its top level, and that file is a bare OIDC token. Only the sessions subdirectory is safe to hand to a tool. Termdeck confines its agent to that subdirectory for exactly this reason.

Compare

Where each engine writes a session

 Claude CodeCodex CLIGrok CLI
Root directory~/.claude/projects$CODEX_HOME/sessions$GROK_HOME/sessions
One session isOne .jsonl fileOne .jsonl rollout fileA directory of files
Grouped bySlugged project pathDate, as YYYY/MM/DDSlugged project path
Path from project + idDerivableNot derivable, resolve by idDerivable
Old sessionsLeft as plain .jsonlCompressed to .jsonl.zstLeft as plain files
Built-in indexNone, scan the treesession_index.jsonlsummary.json per session

Termdeck drives all three from one console, so the differences above stop being three separate habits to remember.

FAQ

Grok CLI session storage, answered

Why is a Grok session a folder instead of a file?

Grok splits a session across several files: a summary index, an update stream, the chat history, rewind points and signals. Giving each session its own directory keeps those five together and lets the CLI update the summary without rewriting the transcript.

Which file tells me what project a Grok session belongs to?

The info.cwd field inside summary.json. The directory name looks like an encoded path but does not always round-trip, because paths too long to encode fall back to a shorter slug, so decoding the directory name is only a fallback.

Is it safe to copy my whole .grok directory?

No. auth.json sits at the top level of that directory and holds a live OIDC access and refresh token. Copy only the sessions subdirectory if you are moving history between machines.

What is a rewind point?

Grok records rewind points in their own file so the CLI can roll a conversation back to an earlier state. They are session metadata rather than transcript content, which is why they are stored separately from chat history.

Claude Code, Codex and Grok in one browser console

Read any session, from anywhere.