{
"$type": "site.standard.document",
"bskyPostRef": {
"cid": "bafyreies5dnpjddg3vdd5krdzuvh4r26nnncxyxjz5sx7uhzkn4zngf7v4",
"uri": "at://did:plc:25rdn5elo5izoxrmtis34zuk/app.bsky.feed.post/3mosc4cavgxy2"
},
"coverImage": {
"$type": "blob",
"ref": {
"$link": "bafkreie2xwrwo4rdpxhkqhhtrne6ugeaffwnwlytioq4psz754i5bhphfi"
},
"mimeType": "image/webp",
"size": 591788
},
"path": "/vikrantnegi/how-graphify-stopped-my-team-from-burning-through-cursors-context-window-2d32",
"publishedAt": "2026-06-21T11:26:47.000Z",
"site": "https://dev.to",
"tags": [
"ai",
"cursor",
"productivity",
"webdev",
"Graphify",
"Graphify repo",
"Twitter",
"GitHub"
],
"textContent": "Every time I asked Cursor about our auth flow, it would open 8-12 files, read through each one, and burn through tokens before even starting to answer. For a React Native codebase maintained by 6 developers, this adds up fast.\n\nI lead a front-end team building React Native apps. Cursor is our primary IDE. And while Cursor is great at understanding code, the way it retrieves context — by grepping and reading raw files sequentially — doesn't scale well on larger projects.\n\nThen I found Graphify, and it fundamentally changed how our AI assistant interacts with our codebase.\n\n## What Graphify actually does\n\nBefore I get to the setup, it's worth understanding the mechanism — because it's not just another Cursor plugin.\n\nGraphify pre-processes your entire project into a **knowledge graph**. Think of it as a map of your codebase where every function, class, module, and concept becomes a node, and every relationship between them becomes an edge. When Cursor needs to answer a question, instead of reading 47 files to understand a flow, it runs `graphify query \"auth flow\"` — a scoped subgraph lookup that returns only the relevant nodes and connections.\n\nThe important part: **code extraction happens entirely locally** via tree-sitter AST parsing. No API calls, no code leaving your machine. You only hit an LLM when processing docs, PDFs, or images. For a pure code project (which most React Native apps are), the extraction cost is basically zero.\n\nThe output is three files:\n\n * `graph.json` — the full graph (the core artifact your assistant queries)\n * `graph.html` — an interactive visualization you can explore in a browser\n * `GRAPH_REPORT.md` — an architecture summary with god nodes, surprising connections, and suggested questions\n\n\n\nThat report alone is worth the setup. It finds connections between modules you didn't realize existed and surfaces the most-connected concepts in your project — the things everything flows through.\n\n## Setting up Graphify for Cursor\n\nI'm on an M1 MacBook Pro. Here's the exact setup that worked for me.\n\n### Install\n\n\n brew install uv # if you don't have it already\n uv tool install graphifyy\n\n\n**Important: use`uv tool install`, not `pip install`.** On M1 Macs, pip can break Python path resolution because Graphify resolves the Python binary at runtime from a cached path. `uv` isolates the environment and avoids this entirely. I learned this the hard way.\n\n### Build the graph\n\n\n cd your-project\n graphify extract .\n\n\nFirst run takes a few minutes depending on codebase size. Since our projects are all code (no PDFs/docs), the entire extraction runs locally on tree-sitter — no API key needed for this step.\n\n### Install the Cursor integration\n\n\n graphify cursor install\n\n\nThis writes a `.cursor/rules/graphify.mdc` file with `alwaysApply: true`. If you've worked with Cursor's rule system, you know what this means — it gets injected into every conversation automatically, telling Cursor to prefer `graphify query` over reading raw source files.\n\nQuick note for anyone working with `.mdc` files: a rule with `alwaysApply: false` and no `globs` and no `description` will never auto-apply — it becomes manual `@`-mention only. Graphify sets `alwaysApply: true`, which is the correct move for a global project context rule.\n\n### Set up the git hook\n\n\n graphify hook install\n\n\nThis installs a `post-commit` hook. Every time anyone commits, it auto-rebuilds the graph using tree-sitter — fully local, takes seconds. It also sets up a git merge driver so if two devs commit graph updates in parallel, `graph.json` gets union-merged automatically instead of leaving conflict markers.\n\nAfter this, you basically forget Graphify is running. The graph stays current with every commit.\n\n## Rolling this out to a team\n\nThis is where I had the most questions before adopting it, so let me cover the practical stuff.\n\n### What to commit\n\nAdd these to your repo:\n\n\n\n graphify-out/\n ├── graph.json # the core artifact\n ├── graph.html # interactive visualization\n ├── GRAPH_REPORT.md # architecture summary\n ├── manifest.json # tracks extracted files (uses relative paths — portable)\n └── cache/ # optional — commit for faster rebuilds\n\n .cursor/rules/graphify.mdc # the Cursor integration rule\n .graphifyignore # if you create one\n\n\nAdd this to `.gitignore`:\n\n\n\n graphify-out/cost.json\n\n\n`cost.json` tracks Graphify's own LLM API spend during extraction — not tokens saved in Cursor. It's local accounting, not a shared artifact.\n\n### Impact on teammates who don't use Graphify\n\n**Zero.** This matters — Graphify is purely additive.\n\nThe `graphify-out/` folder is just inert data files. No build process depends on them, no CI breaks without them. The `.mdc` file only affects Cursor users who have that rule active. If a dev without Graphify installed triggers the `post-commit` hook, it fails silently (binary not found) and the commit goes through normally.\n\nYou can adopt this incrementally. Install it yourself, commit `graphify-out/`, and other devs benefit from the graph whenever they install Graphify later. No coordination needed.\n\n### Recommended team workflow\n\n 1. **Initial setup on`main`** — do the first `graphify extract .` on main and commit `graphify-out/`. This becomes the shared baseline everyone pulls.\n 2. **Feature branches update automatically** — the git hook rebuilds incrementally after every commit on any branch.\n 3. **On merge to main** — the graph from the feature branch comes with it. The merge driver handles concurrent updates.\n\n\n\nOne edge case: if someone runs a long-lived feature branch without the hook installed, their `graph.json` will drift. A manual `graphify extract . --update` before raising the MR resyncs it. I've considered adding this to our MR checklist, but honestly the hook handles 99% of cases.\n\n## What can go wrong\n\nA few things I ran into or anticipated:\n\n**The M1 pip issue.** Already mentioned above — use `uv tool install`, not pip. Wasted about 20 minutes debugging path resolution before figuring this out.\n\n**Can you actually measure token savings?** Honestly, not directly. Cursor doesn't expose per-conversation token usage. What you _can_ observe: response latency drops (graph queries are faster than multi-file reads), context window pressure reduces (fewer \"context limit reached\" moments), and Graphify logs every query at `~/.cache/graphify-queries.log` with nodes returned and duration — so you get a sense of how targeted the retrieval is.\n\nThe rough mental model: without Graphify, Cursor answering \"how does auth connect to the API layer?\" reads 8-12 files. A typical React Native file is ~200-400 tokens. That's ~3000 tokens just for context loading, before the answer. With Graphify, it reads a scoped subgraph — a fraction of that.\n\n**`cost.json` is not \"tokens saved.\"** I initially confused this. `cost.json` tracks what Graphify itself spent on LLM calls during extraction. For a code-only project, this is near zero. It has nothing to do with what Cursor saves in conversation.\n\n**Graph drift on branch switches.** If you install the `post-commit` hook but not the `post-checkout` hook, switching branches won't rebuild the graph. The latest version of Graphify supports `post-checkout` hooks too — check if `graphify hook install` sets both up for you.\n\n## What I'd do differently\n\nIf I were setting this up again:\n\n 1. **Run the initial extraction on a clean main branch first.** I initially ran it on a feature branch and had to redo it when I realized the team needed the baseline on main.\n 2. **Check`GRAPH_REPORT.md` before sharing with the team.** It surfaces god nodes and surprising connections — some of which might reveal architectural issues you'd rather address before making the graph a shared artifact.\n 3. **Skip committing`cache/` initially.** It speeds up rebuilds but adds repo size. Start without it and add later if rebuild times become annoying.\n\n\n\n## Who should use this\n\nGraphify makes the most difference when:\n\n * Your codebase has **50+ files** and multiple modules that interact\n * You use Cursor (or Claude Code, Codex, Gemini CLI — it supports 10+ assistants)\n * You're on a team and tired of your AI assistant not \"knowing\" the codebase between sessions\n * You do code reviews and need to quickly understand how a change connects to the rest of the system\n\n\n\nFor small projects with 5-6 files, the graph adds structural clarity but the token savings are minimal — the files already fit in a context window.\n\n## Try it\n\n\n brew install uv\n uv tool install graphifyy\n cd your-project\n graphify extract .\n graphify cursor install # or the equivalent for your IDE\n graphify hook install\n\n\nThat's 5 commands to set up. The graph builds, your assistant starts using it, and the hook keeps it current. No config files to write, no services to run.\n\nCheck out the Graphify repo for the full docs. If you're on Cursor specifically, the `.mdc` integration is the smoothest path — it just works.\n\nIf you've been feeling like Cursor \"forgets\" your codebase every conversation, or burns through context reading files it shouldn't need — Graphify is worth the 10 minutes to set up. It was for me.\n\n_I'm a React Native tech lead exploring AI-assisted development workflows. Find me on Twitter and GitHub._",
"title": "How Graphify Stopped My Team from Burning Thousands of Tokens Per Query"
}