GBrain: The Personal Memory Brain Built for Agents, Not Humans

An opinionated Postgres-native knowledge system that turns notes, meetings, and inbox history into compiled truth, hybrid search, and automated overnight cleanup.

9 min read · garrytan/gbrain

A desk-sized vault built from stacked index cards, Postgres pipes, and labeled drawers. A small mechanical hand labeled agent reaches into a drawer marked compiled_truth while raw notes, emails, and meeting transcripts pour into an intake chute. The scene explains how GBrain transforms noisy inputs into durable memory for agent use.
GBrain is not a folder tree with embeddings bolted on. It is a machine that keeps turning raw life into a stable memory layer.
Key Takeaways

The Brain Is Not the Folder

GBrain starts with a refusal: personal memory should not look like a pile of files waiting for a search box. It should look like a system that can be queried, updated, and maintained by an agent that never gets tired. That is why the repo feels less like note software and more like a substrate.

The interesting shift is philosophical as much as technical. The unit of value is not a document. It is a living page that can absorb new evidence, preserve history, and expose a current belief state to downstream tools.

A close-up conveyor system splits messy scraps on one side from a clean stamped file on the other. Notes, emails, and transcripts enter a sorting machine, while a shelf preserves older versions and a maintenance arm revisits the stack at night. The image explains the separation between raw history and compiled truth.
GBrain keeps history, but it refuses to confuse history with the current answer.

Compiled Truth, Not Just Raw Recall

This is the repo’s sharpest idea. The schema is built around a page that can hold both a current synthesized state and the trail of how it got there. In practice, that means GBrain can answer like a memory system without deleting the evidence that made the answer possible.

The core pipeline is simple to say and hard to design well: raw inputs become a stable answer, but the path history stays available.

LayerWhat it storesWhy it matters
compiled_truthThe current synthesized beliefThis is what the agent should act on now.
timelineHistorical changes and prior statesThis preserves the evidence trail and avoids amnesia.
content_chunksChunked text with embeddingsThis supports semantic retrieval across noisy inputs.
linksExplicit relationships between entities and pagesThis lets GBrain traverse context instead of guessing from similarity alone.

That split is the whole trick. A normal vector store gives you recall. GBrain is trying to give you memory with editorial judgment.

The Repo Speaks in Tools and Skills

GBrain is designed to be operated, not admired. The CLI exports tools in machine-readable form, and the repo’s docs are written as skills and recipes that an agent can actually follow. The interface is not a dashboard. It is a contract.

// The shape of the agent-facing surface matters more than a UI here.
// GBrain exposes operations as tools so another system can drive them directly.

const ctx = new OperationContext({
  dryRun: false,
  logger,
});

await brain.search({
  query: "who introduced me to Alice?",
  limit: 5,
  includeTimeline: true,
});

await brain.updatePage({
  slug: "alice",
  compiledTruth: "Met at SF dinner in 2024 via Maya.",
  appendTimeline: true,
});

// Agents can inspect available actions without reading source code.
// cli --tools-json

That is why the `/skills` and `/recipes` folders matter. They turn operating knowledge into Markdown the model can read, which is a lot more portable than hiding logic inside a custom app layer.

Hybrid Search Is a Three-Layer Filter

GBrain does not trust embeddings alone. It mixes lexical search, semantic search, and query expansion so vague agent prompts have more than one path to success. That matters because memory queries are often incomplete, referential, or just badly phrased.

Retrieval layerWhat it catchesWeakness if used alone
Keyword searchExact names, slugs, and fuzzy text matchesMisses semantic variants and paraphrases
Vector searchConceptual similarity across chunksCan surface plausible but wrong neighbors
Query expansionBroader or rephrased intentDepends on upstream model quality and can drift

The point is not novelty. The point is resilience. When an agent asks a messy question, GBrain can still triangulate the answer from multiple retrieval paths.

The Dream Cycle Keeps Memory Coherent

The overnight maintenance loop is what turns this from a database into a living system. Entity detection, deduplication, linking, and consolidation are not background chores. They are the reason the knowledge graph does not dissolve into duplicate pages and stale references.

This is the project’s most memorable bet: memory gets better when it is allowed to sleep. During that cycle, older fragments are re-evaluated, connected, and compressed into a cleaner structure that agents can use the next day.

Why This Feels Different From Obsidian, RAG, or a Generic Agent Stack

SystemPrimary userTruth modelSelf-maintaining
ObsidianHuman writerNotes and linksOnly if the user does the work
Generic RAG stackApp developerChunks and embeddingsUsually no
Agent framework with memoryAgent builderSession state or ad hoc storesSometimes
GBrainAgent plus operatorCompiled truth plus timelineYes, through scheduled maintenance

That table is the cleanest way to say it. GBrain is not trying to beat note apps at browsing. It is trying to give agents a durable cognitive substrate that can survive daily updates, conflicting inputs, and forgotten context.

The Opinionated Personal AI Stack

The repo is opinionated in the best sense. It prefers Postgres, Markdown, local-first execution where possible, and explicit agent tooling over a glossy front end. That makes it feel less like a product demo and more like a blueprint for a private AI operating layer.

The bigger idea is simple. As agents become more useful, the bottleneck shifts from model quality to memory quality. GBrain is one answer to that problem, and it is a very specific one: make memory structured, maintainable, and legible to machines.