u/DealerProfessional97

▲ 0 r/Python

I built a graph-based context tool for Claude Code

I’ve been playing around with Claude Code on larger repos and noticed it spends a lot of time just figuring out where to look before it can start working.

Most tools in this space seem to use semantic search:

  • embed files/functions,
  • search for similar code,
  • send that to the model.

That works sometimes, but I kept hitting cases where the most important code wasn’t semantically similar at all.

Usually it was something connected indirectly:

  • a caller,
  • shared interface,
  • related test,
  • sibling implementation,
  • dependency chain, etc.

So I started building something different: claude-context-compiler.

Instead of searching over text, it builds a dependency graph of the repo and traverses relationships between symbols.

The traversal changes based on the task:

  • bug fixes follow callers/tests
  • feature work follows imports and neighboring modules
  • refactors widen traversal to understand impact

Another thing I found useful: returning exact symbol ranges instead of entire files.

So instead of giving Claude:

processor.py

it gives:

processor.py:6-24

That alone cuts down a surprising amount of wasted context.

I ran the same task twice with cache cleared between runs.

Without context-compiler:

  • $1.41
  • 7m 54s

With context-compiler:

  • $1.12
  • 4m 26s

The interesting part was exploration cost.

Without it, Claude spent about $0.24 just reading files and trying to locate the relevant code.

With context-compiler, that dropped to about $0.0004.

Everything runs locally:

  • no cloud indexing
  • no telemetry
  • no code leaves your machine

Currently supports:

  • Python
  • TypeScript

Install:

pip install claude-context-compiler

Then inside your repo:

context-compiler init

Open Claude Code in the same folder and it picks it up automatically.

It can also index multiple repos together:

context-compiler init --dependencies ../shared-lib,../frontend

So Claude can follow relationships across repos instead of treating them separately.

Still early, but I’d love feedback from people working on code tooling / agents / retrieval systems.

Source code in comments.

reddit.com
u/DealerProfessional97 — 5 days ago
▲ 7 r/AItechnology+3 crossposts

I built a graph-based context tool for Claude Code

Title: I built a graph-based context tool for Claude Code

I’ve been playing around with Claude Code on larger repos and noticed it spends a lot of time just figuring out where to look before it can start working.

Most tools in this space seem to use semantic search:

  • embed files/functions,
  • search for similar code,
  • send that to the model.

That works sometimes, but I kept hitting cases where the most important code wasn’t semantically similar at all.

Usually it was something connected indirectly:

  • a caller,
  • shared interface,
  • related test,
  • sibling implementation,
  • dependency chain, etc.

So I started building something different: claude-context-compiler.

Instead of searching over text, it builds a dependency graph of the repo and traverses relationships between symbols.

The traversal changes based on the task:

  • bug fixes follow callers/tests
  • feature work follows imports and neighboring modules
  • refactors widen traversal to understand impact

Another thing I found useful: returning exact symbol ranges instead of entire files.

So instead of giving Claude:

processor.py

it gives:

processor.py:6-24

That alone cuts down a surprising amount of wasted context.

I ran the same task twice with cache cleared between runs.

Without context-compiler:

  • $1.41
  • 7m 54s

With context-compiler:

  • $1.12
  • 4m 26s

The interesting part was exploration cost.

Without it, Claude spent about $0.24 just reading files and trying to locate the relevant code.

With context-compiler, that dropped to about $0.0004.

Everything runs locally:

  • no cloud indexing
  • no telemetry
  • no code leaves your machine

Currently supports:

  • Python
  • TypeScript

Install:

pip install claude-context-compiler

Then inside your repo:

context-compiler init

Open Claude Code in the same folder and it picks it up automatically.

It can also index multiple repos together:

context-compiler init --dependencies ../shared-lib,../frontend

So Claude can follow relationships across repos instead of treating them separately.

Still early, but I’d love feedback from people working on code tooling / agents / retrieval systems.

Source code in comments.

reddit.com
u/DealerProfessional97 — 4 days ago