Put stable instructions in AGENTS.md
Create AGENTS.md at the repository root for architecture boundaries, build and test commands, coding conventions, and safety rules that apply to every task. Add nested AGENTS.md files only where a subtree genuinely differs.
Grok walks from the repository root toward the working directory, and deeper rule files take precedence on conflicts. Short, specific rules are easier to follow and review than a large handbook copied into context.
- State executable verification commands.
- Name generated or protected paths.
- Explain architectural constraints, not temporary task details.
Migrate from Claude Code with evidence
Official xAI documentation says Grok can automatically read Claude Code instruction files, marketplaces, plugins, skills, MCPs, agents, and hooks alongside native .grok assets. Keep that as an attributed compatibility claim and verify the actual repository instead of assuming every extension behaves identically.
CLAUDE.md, Claude.md, CLAUDE.local.md, and .claude/rules are among the documented instruction sources. The grok import subcommand is for Claude Code sessions; asset discovery itself does not require importing those files.
grok inspect
# Import compatible Claude Code session history when needed
grok import Add one-session rules without contaminating the repo
Use --rules for a narrow instruction that belongs only to the current run. Do not use a system-prompt override casually: replacing the system prompt has a much larger effect than appending a constraint.
Run inspect after changing files or compatibility settings. Review every reported path and approximate token cost, then resolve duplicate or conflicting instructions at their source.
grok --rules "Always use TypeScript. Prefer functional components."
grok inspect