independent system
Homelab Second Brain
A compiled memory layer that answers infrastructure questions with cited evidence, and a published self-audit of where it still falls short
Overview
Context, approach, and outcome.
Problem
I wanted a local model, on my own GPU, to answer questions about my own infrastructure: what depends on what, why something is configured the way it is, what changed recently. The two easy options were both bad. Handing the model a dump of my operational docs meant about 103,000 tokens of context (102,896, measured in July). Single-shot embedding retrieval had no exact or lexical stage, no reranking, and no notion of time: a decision written in June and an observation from this morning came back with equal authority.
My role
Owner, architect and operator. The repository that holds it has 496 merged pull requests between July 2 and November 10, 2026; 113 of them changed the memory layer's code.
Since the October audit, most of the implementation has been done by AI coding agents in iterations I scope. An orchestrating session maps the code, writes a spec, hands the change to an implementer in an isolated worktree, and has a separate refuter agent try to break the result. Decisions taken inside those sessions are recorded as reversible ADRs that wait for my review.
Constraints
- Must run entirely local, on a 24GB consumer GPU that is frequently busy with other work.
- Must never become another source of truth. Git, the event ledger and live observations stay authoritative. Facts, graph, capsules and vectors must be rebuildable from them, and history that the sources no longer hold lives in an append-only, hash-chained journal.
- Must be honest. A thin answer and a wrong answer look identical at the point of use.
Architecture
A compiled layer over authoritative sources: a temporal fact store in SQLite with full-text search, a relationship graph (1,446 nodes and 2,403 edges at the November 12 build, 863 of those edges labelled low-confidence), summary capsules and a vector index, assembled into a context packet.
Diagram as text
Components
- Git, ledger, live observations
- Fact store
- Graph
- Capsules
- Vector index
- Context packet
- MCP: ground_question
- Memory CLI tools
Flows
- Git, ledger, live observations → Fact store: compile
- Git, ledger, live observations → Graph
- Git, ledger, live observations → Capsules
- Git, ledger, live observations → Vector index
- Fact store → Context packet
- Graph → Context packet
- Capsules → Context packet
- Vector index → Context packet
- Context packet → MCP: ground_question
- Context packet → Memory CLI tools
Each question class has a hard cap on rendered tokens: 900 for an exact lookup, 4,000 to 5,000 for explain, coverage and multihop questions, 12,000 for open reasoning. A packet may go over only to keep evidence it is not allowed to drop, never past 1.5x the cap, and it labels the overflow when it does.
Entities have immutable ids, and name resolution returns "ambiguous" instead of guessing. A fact is retired only when a complete census says it is gone; a failed collection reads as unknown. Every packet carries a sufficiency verdict (answerable, partial or insufficient) and says whether the caller should fall back to other tools.
Agents reach it through one MCP tool, ground_question, on a server that exposes 96 tools and 41 resources (two of the tools write, and only documentation proposals), or through 42 memory command-line tools.
One rule throughout: grounded or blocked. Selection and ranking are deterministic and reproducible offline. A language model may phrase an already-selected result and may never add, drop, or reclassify one.
The audit, and what it corrected
In early October the memory path was audited end to end against its code. Several things I had been saying about it were stronger than the code:
- "Close, don't overwrite" did not hold. Recompiling stamped every fact with the compile time, and a fact that disappeared and came back overwrote its earlier closed interval.
- A missing input could retire facts, and a freshly rebuilt artifact could read as fresh while its source evidence was old.
- Verification could return trusted with zero confirmations, and ranking confidence could be high while required evidence was missing.
- Token limits were soft and sometimes exceeded.
- The headline "about 99% fewer tokens" compared an average packet of 486 to 569 tokens on a 15-question benchmark with a 102,896-token dump of every operational doc. That dump is a counterfactual, not what a model was actually being sent. The audit's own 12-question sample put the mean packet at 764 tokens. The July shadow run against the existing RAG path compared whether both found the answer (15 of 15 did, after fixing three defects the first run surfaced), not token counts.
The fixes for these are merged; the tracker still lists some as not yet observed live, and the fact-interval fix as partial. The audit became the program of record: 16 findings and eight phases, worked in 13 iterations between October 7 and November 10, with independent refuters on each change and a phase counted done only once it is observed on the host that runs it.
Outcome
Phases 0 to 2 (safety semantics, canonical identities, evidence and temporal authority) closed on October 28, one with an accepted limitation. The compiler contract closed with two clauses not met as written. The audit's quality gates, as measured:
- Required-evidence recall, target 95%: not met. 77 of 97 items (79.4%) on the live store after the November 10 compile, on tune and dev labels an agent checked item by item and I signed off. Those are development questions now: the iteration that raised them from 54 moved the held-out split from 13 to 14 of 36, on agent-written labels nobody has reviewed yet. A plain BM25 baseline over the same store reaches 7 of 36 at equal tokens.
- Judged precision, target 0.85: not met. The committed baseline reads 0.57 on tune and 0.42 on dev (oracle track), on agent labels, so it is not yet quotable as measured.
- Latency: met offline. Packet build p95 of 41 to 44 ms (oracle track) and 102 to 131 ms (natural routing) against a ratified 300 ms ceiling. Online latency is not measured.
- Answers: with a local 14B model, 57% of required items answered correctly with the packet against 47% with BM25 at equal tokens; at the question level the two tie, 21 of 48 each.
- Adoption: the grounded-answer tool served 1 of 69 lookups before agents were told about it and 4 of 76 (5.3%) after, against a 25% target. My voice assistant has never called it.
At the last merge of iteration 13 the memory test suite held 8,855 passing tests and the MCP server's suite 2,261.
What I'd do differently
I built the fact store before I built the thing that audits whether the facts are still true. Those belong in the same release: a memory without self-audit is a confident cache. I would also have written a held-out split and a plain baseline before tuning anything. One iteration gained 26 items on questions I could see and 1 on questions I could not, and I would rather have known that shape from the start. And I would measure whether anything calls a tool in the same pull request that ships it.
Lessons
What I'd carry forward.
A benchmark you tune against turns into a development set whether you call it one or not: one iteration gained 26 items on my tuned questions and 1 on held-out ones. And a tool that exists is not a tool in use until something measures who calls it.
Stack
Tools and platforms.
Related writing
Notes from this project.
- The Tool Nobody CalledI gave my homelab's agents one tool for grounded answers. It served 1 of 69 lookups, and my voice assistant called it in 0 of 32 turns. The nudges meant to fix that had been going to a debug log.
- The Benchmark I Tuned Against Stopped Being a BenchmarkRecall on my memory layer's tuned questions rose from 54 to 80 of 97 in one iteration. On held-out questions it went from 13 to 14 of 36. A stricter grader, a plain BM25 baseline, and one retraction.
- What Deserves Attention TodayMy homelab produces one verdict each morning: something needs you, or nothing does. Getting the second half honest was much harder than the first.
- The Alert That Named a Thing and Called It EvidenceFive high-severity alerts from my own monitoring. All five were the same defect: a record that names something being read as an observation of a property it never measured.
- A Planner That Will Not Onboard AnythingThe tool that decides how to onboard a new service into my homelab has no ability to onboard a service. That separation is the design, not a limitation.
- Documentation That Publishes Itself, After I Say YesMy homelab writes its own wiki pages. Every one of them still passes through a pull request I merge by hand, and publishing happens only from main.
- A Write Loop That Never Merges AnythingMy homelab brain noticed problems and did nothing about them. Closing the loop meant four human gates and an executor whose defining feature is that it stops at a draft PR.
- Teaching a System to Say “I Don’t Know”The most useful thing my homelab brain does is refuse to answer. Grounded-or-blocked: every claim cites the fact that produced it, or it never reaches me.
- A Second Brain That Refuses to GuessAnswering an operational question was costing a local model a 30-50K token dump. I built a compiled memory layer that does it in 2-5K, and blocks itself when it cannot cite a source.
Talk shop
Want to discuss this kind of work?
If you're hiring for similar backend, AWS, voice, or integration work — or just want to compare notes on architecture — reach out directly.