grep and file reads it knows, and answers from whatever it happened to open. Then a few days later the graph is out of date, and the agent stops trusting it. This recipe fixes both problems: it makes Graphify the agent’s first step, keeps the graph current, and gives you a way to check it worked.
The scenario
A small team builds across 12 repositories, and coding agents write most of the code. They connected Graphify, asked a few questions, and liked the answers. A week later nobody can tell whether the agents still call it. One agent renamed a helper and missed three callers that a single graph query would have listed. The team wants three things:- Every agent session starts from the graph, without anyone typing “use Graphify”.
- The graph matches the code the agent is about to change.
- A way to check, after the fact, that the agent really looked.
What you’ll build
- An instruction block in
CLAUDE.mdorAGENTS.mdthat tells the agent when to call Graphify and what to do with the result. - For Graphify Local, hooks that remind the agent to query the graph right before it greps or reads a file, and git hooks that rebuild the graph after every commit.
- A
.graphifyignorethat keeps vendored and generated code out of the graph. - A two-minute check that shows which Graphify tools the agent called in a session.
Setup
Pick the path that matches how you run Graphify. Hosted is Graphify Cloud, where Graphify builds and hosts the graph. Local is thegraphifyy package on your machine.
- Graphify (hosted)
- Graphify Local
- Repositories connected and showing Indexed in the Console. See the Quickstart.
-
Your agent connected to the hosted MCP server and signed in. For Claude Code:
Then run
/mcpin Claude Code, select graphify and choose Authenticate. For Codex, Cursor and others, see Connect cloud coding agents.
Step 1: Check the agent can call Graphify
Start a new agent session and paste:- Graphify (hosted)
- Graphify Local
get_node or god_nodes in the tool list instead of list_repositories, the agent is talking to a local Graphify server, not the hosted one.Step 2: Tell the agent when to use the graph
Agents follow the instruction file they read at the start of every session:CLAUDE.md for Claude Code, AGENTS.md for Codex and many other agents, and .cursor/rules/ for Cursor. A tool the instructions never mention is easy to skip. Make the rule specific: when to call, which tool, and what to do with the answer.
- Graphify (hosted)
- Graphify Local
Add this to To save the agent a lookup, you can set a default repository on the server URL instead, such as
CLAUDE.md or AGENTS.md in each repository and commit it. Replace acme/web-app with the repository’s name in Graphify.AGENTS.md
https://api.graphify.com/mcp?repo=acme/web-app. See Hosted MCP.Step 3: Remind the agent at the moment it reaches for grep
Instructions at the top of a long session fade. Graphify Local’s Claude Code hooks fire right before eachgrep, Bash search, Read or Glob, and add a reminder with the graph’s answer for that exact search. graphify claude install in Step 2 already registered them.
You can see what the agent receives by running the hook yourself:
graphify query, then goes back to nudging, so the agent is never stuck:
GRAPHIFY_HOOK_STRICT=1 or 0. See Environment variables.
The hosted MCP server has no hook. On hosted, the instruction block from Step 2 does this job, so keep it short and specific.
Step 4: Keep the graph fresh
An agent that finds a stale answer once stops trusting the graph. Make updates automatic.- Graphify (hosted)
- Graphify Local
A push to a repository’s default branch starts a new index of that commit. Pushes to other branches don’t update the graph, and a pull request doesn’t build a second graph. In practice:
- Merge to the default branch often. Long-lived branches drift from the graph.
- If a repository’s row in Repositories shows Out of date, select Reindex.
- Combined graphs rebuild when a member repository re-indexes.
Step 5: Keep noise out of the graph
Vendored packages, build output and generated clients fill search results with code nobody on the team wrote. The agent then cites the wrong file. Graphify Local already skips dependency and build folders. Add the rest to.graphifyignore in the repository root. It uses gitignore syntax and is read after .gitignore.
.graphifyignore
graphify update . and check the node count drops. See Ignoring files. On hosted, Graphify indexes what’s in the repository’s default branch, so keep generated output out of git where you can.
Step 6: Prove the agent used the graph
Don’t rely on the answer sounding right. Check the session. In the session. In Claude Code, Graphify calls appear in the transcript as tool calls namedgraphify (hosted MCP) or as graphify query commands (Local). Run /mcp to see whether the server is connected and which tools it lists.
After the session. Claude Code saves each session as a JSONL file under ~/.claude/projects/. Count the Graphify calls across your recent sessions:
- Graphify (hosted)
- Graphify Local
Grep or Read calls and no Graphify calls, the instructions aren’t working for that task. Tighten the rule in Step 2, or turn on strict mode on Local.
A spot-check prompt. At the end of a task, ask:
When it goes wrong
The agent still greps first. Make the trigger concrete: “before the first grep, glob or file read”, not “when helpful”. On Local, check.claude/settings.json has the hook-guard entries, or turn on strict mode.
The agent says Graphify isn’t available. On hosted, run /mcp and authenticate again. On Local, run graphify --version in the same terminal the agent uses.
Answers miss code from today. On hosted, the change isn’t on the default branch yet, or the index is still running. On Local, run graphify hook status, then graphify update ., and check ~/.cache/graphify-rebuild.log.
The agent cites vendored or generated files. Add them to .graphifyignore and rebuild.
Too many tools, the agent picks the wrong one. Name the two or three tools you want in the instruction block. The agent doesn’t need to know about the rest.
Production patterns
- Commit the instruction block and the hook config so every teammate’s agent behaves the same. Local writes
CLAUDE.md,AGENTS.mdand.claude/settings.jsonin the repository. - Keep the block under 15 lines. Long instructions get skimmed by agents as much as by people.
- Ask for citations. “Cite the Graphify result” turns a silent skip into something you can see in the answer.
- Run the transcript count weekly for a few weeks after rollout. It’s the fastest way to see which tasks the agent still handles with grep.
- One graph per repository, one rule per repository. For changes that cross repositories, combine their graphs. See Map dependencies across multiple repositories.
Complete example
A Local setup for a repository, from nothing to verified, in one go:What you built
Your agent now has a specific rule for when to call Graphify, a reminder at the moment it reaches for grep, a graph that updates as the code changes, and a check that shows whether it used the graph.Next steps
Map dependencies across repositories
Combine repositories and ask what a change breaks.
Hosted MCP
Every hosted tool, limits and client setup.
Give Claude Code a monorepo graph
Local skill, hooks and token savings in depth.
Try it in Graphify
We build and host the graph for you. The Free plan (up to 3 repositories) needs no card. Pro and Teams start with a 14-day trial, card required.