bigindexer: BGI: The Code Indexer That Reads Behavior, Not Imports
A look at a static analysis tool that builds architectural maps from intent, turns cluster overflow into a refactoring signal, and exposes the result to AI agents through MCP.
- BGI’s most interesting move is to treat architecture as behavior, so it can group code by role instead of by imports.
- Its Fuse-Graph idea turns cluster overflow into evidence, which makes decomposition pressure visible instead of hiding it inside a dense graph.
- The pipeline is mostly deterministic, with Tree-sitter and heuristics doing the heavy lifting before AI fallback steps in.
- MCP is the delivery layer, not the invention, because the real value is the behavioral index underneath it.
The cluster that tells you where to split the codebase
BGI’s sharpest idea is also its most practical: a cluster that refuses to grow. Instead of treating overflow as a problem to smooth over, BGI records it as a boundary signal. That makes architectural stress visible in the one place teams usually need it most, right before a refactor gets expensive.
BGI tries to group code based on what the code actually does (its behavior), not just which file imports what.
That is the project’s argument in one sentence. Imports are useful, but they flatten intent into links. BGI is trying to infer a system’s shape from how units behave, then use that shape to find seams, coupling, and decomposition pressure.
Why imports stop being useful in large repos
Traditional dependency graphs answer a narrow question: what points at what. That works until the codebase gets large enough that the graph becomes a blur of incidental links. At that point, the problem is not missing data. The problem is that the data is too literal.
| Approach | What it indexes | How it finds relationships | What it misses |
|---|---|---|---|
| Import graph | Files and dependencies | Explicit imports and references | Intent, lifecycle, and role |
| Symbol search | Names and declarations | String matches and language symbols | Behavior across multiple files |
| RAG-style retrieval | Chunks of text | Embedding similarity | Architectural seams and coupling |
| BGI behavioral indexing | Units, roles, and behavioral fingerprints | COV tokens, key-lock pairs, and clustering | Less obvious than syntax, but much closer to architecture |
BGI’s claim is not that the old tools are wrong. It is that they stop being enough when the task shifts from finding code to understanding a system. That is a different job.
BGI’s real trick is the COV vocabulary
The core semantic layer is the Canonical Operation Vocabulary, or COV. Instead of asking whether a function is “important,” BGI tags it with role-oriented tokens such as PERSIST, GUARD, TEARDOWN, and INIT. That vocabulary is what lets the system talk about behavior in a repeatable way.
# Conceptual example of the COV layer
fingerprint = {
"tokens": ["INIT", "GUARD", "PERSIST"],
"confidence": 0.94,
"source": "deterministic"
}
# Key-lock pairing links complementary lifecycle roles
KEY_LOCK_PAIRS = [
("INIT", "TEARDOWN"),
("GUARD", "PERSIST"),
("INTAKE", "EMIT")
]
The point of the pairings is subtle. BGI can connect units that do not call each other directly, but still participate in the same lifecycle. That is a more architectural notion of relatedness than a raw edge in a call graph.
Gate 1 turns source code into behavioral fingerprints
Gate 1 is where BGI earns its “not just an LLM wrapper” credibility. Tree-sitter queries do most of the extraction work, then heuristics and AST walking fill in the gaps. AI fallback exists, but it is the exception, not the foundation.
That matters because the system stays predictable. A semantic index is only useful if you can trust how it was built, and BGI’s first gate is built to be mostly deterministic.
Gate 2 filters noise before it becomes graph clutter
Once units have fingerprints, Gate 2 starts deciding which relationships deserve attention. This is where the token census and spectral masking logic comes in. Common tokens like LOG should not dominate the graph just because they appear everywhere.
This is the anti-noise layer. It keeps the graph legible enough that the important relationships still look important.
Gate 3 makes the architecture legible enough to act on
Gate 3 uses DRS clustering to group units into bounded clusters. The hard cap is the interesting part. Once a cluster tries to exceed the limit, BGI does not silently absorb it. It records a fuse edge.
That is a useful inversion. In many tools, growth just means more blur. In BGI, growth pressure becomes a signal that a seam may already exist.
BGI surfaces high-coupling seams and fuse-boundary signals between clusters so integration risk is easier to spot.
For architects, that is the payoff. BGI is not only telling you what belongs together. It is telling you where togetherness starts to fail.
Why MCP is the last mile, not the main event
MCP is the delivery interface. It makes the behavioral index queryable by tools like Claude or Cursor, which is useful because those tools need context that is structured, not just retrieved. But the interesting part is still the index itself.
In that sense, MCP is the last mile. BGI first builds an architectural model, then exposes it in a form that AI agents can actually use.
- Task fingerprinting can map a request to the code roles likely involved.
- Behavioral twins can surface similar implementations for safer reuse.
- Twin context can provide convention-aware grounding for refactors.
BGI versus the usual indexing stack
| System | Primary strength | Main limitation | Why BGI is different |
|---|---|---|---|
| Sourcegraph-style indexing | Excellent search across large codebases | Still centers retrieval over architecture | BGI emphasizes behavioral role inference and seams |
| Cursor-style retrieval | Fast in-editor context for coding | Can miss deeper structural patterns | BGI adds bounded clustering and fuse signals |
| Symbol-based tooling | Precise language-aware navigation | Weak on cross-file intent and lifecycle | BGI connects complementary behaviors, not just symbols |
| BGI | Architectural maps with pressure points | More opinionated than generic search | It treats overflow and coupling as evidence |
The cleanest way to say it is this: BGI does not compete on search alone. It competes on whether the result helps you see the architecture behind the search result.
What kind of team should care about this
BGI is for teams that already know the repository is large, messy, and expensive to reason about by hand. It is especially relevant when refactors are risky, when multiple teams touch the same monorepo, or when AI tools need stronger boundaries than plain retrieval can give them.
If your main problem is finding a symbol, this is probably too much tool for the job. If your main problem is understanding where the codebase wants to split, BGI is aimed squarely at that mess.