> configuration
Two JSON files drive configuration: ~/.grok/user-settings.json for global defaults (apiKey, baseURL, defaultModel, models) and .grok/settings.json in each project for per-project model and MCP servers. Standing instructions for the model go in .grok/GROK.md (project) or ~/.grok/GROK.md (global), and MORPH_API_KEY enables Morph Fast Apply editing.
// configuration
6 commands$ ~/.grok/user-settings.json$ .grok/settings.json$ .grok/GROK.md$ ~/.grok/GROK.md$ export MORPH_API_KEY=your-morph-key$ grok -p "refactor this function to use async/await and add error handling"// faq
Where does Grok CLI store its configuration?
Global settings live in ~/.grok/user-settings.json; project settings live in .grok/settings.json in the working directory. Project settings override globals, and directories are switched automatically, so each project can use a different model while sharing your global API key.
What is the .grok/GROK.md file for?
It holds custom instructions injected into Grok's system prompt — conventions, preferred libraries, and rules for that project. A project .grok/GROK.md takes priority; ~/.grok/GROK.md is the global fallback used only when no project file exists, and the two are not merged.
What is Morph Fast Apply and do I need it?
Morph Fast Apply is an optional editing engine that applies code changes at 4,500+ tokens/sec. Set MORPH_API_KEY (from the Morph dashboard) to enable the edit_file tool for complex edits; without it, Grok uses its built-in str_replace_editor. It is a separate paid service, purely for edit speed.
Should I commit the .grok directory to git?
Commit .grok/settings.json and .grok/GROK.md to share project model choice, MCP servers, and instructions with your team — but never put the API key there. Keep keys in the environment, a gitignored .env, or ~/.grok/user-settings.json, which lives outside the repo.