Grok context
mdmanager context --runtime grok reports the instruction Markdown Grok Build loads and the hook
files it runs. The model follows Grok Build 2.0.9: its bundled guides plus observed grok inspect --json rows and captured
prompts. Context reads the files itself and never runs grok. A later Grok release can change
this behavior.
mdmanager context --runtime grok
What loads
Grok loads every instruction file it finds. It never picks one file per directory.
Home sources load in this order:
$GROK_HOME(default~/.grok), then~/.claude, then~/.cursor. From each root, Grok loads the named files (AGENTS.md,CLAUDE.md,CLAUDE.local.md,AGENT.md, and theAgents.mdandClaude.mdspellings), then.claude/CLAUDE.mdand.claude/CLAUDE.local.md, thenrules/*.md.- Every entry in
[paths] extra_rule_dirsin$GROK_HOME/config.toml, which must be absolute or start with~/. Grok loads the top-level*.mdfiles in each one, regardless of folder trust,.gitignore, or compatibility cells, even when the directory is inside a repository.
Project sources come from each directory between the Git root and the launch directory. Outside a
repository, or when the Git root is your home folder, only the launch directory counts. Each
directory contributes, in order: .cursorrules (at the root only), the named files,
.claude/CLAUDE*.md, and then the *.md files directly inside .grok/rules, .claude/rules and
.cursor/rules.
- Grok reads only top-level
*.mdrule files. It never reads.mdcfiles or subdirectories. - Grok ignores rule frontmatter, so it always applies every rule. A Claude rule limited by
paths:or a Cursor rule limited byglobs:loads in every session. - Grok has no size cap and does not expand
@imports. It does not readAGENTS.override.md. - A file reached by two paths, through a symlink or a case-insensitive alias, loads once. Context lists the second path as excluded because it is the same file. Identical text under two names loads twice.
- Grok does not load instruction files below the launch directory at startup, and Context does not scan for them.
Prompt order
Grok sends all instructions in one rules block. Every project file comes first, labeled with its
path as an always-applied workspace rule. Every home source follows, without a path, as a user rule
the model follows if appropriate. Context lists sources in this prompt order. Grok's own
grok inspect and guides list home sources first. That discovery order does not reach the prompt.
Gating
- Folder trust. Project files load only when
$GROK_HOME/trusted_folders.tomltrusts the workspace root. Trusting a main checkout also trusts its linked worktrees. Trusting a parent folder does not trust a repository inside it. Your home folder and the filesystem root count as trusted.GROK_FOLDER_TRUST=0or[folder_trust] enabled = falseturns the gate off. Home sources load in every folder. Context lists the project files of an untrusted folder as excluded. .gitignore. Grok skips project files that the repository's root.gitignoreignores. It does not honour.gitignorefiles in subdirectories,.git/info/exclude, orcore.excludesFile, so aCLAUDE.local.mdhidden only through.git/info/excludestill reaches Grok. Grok matches each spelling it searches for on its own. On a case-insensitive disk a pattern forAgents.mdalone does not skipAGENTS.md, because the laterAGENTS.mdspelling still finds it; only a pattern that matches every spelling skips the file.- Symlinks. Grok skips a project symlink whose target is outside the workspace root. It follows home symlinks to any location.
- Home routes. A file that a gate keeps out as a project file still loads when a home source
also reaches it, such as an
extra_rule_dirsentry inside the repository or aGROK_HOMEthere. - Invalid
config.toml. While$GROK_HOME/config.tomlcannot be parsed, Grok turns every compatibility cell off unless its environment variable turns it on, and ignoresextra_rule_dirs. Context reports the parse error and lists the removed files with that reason.
Turn off another runtime's files
Compatibility cells in $GROK_HOME/config.toml decide which Claude and Cursor files Grok reads.
Every cell is on by default. An environment variable overrides the TOML value: 0, false, no
or off turns the cell off, and 1, true, yes or on turns it on. Context lists each file a
cell removes as excluded and names the cell.
| Cell | Environment variable | Files it removes |
|---|---|---|
[compat.claude] agents = false |
GROK_CLAUDE_AGENTS_ENABLED=0 |
~/.claude named files and .claude/CLAUDE*.md in home roots and projects |
[compat.claude] rules = false |
GROK_CLAUDE_RULES_ENABLED=0 |
~/.claude/rules and project .claude/rules |
[compat.cursor] agents = false |
GROK_CURSOR_AGENTS_ENABLED=0 |
~/.cursor named files and ~/.cursor/.claude/CLAUDE*.md |
[compat.cursor] rules = false |
GROK_CURSOR_RULES_ENABLED=0 |
~/.cursor/rules, project .cursor/rules, and .cursorrules |
No cell removes a project's root CLAUDE.md, CLAUDE.local.md or AGENTS.md, or the named files
in $GROK_HOME. mdmanager never edits Grok configuration. Ask your coding agent to set a cell,
then confirm the result with mdmanager context --runtime grok.
Hide a Claude local disable from Grok
Grok ignores claudeMdExcludes. Disabling a file for Claude in .claude/settings.local.json,
including with mdmanager local disable claude, leaves Grok's view unchanged: a file Grok loads
keeps loading, and one a Grok gate already removes stays excluded. To hide a loaded file from Grok
as well, ignore it in the repository's root .gitignore, a shared change. For
.claude/CLAUDE.md, .claude/CLAUDE.local.md or a .claude/rules file, the matching
[compat.claude] cell in the table above also works, but hides every such Claude file from Grok.
mdmanager has no Grok local disable. Check the result with mdmanager context --runtime grok.
Duplicate instructions
Context warns when the same instructions reach Grok twice; see duplicate instructions for what counts. Grok drops rule frontmatter, and two paths to one file load once. Two common causes:
- The Claude Global target
~/.claude/CLAUDE.mdloads alongside a Grok home file that carries the same Sections. Turn off[compat.claude] agents, or keep Grok from getting a second copy. A Globalgroktarget gets its own warning that names the fix; see Managed files. - A project's root
AGENTS.mdand rootCLAUDE.mdboth load. Keep only Claude-specific Sections inCLAUDE.md, plus an@AGENTS.mdline. Grok sends that line as plain text and loadsAGENTS.mdonce. mdmanager renders a ProjectCLAUDE.mdthis way beside anagentstarget.
Hooks
Context lists every hook file Grok reads for the launch directory, after the instructions, under
HOOKS. JSON output carries them in hooks. Each file shows its origin (Grok, Claude, Cursor or
a plugin), the events and commands it registers, and whether each one runs. mdmanager only reports
hooks. It never edits, deploys or turns off hook settings.
Grok reads hook files in this order. When the same command is registered more than once, Grok
runs it once per call, from the first copy whose matcher selects that call. Context lists a later
copy as not run when earlier copies select every call it does: an earlier copy without a matcher or
with the same matcher, or, for SessionStart, earlier copies that cover its new and load
sources. Any other later copy runs for the calls the earlier ones leave, and Context notes which
copy takes the rest. Context warns once per repeated command and names the files. A missing env
and an empty one count as the same.
[[hooks.<Event>]]tables in$GROK_HOME/config.toml.$GROK_HOME/hooks/*.json, alphabetically.~/.claude/settings.json, then~/.claude/settings.local.json.~/.cursor/hooks.json.- For each directory from the workspace root to the launch directory:
.claude/settings.json,.claude/settings.local.json,.grok/hooks/*.json, then.cursor/hooks.json. Launched in your home folder or at the filesystem root, Grok reads no project hook files. - Each enabled plugin's
hooks/hooks.json. Grok looks for plugins in this order: the workspace root's.grok/plugins/and.claude/plugins/,$GROK_HOME/plugins/,~/.claude/plugins/, plugins installed withgrok plugin install, then each[plugins] pathsfolder. When two plugins share a name, Grok loads only the first, even one an untrusted folder holds back. Context lists the hidden plugin as not run. A plugin runs only while[plugins] enablednames it, by name or ID, and[plugins] disableddoes not; a[plugins] pathsplugin is on unless disabled, and Grok trusts it only inside your home folder. A plugin's copy of a command is its own and never merges with another file's.
What keeps a hook from running:
- Folder trust. Project hook files and project plugins run only in a trusted folder, as for
project instructions. In an untrusted folder, Context also warns that an interactive session
holds back your own hooks until you trust the folder; headless
grok -pruns them. - Compatibility cells.
[compat.claude] hooks = falseorGROK_CLAUDE_HOOKS_ENABLED=0turns off every.claude/settings*.jsonfile.[compat.cursor] hooks = falseorGROK_CURSOR_HOOKS_ENABLED=0turns off every.cursor/hooks.json. Context lists their hooks as not run and names the cell. Neither cell affects plugins. - Cursor's own entries. Grok runs a
hooks.jsonmatcher group (an entry with ahookslist) like any other hook. Cursor's own entries, written without ahookslist, run only underpreToolUse, only from~/.cursor/hooks.jsonor the root's.cursor/hooks.json, and only while[features] cursor_hook_entriesis on. It is off by default, andGROK_CURSOR_HOOK_ENTRIES=1turns it on. Such an entry also gives way to any other hook that runs the same command. - Handlers Grok cannot run. Grok skips handlers that are not
commandorhttp, such as Claude'spromptandagenthooks, a command handler without a command, an http handler without a url, handlers that setif, matchers that are not valid regular expressions, and events it does not know, such as Claude'sPermissionRequest. SessionStartmatchers. Grok'sSessionStartmatcher sees onlyneworload. A Claude matcher such asstartup|resume|clear|compactnever fires under Grok, so Context lists it as not run. On other events Context checks only that a matcher is valid, not which calls it selects.
Context warns when Claude or Cursor hooks run. Grok runs them with CLAUDE_PROJECT_DIR set and
without CLAUDECODE or any other Claude marker. A hook written for Claude therefore believes it
runs under Claude unless it checks GROK_AGENT or GROK_HOOK_EVENT. When a repeated command has a
copy in a Cursor hooks.json, Grok also reads its reply by Cursor's rules and keeps the stricter
result; the duplicate warning says so.
Context does not model organization hooks (managed_config.toml, requirements.toml,
/etc/grok, allow_managed_hooks_only), hooks-paths, agent frontmatter hooks:, hooks you
turned off in Grok's Hooks tab (~/.grok/disabled-hooks), plugins loaded with --plugin-dir,
plugin manifests that move hooks/hooks.json, installed repositories holding several plugins, or
Cursor's matcher and field checks. When in doubt, compare with grok inspect.
Managed files
- The Global target
grok, created bymdmanager init grok, is the user rule$GROK_HOME/rules/mdmanager.md(default~/.grok/rules/mdmanager.md). Grok loads it in every folder, trusted or not, and no other runtime reads it. It renders plain Markdown, since Grok ignores rule frontmatter. Any.mdfile directly in~/.grok/rulesor$GROK_HOME/rulescan be a Global target. A named file directly in~/.grokor$GROK_HOME, such as~/.grok/AGENTS.mdor~/.grok/AGENT.md, is refused: Grok loads those named files, but its documentation names onlyrules/*.mdas the user rule location. Context still lists a named file there when it exists. - While
[compat.claude] agentsis on, Grok also reads the Claude Global target~/.claude/CLAUDE.md, so it gets both Global compositions. While Grok loads both that file and a Global Grok rule target, from any Profile, Context andmdmanager statuswarn and name the fix. Both check what Grok loads when launched in the current directory, so a Grok rule that is not applied, or sits outside aGROK_HOMEthat moved, gets no warning: apply it first, because the fix leaves Grok only its own rules. Give Grok only its own target:
toml
# ~/.grok/config.toml
[compat.claude]
agents = false
or export GROK_CLAUDE_AGENTS_ENABLED=0. The cell also turns off every project's
.claude/CLAUDE.md and .claude/CLAUDE.local.md, but not a root CLAUDE.md.
- Grok reads neither ~/.codex/AGENTS.md nor the Cursor rule ~/.cursor/rules/mdmanager.mdc.
- Grok loads both Project Instruction files, root AGENTS.md and root CLAUDE.md. Beside an
agents target the rendered CLAUDE.md holds only an @AGENTS.md line and Claude-only
Sections, so Grok gets each shared Section once.
- The Local file CLAUDE.local.md reaches Grok as well as Claude. Grok has nothing like
AGENTS.override.md.
Context does not read a project's .grok/config.toml, managed Grok configuration, or
requirements.toml. Skills, text passed with --rules, and system prompts are outside its scope.