Large, grown software estates (legacy codebases) pose a particular challenge for retrieval-augmented generation (RAG) systems: they combine strict syntactic dependencies across millions of lines of source code with unstructured, often fragmented domain documentation. Existing Graph-RAG approaches attempt to capture these relationships through costly large-language-model entity extraction and pass large subgraphs directly into the context window. This paper describes an alternative dual-graph architecture that is fully deterministic for the code and index path and locally operable, based on a single embedded search engine (Apache Lucene) that operates as a central Multi-Project Intelligence Hub. The system combines a structural abstract-syntax-tree (AST) graph for hard code dependencies with a vector-based semantic neighborhood graph for code and documentation; the hub holds arbitrarily many repositories and live workspaces separately. Both graphs are clustered automatically via community detection (Leiden algorithm) and semantically signed via class-based TF-IDF (c-TF-IDF) without LLM cost. A progressive-disclosure interface first gives the LLM highly condensed structural references instead of raw text and enables autonomous, project-scoped navigation through specialized retrieval tools; cross-project contract validation is described as an outlook. In a reproducible benchmark on a frozen prjxp corpus, the architecture achieves, in the first four-arm run, the highest quality score (0.63) and the highest quality per resource use (QEI 2.02) at 29,138 effective tokens and 33.2 seconds per session against three baselines from the file system, naive vector search, and a code graph. A counter-check with the file-system and hub arms in the same run on both corpora confirms the score advantage (0.64 vs. 0.62 and 0.46 vs. 0.43); however, with the grown tool schema, peak context and runtime are no longer below those of the naive arm. The methodologically corrected four-arm measurement without a tool-call limit (Section 8) sharpens this statement: the quality gain is corpus-dependent. On the legacy corpus the score with prjxp rises from 0.583 to 0.655 (Qwen, +12.4 %) and from 0.683 to 0.723 (DeepSeek, +5.9 %); on the prjxp corpus it remains practically unchanged (0.762 vs. 0.760 and 0.836 vs. 0.808). A measurable benefit thus also appears for a capable model, but under the legacy conditions studied and not as a general superiority over native tools.
Introduction and Problem Statement
Providing legacy systems to modern AI-supported development and analysis tools often fails in practice for two opposing reasons: the syntactic blind flight of classic vector search and the extraction and context explosion of modern Graph-RAG frameworks.
Limits of Pure Vector RAG in the Code Context
Classic RAG pipelines split source code and documentation into overlapping text blocks (chunks), compute dense vector embeddings, and select the top- most similar hits at query time. In grown enterprise applications (e.g., monolithic Java EE or older Spring systems), this approach leads to serious deficits:
Loss of structural coupling: An embedding captures semantic similarity in text space but ignores directed call chains (caller/callee), inheritance hierarchies, and interface implementations. Two classes that are tightly coupled in the domain but use different identifiers are often far apart in vector space.
Fragmentation of topic complexes: In a top- search, relevant chunks of a coherent domain module are often cut off just below the similarity threshold. The LLM receives isolated code fragments without knowledge of their overarching system context.
Limits of Existing Graph-RAG Frameworks
To restore structural context, current frameworks (such as Microsoft GraphRAG, LightRAG, or dynamic knowledge graphs such as Graphiti) rely on automated entity and relation extraction via LLMs during indexing. For large legacy codebases, this paradigm proves unsuitable:
Prohibitive indexing cost and latency: Passing every single code chunk through an LLM causes enormous compute cost and runtimes of hours to days for millions of lines of code. Every code commit creates considerable synchronization effort.
Non-determinism and schema sprawl: Probabilistic extraction produces inconsistent nodes for code identifiers (duplicates, different levels of abstraction) and requires elaborate entity-resolution pipelines.
Context-window stuffing: Returning large subgraphs or concatenated chunk lists floods the context window, increases inference latency through growing KV caches, and promotes the lost-in-the-middle effect in local models.
Architecture of the Dual-Graph-RAG System
To combine the structural precision of static code analysis with the semantic reach of modern vector spaces, the architecture rests on four core principles: dual-graph topology, automatic community clustering, statistical term signatures, and progressive disclosure.
The Dual-Graph Topology
The knowledge model maps the codebase and accompanying documentation onto two complementary graph levels:
Structural AST graph (code level): An abstract syntax tree is created for the source code. Nodes represent classes and methods; fields are typed edges. Directed edges represent syntactic relationships (
CALL,IMPLEMENTS,EXTENDS,IMPORT,FIELD,PARAM,RETURN,CONTAINS,GENERIC_ARG,ANNOTATION). Graph construction is a property of the language pack: Java is built in, C# ships as an external plugin package, and the node identifier is deliberately identical to the chunk identifier – this is what allows the index to carry the graph reference and the cluster rating per chunk without a mapping table. Edges are emitted only for unambiguous, project-internal targets. TypeScript, Visual Basic, and GDScript are chunked but currently contribute no graph nodes.Semantic vector graph (documentation and bridge level): All chunks are stored as vector embeddings in an HNSW index in Apache Lucene. The resulting neighborhood graph connects domain documentation with the technical implementation.
Automatic Community Clustering
Both graphs are decomposed into disjoint clusters by the Leiden algorithm. On the AST graph, this identifies tightly coupled modules; on the semantic graph, thematically related knowledge clusters.
Zero-LLM Signatures via TF-IDF and c-TF-IDF
Instead of generating LLM summaries, the system uses inverted-index statistics from Apache Lucene: At cluster level, class-based TF-IDF (c-TF-IDF) is computed to produce precise semantic signatures without an LLM. The code and index path is thus fully deterministic. The optional conversion of image and PDF documents may use a vision LLM; it is not part of the code index path and is addressed in the outlook.
Retrieval Workflow: Progressive Disclosure
The interaction pattern follows the principle of progressive disclosure. Instead of raw text, the LLM receives compact structural references.
Structured Reference Return
| Field | Availability | Meaning and function for the LLM |
|---|---|---|
project_id |
Context/header | Unique identifier of the source system (repository, upload, or live workspace) |
chunk_id |
Pointer | Unique reference ID of the hit in the Lucene index |
file / chapter |
File in the pointer; chapter in the docs UI | Full file path and syntactic path |
cluster_id |
Metadata/on-demand | Membership in the semantic or structural cluster graph |
cluster_keywords |
Metadata/on-demand | Top terms of the cluster via c-TF-IDF (macro context) |
keywords |
Metadata/on-demand | Rarest significant terms of the chunk via TF-IDF (micro specificity) |
neighbours |
On-demand (graphNode) |
List of direct neighbor IDs in the similarity or AST graph |
Tool-Supported Graph Navigation (Tool Calls)
The model requests only the content it needs through specialized tools:
readChunks(ids): loads the content of chunks including neighbors (implemented).readFile(project, file, offset, limit)/readBySignature(FQN#name): escalates to file, class, or method level (implemented); a dedicatedreadChaptertool is an outlook.graphNode(symbol)/graphFile(file): typed neighbours of a class, method, or file – callers, implementations, contained members – with a condensed (module/class) or a paged raw view (implemented). Bare method names resolve, so the model does not need the full signature.graphSearch(question, depth, contextFilter): bounded subgraph around keyword-matched seeds, depth 1–6, optionally filtered by edge type (implemented); a 1:1relation/scopesemantic is an outlook.graphCluster(clusterId)/graphClusterOverview/semanticGraphCluster: membership and top members of one cluster, or the largest structural clusters as an architecture entry point (implemented).
The Multi-Project Intelligence Hub: Architecture for Distributed System Landscapes
As a central Multi-Project Intelligence Hub, the system holds arbitrarily many repositories and live workspaces – indexed separately and addressed through the project parameter. The retrieval tools currently operate strictly per project: a request resolves exactly one project. Cross-project linking and contract validation are described as an architectural perspective (Section 9), not as available functionality. The hub is thus the foundation for cross-departmental analysis, not its current scope.
Integration of Heterogeneous Code and Live Sources
Deterministic zero-LLM indexing allows static archives and active live workspaces or CI drop-in directories (e.g., Jenkins) to be connected in parallel. The LLM always works on the real build state.
Differentiation from Market Peers
| Dimension | Classic Graph-RAG systems | Dual-graph Lucene RAG (hub) |
|---|---|---|
| Index construction | Probabilistic LLM extraction; high cost. | % deterministic in the code/index path (AST, HNSW, Leiden, c-TF-IDF); document conversion optionally uses a vision LLM. |
| Maintenance & updates | Elaborate entity resolution on code changes. | Atomic swap in seconds; full reindex of 991 files in 4–5 min. |
| Retrieval pattern | Rigid top- or massive subgraph dumps. | Metadata-first triage with TF-IDF signatures and tool calls. |
| Infrastructure | Distributed stack (vector DB + graph DB). | Single-engine embedded architecture (Apache Lucene). |
Test Setup: Description and Rationale
Goal
The test setup is designed to answer three questions: How much context and response time does a correct answer cost? Does the dual-graph index beat the baselines from the file system, naive vector search, and code graph? And does the finding hold when the cheapest cache assumption is dropped and the measurement is transferred to a second, real legacy system? The setup is chosen so that contrary results remain visible: regressions and exceeded budget limits are reported, not smoothed over.
Experimental context. The study was conducted under the resource conditions of a single developer with a notebook and 128 GB of memory. Qwen3.8-27B-Splash was chosen as the primary local reference model because it has proven to be a particularly capable model for agentic coding in this environment. DeepSeek-V4.1-Flash serves as an additional cross-model counter-check. This is a deliberate and traceable experimental restriction; the work does not claim a comprehensive evaluation of all available coding models.
Corpora
prjxp. All arms work on the same working tree,
pinned to one commit (2870c6a, 13 November 2026). The hub
index comprises 991 files with 14,418 chunks in the four-arm run; the
reindex for the 26 November counter-check comprises 14,376 chunks. The
AST graph has 6,769 nodes and 41,981 edges (CONTAINS,
CALL, IMPORT, ANNOTATION,
PARAM, RETURN, FIELD,
GENERIC_ARG, IMPLEMENTS,
EXTENDS). A reindex of this size takes about four to five
minutes and consumes 1.54 million embedding tokens; no LLM is involved.
The Graphify graph comprises 10,008 nodes and 408 communities; the
Chroma index comprises 1,930 chunks.
Legacy project. A real, production legacy system serves as the second corpus. It is a grown codebase of roughly 3,700 files (about 1,600 Java source files), frozen analogously to the prjxp working tree. The project is a real customer project: its name, domain, and technology stack are deliberately not disclosed; it is referred to throughout as the “legacy project”. The index is built with the same pipeline as the prjxp corpus; it comprises 40,538 chunks from 2,881 files (26 November 2026; 40,364 chunks in the four-arm run).
The motivation for the second corpus is generalization. The prjxp corpus is the tool’s own repository – modern, well structured, with extensive documentation. A finding that holds only there is a statement about one codebase, not about the architecture. The legacy project is a real production system with grown structure; the same question stratification (Section 6.4) makes the two corpora directly comparable.
Contamination avoidance. Contamination is the
largest methodological error in such a comparison. We therefore keep
answer keys and measurement documentation outside the corpus, remove the
gitignored documentation folder before the index run, disable the LLM
documentation pipeline, and set liveUpdate to
DISABLED so that no background rescan interrupts a run. The
source manifest is identical before and after the run; positive controls
confirm that all hits lie within the pinned commit, and a drift check
before and after the run confirms that the system was unchanged.
Arms
We compare four pure arms (Table 1), i.e., systems with only their own tools – no arm may fall back on another arm’s tools. This measures the system as delivered and keeps tool transport separate from the object under test.
| Arm | System | Tools | Index / corpus |
|---|---|---|---|
| N | Naive, no RAG | grep, glob,
read, shell |
Files of the working tree |
| P | prjxp hub (dual graph) | MCP tools (vectorSearch,
graphSearch, …) |
Lucene index (chunks + AST graph) |
| G | Graphify, --code-only |
graph tools (query_graph,
get_node, …) |
AST graph, no method bodies |
| V | LlamaIndex + Chroma | tools (search,
read_chunk) |
Vector index, SentenceSplitter 1000/100 |
Cross-Model Extension. To compare two model classes,
two further arms were added: D-N (DeepSeek without
prjxp, native tools only) and D-P (DeepSeek with prjxp
via MCP). Both use deepseek/deepseek-v4.1-flash-1017 via
OpenRouter (552 B backbone parameters, 8 B/16 B active, 1 M context)
with identical sampling and system prompt; the only difference is the
tool set and network (D-N cannot reach the prjxp hub). Measurement runs
without a tool-call limit; control is via a token ceiling of 144,696
(three times the maximum observed peak context) and a timeout. The arm
thus measures the content of tool responses, not the number of calls.
The existing arms were re-measured under the same policy for this
comparison (Section 8).
Questions and Answer Keys
Nine questions per corpus form the golden dataset; their wording is frozen. They are stratified by type so that no system wins merely because the questions happen to suit its strengths (Table 2).
| Stratum | prjxp (F1–F9) | Legacy project (L1–L9) |
|---|---|---|
| Structural / graph | F1, F2, F3, F5, F6, F7, F9:
graphFile, chunks and retrievers, PxChunk
usage, language pack and code graph, PxChunk change across
two projects, error handling in the AST graph, service instantiation and
cycles |
L1, L2, L3, L5, L6, L7, L9: method/function, architecture, central class, refactoring, data structure, error handling, internal flow |
| Documentation / configuration | F4: configuration parameters of the index | L4: operation/installation |
| Algorithmics | F8: combination of c-TF-IDF and Leiden clusters | L8: internal business logic |
The L questions mirror the F questions stratum by stratum, so the two corpora are directly comparable. For the legacy project only the categories are published: the concrete wording is frozen but undisclosed because it is a real customer project.
For every question there is an answer key with individually checkable
key facts and file:line evidence. A blind LLM judge decides
per key fact whether it is covered in substance; paraphrases count, and
the judge never sees the arm assignment. This yields two quantities:
and
. The score is
their product; it penalizes gaps and hallucinations equally.
Protocol
This section describes the original four-arm protocol of the November measurement (N, P, G, V, Qwen, eight tool calls); it is the basis of the results in Section 7. The methodologically corrected re-measurement described in Section 8 stands alongside it and does not replace this protocol: it measures four model/tool combinations (Qwen N/P and DeepSeek D-N/D-P) without a tool-call limit and serves the cross-model comparison. The temporal and methodological order is therefore: first the capped protocol described here, then the uncapped re-measurement.
Each question runs three times per arm – 108 sessions per corpus –
with temperature 0 and a fixed seed for the order. All four
arms of this measurement use the same model
(qwen3.8-27b-splash), the same context limit (262,144
tokens
0.7), the same budget of eight tool calls, and the same time limit of
900 seconds. The 26 November counter-check measures N and P in the same
run on both corpora (54 sessions per corpus); G and V remain the
four-arm run of 14 November. All measurements ran on a single Apple M5
Max with 128 GB unified memory; the reference answers of the answer keys
were produced with DeepSeek-V4.1-Flash. For each session the harness
records – from the session database, not from self-report – input and
output tokens, peak context, tool output, the number of tool calls, and
wall time split into tool and model time.
The protocol is reproducible, not the individual answer: local inference and tool selection remain stochastic. We therefore report medians, min/max, and IQR over the three runs per cell.
Metrics
Cost model. The static prefix of tool schema and system prompt is loaded once at session start and then served from the prompt cache. Counting it in every turn penalizes a large tool catalog times, although it does not occur times. The token basis is therefore where is the token total over all turns, is the static prefix, and is the number of turns. The full computation without cache () is reported as a sensitivity.
Quality per resource use (QEI). The lead metric combines quality, token cost, and response time: with the mean score and the medians of token basis and wall time. The geometric mean weights both costs equally: ten percent fewer tokens count as much as ten percent shorter response time, without free weights. The factor 100 makes the number readable, not absolutely comparable.
Quality per token (QPM). As a pure token economy, pooled over all sessions. A median of per-question quotients would be wrong here: it would over-weight cheap questions and under-weight expensive, insightful ones.
Robustness. A single leaderboard winner may be chance. We therefore check every result three ways: via Pareto dominance (does one arm beat another on both score and cost), via leave-one-question-out (rank one in all eight-of-nine subsets), and via both cost models. Peak context and score per minute are additionally reported as diagnostics; they do not enter QEI.
Rationale for the Design Decisions
Pure arms. An arm allowed to fall back on another arm’s tools would measure the system and the transport together. Pure arms keep the object of measurement at the system; the price – different tool granularity complicates the causal attribution of individual percentage points – is known and named in the limits of the statement.
Graphify with --code-only. The G arm
runs without LLM entity extraction: extraction is tree-sitter based,
requires no API key, and is reproducible – a prerequisite for a
benchmark with a frozen protocol whose graph is built offline in the
container. At the same time, this makes the comparison fair with respect
to the architectural claim “deterministic, no LLM in the query path”
that the hub makes for itself. The price is documented as a finding, not
as a measurement error: the graph contains no
documentation/configuration and no method bodies, so questions about
method contents or configuration values can be answered only through
additional file access. The G arm’s statement therefore does not
transfer to an LLM-extracting GraphRAG variant.
V deliberately naive. Standard chunking (1000/100) is not code-aware. The gap to P therefore also measures chunking quality, not only vector search – this is the intended counterpoint: what a classic RAG system with standard chunking achieves.
Three runs per cell. Local LLM inference is not bit-deterministic; a single run per cell could be chance. Medians and IQR over three runs separate system effect from variance without claiming that the answer itself is deterministic.
Second corpus. All statements of a single-repository benchmark hold for exactly that codebase. The legacy project as a second, real corpus tests whether the finding is tied to the architecture or to the peculiarities of the prjxp repository – without reinventing the questions: the stratification stays identical, only the corpus changes.
Anonymity. The legacy project is a real customer project. Name, domain, and technology stack are not disclosed; the questions are published only as categories. This is a methodological requirement, not a limitation. The findings are, however, initially bound to the configurations studied and the two corpora; whether they transfer to the architecture is precisely the subject of the limited generalization (Section 7.6) and is not presupposed.
Benchmarks: Results
An architecture that saves context must demonstrate that it does not sacrifice accuracy. Section 6 describes and justifies the test setup; the following chapter reports the results. Contrary results remain visible: three regressions and one exceeded budget limit are explicitly part of this chapter.
Results
Provenance. After this run, the P arm was developed
further in six stages (graph, tool surface, query). Its values therefore
come from the final run of 15 November; the unchanged arms N, G, and V
come from the main run of 14 November; the run IDs are given in Table 3. Corpus commit, model, seed,
and judge are identical. For P, the hub image (d236dc4e),
index manifest (82aa4159), and tool schema
(0a6c674a, 16 tools) are documented, and a drift check
before and after the run confirms that the hub ran unchanged.
Table 3 is the only four-arm comparison; for P it mixes the final run of 15 November with the unchanged arms of 14 November. A second, methodologically stricter counter-check measures N and P on 26 November in the same run on both corpora (Section 7.2). It confirms the score advantage but relativizes the statements on peak context and runtime: with the larger tool schema, both are no longer below those of the naive arm. The 30 November re-measurement without a call limit (Section 8) further shows that the score advantage on the prjxp corpus is not robust; the findings of this section apply to the 15 November run.
| Rank | Arm | Coverage | Precision | Score | QPM | QEI | Tokens eff. | Peak | Duration |
|---|---|---|---|---|---|---|---|---|---|
| 1 | P | 0.63 | 1.00 | 0.63 | 21.9 | 2.02 | 29,138 | 11,768 | 33.2 s |
| 2 | N | 0.60 | 1.00 | 0.60 | 15.6 | 1.45 | 39,330 | 13,485 | 44.0 s |
| 3 | G | 0.41 | 0.99 | 0.41 | 11.7 | 1.11 | 29,098 | 13,328 | 46.2 s |
| 4 | V | 0.38 | 0.94 | 0.36 | 7.3 | 0.70 | 52,313 | 17,676 | 51.6 s |
In the four-arm run, P leads in all four target quantities. The hub achieves the highest score (0.63), the smallest peak context (11,768 tokens), the shortest runtime (33.2 s), and the lowest effective token cost (29,138). Against N, this means 39 percent more QEI at four percent more score, 26 percent fewer tokens, and 24 percent less time. Against G, P is token-par (29,138 to 29,098) while delivering 54 percent more score at 28 percent shorter runtime. V trails as a naive vector search in every dimension. The counter-check of 26 November shows that this fourfold lead is tied to the 15 November run: with the grown tool schema, P is above N in both peak and runtime (Section 7.2).
In the four-arm run, N is dominated by P. N reaches a score of 0.60 but needs 35 percent more effective tokens and 33 percent more time. P thus beats the strongest baseline arm in both cost dimensions and in score; Pareto dominance here is not an artifact of weighting. In the counter-check, the score advantage remains, but the time dominance does not: there, P is slower because of the tool schema.
G is cheap but incomplete. Graphify needs no embeddings and is token-wise on par with P. The price is coverage: 0.41 against 0.63. The cause is structural – the graph provides nodes, edges, and file paths but no method bodies, so questions about the content of a method (F1) or configuration values (F4, still 0.93 coverage) can only be answered through additional file access. G is also the slowest arm after V because its answers are 3,238 output tokens long, almost twice those of P (1,822); retrieval cost does not explain the latency.
The advantage lies in the index, not in the agent. Stratification shows where P wins: on structural questions, 0.64 coverage ahead of N (0.55), G (0.35), and V (0.30). On documentation questions, G leads (0.93), but P is the cheapest there (22,678 tokens). On the algorithmics question F8, P falls back to 0.39 while the naive arm reaches 0.72 – the only area with a large gap.
Economics. A one-time build of 1.54 million embedding tokens is offset by 11,390 saved retrieval tokens per question; the index is therefore amortized after 135 questions, or after 75 when adjusted for quality. G has no build cost and is on the same order as N in retrieval cost per score point (57,908 to 59,094), while P is clearly cheaper there at 38,580. In the counter-check, P is at 34,500 (prjxp) and 52,000 (legacy) retrieval tokens per score point; N at 48,600 and 89,800. Per question, P saves 8,073 (prjxp) and 14,765 (legacy) retrieval tokens against N.
Contrary findings. In the 15 November run, the further development of the P arm did not only win: F7 costs 10,139 more retrieval tokens than in the previous run, F8 4,291, and F6 loses 0.15 coverage. The median is eleven tool calls, above the budget of eight; the steer takes effect only after settle. And the tool schema grows to 3,158 tokens per turn (27 percent of peak context) – the next lever is therefore schema size, not retrieval.
Counter-Check: Same Run, Two Corpora (26 November 2026)
The four-arm comparison mixes runs: P comes from the final run of 15
November, N, G, and V from the main run of 14 November. To address this
weakness and test generalization, N and P were measured on 26 November
in the same run on both corpora – with the same model, seed, and judge.
The P arm carried the further-developed tool contract (among other
things, corrected source-type filters, a similarity window bounded at
0.80, and a lexical keyword fallback); the hub ran with image
d3591fe0, 16 tools, and schema dc894834; the
drift check was negative. G and V were not re-measured: their values
remain the reference from the four-arm run.
| Corpus | Arm | Coverage | Precision | Score | QPM | QEI | Tokens eff. | Peak | Duration |
|---|---|---|---|---|---|---|---|---|---|
| prjxp | N | 0.620 | 1.000 | 0.620 | 17.1 | 1.76 | 33,158 | 12,041 | 37.5 s |
| prjxp | P | 0.647 | 0.981 | 0.639 | 21.9 | 1.81 | 27,960 | 13,583 | 44.9 s |
| Legacy | N | 0.434 | 0.967 | 0.430 | 9.3 | 1.03 | 41,524 | 14,107 | 41.7 s |
| Legacy | P | 0.459 | 0.992 | 0.459 | 11.7 | 1.13 | 30,497 | 14,228 | 54.0 s |
The score advantage holds; cost leadership does not. P achieves higher coverage on both corpora (prjxp +0.027, legacy +0.025) and a higher score (0.639 vs. 0.620; 0.459 vs. 0.430). In retrieval context, the gap is clear: P needs 22,055 instead of 30,128 (prjxp) and 23,850 instead of 38,615 (legacy) retrieval tokens. QPM and QEI also lead; on prjxp, the QEI advantage is narrow at 1.81 to 1.76.
What the counter-check corrects. In the 15 November run, P had the smallest peak context and the shortest runtime. With the grown tool schema (3,018 instead of 1,094 tokens per turn), this no longer holds: P is at 13,583 vs. 12,041 (prjxp) and 14,228 vs. 14,107 (legacy) in peak, and at 44.9 vs. 37.5 s and 54.0 vs. 41.7 s in duration. Precision on prjxp is narrowly below N at 0.981 (1.000); on legacy, P leads at 0.992. The robust statement is therefore not “P is cheaper in every dimension” but: at equal or better answer coverage, the hub needs substantially less retrieval context; the price is the tool schema.
Interface effects. The counter-check also tests the robustness of the tool contract: no abort (“no valid context”) and no documentation leak in a code search (0 in both corpora). The keyword fallback was triggered three times and was not followed by the model; it is a safety net, not a driver of the score advantage.
Results as Bar Charts
The following figures present the same data graphically: one row per arm, sorted by QEI rank, with the value bar horizontally next to it. Bar lengths are normalized per panel to its maximum; the measured value is at the end of the bar so that both the order and the numbers remain readable. The panels show the four-arm run; the N/P counter-check is given as Table 4 because G and V were not re-measured.
Robustness
The protocol is reproducible, not the individual answer: the interquartile range of total tokens is zero in 9 of 9 cells for G and P, in 7 of 9 for V, but in none for N (median IQR 7,756 tokens). The variance sits where the agent needs a different number of turns – a finding about tool selection, not about retrieval.
The ranking does not depend on the cache assumption. Without prompt cache, all token costs rise, P and N are then nearly tied (44,927 to 44,803), and P wins through score and time rather than tokens. The order remains unchanged.
| Arm | Tokens cached | Tokens full | QEI cached | QEI full | Rank (full) |
|---|---|---|---|---|---|
| P | 29,138 | 44,927 | 2.019 | 1.626 | 1 |
| N | 39,330 | 44,803 | 1.448 | 1.357 | 2 |
| G | 29,098 | 38,766 | 1.113 | 0.964 | 3 |
| V | 52,313 | 54,089 | 0.698 | 0.686 | 4 |
The Pareto check supports the picture as well: under the cache model, P is optimal, N is dominated by P, and V by N. Only G remains Pareto-optimal alongside P because it has no embedding cost – an advantage paid for with coverage. In the full model, P, N, and G are optimal. Leave-one-question-out wins for P in all nine eight-of-nine subsets; the other arms win in none. The result is therefore not tied to a single question.
Operational Classification
Three numbers are decisive for use as an enterprise-wide knowledge base. First, peak context: 11,768 tokens in the four-arm run and 13,583 in the counter-check mean that a 32k window is sufficient with reserve – the prerequisite for serving many projects sequentially or in parallel. Second, updatability: a full reindex of 991 files takes four to five minutes and requires no LLM in the query path. Third, the spread of question cost: it ranges from 11,288 retrieval tokens (F1) to 34,036 (F7) and is thus more predictable than the spread of the naive arm, whose median IQR is 7,756 tokens.
Not measured are tenant separation and permissions, incremental updates in continuous operation, multi-project search across many repositories, cold start, and parallel load. These questions concern the hub as a product, not the retrieval architecture, and are separate measurements.
Limits of the Statement
One commit, two corpora. All reported results hold for
prjxpat commit2870c6a, not for legacy codebases in general. The legacy project as a second corpus (Section 6) tests exactly this generalization; the 26 November counter-check shows the same score advantage but not the same cost leadership. Both corpora remain a sample.Nine questions per corpus, structural focus. The question set deliberately concentrates on structural and configuration-related relationships; three repetitions per question bound the statement about variance. The results are a sample, not full coverage of the respective system.
Concrete system configurations, not fundamental inability. The comparison covers concrete arms with their respective tools. It is not disputed that an agent with native tools can in principle reconstruct the same relationships; what is measured is the effort in the given configuration.
The 15 November and 26 November runs are not byte-identical. After the 15 November run, the P arm was extended with filter, threshold, and fallback behavior; the index rebuilds comprise 14,376 (prjxp) and 40,538 (legacy) chunks. Statements are comparative within a run, not an exact reproduction across runs.
The 26 November counter-check is N/P-only. G and V were not re-measured; their values remain the 14 November reference.
G is not the full GraphRAG paradigm. The arm ran with
--code-only, i.e., without LLM entity extraction. This is fair with respect to the architectural claim “deterministic”, but it says nothing about the quality of an LLM-extracting GraphRAG variant.V is deliberately naive. Standard chunking (1000/100) is not code-aware. The gap to P therefore also measures chunking quality, not only vector search.
The tool sets are not equivalent. MCP tools, native tools, and graph tools have different granularity. This is intended for pure arms but complicates the causal attribution of individual percentage points.
Judge and arm share the model (Qwen arms only). The judge does not see the arm assignment and evaluates factually against the answer key; a self-evaluation bias nevertheless remains possible. For the DeepSeek arms, Qwen is a different model, so this bias does not apply.
Stage B is not bit-identical. Local inference and tool selection remain stochastic. The protocol is reproducible, not the individual answer – hence medians, min/max, and IQR are reported.
Cross-Model Benchmark: DeepSeek-V4.1-Flash
The earlier arms measure a single model
(qwen3.8-27b-splash). It remained open whether prjxp’s
benefit depends on the model and whether a substantially more capable
model still gains measurably. The measurement was therefore extended by
two arms: D-N (DeepSeek without prjxp, native
filesystem and text tools only) and D-P (DeepSeek with
prjxp via the existing MCP interfaces). They differ only in their tool
set.
Model Classes
DeepSeek-V4.1-Flash is not the smaller model: it is a sparse mixture-of-experts model with 552 B backbone parameters (763 B including Engram and vision components in the Hugging Face counter), 8 B active parameters per prompt token and 16 B per generated token at a context of 1,048,576 tokens1. Qwen3.8-27B, by contrast, has 27 B dense parameters. DeepSeek is thus about twenty times larger; a quality difference between the models is expected and must not be attributed to the retrieval system.
Methodological Correction: Tool Calls Are Not a Cost Measure
A tool call is cheap in itself; what is expensive is the context its response occupies. The earlier control via an 8-call limit therefore measured call economy rather than retrieval quality and systematically cut off exploratory strategies. All four arms were thus re-measured: without a call limit, bounded only by content (a token ceiling) and a timeout. The ceiling is tokens, three times the maximum peak context observed across all previous runs.
| DeepSeek model | deepseek/deepseek-v4.1-flash-1017 |
| Provider | OpenRouter
(openai-completions) |
| Sampling | temperature=0,
top_p=1, thinking off |
| Tool-call limit | none |
| Token ceiling | 144,696 (content-driven control) |
| Timeout | 900 s (safety net) |
| Repetitions | 3 per question |
| Judge | qwen3.8-27b-splash, blinded,
inline |
Results
| Arm | Coverage | Precision | Score | QEI | Eff. tokens | Time |
|---|---|---|---|---|---|---|
| Qwen-N | 0.764 | 0.997 | 0.762 | 0.719 | 144,572 | 77.7 s |
| Qwen-P | 0.760 | 1.000 | 0.760 | 0.690 | 126,666 | 95.7 s |
| D-N | 0.836 | 1.000 | 0.836 | 1.189 | 159,770 | 30.9 s |
| D-P | 0.813 | 0.995 | 0.808 | 0.969 | 197,378 | 35.3 s |
| Arm | Coverage | Precision | Score | QEI | Eff. tokens | Time |
|---|---|---|---|---|---|---|
| Qwen-N | 0.609 | 0.958 | 0.583 | 0.487 | 175,208 | 82.0 s |
| Qwen-P | 0.655 | 1.000 | 0.655 | 0.733 | 96,925 | 82.5 s |
| D-N | 0.738 | 0.926 | 0.683 | 0.701 | 265,092 | 35.9 s |
| D-P | 0.727 | 0.995 | 0.723 | 0.729 | 246,694 | 39.9 s |
Analysis
prjxp helps both models on the legacy corpus. Without the call cap, prjxp raises the score of Qwen by 12.4 % (0.583 0.655) and of DeepSeek by 5.9 % (0.683 0.723). On the prjxp corpus the effect is neutral to slightly negative ( and %).
The earlier counter-finding was a measurement artefact. With the 8-call cap, the legacy score of Qwen+P fell to 0.410 and that of DeepSeek+P to 0.433. The cap was binding in 24 of 27 sessions and penalised exactly the exploratory accesses that prjxp enables. Without it, the sign reverses.
The model advantage remains. DeepSeek+P leads Qwen without prjxp on both corpora (0.808 vs. 0.762 and 0.723 vs. 0.583) and also leads Qwen+P at the same retrieval system (+6.3 % and +10.4 %). This is an observed model advantage. Because model and infrastructure differ at the same time, it cannot be attributed causally to model size alone (see the limits of this section); prjxp does not level the model differences. At the same time, the legacy gain of DeepSeek (+5.9 %) shows that prjxp still provides measurable benefit to a capable model – the benefit is not restricted to weaker models.
Efficiency. DeepSeek is about 2–2.5 faster (31–40 s vs. 78–83 s) and achieves a higher QEI. The price is context: without a call limit, effective tokens rise by a factor of 3–5 compared with the 8-call run, and prjxp increases DeepSeek’s peak context (23,317 30,314 and 33,996 36,957). The costs reported by OpenRouter – in each case for one arm on one corpus, i.e. 27 sessions (9 questions 3 repetitions) – range from 0.13 US$ (D-N, prjxp corpus) to 0.28 US$ (D-P, legacy corpus), roughly 0.005–0.010 US$ per session. This is not the price of the entire cross-model comparison: the Qwen arms ran locally and are not billed in dollars.
Interpretation: Corpus-Dependent Benefit
The central finding is not a blanket superiority of prjxp. The measured benefit depends on the corpus studied: on the legacy corpus prjxp improves the score of both models (Qwen +12.4 %, DeepSeek +5.9 %), whereas on the prjxp corpus it does not (0.762 0.760 and 0.836 0.808). prjxp therefore does not improve every coding-agent result in every codebase.
A possible explanation is a hypothesis, not a proven law: the benefit may be related to the structural complexity and the difficulty of navigating a codebase. In a small, already well-explored codebase, an agent with native tools can reconstruct the same relationships; in a grown legacy system, a pre-built structural and semantic layer shifts effort from the query into indexing.
prjxp thus provides a pre-built code-intelligence layer that can help an agent orient itself by not having to reconstruct relevant relationships from scratch on every request. An agent with native tools can in principle reconstruct comparable relationships as well. The study therefore compares concrete system configurations, not a fundamental inability of native tools.
Limits
Provider change. Qwen ran locally (4-bit MLX), DeepSeek was hosted via OpenRouter; model and infrastructure effects are not separable.
Unstable legacy cells. The DeepSeek N vs. P comparison is not robust: pooled mean and per-question median point in different directions (L2 is 0.00 for D-N in all repetitions).
L8 answer key. L8 was deliberately revised; the re-measurement uses the new version consistently for all arms.
Variance. Effective tokens vary widely (IQR up to 557,840); three repetitions per question limit robustness.
Further Improvements and Outlook
The following points are deliberately not described as current functionality. They are either conceptually prepared or concern extensions outside the code/index path measured here.
Cross-Project Contract Validation
Project and project (often in different departments) communicate through interfaces. An extension of the hub is intended to detect entity changes in project , locate corresponding consumers in project , and automatically check for breaking changes. Today all tools are strictly scoped to one project; cross-project resolution and a breaking-change check are open.
Global Clustering across Projects
Global Leiden clustering across all projects is intended to bundle domain-related artifacts into shared topic clusters without overloading the context window. Today clustering runs per project; cluster IDs are project-local.
Extended Tools and Reference Fields
A dedicated readChapter tool and
relation/scope filters for AST traversal are
planned. The reference fields neighbours,
cluster_id, keywords, and
cluster_keywords are already stored in the index but are
not rendered in the compact POINTERS block; optional
rendering or consistent on-demand use is an outlook.
Deterministic Documentation Pipeline
The code and index path is deterministic. The optional conversion of
image and PDF documents currently uses a vision LLM; documentation
generation in docpipe uses an LLM service. An LLM-free or
locally reproducible documentation pipeline is a separate extension.
CI, AST, and Index Extensions
There is no Jenkins-specific integration; the hub offers a generic CI
drop-in directory. In the AST graph, fields are currently edge targets
rather than nodes, and the fine-grained edges (IMPORT,
FIELD, PARAM, RETURN) replace a
single REFERENCES edge. An explicit HNSW configuration
(m, beamWidth) is likewise open.
Further Languages and Cluster Quality
Graph construction is available for Java and C#; TypeScript, Visual
Basic, and GDScript are chunked deterministically but contribute no
graph nodes. Their packs can adopt the same contract later — the C# pack
is the reference implementation. A second caveat concerns cluster
quality: on a 3,300-node C# corpus, 77 % of the Leiden
clusters are singletons and only 37 % of the edges are intra-cluster,
because the weighting is dominated by high-cardinality
PARAM edges. Clusters are therefore used as a local
neighbourhood hint today; as an architecture map they need a reworked
weighting.
Conclusion and Outlook
Providing legacy code to LLMs does not require heavy extraction pipelines or distributed graph-database clusters. By combining AST, statistical TF-IDF methods, Leiden clustering, and progressive disclosure in Apache Lucene, a highly efficient Multi-Project Intelligence Hub emerges that lays the foundation for cross-departmental interface analysis locally. Cross-project contract validation and global clustering are deliberately formulated as an outlook; the measured code/index path is reproducible independently of them.
The actual architectural contribution is independent of the corpus measured: prjxp shifts part of the orientation work from query time into a precomputed index. Whether an agent with grep could in theory find the same information does not change the fact that this work would then be incurred again on every request.
The measurements do not establish a general superiority over grep or native tools. They show a corpus-dependent benefit: on the legacy corpus prjxp raises the score of both models studied, on the prjxp corpus it does not. The obvious explanation – greater benefit for structurally complex, hard-to-navigate codebases – is a hypothesis that requires further corpora and repetitions. prjxp also does not compensate for performance differences between models; the advantage of the larger model remains.
DeepSeek-V4.1-Flash Technical Report, arXiv:2609.19969; model card
deepseek-ai/DeepSeek-V4.1-Flash.↩︎