Grok CLI¶
Grok CLI combines a prompt-history audit log with full session transcript files. agentgrep searches user prompts by default. Targeted effort resolves a prompt record’s session UUID to the corresponding project transcript; full assistant, reasoning, and tool records also require conversation or all scope.
Base path: ~/.grok (env override: GROK_HOME).
observed_version: grok 1.0.70 (observed 2026-10-25).
Grok stores data under ~/.grok/sessions/ using URL-encoded project
paths as directory keys (e.g. %2Fhome%2Fd%2Fwork%2Fpython%2Fproj).
Each session is identified by a UUIDv7 (timestamp-sortable).
Stores¶
- Role:
prompt_history- Format:
jsonl- Coverage:
default_search- Adapter:
grok.prompt_history_jsonl.v1
- Role:
primary_chat- Format:
jsonl- Coverage:
default_search- Adapter:
grok.sessions_jsonl.v1
- Role:
supplementary_chat- Format:
sqlite- Coverage:
default_search- Adapter:
grok.session_search_sqlite.v1
- Role:
supplementary_chat- Format:
json_object- Coverage:
default_search- Adapter:
grok.subagents_json.v1
- Role:
app_state- Format:
jsonl- Coverage:
catalog_only- Adapter:
-
- Role:
app_state- Format:
json_object- Coverage:
catalog_only- Adapter:
-
- Role:
persistent_memory- Format:
md_frontmatter- Coverage:
inspectable- Adapter:
grok.memory_text.v1
- Role:
app_state- Format:
sqlite- Coverage:
catalog_only- Adapter:
-
- Role:
app_state- Format:
opaque- Coverage:
catalog_only- Adapter:
-
- Role:
plan- Format:
md_frontmatter- Coverage:
inspectable- Adapter:
grok.plans_text.v1
- Role:
app_state- Format:
text- Coverage:
catalog_only- Adapter:
-
- Role:
app_state- Format:
json_object- Coverage:
catalog_only- Adapter:
-
- Role:
app_state- Format:
jsonl- Coverage:
catalog_only- Adapter:
-
- Role:
app_state- Format:
jsonl- Coverage:
catalog_only- Adapter:
-
- Role:
app_state- Format:
text- Coverage:
catalog_only- Adapter:
-
- Role:
instruction- Format:
md_frontmatter- Coverage:
catalog_only- Adapter:
-
- Role:
app_state- Format:
json_object- Coverage:
catalog_only- Adapter:
-
- Role:
app_state- Format:
json_object- Coverage:
catalog_only- Adapter:
-
- Role:
app_state- Format:
sqlite- Coverage:
catalog_only- Adapter:
-
- Role:
app_state- Format:
text- Coverage:
catalog_only- Adapter:
-
- Role:
persistent_memory- Format:
md_frontmatter- Coverage:
inspectable- Adapter:
grok.memory_text.v1
- Role:
app_state- Format:
text- Coverage:
catalog_only- Adapter:
-
- Role:
cache- Format:
json_object- Coverage:
catalog_only- Adapter:
-
grok.prompt_history¶
JSONL per-project user-prompt audit log. Keys: timestamp (ISO-8601 nanosecond), session_id (UUIDv7), prompt (text), is_bash (bool).
- Agent:
Grok
- Role:
prompt_history- Format:
jsonl- Coverage:
default_search- Path:
${GROK_HOME or ${HOME}/.grok}/sessions/<url_encoded_project>/prompt_history.jsonl- Adapter:
grok.prompt_history_jsonl.v1- Data version:
-- Version strategies:
-- Observed:
grok 1.0.70 (2026-10-25)
- Default search:
yes
Record keys observed (1.0.70, 2026-10-25)
- Keys:
is_bash,prompt,session_id,timestamp
grok.sessions¶
JSONL full session transcripts. type discriminates system/user/assistant/reasoning/tool_result/backend_tool_call. Assistant tool calls live in a tool_calls array on the assistant record; backend_tool_call records host-side calls. reasoning records carry a readable summary array of {type: summary_text, text} blocks plus an opaque encrypted_content blob; agentgrep does not surface them because the adapter reads only content, which reasoning records omit. content is text or a content-blocks array. No record of any type carries a timestamp key, so the adapter backfills the source mtime. Agent-injected turns are written as user records tagged with synthetic_reason (system_reminder, project_instructions); the adapter does not yet read that key, so they are indexed as user prompts.
- Agent:
Grok
- Role:
primary_chat- Format:
jsonl- Coverage:
default_search- Path:
${GROK_HOME or ${HOME}/.grok}/sessions/<url_encoded_project>/<session_uuid>/chat_history.jsonl- Adapter:
grok.sessions_jsonl.v1- Data version:
-- Version strategies:
-- Observed:
grok 1.0.70 (2026-10-25)
- Default search:
yes
Record keys by type observed (1.0.70, 2026-10-25)
- assistant:
content,model_fingerprint,model_id,reasoning_effort,tool_calls,type- backend_tool_call:
kind,type- reasoning:
encrypted_content,id,status,summary,type- system:
content,type- tool_result:
content,tool_call_id,type- user:
content,prompt_index,synthetic_reason,type
Full per-session transcript with tool calls; grok.prompt_history is the user-prompts-only audit log.
grok.session_search¶
SQLite with FTS5. Table session_docs: session_id, cwd, updated_at (unix seconds), title (generated), content (full-text index), content_hash, last_indexed_offset. A meta table carries session_search_schema_version (4) and last_bootstrap_at; PRAGMA user_version stays 0.
- Agent:
Grok
- Role:
supplementary_chat- Format:
sqlite- Coverage:
default_search- Path:
${GROK_HOME or ${HOME}/.grok}/sessions/session_search.sqlite- Adapter:
grok.session_search_sqlite.v1- Data version:
-- Version strategies:
-- Observed:
grok 1.0.70 (2026-10-25)
- Default search:
yes
SQLite tables observed (1.0.70, 2026-10-25)
- meta columns:
key,value- session_docs columns:
session_id,cwd,updated_at,title,content,content_hash,last_indexed_offset- session_docs_fts columns:
title,content- session_docs_fts_config columns:
k,v- session_docs_fts_data columns:
id,block- session_docs_fts_docsize columns:
id,sz- session_docs_fts_idx columns:
segid,term,pgno
Pre-indexed session titles and content for fast lookup. De-duplicate against grok.sessions by session_id.
grok.subagents¶
Per-subagent dispatch record. One JSON object per delegated subagent: prompt (the delegated instruction), description, subagent_type, tool_calls, turns, and parent/child session linkage. effective_model_id and child_cwd name the model and working directory the child ran under. The child session keeps its own chat_history.jsonl, read as grok.sessions; this record is the delegation itself. tool_calls is a count, not a list.
- Agent:
Grok
- Role:
supplementary_chat- Format:
json_object- Coverage:
default_search- Path:
${GROK_HOME or ${HOME}/.grok}/sessions/<url_encoded_project>/<session_uuid>/subagents/<subagent_uuid>/meta.json- Adapter:
grok.subagents_json.v1- Data version:
-- Version strategies:
-- Observed:
grok 1.0.70 (2026-10-25)
- Default search:
yes
Record keys observed (1.0.70, 2026-10-25)
- Keys:
attempt_id,child_cwd,child_session_id,completed_at,description,duration_ms,effective_context_source,effective_model_id,fork_copy_error,parent_session_id,prompt,resumed_from,started_at,status,subagent_id,subagent_type,tool_calls,turns
Subagent dispatch prompts are conversation content; the child’s own turns are in its session transcript. Parity with claude.projects.subagent and cursor-cli.subagent_transcripts.
grok.sessions.events¶
Per-session event stream. type values include turn_started, turn_ended, loop_started, first_token, phase_changed, tool_started, tool_completed, permission_requested/resolved, and an mcp_* lifecycle family (illustrative, not exhaustive). A per-record schema_version (“1.0”) rides on turn_started.
- Agent:
Grok
- Role:
app_state- Format:
jsonl- Coverage:
catalog_only- Path:
${GROK_HOME or ${HOME}/.grok}/sessions/<url_encoded_project>/<session_uuid>/events.jsonl- Adapter:
-
- Data version:
-- Version strategies:
-- Observed:
grok 1.0.70 (2026-10-25)
- Default search:
no
grok.sessions.summary¶
Per-session summary: id, cwd, session_summary, created_at, updated_at, num_messages, current_model_id, git metadata, generated_title, agent_name.
- Agent:
Grok
- Role:
app_state- Format:
json_object- Coverage:
catalog_only- Path:
${GROK_HOME or ${HOME}/.grok}/sessions/<url_encoded_project>/<session_uuid>/summary.json- Adapter:
-
- Data version:
-- Version strategies:
-- Observed:
grok 1.0.70 (2026-10-25)
- Default search:
no
grok.memory¶
Persistent memory Markdown managed by Grok’s memory system. Covers the flat memory/MEMORY.md and the per-project memory/<project-slug>-<hash8>/MEMORY.md subtree. The companion index.sqlite is not separately enumerated; it is a chunk store (chunks) with both an FTS5 mirror (chunks_fts) and a sqlite-vec embedding index (chunks_vec), not an FTS index alone. Grok derives the directory name from the git remote URL, so every clone and worktree of one repository shares a memory directory. Inspectable opt-in.
- Agent:
Grok
- Role:
persistent_memory- Format:
md_frontmatter- Coverage:
inspectable- Path:
${GROK_HOME or ${HOME}/.grok}/memory/**/MEMORY.md- Adapter:
grok.memory_text.v1- Data version:
-- Version strategies:
-- Observed:
grok 1.0.70 (2026-10-25)
- Default search:
no
grok.logs¶
Structured application logs: ts, src, pid, lvl, msg, ctx. Debugging diagnostics, not chat content.
- Agent:
Grok
- Role:
app_state- Format:
jsonl- Coverage:
catalog_only- Path:
${GROK_HOME or ${HOME}/.grok}/logs/unified.jsonl- Adapter:
-
- Data version:
-- Version strategies:
-- Observed:
grok 1.0.70 (2026-10-25)
- Default search:
no
grok.worktrees_db¶
SQLite database tracking git worktrees created by Grok.
- Agent:
Grok
- Role:
app_state- Format:
sqlite- Coverage:
catalog_only- Path:
${GROK_HOME or ${HOME}/.grok}/worktrees.db- Adapter:
-
- Data version:
-- Version strategies:
-- Observed:
grok 1.0.70 (2026-10-25)
- Default search:
no
grok.config¶
grok.plans¶
Per-session plan-mode Markdown — the agent’s working plan for the session. Inspectable, parity with claude.plans and cursor-cli.plans; not searched by default.
- Agent:
Grok
- Role:
plan- Format:
md_frontmatter- Coverage:
inspectable- Path:
${GROK_HOME or ${HOME}/.grok}/sessions/<url_encoded_project>/<session_uuid>/plan.md- Adapter:
grok.plans_text.v1- Data version:
-- Version strategies:
-- Observed:
grok 1.0.70 (2026-10-25)
- Default search:
no
grok.sessions.system_prompt¶
The rendered system prompt for the session (agent instructions plus injected context). Agent-side boilerplate, largely shared across sessions; documented for inventory, not searched.
- Agent:
Grok
- Role:
app_state- Format:
text- Coverage:
catalog_only- Path:
${GROK_HOME or ${HOME}/.grok}/sessions/<url_encoded_project>/<session_uuid>/system_prompt.txt- Adapter:
-
- Data version:
-- Version strategies:
-- Observed:
grok 1.0.70 (2026-10-25)
- Default search:
no
grok.sessions.prompt_context¶
Session prompt-context metadata: working_directory, agents_md_files, persona_summaries, os_name, current_date, prompt_mode, audience, version. Configuration, not chat.
- Agent:
Grok
- Role:
app_state- Format:
json_object- Coverage:
catalog_only- Path:
${GROK_HOME or ${HOME}/.grok}/sessions/<url_encoded_project>/<session_uuid>/prompt_context.json- Adapter:
-
- Data version:
-- Version strategies:
-- Observed:
grok 1.0.70 (2026-10-25)
- Default search:
no
grok.sessions.hunk_records¶
Edit-attribution JSONL (filePath, hunkStart/End, linesAdded/Removed, authorType, promptIndex, eventType). Code-change telemetry, no prompt payload; documented, not searched.
- Agent:
Grok
- Role:
app_state- Format:
jsonl- Coverage:
catalog_only- Path:
${GROK_HOME or ${HOME}/.grok}/sessions/<url_encoded_project>/<session_uuid>/hunk_records.jsonl- Adapter:
-
- Data version:
-- Version strategies:
-- Observed:
grok 1.0.70 (2026-10-25)
- Default search:
no
grok.sessions.updates¶
ACP-style session/update notification stream (method, params.sessionId, update payloads). Protocol traffic, not chat; documented, not searched.
- Agent:
Grok
- Role:
app_state- Format:
jsonl- Coverage:
catalog_only- Path:
${GROK_HOME or ${HOME}/.grok}/sessions/<url_encoded_project>/<session_uuid>/updates.jsonl- Adapter:
-
- Data version:
-- Version strategies:
-- Observed:
grok 1.0.70 (2026-10-25)
- Default search:
no
grok.sessions.terminal¶
Per-tool-call terminal stdout/stderr logs (thousands per active project). Tool output, not chat, and high-volume; documented for inventory and deliberately not searched.
- Agent:
Grok
- Role:
app_state- Format:
text- Coverage:
catalog_only- Path:
${GROK_HOME or ${HOME}/.grok}/sessions/<url_encoded_project>/<session_uuid>/terminal/call-<id>.log- Adapter:
-
- Data version:
-- Version strategies:
-- Observed:
grok 1.0.70 (2026-10-25)
- Default search:
no
grok.skills¶
skills/<name>/SKILL.md skill-instruction files a user authors. The directory is present but empty at grok 1.0.25: the bundled set lives under bundled/skills/ and is no longer mirrored here. Parity with claude.skills and cursor-cli.skills.
- Agent:
Grok
- Role:
instruction- Format:
md_frontmatter- Coverage:
catalog_only- Path:
${GROK_HOME or ${HOME}/.grok}/skills/<name>/SKILL.md- Adapter:
-
- Data version:
-- Version strategies:
-- Observed:
grok 1.0.70 (2026-10-25)
- Default search:
no
grok.grove¶
Pin garbage-collection state: an orphans list. Not conversation content.
- Agent:
Grok
- Role:
app_state- Format:
json_object- Coverage:
catalog_only- Path:
${GROK_HOME or ${HOME}/.grok}/grove/pin_gc_orphans.json- Adapter:
-
- Data version:
-- Version strategies:
-- Observed:
grok 1.0.70 (2026-10-25)
- Default search:
no
grok.campaigns_state¶
Holds dismissed_ids. Not conversation content.
- Agent:
Grok
- Role:
app_state- Format:
json_object- Coverage:
catalog_only- Path:
${GROK_HOME or ${HOME}/.grok}/campaigns_state.json- Adapter:
-
- Data version:
-- Version strategies:
-- Observed:
grok 1.0.70 (2026-10-25)
- Default search:
no
grok.dashboard_db¶
SQLite database with members and meta tables, beside its -wal and -shm sidecars. Dashboard state, not conversation content.
- Agent:
Grok
- Role:
app_state- Format:
sqlite- Coverage:
catalog_only- Path:
${GROK_HOME or ${HOME}/.grok}/dashboard/workspace.db- Adapter:
-
- Data version:
-- Version strategies:
-- Observed:
grok 1.0.70 (2026-10-25)
- Default search:
no
grok.background_tasks¶
Shell scripts and .trace output files for background jobs the agent started. They can quote commands and their output, so they stay unread.
- Agent:
Grok
- Role:
app_state- Format:
text- Coverage:
catalog_only- Path:
${GROK_HOME or ${HOME}/.grok}/long-running-background-tasks/<task>.{sh,trace}- Adapter:
-
- Data version:
-- Version strategies:
-- Observed:
grok 1.0.70 (2026-10-25)
- Default search:
no
grok.memory_v2¶
The second-generation memory tree, beside memory/, which Grok Build no longer writes. Each of global/ and workspaces/<workspace>/ holds a generated MEMORY.md index, topics/, archive/, observations/_inbox/<session>__t<turn>-<turn>__n<index>.md notes, and the SQLite files index.sqlite and memory_state.sqlite. Inbox and archived notes open with YAML front matter (schema_version: 2, type, topic_hint, session_id, and others). agentgrep reads every Markdown note as one text record; the SQLite files are not read.
- Agent:
Grok
- Role:
persistent_memory- Format:
md_frontmatter- Coverage:
inspectable- Path:
${GROK_HOME or ${HOME}/.grok}/memory-v2/**/*.md- Adapter:
grok.memory_text.v1- Data version:
-- Version strategies:
-- Observed:
grok 1.0.70 (2026-10-25)
- Default search:
no
grok.pager_config¶
Pager preferences in a [scrollback.scroll] table. Not conversation content.
- Agent:
Grok
- Role:
app_state- Format:
text- Coverage:
catalog_only- Path:
${GROK_HOME or ${HOME}/.grok}/pager.toml- Adapter:
-
- Data version:
-- Version strategies:
-- Observed:
grok 1.0.70 (2026-10-25)
- Default search:
no
grok.settings_cache¶
A signed copy of server-side settings: a payload string and its signature. Not conversation content.
- Agent:
Grok
- Role:
cache- Format:
json_object- Coverage:
catalog_only- Path:
${GROK_HOME or ${HOME}/.grok}/settings_cache.json- Adapter:
-
- Data version:
-- Version strategies:
-- Observed:
grok 1.0.70 (2026-10-25)
- Default search:
no
Record schemas¶
Prompt history¶
grok.prompt_history is a per-project user-prompt audit log. One
record per prompt, append-only.
{"timestamp": "2026-05-25T10:00:00.000000000Z",
"session_id": "019729a0-...", "prompt": "...", "is_bash": false}
Keys: timestamp (ISO-8601 nanosecond), session_id (UUIDv7),
prompt (user text), is_bash (bool — true for shell commands).
Session transcripts¶
grok.sessions contains full session transcripts. The type field
discriminates record kinds: system, user, assistant, reasoning,
tool_result, backend_tool_call.
Not every user record is something you typed. Grok writes its own
injected turns into the same stream, tagged with a synthetic_reason
key naming why — system_reminder for tool nudges, project_instructions
for AGENTS.md content. In the sample this page was verified against,
52 of 101 user records carried one. agentgrep does not yet read that
key, so those injected turns are searched as if you had typed them; a
prompt result you do not recognise is most likely one of these.
Assistant tool calls live in a tool_calls
array on the assistant record; reasoning records carry a readable summary
array of {type: summary_text, text} blocks plus an opaque encrypted_content
blob, but agentgrep does not surface them because the adapter reads only
content, which reasoning records omit. content is either a plain string or
a content-blocks array.
{"type": "user", "content": "explain the design"}
Transcript records carry no clock of their own — no record of any type
has a timestamp key — so agentgrep backfills the transcript file’s
modification time. That dates a record to its session rather than to
its turn, which is enough to order results and answer a date filter but
not to distinguish two turns in the same session. The per-prompt clock
lives next door, in the prompt-history log.
An assistant record names the model that answered in model_id — Grok’s
spelling of the key other agents call model — and agentgrep surfaces it as
the record’s model, so model:grok-* reaches Grok transcripts.
Subagent delegations¶
grok.subagents is one JSON dispatch object per delegated subagent
under sessions/<project>/<session>/subagents/<subagent>/meta.json. The child
session also keeps its own transcript, which grok.sessions
reads; this file is the delegation itself.
{"subagent_id": "019e6626-...", "parent_session_id": "019e660d-...",
"subagent_type": "code-explorer", "description": "Map the auth module",
"prompt": "Explore the auth module and summarize ...", "tool_calls": 3,
"effective_model_id": "grok-code", "child_cwd": "/home/you/work/project"}
agentgrep emits the prompt as one supplementary-chat record titled
with description; subagent_type and parent_session_id are
attached as metadata. effective_model_id becomes the record’s model and
child_cwd its cwd; a file without child_cwd falls back to the decoded
project directory.
Session search index¶
grok.session_search is a SQLite database with FTS5. Table
session_docs:
Column |
Type |
Description |
|---|---|---|
|
TEXT |
UUIDv7 primary key |
|
TEXT |
Working directory |
|
INTEGER |
Unix seconds |
|
TEXT |
Generated session title |
|
TEXT |
Full-text indexed body |
|
TEXT |
Content digest |
|
INTEGER |
Incremental-index cursor |
A sibling meta table holds session_search_schema_version (4) and
last_bootstrap_at; PRAGMA user_version stays 0. agentgrep converts
updated_at to ISO-8601 for timestamp consistency with other adapters.
Plans¶
grok.plans is per-session plan-mode Markdown at
sessions/<project>/<session>/plan.md — the agent’s working plan. Inspectable
(opt-in), parity with claude.plans and
cursor-cli.plans; not searched by default.
Project context¶
Store |
|
|
|
|---|---|---|---|
assistant record’s |
|
— |
|
— |
|
— |
|
— |
|
— |
|
|
|
— |
%2F is a lossless escape, so the project directory key inverts exactly
— the lossless tier. agentgrep decodes it back
into the working directory and reports it on every prompt-history and
transcript record, which is the same absolute path
grok.session_search already stored literally in
session_docs.cwd. All four stores therefore answer --cwd and cwd:
with one working directory per session.
That encoding has one exception, and it is the reason a deeply nested
project can behave differently from a shallow one. When the encoded
name would exceed 255 bytes, Grok names the directory with a slug plus
a hash instead and writes the real path into a .cwd file inside the
group. A slug does not invert, so agentgrep reads the sidecar; without
it those sessions would lose cwd while every shallower project kept
it. A directory that neither decodes nor carries a .cwd file yields
no cwd rather than a plausible one.
branch: does not reach this backend, but not because Grok is unaware
of git. Each session’s summary.json carries head_branch,
head_commit, git_root_dir, and git_remotes — no store row reads
that file, so the branch is on disk and out of reach rather than
absent.
Changes by version¶
Each entry brackets a change between the observation that first saw it and the last one that did not; see Observed record shapes.
1.0.70¶
Seen in 1.0.70 (2026-10-25); absent in 1.0.25 (2026-09-11).
Subagent
meta.jsonfiles addattempt_id. Search reads none of it.memory-v2/appears besidememory/, with a generatedMEMORY.mdindex,topics/,archive/, andobservations/_inbox/notes inglobal/and in one directory per workspace, and Grok Build stops writingmemory/. Its Markdown notes are read asgrok.memory_v2, opened by--scope alllikegrok.memory, which readsmemory/only.Four more paths appear, catalogued since as
grok.dashboard_db,grok.background_tasks,grok.pager_config, andgrok.settings_cache.prior_turn_interruptis missing from the user-record sample, but six session files on disk still carry it, so this is sample turnover.
1.0.25¶
Seen in 1.0.25 (2026-09-11); absent in 1.0.0 (2026-08-08).
Subagent dispatch files appear under
subagents/<subagent>/meta.json, andgrok.subagentsreads them. Each also recordseffective_model_idandchild_cwd, which agentgrep reads as the record’s model andcwd.grove/, holding apin_gc_orphans.jsonwith anorphanslist, andcampaigns_state.json, holdingdismissed_ids, appear, catalogued asgrok.groveandgrok.campaigns_state. Neither holds conversation text.models_cache.json, present in the 1.0.0 observation, is gone.