prjxp paper · November 2026

Dual-Graph-RAG for legacy codebases.

Deterministic code and documentation analysis with Apache Lucene. No LLM entity extraction, no graph database, no context-window stuffing — just two graphs in one embedded index.

Corpus prjxp + real legacy project Arms prjxp · naive · Graphify · vector Result best score & best QEI
Abstract

Large, grown software estates combine strict syntactic dependencies across millions of lines of source code with unstructured, often fragmented domain documentation. Existing Graph-RAG approaches try to capture these relationships through costly LLM entity extraction and pass large subgraphs into the context window.

prjxp takes a different route: a fully deterministic code and index path, locally operable on a single embedded Apache Lucene engine that acts as a Multi-Project Intelligence Hub. It combines a structural AST graph for hard code dependencies with a vector-based semantic neighbourhood graph for code and documentation across many repositories and live workspaces. Both graphs are clustered with Leiden and signed with c-TF-IDF — with zero LLM cost. A progressive-disclosure interface hands the LLM condensed structural references first and lets it navigate autonomously with project-scoped tools.

0.63
Best quality score in the four-arm benchmark
2.02
QEI — quality per resource use, ahead of every baseline
29,138
Effective tokens per session, the lowest of the four arms
33.2 s
Median session duration, the fastest of the four arms
1 · Problem

Two failure modes, one gap

Providing legacy systems to modern AI tooling fails for two opposing reasons: the syntactic blind flight of classic vector search and the extraction and context explosion of modern Graph-RAG frameworks.

🔎

Pure vector RAG

Embeddings capture semantic similarity but ignore directed call chains, inheritance and interface implementations. Two tightly coupled classes with different identifiers end up far apart in vector space.

structural blind flight
🏗️

LLM-extracting Graph-RAG

Entity extraction through an LLM is expensive, slow and non-deterministic. It produces duplicate nodes, requires entity resolution and triggers hours-to-days runtimes on millions of lines of code.

extraction explosion

Both lose in a different dimension

Vector RAG loses structure. Graph-RAG restores it but pays with compute, latency and context. prjxp's claim is that structural precision does not require an LLM in the index path — and that the right index can keep the context window small.

2 · Architecture

Four principles, two graphs

Dual-graph topology, automatic community clustering, statistical term signatures and progressive disclosure. The code and index path is deterministic throughout.

▸ Structural AST graph

An abstract syntax tree is created for the source. Nodes are classes and methods; typed fields are edges. Directed edges capture hard syntax relationships.

  • CALL
  • IMPLEMENTS
  • EXTENDS
  • IMPORT
  • FIELD
  • PARAM
  • RETURN
  • CONTAINS
  • GENERIC_ARG
  • ANNOTATION
px Lucene

▸ Semantic vector graph

All chunks are stored as vector embeddings in an HNSW index. The resulting neighbourhood graph connects domain documentation with the technical implementation.

  • HNSW
  • KNN
  • Doc ↔ Code

Dual-graph topology

Hard code dependencies on one level, semantic neighbourhoods on the other. Both are queryable through the same index.

AST + HNSW

Community clustering

The Leiden algorithm decomposes both graphs into disjoint clusters: coupled modules and thematically related knowledge.

Leiden

Statistical signatures

TF-IDF scores terms per chunk; class-based c-TF-IDF produces precise semantic signatures per cluster.

c-TF-IDF

Progressive disclosure

The LLM first receives compact references, then navigates to neighbours or exact source only when needed.

pointers → tools

TF-IDF · chunk level

Rarest significant terms make each chunk specific — the micro signature.

ScoreTF-IDF(t, d) = tf(t ∈ d) · (1 + log((N+1) / (df(t)+1)))

c-TF-IDF · cluster level

Top terms per Leiden cluster provide the macro context without an LLM summary.

cluster_keywords = top_terms( c-TF-IDF(cluster) )
3 · Retrieval

Progressive disclosure instead of raw text

A compact reference schema first. The model then requests only the content it actually needs, through specialized graph and read tools.

STEP1

POINTERS · the compact reference

Project, chunk ID, file, score — plus on-demand metadata: cluster ID, c-TF-IDF cluster keywords, TF-IDF chunk keywords, and graph neighbours. No source text yet.

STEP2

Graph navigation

graphCluster / semanticGraphCluster give a cluster overview. graphNode / graphSearch traverse the AST for callers, implementations and dependency depth.

STEP3

Exact source escalation

readChunks(ids) loads chunks and neighbours. readFile and readBySignature escalate to a complete file, class or method — reconstructed exactly from the index.

The hub exposes a 16-tool MCP surface. Tools are strictly project-scoped; the index is shared across projects.

4 · The hub

One index for the whole system landscape

As a central Multi-Project Intelligence Hub, prjxp links arbitrarily many repositories and live workspaces across departmental boundaries.

🗂️

Static archives

Drop a tar archive or mount a frozen project. It is chunked and embedded in-process, then stamped with its own project ID.

⚡

Live workspaces

Mount active projects with a prjxp.yaml marker or a CI drop-in directory. The LLM always works on the real build state.

🧭

Deterministic indexing

No LLM in the code/index path means a full reindex of 991 files takes four to five minutes, and an atomic swap is a matter of seconds.

5 · Differentiation

Dual-graph Lucene RAG vs. classic Graph-RAG

DimensionClassic Graph-RAGDual-graph Lucene RAG (hub)
Index construction Probabilistic LLM extraction; high cost. 100% 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-k 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).
6 · Benchmark

Highest quality, smallest context

Four pure arms on a frozen corpus, nine stratified questions, three runs per cell, the same model and the same budget. Score is coverage × precision.

Score (0–1)
P
0.63
N
0.60
G
0.41
V
0.36
QEI
P
2.02
N
1.45
G
1.11
V
0.70
QPM (per M tokens)
P
21.9
N
15.6
G
11.7
V
7.3
Effective tokens (lower is better)
P
29,138
N
39,330
G
29,098
V
52,313
Peak context (lower is better)
P
11,768
N
13,485
G
13,328
V
17,676
Duration (lower is better)
P
33.2 s
N
44.0 s
G
46.2 s
V
51.6 s
P — prjxp hub (dual graph) N — naive file-system agent G — Graphify (code only) V — naive vector search
RankArmCoveragePrecisionScoreQPMQEITokens eff.PeakDuration
1P0.631.000.6321.92.0229,13811,76833.2 s
2N0.601.000.6015.61.4539,33013,48544.0 s
3G0.410.990.4111.71.1129,09813,32846.2 s
4V0.380.940.367.30.7052,31317,67651.6 s
39%
more QEI than the naive arm — at 26% fewer tokens and 24% less time
+54%
score over the code graph at token parity, with 28% shorter runtime
135
questions until the one-time index build is amortized (75 quality-adjusted)

Four-arm run: P from the final run of 15 Nov, N/G/V from the main run of 14 Nov. Same corpus commit, model, seed and judge.

7 · Counter-check

Same run, two corpora — including the inconvenient result

To address the mixed-run weakness, N and P were measured again in a single run on both the prjxp corpus and a real legacy project. The score advantage holds; the cost leadership does not survive the grown tool schema.

CorpusArmCoveragePrecisionScoreQPMQEITokens eff.PeakDuration
prjxpN0.6201.0000.62017.11.7633,15812,04137.5 s
prjxpP0.6470.9810.63921.91.8127,96013,58344.9 s
LegacyN0.4340.9670.4309.31.0341,52414,10741.7 s
LegacyP0.4590.9920.45911.71.1330,49714,22854.0 s

The robust statement

At equal or better answer coverage, the hub needs substantially less retrieval context — 22,055 instead of 30,128 tokens on prjxp and 23,850 instead of 38,615 on the legacy corpus. The score advantage holds on both corpora.

The price: tool-schema overhead

With 16 tools the static schema grows to ~3,018 tokens per turn. Peak context and runtime are therefore no longer below the naive arm. The next lever is schema size, not retrieval.

8 · Limits

What the paper does not claim

The benchmark is honest about its scope. Contrary results and regressions stay visible instead of being smoothed over.

  • One commit, two corpora. Results hold for prjxp at commit 2870c6a and one anonymised legacy project — a sample, not all legacy code.
  • Runs are not byte-identical. The P arm was developed further between runs; statements are comparative within a run.
  • Counter-check is N/P-only. G and V were not re-measured and remain the four-arm reference.
  • G is not the full GraphRAG paradigm. It ran code-only, without LLM entity extraction.
  • V is deliberately naive. Standard 1000/100 chunking is not code-aware, so the gap also measures chunking quality.
  • Tool sets are not equivalent. Different granularity complicates causal attribution of individual percentage points.
  • Judge and arm share the model. The judge is blind to arm assignment but a self-evaluation bias remains possible.
  • Stage B is stochastic. The protocol is reproducible, not the individual answer — hence medians, min/max and IQR.

Also openly reported: the regressions

In the 15 November run, F7 costs 10,139 more retrieval tokens and F8 4,291 more; F6 loses 0.15 coverage. The median is eleven tool calls, above the budget of eight. On the algorithmics question F8, P falls back to 0.39 while the naive arm reaches 0.72.

9 · Outlook

Next: from retrieval to the product

These are deliberately not current functionality. They are conceptually prepared or concern extensions outside the measured code/index path.

🔗

Cross-project contracts

Detect an interface change in project A, locate its consumers in project B and check for breaking changes automatically. Today all tools are strictly project-scoped.

🌐

Global clustering

Leiden across all projects, bundling domain-related artifacts into shared topic clusters without overloading the context window. Today cluster IDs are project-local.

🧰

Extended tools

A dedicated readChapter tool and relation/scope filters for AST traversal. Reference metadata is already stored and can be rendered on demand.

📄

Deterministic docs pipeline

The code/index path is deterministic; PDF/image conversion and docpipe still use an LLM. An LLM-free documentation pipeline is a separate extension.

⚙️

CI & AST extensions

A generic CI drop-in directory exists; Jenkins-specific integration is open. Fields as AST nodes and explicit HNSW configuration (m, beamWidth) are likewise open.

📊

More measurement

Tenant separation, permissions, incremental updates, multi-project search, cold start and parallel load are separate product measurements.

prjxp

Read it, run it, break it.

The architecture and the full benchmark are laid out above. Try prjxp on your own legacy codebase and see how it performs.