DEV Community

Cover image for Your AI Re-Reads Your Whole Codebase Every Session. Hand It a Map Instead
Athreya aka Maneshwar
Athreya aka Maneshwar

Posted on

Your AI Re-Reads Your Whole Codebase Every Session. Hand It a Map Instead

Hello, I'm Maneshwar. I'm building git-lrc, a Micro AI code reviewer that runs on every commit. It is free and source-available on Github. Star git-lrc to help devs discover the project. Do give it a try and share your feedback.

Let me paint you a picture you already know too well.

You open a fresh Claude Code (or Codex, or whatever coding agent you're loyal to this week) session.

You type one tiny question.

Something like "where do we handle retries?" And before your agent even thinks about answering, it quietly inhales half your repo.

Every file, every function, every stray utils.js that nobody has touched since the Obama administration. Thousands of tokens, gone, before you got a single useful word back.

That's the token tax.

You pay it every single session. And it's the reason your $20 plan sometimes feels like it's rationing you like it's 1943.

So when a tool showed up that promised to fix exactly this, I did the responsible thing: I got suspicious, then I tried it anyway.

The tool is called Graphify, and the short version is that it stops your AI from cramming for the same exam every morning.

Let me explain, because there's a genuinely clever idea underneath the hype.

The problem isn't your AI. It's the cramming.

Here's the thing about large language models reading raw files: they're doing it blind, every time.

There's no memory of the shape of your project between sessions.

So the model re-derives "how does this codebase fit together" from scratch, token by expensive token, on question number one.

The insight Graphify runs on isn't new, and the author is upfront about where it came from: an old note by Andrej Karpathy about building an LLM-friendly knowledge base. The pitch was simple. Instead of feeding a model your raw files over and over, index them once into something structured, then let the model query that.

Graphify is a real, working version of that idea for your local folders.

You point it at a directory.

It compiles that directory into a knowledge graph. And from then on, your agent asks the graph instead of re-reading the world.

Okay, so what even is a knowledge graph here?

Fair question, because "knowledge graph" is one of those phrases people say to sound smart at meetups.

Strip the jargon and it's two things: nodes and edges.

Nodes are the pieces of your project (a function, a file, a component, a concept).

Edges are the relationships between them (this function calls that one, this doc describes that module, this config feeds that service).

Draw enough of those and clusters start to appear on their own.

See that red node with everything hanging off it? Graphify calls those god nodes, and they're not the little leaf nodes out at the edges.

They're the opposite: the most connected nodes in your whole project.

Your core abstractions. The stuff that, if it broke, would take the afternoon down with it.

Finding those automatically is weirdly delightful, because every codebase has three or four functions secretly holding the entire thing together, and now you get a list of them for free.

How it actually builds the thing

This is the part I found genuinely neat, so I'm going to nerd out for a second.

Graphify doesn't just throw your whole repo at a model and pray.

It splits the work in two:

For code, it parses the actual syntax tree.

No LLM, no tokens, no cost.

It just reads the code like a compiler would and pulls out functions, calls, and structure deterministically. That's the free lunch, and it's a big one.

For docs, papers, and images, where meaning matters more than syntax, it brings in a model to extract concepts and relationships.

That's the part that costs tokens, and it only runs on the stuff that actually needs interpreting.

Then it merges both, runs community detection to find the natural clusters, and hands you three files: an interactive graph.html, a plain-language GRAPH_REPORT.md, and the raw graph.json for anything programmatic.

One detail I appreciated: the report keeps an honest audit trail.

Every relationship is tagged as EXTRACTED (it's really in the code), INFERRED (the model reasoned it out, trust but verify), or AMBIGUOUS.

No pretending the guesses are gospel. I have trust issues with tools, and this one earned a little back.

The payoff: an actual map you can poke

Here's the interactive graph in motion:

graph output

You can toggle communities on and off, isolate the cluster you care about, and see how things connect instead of holding forty files in your head at once.

The first time you spot a dependency you didn't know existed, staring right at you as a line between two nodes, it's a small "oh, that's why that broke" moment. Cheaper than therapy.

The three commands that make it stick

The graph is nice to look at, but the reason it earns a spot in your workflow is querying.

Three commands do most of the heavy lifting:

  • query "how does auth work?" walks the graph and answers in plain language, citing the actual files.
  • path "AdminPanel" "Database" finds the shortest route between two concepts and shows you every hop.
  • explain "RateLimiter" gives you a human explanation of a single node using its neighborhood in the graph.

And when you change a bunch of files, you don't rebuild from zero. --update re-extracts only what changed.

Your map stays current without re-surveying the whole continent.

The bit your wallet cares about

Now the money question, literally.

Because your agent queries a compact graph instead of swallowing raw files, the token cost of "understand my project" drops hard.

The project claims around 70% fewer tokens, and on individual questions the reported reductions are measured in multiples, not modest percentages.

Your mileage will vary with repo size and question type, so take the exact number with a grain of salt, but the direction is not subtle.

Translation: the plan you're already paying for suddenly stretches a lot further. Same subscription, more actual work per dollar. That's the whole trick.

Who this is actually for

Straight answer: this shines when you read more than you write.

Onboarding onto a codebase somebody else built.

Doing research across a pile of code and docs.

Exploring a repo you cloned an hour ago and already regret.

In those situations, a pre-built map is exactly what you want.

If you're heads-down writing brand new code in a small project you already know cold, the graph buys you less. And you do pay an upfront cost to build it (the semantic pass on docs and images isn't free), though a code-only run leans on that deterministic parser and stays cheap.

It's a "spend a little now to save a lot later" deal, so spend it where later actually shows up.

Setup, if you're curious, is about as heavy as installing any Python tool: you need Python and uv (think of uv as npm, but for Python and in a good mood), then one install command, then you point it at a folder. That's the whole ceremony.

The takeaway

We spend a lot of energy making models smarter.

Graphify makes a quieter bet: give the model a decent memory of your project, and it stops wasting brainpower re-learning the map every morning.

It won't write your code for you.

But it will stop your AI from treating every session like the first day of school. Give your codebase a map. Your token budget might send a thank-you card.


AI agents write code fast. They also silently remove logic, change behavior, and introduce bugs — without telling you. You often find out in production.

git-lrc fixes this. It hooks into git commit and reviews every diff before it lands. 60-second setup. Completely free.

Any feedback or contributors are welcome! It's online, source-available, and ready for anyone to use.

⭐ Star it on GitHub:

GitHub logo HexmosTech / git-lrc

Free, Micro AI Code Reviews That Run on Git Commit




GenAI today is a race car without brakes. It accelerates fast -- you describe something, and large blocks of code appear instantly. But AI agents silently break things: they remove logic, relax constraints, introduce expensive cloud calls, leak credentials, and change behavior -- without telling you. You often find out in production.

git-lrc is your braking system. It hooks into git commit and runs an AI review on every diff before it lands. 60-second setup. Completely free.

In short, git-lrc helps Prevent Outages, Breaches, and Technical Debt Before They Happen

At a glance: 10 risk categories · 100+ failure patterns tracked · every commit…

Top comments (0)