Executive Summary & Facts
Problem: Engineering teams retain their source code but lose the rationale behind architectural decisions across Slack threads, PR reviews, Jira tickets, ADRs, and postmortems. Standard vector RAG retrieves isolated text chunks yet fails on relational questions—who owns a module, what breaks downstream, or whether an old assumption was later contradicted—and risks fabricating ungrounded citations.
Result: Built Fencekeep, a multi-tenant FalkorDB knowledge graph and retrieval-first agent that ingests structural engineering history deterministically, enforces verbatim quote verification (≥ 90% normalized match) on extracted decisions, flags outdated premises via two-model drift consensus, and logs an (:Answer)-[:USED]->(...) audit trail. On 40 ground-truth engineering questions, Fencekeep scores 34/40 (85.0%) strict (31/40 / 77.5% judged) versus 22/40 (55.0%) for dense vector RAG and 9/40 (22.5%) for keyword RAG, while deterministic zero-AI graph routing alone scores 32/40 (80.0%) in the baseline run and 36/40 (90.0%) after adding chained multi-hop tools.
Role: Lead AI & Knowledge Graph Engineer; designed and implemented the FalkorDB graph schema, deterministic GitHub and company-workspace importers, quote-grounded extraction and 2-model drift pipeline, 19 Cypher/graph tools, SSE agent loop and deterministic router, 16-tool MCP server, OKF v0.1 exporter, React 19 UI, and 40-question evaluation suite.
Problem & Engineering Constraints
Document retrieval in engineering organizations breaks down when questions cross system boundaries, time windows, or contributor histories:
1. The Relational Blindspot of Chunk-Based RAG
Dense vector search performs well when rationale sits inside a single paragraph (matching Fencekeep at 14/17 on isolated why questions), but collapses to 0/5 on expertise routing (who), 0/3 on dependency blast radius (impact), and 0/2 on timeline queries (history). Those answers do not live in one text chunk—they emerge from aggregating PR touches, review edges, dependency manifests, and timestamps across nodes.
2. Silent Decision Drift & Citation Hallucination
Teams rarely update old ADRs when a later incident or benchmark invalidates an original assumption, and free-form LLM extractors frequently paraphrase or invent source links. Extracting company memory requires deterministic structural edges paired with machine verification of every quoted claim.
verify_quote) or be discarded.pending (:Action) nodes until approved, scoped strictly to FENCEKEEP_ACTION_REPOS with @mentions defanged.fencekeep across 13 public FalkorDB repos; fencekeep_orbiton for a 24-person company dataset).Knowledge Graph & Agent Architecture
Fencekeep separates deterministic graph construction from bounded LLM judgment across four coordinated layers:
1. Deterministic Multi-Source Ingestion & Identity Unification
GitHub ingestion (github/fetch.py, ingest/loader.py) imports PRs, issues, discussions, reviews, CODEOWNERS, manifests (DEPENDS_ON), and docs while skipping dependency-bot churn (dependabot, renovate). Company workspaces (importers/workspace.py) ingest Slack exports, Jira/Linear CSVs, org charts, and Markdown ADRs/RFCs/ postmortems, resolving people across GitHub logins, Slack IDs, Jira display names, and email into unified Person nodes.
2. Graph Schema, Derived Expertise & Native Algorithms
The graph models Person, Team, System, Source, Decision, Premise, Action, and Answer nodes with range and full-text indexes (graph/schema.py). derive/expertise.py computes recency-weighted KNOWS_ABOUT edges (weights: decided=4.0, authored=3.0, wrote=3.0, reviewed=1.5, worked=1.5, merged=1.0, commented=0.5, chatted=0.5, discussed=0.75) with a 180-day half-life and log-dampened PR churn, while retaining undecayed lifetime scores for departure risk. Bi-directional WORKS_WITH edges power FalkorDB's native algo.betweenness (bridge engineers) and algo.labelPropagation (inferred teams).
3. Verbatim Quote Grounding, Decision Merging & 2-Model Drift
Extraction candidates are ranked by rationale language signals (rationale_signal) and reply depth. extract/grounding.py validates every extracted quote after NFKC and markdown normalization (≥ 12 characters, exact substring or ≥ 90% contiguous SequenceMatcher match). Restated decisions within ±120 days (or ±45 days on the same system) merge onto one Decision via DISCUSSED_IN while preserving numeric conflicts as distinct decisions. Drift detection (extract/drift.py) scans strictly later non-doc sources, requires a distinct second model (enforced via same_model()) to confirm contradiction, and verifies the contradicting quote before writing CHALLENGES and setting decision.drift = true.
4. Retrieval-First Agent, 19 Graph Tools & 4 Workflows
When a user asks a question via POST /api/ask (SSE stream), the deterministic router (agent/router.py) classifies intent and pre-fetches graph evidence before calling the LLM (capped at 5 tool steps across 19 Cypher/graph tools in agent/tools.py, including multi-hop traces departed_decisions, stale_runbooks, and trace_topic). A Ledger numbers citable evidence as [n]; clean_citations() strips invalid refs and logs (:Answer)-[:USED]->(...). Four built-in workflows (workflows.py) power Change Impact, Incident Memory, Decision Guard (zero-AI PR check), and Handoff Plan.
5. Read-Only MCP Server & Deterministic OKF v0.1 Wiki Export
mcp_server.py exposes 16 read-only graph tools over stdio, sse, or streamable-http for IDE/desktop agents (Claude Desktop, Cursor), while okf/export.py deterministically renders systems, decisions, quotes, drift warnings, people, and log.md into an Open Knowledge Format markdown bundle for approval-gated wiki PRs.
Engineering Decisions & Defenses
Dense vector RAG only embeds isolated 1,500-character chunks. It cannot count PR touches across a 180-day half-life, traverse transitive DEPENDS_ON*1..4 blast radii, or compute betweenness centrality. Moving structural truth into Cypher yielded 5/5 on expertise routing and 3/3 on impact analysis where dense vector RAG scored 0/5 and 0/3.
Unverified LLM summaries silently introduce fabricated rationale or false drift alarms when a PR simply implements a decision. Requiring a verbatim quote in the raw source text and forcing a second distinct model (checked across provider aliases via same_model()) eliminated ungrounded claims and reduced noisy drift edges.
LLMs are inconsistent about which tool to open first and frequently fail on false-premise traps. Pre-fetching evidence grounds turn 1 immediately, while the zero-AI router guarantees 0.07s answers (80% baseline / 90% post-eval strict score) even with zero API keys configured or when providers hit daily quota.
Free-tier providers impose strict daily token caps and RPM ceilings. Content-addressed caching of temperature-0 calls makes snapshot rebuilds cost zero quota, RPM pacing prevents 429 bursts on NVIDIA/OpenRouter, and daily-quota circuit breakers keep extraction and Q&A running across fallback providers.
Empirical Evaluation & Benchmark Comparison
Fencekeep was evaluated on 40 ground-truth questions (eval/questions.jsonl) written directly from raw source data—25 across 13 public FalkorDB GitHub repositories (fencekeep) and 15 across the Orbiton multi-tool workspace (fencekeep_orbiton)—so evaluation is non-circular.
All LLM-enabled systems ran with nvidia:nvidia/nemotron-3.5-super-vl-120b-a12b and were scored two ways: Strict (automatic check verifying expected source UID cited, ≥ 50% expected key terms, expected people handles named, and false premises declined) and Judged (independent grading against written references by cloudflare:@cf/openai/gpt-oss-120b). Dense RAG embedded 1,500-character chunks (200-char overlap) using nvidia/nemotron-3-embed-1b in FalkorDB's vector index.
| System | Strict Score | Judged Score | FalkorDB (25) | Orbiton (15) | Avg Latency |
|---|---|---|---|---|---|
| fencekeep Graph Agent + Citation Ledger | 34/40 (85.0%) | 31/40 (77.5%) | 21/25 | 13/15 | 4.6 s |
| router Deterministic Graph Only (Zero AI) | 32/40 (80.0%)* | 26/40 (65.0%) | 20/25 | 12/15 | 0.07 s |
| vector Dense RAG (nemotron-3-embed-1b) | 22/40 (55.0%) | 19/40 (47.5%) | 13/25 | 9/15 | 0.47 s |
| rag Keyword Full-Text Search | 9/40 (22.5%) | 5/40 (12.5%) | 4/25 | 5/15 | 0.01 s |
router scoring to 36/40 (90.0%) strict (4/4 multi-hop); only router was re-measured after that addition, so the table above reflects the synchronized 4-system run.| Category | fencekeep | router | vector RAG | keyword RAG |
|---|---|---|---|---|
| why (17) · Decision rationale | 14/17 | 14/17 | 14/17 | 3/17 |
| who (5) · Expertise routing | 5/5 | 5/5 | 0/5 | 1/5 |
| impact (3) · Dependency blast radius | 3/3 | 3/3 | 0/3 | 0/3 |
| history (2) · Temporal window | 2/2 | 2/2 | 0/2 | 0/2 |
| risk (3) · Bus factor & attrition | 3/3 | 3/3 | 1/3 | 0/3 |
| drift (1) · Challenged premises | 1/1 | 1/1 | 1/1 | 0/1 |
| incident (1) · Past outage lookup | 1/1 | 0/1 | 1/1 | 0/1 |
| unanswerable (4) · False premises | 4/4 | 4/4 | 4/4 | 4/4 |
| multi-hop (4) · Chained traversals | 1/4 | 0/4* (4/4 post-eval) | 1/4 | 1/4 |
cd backend && uv run fencekeep eval against eval/questions.jsonl.Highlighted rows (who, impact, history, risk) account for the entire 30-point accuracy gap between Fencekeep (85%) and dense vector RAG (55%). Vector RAG retrieves paragraphs describing local why decisions (14/17) and correctly refuses out-of-corpus false premises (4/4), but scores 0/10 combined on who, impact, and history because no single document chunk holds aggregated recency-weighted authorship or multi-repo dependency chains.
Graph Scale, Latency & Cost Profile
Containerized Architecture & AWS / Vercel Rollout
Fencekeep runs locally in a single command via Docker Compose (fencekeep demo restores both frozen snapshots in ~30 seconds with no API keys required) and includes a hardened single-VM deployment configuration (deploy/) paired with a Vercel frontend rewrite:
flush_interval -1) on /api/*./api/ask) and constant-time FENCEKEEP_ADMIN_TOKEN checks on write routes./opt/fencekeep-data with TIMEOUT_DEFAULT 30000 ms and RESULTSET_SIZE 20000.react-force-graph-2d UI renders live reasoning subgraphs.Live demo is accessible at https://fencekeep.vercel.app/.
Engineering Retrospective: What Failed, Solved & Next Steps
Failure 1: FalkorDB 6.0.2 Query & Export Edge Cases
Pinned FalkorDB 6.0.2 returned empty sets on id(n) > -1, crashed when aggregate queries referenced never-stored property names, and evaluated filtered OPTIONAL MATCH clauses unreliably after an aggregating WITH. Resolution: Paged portable exports from id(n) >= 0, wrapped optional fields in coalesce(), split multi-step aggregations into sequential queries, sanitized unpaired emoji surrogates at load time, and stored WORKS_WITH edges bidirectionally for graph algorithms.
Failure 2: Citation Bracket Drift & Unverified Model Refs
Fallback models (including gpt-oss) emitted lenticular brackets (【1†source】), numeric spans ([1-3]), or tool names ([impact]) instead of integer citation refs. Resolution: Built clean_citations() in agent/loop.py to normalize bracket styles, expand valid ranges, strip ungrounded tool-name or unknown refs against Ledger, and degrade cleanly to the deterministic router whenever a model returns empty text or hits daily quota.
Failure 3: False-Positive Drift & Generic System Word Collisions
Early drift checks flagged PRs that carried out a decision as contradicting its pre-decision premise, and Decision Guard matched generic system identifiers (such as driver or app). Resolution: Excluded docs from drift candidates, filtered out title-restatement PRs (≥ 0.5 stem overlap with decision title), required ≥ 2 matching stems and two distinct LLMs with a verified quote, and subtracted system_words from Decision Guard term overlap.
Next Steps & Roadmap
- Re-run the full 4-system benchmark suite across all models with the chained multi-hop tools enabled (currently re-measured only on
router, which improved to 36/40). - Add live incremental connectors for Slack and Jira alongside the existing GitHub sync (currently imported via
fencekeep workspace import).