Generalist RAG fails in high-stakes legal workflows because it treats law as text rather than a versioned jurisdictional hierarchy, and treats memory as conversational history rather than structured state. When evaluated against held-out statutes, Recall@1 drops to 66.7%, and empirical assertion grounding stalls at 70.0% on divergent propositions. We do not claim to replace probabilistic guessing with magical intelligence; rather, we bound guessing to explicit propositions, enforce mechanical validation before semantic evaluation, and refuse claims when governing authority is absent.
The Measured Retrieval & Grounding Baseline
| Evaluation Gate | Fixture Benchmark (Bootstrap) | Held-Out & Empirical Reality | Target State |
|---|---|---|---|
| Recall@1 (Top-1 Accuracy) | 92.0% (n=25) | 66.7% (n=12) | > 80.0% via Conflict-Pair Gates |
| Recall@5 (Top-5 Coverage) | 100.0% | 100.0% | 100.0% |
| Invented Citations Blocked | 100.0% (9/9) | 100.0% | 100.0% (Mechanical Pass A) |
| Stale / Repealed Law Detected | 100.0% (4/4) | 100.0% | 100.0% (Temporal Pass A) |
| Divergent Proposition Accuracy | — | 100.0% (10/10) | 100.0% (Pass B Entailment & Inline Refusal) |
1. What Is Implemented vs. What Is Planned
| Component | Status | Implementation Details |
|---|---|---|
| Span-True Ingestion | ✅ Implemented | Poppler layout extraction, Tesseract OCR fallback, bit-for-bit span offset tracking (krusch-nexus). |
| Hybrid RRF Search | ✅ Implemented | Reciprocal Rank Fusion ($k=60$) combining pgvector HNSW cosine distance and tsvector cover density (krusch-nexus, krusch-law). |
| Grounding Failure Taxonomy | ✅ Implemented | 5-class granular classifier: entailed, contradicted, exception_applies, insufficient_context, not_in_corpus (krusch-law). |
| Episodic Working Memory | ✅ Implemented | Lakebase architecture: SQLite compute cache (.agent/memory.db) synced to PostgreSQL with explicit superseding and invalidation (krusch-context-mcp). |
| Lean Tool Routing | ✅ Implemented | 13-tool core profile (~900 tokens) with dynamic L2 neural centroid dispatching (krusch-context-mcp). |
| Deterministic Jurisdiction Machine | ✅ Implemented | Deprecated scalar multipliers (1.0x). Evaluates temporal validity, spatial applies_if gates, and preemption graph edges (krusch-law). |
| Two-Pass Claim Verifier | ✅ Implemented | Pass A (mechanical syntax/date) + Pass B (propositional entailment, numbers, duty inversions, statutory exceptions) with inline refusal (krusch-law). |
| Statutory Amendment Pipeline | ✅ Implemented | Computes legislative diffs, transitions nodes to amended, and routes affected memories to STALE_PENDING_REVIEW queue (krusch-law, krusch-context-mcp). |
| Code-to-Statute Traceability Table | ✅ Implemented | Curated StatuteCodeTraceability table binding California housing statutes to symbols with attorney review attestations (krusch-law). |
| Unified Runtime API Bridge | ✅ Implemented | Native /api/laws/search, /api/laws/section, /api/verify/assertions, and /api/cases/brief endpoints unifying context and law (krusch-law). |
2. Replacing Authority Multipliers with a Jurisdiction Machine
The weakest technical pattern in early legal RAG prototypes is the authority multiplier (e.g. boosting state statutes by $1.25\times$ and local ordinances by $1.00\times$).
Preemption is not a ranking boost. A municipal rent control ordinance does not lose 20% of its relevance when a state statute applies; it is either controlling, preempted, or conditionally harmonized under statutory carve-outs.
┌───────────────────────────┐
│ Candidate Authorities │
│ (Hybrid Vector + Lexical)│
└─────────────┬─────────────┘
│
▼
┌───────────────────────────┐
│ Pass 1: Temporal & Place │
│ Drop repealed, sunset, │
│ or out-of-jurisdiction │
└─────────────┬─────────────┘
│
▼
┌───────────────────────────┐
│ Pass 2: Preemption Graph │
│ Apply explicit edges: │
│ `preempted_by` pointers │
└─────────────┬─────────────┘
│
▼
┌───────────────────────────┐
│ Pass 3: Mandatory Graph │
│ Hydrate linked exception │
│ and definition children │
└─────────────┬─────────────┘
│
▼
┌───────────────────────────┐
│ Ranked Live Authorities │
│ (Only active law reaches │
│ the prompt context) │
└───────────────────────────┘
The jurisdiction machine evaluates candidate rules against explicit relational properties: jurisdiction, instrument_type, effective_from/effective_to, preempted_by[], and applies_if fact gates (e.g., unincorporated county islands, multi-unit buildings). Only live, legally governing rules survive into prompt assembly.
3. Two-Pass Grounding: Mechanical Gate vs. Proposition Entailment
The dominant failure mode in production legal RAG is misgrounding: citing an authentic, active statutory section for a legal proposition that the statute does not support. This accounts for our 70.0% divergence baseline.
Asking the drafting model to grade its own output produces self-reinforcing hallucinations. Verification must be decoupled into two distinct passes:
Checks that the citation exists in the corpus, section alphanumeric string parses, cited span offsets resolve to the source binary, temporal status was active on the matter incident date, and quotes are normalized near-substrings. Highly parallelized, cheap, deterministic.
Decomposes drafts into atomic claims {c1, c2, ... cn}, binds each claim to specific source span IDs, and evaluates through an isolated entailment pass: entailed, contradicted, exception_applies, insufficient_context, not_in_corpus. When a proposition is contradicted, the specific claim is refused, not the entire brief.
4. Separation of Invariants: Three Distinct Stores
Treating lease exhibits, public statutes, and attorney theories as interchangeable vector records causes severe memory contamination. The architecture enforces three isolated stores with distinct invariants:
| Store Type | Primary Artifacts | Storage Invariants | Retention Policy |
|---|---|---|---|
| 1. Public Law Store | State statutes, municipal codes, administrative regulations | Public, versioned graph, hierarchical parent/child linking | Permanent: never purged when a client matter closes |
| 2. Matter Fact Store | Client leases, eviction notices, email exhibits, photographs | Confidential, page-true coordinates, strict tenant isolation | Cryptographic hard purge on matter conclusion |
| 3. Case Theory Store | Attorney working theories, procedural dates, judge quirks | Typed episodic memory, Lakebase SQLite compute cache | Active superseding and invalidation lifecycle |
5. End-to-End Walkthrough: California Residential Just-Cause Defense
Rather than claiming generic competence across all legal domains, the pipeline is hardened against one exception-dense vertical: California Residential Habitability, Security Deposits, and Just-Cause Notices.
Matter Record: Oakland, CA apartment tenant served with 30-day notice for "owner move-in" (OMI)
by adult nephew, with zero relocation assistance payment.
Step 1: Ingestion & Spatial Binding (KruschNexus)
Input: `30_day_notice_to_vacate.pdf` (scanned exhibit).
Processing: Poppler text layout extraction + Tesseract OCR on municipal notice stamp.
Output: Stamped notice date, physical page 1, character offsets [120-450].
Stored: Matter Fact Store (isolated to matter_id = 104).
Step 2: Candidate Authority Retrieval (KruschLaw)
Query: "owner move in eviction relative relocation payment"
RRF Candidates: OMC § 8.22.360, Cal. Civ. Code § 1946.2, OMC § 8.22.030.
Step 3: Deterministic Jurisdiction Filtering
- Property is in incorporated Oakland. OMC § 8.22.360 applies.
- Preemption check: Cal. Civ. Code § 1946.2(g)(1)(B) preserves local ordinances
enacted prior to 2006 with greater tenant protections. Oakland controls.
- Exception hydration: OMC § 8.22.360(A)(8) owner move-in allows only spouse, child,
parent, or grandparent. Nephew is excluded as a qualifying relative.
Step 4: Draft Generation & Claim-Level Entailment Gate
Drafted Claim 1: "Under OMC § 8.22.360, an owner move-in eviction cannot be based on occupancy by a nephew."
-> Pass A: Section parses and is active. PASS.
-> Pass B: Bound to span OMC § 8.22.360(A)(8). Verdict: ENTAILED.
Drafted Claim 2: "Landlord must pay relocation assistance within 10 days of notice."
-> Pass A: Section parses and is active. PASS.
-> Pass B: Bound to span OMC § 8.22.360(G). Verdict: CONTRADICTED.
(Statute mandates half paid at service of notice, half upon vacating).
-> Action: Claim 2 REFUSED. Text corrected before attorney presentation.
Step 5: Working Memory Update (KruschContext MCP)
Committed to Lakebase (`.agent/memory.db`):
- Category: `lessons`
- Content: "OMC § 8.22.360 OMI defense: nephew is non-qualifying relative; notice relocation payment split required under Subsection G."
6. The Amendment Pipeline: Stale-Law Review Queue
Statutory change is a product feature, not an edge case. When a municipal code or chaptered state bill is amended, the system must not silently rewrite legal conclusions. It executes an automated review pipeline:
- Ingest chaptered bill or ordinance amendment via KruschNexus.
- Compute AST and text diff against existing statutory graph node.
- Mark old node
status = amendedwith a pointer; do not delete historical records. - Query KruschContext for all stored memories and matter conclusions citing the old section.
- Mark affected memories as
stale_pending_review. - Surface an explicit review queue to counsel: "3 stored case theories may be invalidated by recent amendments."
7. Threat Model & Operational Boundaries
To prevent over-reliance on local agent architectures, operators must enforce defensive bounds against known failure vectors:
- Incomplete Municipal Corpus: Municipal ordinances in small or unincorporated jurisdictions are frequently absent from public bulk archives. The system must fail closed: if a county code is missing, it must return
MISSING_GOVERNING_AUTHORITYrather than falling back to state law assumptions. - Degraded OCR Coordinates: On third-generation photocopies or skewed scans, OCR bounding boxes may miscalculate character span offsets. Downstream claim binding must tag OCR spans with confidence scores.
- Missing Appellate Common Law: Statutory text alone does not capture judicial gloss or binding appellate precedents. KruschLaw explicitly indexes statutes and ordinances, not appellate case reporters.
- False Reliance on Grounded Falsehoods: An agent can generate a grammatically flawless, fully grounded legal theory based on an incomplete factual narrative supplied by the client. Outputs remain provisional research work product requiring independent human review under California RPC Rule 1.1 and Rule 5.3.
Conclusion: Engineering Bounds, Not Magic
True sovereignty in legal artificial intelligence is not achieved by declaring an architecture "private" or running open weights on localhost. It is achieved by bounding retrieval to verified physical spans, bounding legal relevance to deterministic jurisdictional and preemption rules, bounding generation to independently verified, claim-level entailment, and bounding working memory to isolated, hygiene-enforced stores.