Skip to main content

Grok Bot Integration

Your Grok Bot remembers. Claude-mem captures what the agent does, compresses it, and injects it into later sessions.

No host hooks

Ingest is a transcript watcher on agent JSONL, not Cursor-style hooks.

CMEM Pro default

npx claude-mem install --ide grok-bot pre-selects CMEM Pro. --provider host is opt-in.

Independent of Cursor

Install Grok Bot only, Cursor only, or both. Neither host requires the other.

MCP search

Search past sessions with the 3-layer memory tools.
This install path ships in claude-mem 13.24 (PR #3842). npm 13.23.x does not yet accept --ide grok-bot. Grok Bot is not Grok Build CLI. Plugin id: claude-mem-grok-bot.

How it works

Grok Bot has no session-start, file-read, or tool-use hooks. Claude-mem wires up four pieces instead:
  1. Transcript watcher tails agent-transcripts/*/*.jsonl and stamps platformSource=grok-bot.
  2. Local worker stores sessions and serves search (default port 37700 + uid % 100 on 127.0.0.1).
  3. Observer (CMEM Pro by default) — observation extraction runs off-plan through https://cmem.ai/api/inference/v1 with model cmem-observer. Opt in to a host observer with --provider host (this Grok login over a local OpenAI-compatible loopback, no API key).
  4. MCP exposes search to the bot (searchtimelineget_observations).
  5. Awareness push (pilot) — after an observation is stored, needle types are appended as one dated fact line into that bot’s Grok memory log. The host already re-reads the file from disk.
Do not install Claude CLI for this host. Do not pass an xAI API key. There is no --provider grok flag. Grok Bot does not use Claude Code hook stdin, so the #2188 empty-stdin / CAPTURE_BROKEN path does not apply. Capture is the transcript watcher. Each watch now carries agentId into ingest so observations stay labeled with the bot they came from.

Install

CLI (Grok Bot only)

That starts a local worker with CMEM Pro as the observer (pre-selected). Local host-login observer is opt-in:
--ide takes a single host. To also wire Cursor, run a second install (do not pass --ide twice on one command — only the last value is kept):
Other options:
--provider also still accepts claude and gemini. Passing an explicit --provider skips the sign-in step.
npm install -g claude-mem installs the SDK only. It does not start the worker, watcher, or observer. Always use npx claude-mem install.

Plugin store

Grok Bot’s plugin store is the Cursor catalog. Install claude-mem-grok-bot from there when the listing is live (submitted at cursor.com/marketplace/publish after 13.24 lands). The listing does not install Cursor. After the plugin is installed, still run the CLI above for a local worker, or set CLAUDE_MEM_MCP_TOKEN for remote MCP.

Observer and worker

--provider host is an OpenRouter-shaped loopback: CLAUDE_MEM_OPENROUTER_BASE_URL=http://127.0.0.1:<shim>/v1 plus a dummy non-empty API key. You do not configure that by hand. Port rule: the observer shim must not bind the worker port. The worker is often 37700 + (uid % 100). On macOS it is often 37777 — if that port is taken, the shim uses 37778 (or CLAUDE_MEM_HOST_OBSERVER_PORT). Never restart a healthy worker. The observation queue is in RAM and a restart drops it. Host-observer idle replies must be skip_summary XML; a finished unit is one observation. Prose like “still observing” drops the batch (issue #2485).

XML contract (host observer)

When using --provider host, the worker parser only accepts three roots. Idle / init / no tool results yet:
Finished searchable unit: one <observation> covering the whole pile — real title, 4–10 facts with paths, a short narrative. Never title with a tool name. Do not mix skip_summary and <observation>. Timeouts must return skip_summary XML, not an HTTP 504.

Using memory

At the start of a real task, call MCP session_start_context for the project with platformSource grok-bot. Then the 3-layer search:
  1. search — compact index with IDs
  2. timeline — context around a hit
  3. get_observations — full details only for the IDs you will use
Writes from this host stamp platformSource=grok-bot. When reading, do not drop Cursor (or other host) memories unless you asked for grok-only. See Search Tools.

Verify it worked

  1. Worker health: open http://127.0.0.1:<worker-port>/api/health (port is in ~/.claude-mem/.worker.port or settings).
  2. Memory viewer: open the worker URL printed at install.
  3. Do a small unit of work in Grok Bot, then search. New observations should show platformSource=grok-bot.
  4. Default observer: first real observation stores via model cmem-observer. Host observer: if the queue sits idle, the reply is probably prose instead of skip_summary.
  5. Awareness push pilot (LFG + Orifice): a needle observation (decision, bugfix, security_alert, sensitive) should append - YYYY-MM-DD [awareness] … to agents/<agent_id>/memory/log/YYYY-MM.md. Nothing is written to profile.md. Turn off with CLAUDE_MEM_GROK_BOT_AWARENESS_ENABLED=false.

Troubleshooting

Nothing is being stored

  • Confirm the worker is up and you did not restart a healthy one.
  • CMEM Pro: check /api/health (provider openrouter) and /api/sync/status. See CMEM Pro (manual / headless).
  • Host observer: confirm the reply is XML (skip_summary or observation), and the shim is not on the worker port (macOS: worker 37777 → shim 37778).

npx claude-mem install --ide grok-bot is rejected

You are on npm 13.23.x or earlier. This host lands in 13.24 with PR #3842.

I also use Cursor

--ide is a single string. Run a second install for Cursor; do not stack --ide flags on one command:
Cursor uses hooks (npx claude-mem hook cursor …) and platformSource=cursor. Grok Bot still has no hooks. See Cursor Integration.

This is not Grok Build

The Grok Build CLI marketplace (xai-org/plugin-marketplace) is a different catalog. This page is Grok Bot only.

Next steps