grok-session-restore — list and load Grok CLI sessions for context restoration.
Session layout (under $GROK_HOME or ~/.grok): sessions///summary.json — index sessions///updates.jsonl — ACP conversation log sessions///chat_history.jsonl sessions///signals.json sessions///plan.json sessions///compaction/ — segment summaries sessions///subagents/ — child session ids active_sessions.json — live pids
Memory is a separate plane under ~/.grok/memory/ and is only path-listed.
Topic selection
summary.json's own generated_title/session_summary wins when
non-empty. Otherwise the topic falls back to the first non-synthetic human
prompt found in chat_history.jsonl (a bounded head scan, then the tail
digest as a last resort) — never left blank when real content exists.
Digest is verbatim, not a summary
load's report never paraphrases the end of a session: the last human
prompts, the last assistant texts, and the last tool operations (calls
with their key argument, plus outputs and failures) are printed as direct
quotes from updates.jsonl/chat_history.jsonl, in chronological order,
newest last. summary.json's own last_turn_summary and any compaction
segment body are the store's own LLM-written paraphrases — they are
shown separately, clearly labeled, and never substituted for the verbatim
digest. The compaction body itself is hidden by default; --full-summary
opts in.
Reads are byte-budgeted, not full-file scans
Both updates.jsonl and chat_history.jsonl are read via a bounded tail
window (DEFAULT_TAIL_BYTES), and the topic fallback uses a bounded head
window (HEAD_FALLBACK_BYTES), so even a multi-hundred-megabyte session
loads in a fraction of a second.