Grok Build

How do I give Grok Build my project's rules and fixes with cachly?

Explain it once. Every AI knows it. You fixed a bug with Grok Build yesterday, and today a new session knows nothing about that fix. cachly keeps your project's rules, decisions and fixes and hands them to every AI tool through MCP.

Shared team memory between your code, your tickets and your AI. Grok Build is a client for the Model Context Protocol (MCP), so cachly connects as an MCP server.

The short answer

Run one command in your project folder. cachly signs you in, finds Grok Build through its home folder ~/.grok, and writes the MCP entry into .grok/config.toml and the rules into AGENTS.md. Then start grok in that folder and check the server with grok mcp list.

terminal
npx @cachly-dev/mcp-server@latest autopilot

Your lessons are stored in Germany. By default, no generative AI model reads or rewrites your lessons. A small ranking model in the EU only scores them.

One command: autopilot

autopilot detects Grok Build when ~/.grok, $GROK_HOME or a .grok/ folder in the project exists. It then writes .grok/config.toml and adds the cachly block to AGENTS.md. Both files are written without touching other entries, and a second run changes nothing.

To set up only Grok Build, run npx @cachly-dev/mcp-server@latest init --editor grok with your Brain ID and key. The file holds no API key. The server reads it from the environment (CACHLY_JWT) or from ~/.cachly/credentials.json.

.grok/config.toml
[mcp_servers.cachly]
command = "npx"
args = ["-y", "@cachly-dev/mcp-server@latest"]
env = { CACHLY_BRAIN_INSTANCE_ID = "<your-brain-id>" }

npx @cachly-dev/mcp-server@latest uninstall removes the entry again.

By hand: grok mcp add

If you prefer to register the server yourself, one grok mcp add line does it. Everything after -- is the server command, -e sets one environment variable, and --scope project writes .grok/config.toml in the current folder instead of ~/.grok/config.toml. Run it once per project.

terminal
grok mcp add --scope project -e CACHLY_BRAIN_INSTANCE_ID=<your-brain-id> cachly -- npx -y @cachly-dev/mcp-server@latest
grok mcp list

Grok Build also reads project .mcp.json files, but config.toml ranks higher. If a project server has the same name as a user server, the project one replaces it completely. grok inspect shows every loaded server and where it came from.

The remote endpoint

Grok Build can talk to a hosted MCP server over HTTP and send a fixed header, so cachly's endpoint works without installing anything. Put your key in an environment variable. Grok expands ${CACHLY_KEY} when it loads the file, so the key stays out of the config.

terminal
grok mcp add --transport http cachly https://mcp.cachly.dev/mcp --header "Authorization: Bearer ${CACHLY_KEY}"
.grok/config.toml
[mcp_servers.cachly]
url = "https://mcp.cachly.dev/mcp"
headers = { "Authorization" = "Bearer ${CACHLY_KEY}" }

More on the remote endpoint and which Brain opens.

What you see

grok mcp list shows the configured servers, and grok mcp doctor checks the setup and the connection. In a session, /mcps opens the server list. Per the Grok Build docs, tool names carry the server name as a prefix, so cachly's tools appear as cachly__smart_recall and cachly__learn_from_attempts.

The rule block in AGENTS.md tells the agent to call smart_recall before a task and learn_from_attempts after a fix. Grok Build loads AGENTS.md into every session in that folder tree.

Limits

We have not run this ourselves yet. No Grok Build install and no xAI account were available, so every step above follows xAI's documentation, and the config writing is covered by automated tests in the cachly repository. Please report anything that differs.

  • No automatic hooks. Grok Build has hooks, but the documentation describes no way for a hook to put text into the model's context. So cachly writes none. The agent calls the tools when the rules in AGENTS.md tell it to, or when you ask.
  • Trust for project files is not documented. The MCP page does not say whether a project .grok/config.toml needs a trust step. If the server does not show up, run grok mcp doctor.
  • Windows is untested. The entry uses npx. Whether Grok Build starts it directly on Windows is not documented. A cold npx start can need a higher startup_timeout_sec (default 30).

Sources

More: cachly with Qwen Code · cachly with Kimi Code CLI · Remote MCP · All docs