← Back Case study · Agent platform Self-hosted · evolved into v2

Brains

One system remembers everything I work on, and acts on it. Every coding session, commit, voice note and email lands in a persistent memory that a fleet of agents briefs from, triages with, and reflects on, behind human approval gates, on my own hardware. I designed it, built it, and used it every day.

Designer · Sole engineer · Daily operator Independent · self-hosted 2026 · v1 archived, v2 in daily use Python · TypeScript · Postgres 17 · pgvector · local models
Brains agent console with knowledge graph
Agent console: knowledge-graph viewdesigned mockup; the live system holds private data

00 / 05Context

The problem.

Knowledge work leaks memory. A decision made in one coding session is invisible to the next; a voice note never meets the commit it explains; the context that made last month's choice sensible evaporates when the window closes. LLM assistants make this worse: each conversation starts from zero.

The brief I set myself: give agents real memory: one store that captures everything worth remembering, retrieval that works by meaning, and agents that act on it, with two hard constraints: it runs on my own hardware, and nothing outward happens without my approval.

01 / 05System

The memory loop.

One loop, five stages, capture to action. Everything is an episode: a timestamped unit of memory with its source attached. Episodes are embedded for retrieval, distilled into a knowledge graph, and served back to every tool that needs context.

→ 01

Capture

Coding sessions, git commits across every configured repo, transcribed voice notes, mail-triage decisions, ingested news: everything worth remembering, with provenance.

→ 02

Embed

Every episode embedded (bge-m3) into a local vector index: recall works by meaning, not keywords.

→ 03

Distill

A local model extracts entities and relations into a living knowledge graph; a nightly deep-sleep agent clusters it into community summaries.

→ 04

Retrieve

Context follows the work: session-start injection, entity cards, and a local HTTP API any tool can query.

→ 05

Act

A fleet of scheduled agents (briefing, triage, reflection) drafts; I decide. Every outward action sits behind a human approval gate.

02 / 05Memory

Memory is the product.

Not a chat log: a queryable, compounding store that gets more useful the longer it runs, because retrieval works by meaning and the graph maintains itself. The figures below are a v1 snapshot, June 2026.

Episodic store

14,344 episodes at v1's June 2026 measurement: every session, commit, note and decision, timestamped with its source. SQLite-backed: one file, trivially backed up, no cloud dependency.

Semantic retrieval

Recall by meaning, not keywords: asking about a topic surfaces the sessions and commits that actually dealt with it.

Living knowledge graph

11,455 entities and 6,465 relations, distilled by a local model (people, projects, repos, topics), so the system knows not just what happened, but how things connect.

Deep-sleep summaries

A nightly agent clusters the graph and writes community summaries: the themes of the week, discovered rather than filed. Memory that organises itself while I sleep.

Snapshot
v1, June 2026
Episodes
14,344
Entities
11,455
Relations
6,465
Recall
semantic · sqlite-vec
Agents
10 scheduled · HITL-gated
Interfaces
API · Discord · voice

03 / 05Evals

How I check it.

v2 runs on a fork of Garry Tan's open-source gbrain (MIT), on Postgres 17 with pgvector. Local models do the extraction; Claude does the deep synthesis through my flat-fee subscription, so no metered key exists. Every model choice and every retrieval change since has a measurement behind it, committed next to the code.

The memory stays private. The evals do not: the scripts, the golden queries and the before-and-after results are public in my fork ↗. The longer account is in What I measured before I trusted a model.

Model chosen by A/B

Twelve real pages, one task, the same settings: Gemma 4 returned valid JSON on 100% of pages against 83% for Qwen 3, and found 102 tickers against 79 at nearly the same speed. A second test kept the 4-bit build: it agreed with 8-bit at F1 0.997 and ran 35% faster. That test scores agreement, not correctness, and says so.

Retrieval that stopped poisoning itself

The system's own daily summaries were outranking the sources they summarised. Fifteen golden queries scored the fix: poison hits 25 to 0, the median age of time-sensitive results 15 to 10.5 days, and ranking level (MRR 0.844 to 0.843).

1,063 edges deleted

An open-schema extraction pass had written 1,063 relations with no receipt. A hand check of 25 found 28% precision, and the best judge model reached only about 56%, so all of them went. The replacement keeps an edge only with the quoted sentence that states it, and uses 14 defined relations instead of 350.

Still in shadow

The new pass writes nothing to the graph until 50 human labels show at least 90% precision, reported with a Wilson 95% interval. As of November 2026 it has no labels yet, so its gate is still closed. A gate that stays shut until the numbers say otherwise is the point.

Store
Postgres 17 · pgvector · bge-m3 embeddings · a local reranker
Models
Gemma and Qwen locally for extraction · Claude for synthesis · no metered keys
Evals
hit@k · MRR · poison · freshness · precision with a Wilson interval
Code
Public fork of gbrain, branch brains-port

04 / 05Result

What it proved.

Nothing gets forgotten

Every session starts with context from the last one; every commit and note lands somewhere retrievable. The compounding effect is real within weeks.

Trust needs gates

Human-in-the-loop approval on every outward action is what made a fleet of autonomous agents livable: drafts flow freely, actions wait for me.

Local-first works

One SQLite file, local embeddings, local extraction models: private by construction, backed up in seconds, no cloud dependency to rot.

Honest status

v1 ran daily through the first half of 2026 and was archived in July when the architecture converged into a leaner, headless successor on Postgres 17 with pgvector, built on a fork of Garry Tan's open-source gbrain (MIT). It carries the same memory forward and is in daily use today.

Next case study Breakwise →
© 2026 Anthony Meijer · Singapore Brains · independent, self-hosted