MESA V4 · RETRIEVAL

Different signals. One evidence identity.

Each lane proposes eligible candidates for a different reason. Fusion combines their ranks; provenance keeps the reasons inspectable.

Four lanes, four useful questions.

Vector · semantic similarity

Does this assertion mean something close to the query? Compatible query embeddings search the LanceDB assertion projection.

BM25 · passage and citation

Does the evidence text contain useful terms or a scoped citation? FTS5 ranks passages; exact citation lookup contributes within the lane.

Assertion · structured relation

Do subject, predicate, entity/literal object and evidence match? SQLite-owned relations provide a separate signal.

Graph · supported path

Is there a bounded relationship path supported by eligible canonical assertions? Paths retain supporting IDs and direction.

RECIPROCAL RANK FUSION

Ranks combine; raw scores stay separate.

RRF(candidate) = Σ weight_lane / (k + rank_lane)
k = 60 · vector = 8.0 · BM25/assertion/graph = 1.0 · rank starts at 1

A duplicate candidate casts one vote per lane. Ties resolve by candidate identity. A lane may return no eligible hit. This example uses one first-ranked candidate; it does not simulate the complete retrieval engine.

Illustrative rank fusion · choose contributing lanes
RRF score 4 / 61 = 0.065574

All enabled lanes rank the same candidate first; this teaching example deliberately uses weights of 1.0 and k=60. Runtime defaults use vector 8.0 and other lanes 1.0. This calculator makes no API call and measures neither probability nor retrieval quality.

Citation boosts apply inside lanes: BM25 exact +200, same statute +40; assertion exact +150, same statute +40. They affect lane order, not RRF increments. When MESA_LEGAL_RULES_ENABLED=true, a query-dependent legal factor after fusion is 1.5 for exact statute/article, 1.25 for the same statute, 0.25 for a competing statute, and 1.0 otherwise.

Responses expose rrf_score, legal_factor, raw_score and final_score separately. Higher fused relevance is better; none of these fields is a probability of truth.

Exact legal matches can lead the results.

With legal rules enabled, an exact law/article or a decision’s own docket/decision reference reserves at most three leading positions in document order after fusion and optional reranking. Decision identity must start within the first 300 characters of chunk zero; later quotations do not count. Other hits retain their order. Scoped titles and first-chunk law headers teach law names, including K.; AYM alone does not select the Constitution.

Versioned legal_items retain original chunk offsets separately from SPO facts and do not add fusion score. MESA_LEGAL_RULES_ENABLED=false bypasses legal processing and hides stored legal overlays in returned copies while preserving generic retrieval and durable snapshots.

Legal settings and limits

Bounds are part of the contract.

Graph resources

At most 20 seeds, 3 hops and 500 requested graph hits; frontier 64, per-node fan-out 32, default request timeout 15 seconds. PageRank is telemetry only. These limits do not guarantee latency or completeness.

Context packing

The default 2048-token budget counts formatted model-visible evidence with cl100k_base. If BPE cannot load, a conservative UTF-8 byte upper bound may fit less. Complete graph proof fits atomically.

Adaptive context · opt in

Single query is the default. Adaptive mode triggers on empty Q0 or no two-lane support in its top three; at most one planner and two expansions keep the same scope. Outer fusion weights are Q0=1.0 and Q1/Q2=0.5. Failure preserves Q0.

Runtime availability

Capability flags describe operational support. An expected failure of a configured vector/graph backend returns explicit 503. Projection-only graph adapters do not advertise neighbor traversal.

v0.9.3 runtime and historical DEV evidence

Vector weight defaults to 8.0; use MESA_RRF_VECTOR_WEIGHT=1 for the previous setting. Zero removes a lane contribution. Optional BGE reranking is off by default, needs [ml] and adds rerank_score after fusion while preserving rrf_score and final_score.

Read the DEV matrix, CPU/GPU latency and limits →

FOR DEVELOPERS · CONTRACT TEST

Show the repository test and source references

Core has a deterministic contract fixture: one “Alice knows Aurora” assertion ranks first in all four lanes, with RRF = 4/61 under explicit unit weights (the runtime vector default is 8.0). It uses real SQLite and Kùzu with mock vectors; it is not a quality benchmark.

QUERY“Alice”Deterministic test fixture
RETRIEVED KNOWLEDGE

AliceknowsAurora

One assertion. Its source still attached.

EVIDENCE
source
source-chunk-1
document / chunk
doc-1 / chunk-1
span
“Alice knows Aurora”
Retrieval signals & application context
  • vector rank 1
  • BM25 rank 1
  • assertion rank 1
  • graph path rank 1

Expected RRF: 4 ÷ 61

APPLICATION CONTEXT
UNTRUSTED_MEMORY_EVIDENCE {
  subject: "Alice", relation: "knows",
  object: "Aurora", source: "source-chunk-1"
}

Schema-aligned website rendering of the fixture fields; production context is token-bounded JSON evidence.

test_real_four_lanes_fuse_once_and_repeat_deterministicallyCore test in the v0.9.3 release.

Vector search results are mocked in this test. This is a static example, not a live benchmark.

Source baseline: Core v0.9.3.

Inspect the implementation.

NEXT STEP

Where to go from here