Grok Build Integration
Your next Grok Build session starts where the last one left off.Grok Build is xAI’s coding CLI. It reads Claude Code plugins, so Claude-Mem already works there for capture and search. This page covers the one piece that needed its own setup: getting recalled notes into the model when a session starts.
Tested on Grok Build 1.0.77 (Windows 11). The behavior below comes from Grok Build’s documentation: the public hooks and project rules pages, plus the fuller user guide Grok Build 1.0.77 installs at
~/.grok/docs/user-guide/ (10-hooks.md, 12-project-rules.md). The public hooks page says only that “for passive events, stdout is ignored”. The installed guide names the events: only PreToolUse, PostToolUse and PostToolUseFailure can add context, and “every other event is passive”.
Why a rules file
Grok Build runsSessionStart and UserPromptSubmit hooks, but it never gives their output to the model. Its docs say only PreToolUse, PostToolUse and PostToolUseFailure can add context, and every other event is observe-only. Claude-Mem’s session-start notes therefore never reach the model there.
Grok Build does load Markdown files from <project>/.grok/rules/ when a session starts. Claude-Mem writes one file there, claude-mem-context.md, and refreshes it after each session summary.
Set it up
Run this in the project folder, with the Claude-Mem worker running:npx claude-mem grok install works too.)
It:
- writes
.grok/rules/claude-mem-context.md, filled from your existing notes for this project (or a short placeholder if there are none yet); - adds that one file to
.git/info/exclude, so it stays out ofgit statusand your.gitignoreis untouched; - remembers the folder so the file is refreshed after each session summary.
grok --trust or accept the trust prompt.
Check it:
grok inspect lists claude-mem-context.md under project instructions once the folder is trusted.
Grok Build reads the file when a session starts. A refresh that lands during a session shows up in the next one, and a new session opened before the last summary is stored won’t have those notes yet.
What is stored and sent
- The file holds the same recalled notes Claude-Mem gives Claude Code at session start, for this project only. It stays on your machine.
- Claude-Mem skips folders on your excluded-projects list and writes only into folders you ran
grok installin. If you exclude a project after installing, its notes are replaced with a short “excluded” line the next time any project finishes a session summary, so it doesn’t wait on the excluded project itself. A Grok session that starts before that still loads the old notes. For an immediate effect, runclaude-mem grok uninstallin that folder. - Grok Build loads rules files as project instructions, so the model gives recalled notes the same weight as instructions you wrote. The file’s header calls them reference data, but a header can’t stop a model from acting on text inside a note. Claude Code’s session-start context carries the same risk. Only install in projects whose captured content you trust, and remember that notes can quote web pages, tool output and files you opened.
- Don’t commit the file. The install adds it to
.git/info/excludefor you. If you exclude it through.gitignoreinstead, Grok Build skips it and your notes stop loading.
If memory is unavailable
Refreshing is best effort. If the worker is stopped or slow, Claude-Mem leaves the previous file as it was and does nothing else: no retry, no queue, nothing to replay later. Grok Build is never blocked, and the session starts with whatever the file already held.Troubleshooting
Turn it off
Limits
- Memory reaches the model at session start only, not on every prompt.
- Context is one session behind: it is rebuilt after a summary and read at the next start.
- The setup is per folder. Install at the repository root and sessions started in its subfolders load the file too, because Grok Build reads rules from the repository root down to the folder it starts in.
- Sessions captured from Grok Build are recorded under the
claude-codesource, the same as the plugin’s other Claude-format hosts.
Next steps
- Search Tools — ask for details from past sessions
- Grok Bot Integration — a different product, with its own setup
- Configuration — settings and excluded projects

