CodeNib: A Multi-View Data System for Serving Repository Context to Coding Agents

Zhongming Yu, Hengjia Yu, Boqin Yuan, Shuting Zhao, Yizhao Chen, Aryan Dokania, Mihir Jagtap, Jiayu Chang, Yitong Ma, Yash Jayswal, Wentao Ni, Hejia Zhang, Zhaoling Chen, Gangda Deng, Jishen ZhaoarXiv 2026

TL;DR

CodeNib is a novel multi-view data system designed to efficiently serve repository context—such as lexical, semantic, and structural code details—to AI coding agents. By treating repository commits as immutable base data and using incremental updates alongside smart history compaction, CodeNib slashes agent token usage by 50–87% and accelerates context updates by up to $25\times$ without sacrificing code localization quality.

What Problem Does This Paper Address?

AI coding agents (like Devin or SWE-agent) spend a significant amount of time searching, navigating, and reading code within large, evolving repositories. However, existing agent runtimes rely on disconnected tools: standalone vector databases for semantic search, raw grep for lexical search, and live Language Server Protocol (LSP) instances for symbol navigation.

This fragmentation creates a major data-lifecycle coordination problem. Every time a repository changes, re-indexing the entire codebase becomes prohibitively expensive. Furthermore, agents often pass their entire messy, step-by-step exploration history back into the LLM prompt at every turn, leading to massive token bloat, high latencies, and soaring API costs.

Methods

CodeNib approaches repository context as a unified data-systems problem. Instead of collapsing all context into a single representation, it compiles three distinct, heterogeneous views for each repository commit:

  1. Lexical View: Text indexes (BM25 or Zoekt) for keyword and regex matching.
  2. Dense View: Code embeddings stored in FAISS for semantic retrieval.
  3. Structural View: Symbol containment and dependency graphs built using tree-sitter and SCIP.

All three views are linked via a central Repository Manifest ($M_c$) and mapped to a shared, repository-relative source range address space.

Figure 1: CodeNib compiles and maintains heterogeneous repository views, then serves them as bounded agent context.

Incremental Maintenance

When a developer or agent modifies the code, CodeNib avoids full rebuilds. Instead, it uses Git diffs to perform view-specific delta maintenance:

  • Vectors: Reuses content-addressed embeddings for unchanged files and only updates mutated chunks.
  • Graphs: Employs LSP-assisted graph repair to delete invalid nodes/edges and re-wire modified symbols rather than parsing the whole repository from scratch.

Agent Runtime & Context Policies

CodeNib exposes these views to agents via standard Model Context Protocol (MCP) tools. Crucially, it introduces a Compact Context Policy. When an agent successfully reads a file, CodeNib deterministically rewrites the LLM's interaction history—pruning out the verbose intermediate search transcripts while preserving the core discovered code blocks and a small "direction cue."

Datasets

The authors evaluated CodeNib using two primary configurations:

  • CodeNib Base: A dataset of 100 repository snapshots from 25 distinct repositories across five programming languages (C/C++, Go, Python, Rust, TypeScript/JavaScript), sampled from SWE-bench Verified and SWE-bench Multilingual.
  • CodeNib Synthesis: A second-stage evaluation workload consisting of 500 tasks (25 snapshots $\times$ 20 queries each) evaluated across five prominent LLMs (including Claude 4.5 Haiku, Qwen3.5, Gemma, and Gemini) to generate 7,500 interaction trajectories.

Key Insights and Ideas

  • Commits as Immutable Base Data: By treating a specific commit as immutable, CodeNib can safely materialize and cache diverse indexes behind a single manifest, allowing a query composer to execute optimized, hybrid retrieval plans.
  • History Compaction is a Free Lunch: Agents don't need to remember how they found a file, only what they found. Deterministically cleaning up the prompt history after a successful file read maintains the agent's localization accuracy while drastically lowering token costs.
  • The Language-Fidelity Tradeoff in Graph Repair: While incremental vector updates are robust across all languages, incremental graph repair is highly dependent on compiler/LSP determinism. Languages like Go and Python achieved perfect match rates, whereas Rust and TypeScript graphs occasionally diverged from a full rebuild due to subtle live-server state variations.

Key Results

  • Drastic Update Speedups: Compared to rebuilding indexes from scratch, CodeNib’s incremental maintenance updates graphs $8.7\times$ faster and vectors $25.4\times$ faster at the median.
  • Sub-Millisecond Navigation: For symbol navigation requests where static and live server outputs matched, CodeNib's static graph provider achieved a median $4.7\times$ latency reduction over a live JSON-RPC language server.
  • Massive Token Savings: Across five different LLMs, CodeNib’s context delivery policies preserved code localization quality while using 50–87% fewer trajectory tokens compared to standard agent exploration (grep/read).
Figure 2: CodeNib’s repository-to-agent dataflow. The left column lists supported applications and dependencies, not a pipeline stage. The center Repository View Compiler’s View Builders and View Maintainers create and update manifest-linked views (Secs. 5–6). The upper-right Query Planning and Retrieval path composes source-linked ranked retrieved code blocks (Sec. 7.2); the lower-right Agent Runtime applies context policies and exposes index tools around the agent loop (Secs. 7.1, 7.3, and 7.4). Hashes, lag, and scores are illustrative, not measurements.

Limitations and Future Work

While CodeNib excels at serving context for code localization, the authors note several boundaries:

  • Scope Limits: The system focuses purely on context serving and localization; it does not generate patches or run test suites.
  • Static vs. Live Discrepancies: Static navigation reproduced live server locations perfectly on 63.2% of requests but fell short on complex cross-file references (matching only 39% of the time). Runtimes requiring strict workspace semantics must still maintain a live LSP fallback.
  • Future Directions: The authors plan to extend CodeNib into a full database service supporting concurrent agent writes, atomic cross-view version publication, and learned online query routing to automatically balance latency and quality budgets.

Summary updated

BibTeX
@misc{yu2026codenib,
  author = {Zhongming Yu and Hengjia Yu and Boqin Yuan and Shuting Zhao and Yizhao Chen and Aryan Dokania and Mihir Jagtap and Jiayu Chang and Yitong Ma and Yash Jayswal and Wentao Ni and Hejia Zhang and Zhaoling Chen and Gangda Deng and Jishen Zhao},
  title = {{CodeNib: A Multi-View Data System for Serving Repository Context to Coding Agents}},
  year = {2026},
  eprint = {2607.25431},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2607.25431},
}
Figure