Code retrieval for AI agents: Why vector embeddings fail and per-file LLM graphs win

A year-long experiment building a code indexing system for AI coding tools yielded clear results: vector embeddings on code chunks and Tree-sitter AST parsing both have critical flaws, while per-file LLM analysis stored in a Neo4j graph with semantic fulltext search works best. The findings echo recent papers like RepoGraph (ICLR 2025) and Code-Craft.
Approaches tested
- Vector embeddings on code chunks – discarded entirely. A function named
process()in a payments service and one in an image pipeline embed to similar vectors, despite having nothing to do with each other. Vectors flatten call graphs, inheritance, imports — all structural relationships. Retrieval precision was unacceptable. - Tree-sitter AST parsing – precise and fast, but structural-only. It can tell you a function exists and what it calls, but cannot answer the question “this function handles webhook retries for failed Stripe payments.” Falls short when developers phrase questions in business language.
- Per-file LLM analysis → graph – works. Every file gets an LLM call generating
purpose,summary, andbusinessContext, stored as nodes in Neo4j with edges to classes, functions, keywords, and imports. Retrieval uses fulltext search across those semantic fields instead of vector similarity. SHA-256 diffing limits reindexing to changed files, making the upfront cost manageable.
Benchmarks from literature
RepoGraph (ICLR 2025) showed +32.8% improvement on SWE-bench with graph approaches. Code-Craft achieved +82% top-1 retrieval precision using bottom-up LLM summaries from code graphs.
Comparison to existing tools
The team published a side-by-side in comparison.md. Key differences:
- Bytebell: per-file LLM → purpose + summary + businessContext + entities; Neo4j + MongoDB storage; SHA-256 diff-aware reindex.
- PageIndex: TOC reasoning tree for long PDFs/docs; no code-specific semantics.
- GitNexus: Tree-sitter AST + community detection; optional per-symbol semantics; uses LadybugDB.
- GraphRAG: per-chunk LLM entities + community clustering for general text, not code.
- Sourcegraph/Cody: LSIF/SCIP search index; no per-node semantics; deployment is self-hosted or SaaS.
- Augment: proprietary semantic index with embeddings; SaaS-only; continuous indexing managed.
Open source
The system is open source at github.com/ByteBell/bytebell-oss.
📖 Read the full source: r/LocalLLaMA
👀 See Also

Be brief beats caveman plugin in Claude Code compression benchmark
A 24-prompt benchmark shows Claude Code's caveman compression plugin produces the same token counts and quality as simply prepending 'be brief.' — but the plugin's consistent output shape and safety escape rules offer structural advantages.

Open-source 31-agent product development system for Claude with 12,000+ lines of content
An open-source Claude Skill provides 31 specialized AI agents and 20 strategic frameworks covering all company departments from product to compliance. The MIT-licensed system includes 62 files with 12,000+ lines of actionable content, country-specific compliance for multiple regions, and a smart-loading system that routes requests efficiently.

P2PCLAW: A Peer-to-Peer Network for AI Agents to Publish Formally Verified Science
P2PCLAW is a peer-to-peer network where AI agents and human researchers can publish scientific results validated through formal mathematical proofs in Lean 4. The system uses GUN.js and IPFS, with post-quantum cryptography and privacy features for secure participation.

Self-Hosted GitHub Bot Runs Claude Code with 40+ Webhook Triggers and MCP Tools
A self-hosted GitHub bot leverages Claude Agent SDK with full Claude Code features, supporting 40+ webhook triggers, 4 built-in MCP servers, and custom YAML-based workflows for PR review, CI auto-fix, and issue triage.