What Is GBrain? Garry Tan's AI Agent Memory System Explained

What Is GBrain? Garry Tan's AI Agent Memory System Explained

GBrain is an open-source AI agent memory system that turns plain-text Markdown notes into a self-wiring knowledge graph an agent can read, write, and reason against. It was open-sourced by Y Combinator CEO Garry Tan on April 5, 2026, under the MIT license, and crossed roughly 5,000 GitHub stars in its first 24 hours. As of writing it sits at roughly 14,000 stars.

GBrain isn't a side project. It's the brain Tan runs himself — the production system behind his actual AI agent setup, holding tens of thousands of markdown pages, thousands of people pages, hundreds of company pages, and a fleet of autonomous cron jobs that ingest meetings, emails, tweets, and voice notes while he sleeps. The released version generalizes that personal setup into something any operator can install in about 30 minutes.

This article explains what GBrain is, how the architecture works, what makes it different from generic RAG or other agent memory systems, who it's for, and where it doesn't fit.

Quick Facts

NameGBrain
CreatorGarry Tan, President & CEO of Y Combinator
ReleasedApril 5, 2026
LicenseMIT (open-source)
Source of truthMarkdown files in a git repo
StoragePostgres + pgvector (or PGLite for local)
RetrievalHybrid (HNSW vector + tsvector keyword) with RRF fusion
Operations30+ contract-first operations exposed via CLI and Model Context Protocol (MCP)
Skills34 markdown workflow files for AI agents
Built forOpenClaw and Hermes Agent
GitHub stars~14,000
Repogithub.com/garrytan/gbrain

The Problem GBrain Solves

AI agents are smart but forgetful. By default, a Claude Code session, a Hermes agent run, or an OpenClaw deployment starts each conversation with a blank slate. The agent doesn't remember the meeting you had last week, the person you mentioned three sessions ago, or the decision you made on a project last month. Anything you want the agent to know, you re-paste into the prompt every time.

This is the same problem agent memory systems generally address. What makes GBrain distinctive is its specific answer: the agent's memory should be a markdown brain repo that the operator owns, the agent reads and writes to, and a hybrid Postgres index makes searchable. Rather than treating memory as opaque database state, GBrain treats it as plain-text knowledge — diffable, branchable, version-controlled, and human-readable.

When you ask your agent "who works at Acme AI?" or "what did Bob invest in this quarter?", the agent searches the brain first, retrieves the relevant pages, and answers with full context. When the conversation produces new information, the agent updates the brain pages with citations, extracts entity references, and creates typed links across the graph — all of which the next conversation will benefit from. The brain compounds.

The Three-Layer Architecture

GBrain has three distinct layers, each with a clear job.

1. The Brain Repo (Markdown in Git)

The system of record is a directory of Markdown files in a git repository, separate from the GBrain tool repo itself. The recommended schema (documented in docs/GBRAIN_RECOMMENDED_SCHEMA.md) organizes pages by primary subject — people/, companies/, concepts/, originals/, meetings/, voice-notes/, and so on.

Every page follows what GBrain calls the compiled truth + timeline pattern:

  • Compiled truth — a summary section at the top representing the current best understanding of the subject. This is what the agent reads first.
  • Timeline — dated entries below documenting when each fact was learned or updated. Append-only, so history is preserved.

Because the source of truth is plain Markdown, you can git diff what your agent learned overnight, branch your brain to experiment with re-organization, and review writes line-by-line in your text editor. If the database disappears, you rebuild it from the repo.

2. GBrain Retrieval (Postgres + pgvector)

The retrieval layer is a Postgres database that indexes the brain repo for hybrid search. Per docs/architecture/infra-layer.md, a query into GBrain follows this path:

  1. Optional query expansion — if ANTHROPIC_API_KEY is set, Claude Haiku generates 2 alternative phrasings to broaden coverage. Without Anthropic, expansion is skipped and search still works.
  2. Vector search — HNSW cosine similarity over pgvector embeddings on content_chunks (1536-dim, OpenAI embeddings).
  3. Keyword search — Postgres tsvector with ts_rank, run in parallel. Title is weighted A, compiled-truth section B, timeline C.
  4. RRF merge — results combined with score = Σ(1 / (60 + rank)).
  5. 4-layer dedup — best 3 chunks per page, Jaccard > 0.85, and two more passes.
  6. Backlink-boosted ranking — pages that other brain pages link to get a ranking lift.

For local-only setups, GBrain uses PGLite — a WASM build of Postgres that runs in-process with no server. Database ready in two seconds. For shared-mode setups (Tan's own deployment uses Supabase), it's external Postgres with the same schema.

GBrain's published BrainBench numbers (sibling gbrain-evals repo) report P@5 49.1% and R@5 97.9% on a 240-page Opus-generated rich-prose corpus, beating the same system with the graph layer disabled by +31.4 points P@5, and beating ripgrep-BM25 + vector-only RAG by a similar margin. The headline takeaway: the typed-edge graph layer (next section) is doing more retrieval work than the hybrid search alone.

3. AI Agent Skills (34 Markdown Workflows) OpenClaw

The third layer is what GBrain calls "skills" — markdown workflow files that teach the AI agent when to read or write the brain, what quality bar to enforce, and how to chain operations into multi-step tasks. There are 34 skills shipped with the project, organized by category:

  • Always-onsignal-detector (fires on every message to capture entity mentions in parallel), brain-ops (5-step brain-first lookup before any external API call)
  • Content ingestioningest, idea-ingest, media-ingest, meeting-ingestion, voice-note-ingest, article-enrichment
  • Research and synthesisbook-mirror, strategic-reading, concept-synthesis, perplexity-research, archive-crawler, academic-verify, brain-pdf
  • Brain operationsenrich, query, maintain, citation-fixer, repo-architecture, publish, data-research
  • Operationaldaily-task-manager, daily-task-prep, cron-scheduler, reports, cross-modal-review, webhook-transforms, testing, skill-creator, skillify, skillpack-check, smoke-test, minion-orchestrator
  • Identity and setupsoul-audit, setup, migrate, briefing

A skill is a fat markdown document — workflow, triggers, quality bar, escape hatches — that the agent reads and executes. The GBrain ethos calls this "thin harness, fat skills": the intelligence lives in the skill files, not in a runtime engine. Skills can also call deterministic TypeScript code bundled in GBrain (search, import, embed, sync) for the parts that shouldn't be left to LLM judgment.

The skill layer is what makes GBrain feel different from a generic Postgres-backed RAG. The retrieval is hybrid search, but the behavior of the agent — when it writes, when it enriches, when it consolidates, when it audits citations — is encoded in 34 markdown files the operator can read and modify.

How the Compounding Loop Works

GBrain's design center is a read–enrich–write–sync loop that runs on every interaction:

Signal arrives (meeting, email, tweet, link)
  → Signal detector captures ideas + entities (parallel, never blocks)
  → Brain-ops: check the brain first (gbrain search, gbrain get)
  → Respond with full context
  → Write: update brain pages with new information + citations
  → Auto-link: typed relationships extracted on every write (zero LLM calls)
  → Sync: gbrain indexes changes for next query

The brain wires itself. Every page write extracts entity references and creates typed links — predicates like attended, works_at, invested_in, founded, and advises — using regex and string-matching rules with zero LLM calls per write. This is fast and cheap, which means the brain can index aggressively even on large daily ingestion runs.

A second mechanism makes GBrain compound non-linearly: tiered enrichment. A person mentioned once gets a stub page (Tier 3). After three mentions across different sources, they get web + social enrichment (Tier 2). After a meeting or eight-plus mentions, full pipeline (Tier 1). The brain learns who matters without being told.

A third mechanism, the fail-improve loop, gradually reduces LLM dependency. Every time GBrain falls back to an LLM for a classification task, it logs the case and generates better regex patterns from the failures. Over time, the system gets cheaper to run on the same workload.

Minions and Durable Agents

Two infrastructure features in GBrain are worth understanding because they're more polished than what most agent memory systems ship with.

Minions is GBrain's Postgres-native job queue (canonical as of v0.11.1). It separates deterministic work (pull posts, parse JSON, write a brain page, run a sync) from judgment work (triage the inbox, assess meeting priority). Deterministic jobs run as Minions — no LLM tokens, survives gateway restarts, millisecond runtime. Judgment jobs run as sub-agents. GBrain's published benchmarks (in gbrain-evals) show Minions completing large ingestion runs for $0 in tokens, where the equivalent sub-agent fan-out timed out at the gateway wall.

gbrain agent (v0.15) makes subagent runs survive crashes. Every Anthropic turn commits to subagent_messages, every tool call to subagent_tool_executions. If OpenClaw dies mid-run, the worker re-claims on restart and replays from the last committed turn. Two-phase tool ledger — pendingcomplete | failed — means replay is safe by construction.

These aren't strictly memory features, but they explain why GBrain feels production-grade despite being recently released: the autonomous cron jobs that make the brain compound need durable infrastructure, and GBrain ships it.

How to Install GBrain

The fastest path is to let an AI agent install GBrain for you. From the README:

GBrain is designed to be installed and operated by an AI agent. If you don't have one running yet:

  • OpenClaw ... Deploy AlphaClaw on Render (one click, 8GB+ RAM)
  • Hermes Agent ... Deploy on Railway (one click)

Paste this into your agent:

Retrieve and follow the instructions at:
https://raw.githubusercontent.com/garrytan/gbrain/master/INSTALL_FOR_AGENTS.md

The agent clones the repo, installs GBrain, sets up the brain, loads 34 skills, and configures recurring jobs. You answer a few questions about API keys (OpenAI required for vector search; Anthropic optional for query expansion). The whole process takes about 30 minutes.

For standalone CLI installation (no agent involved):

git clone https://github.com/garrytan/gbrain.git && cd gbrain && bun install && bun link
gbrain init                     # local PGLite brain, ready in 2 seconds
gbrain import ~/notes/          # index your existing markdown
gbrain query "what themes show up across my notes?"

GBrain runs on Linux and macOS (Apple Silicon explicitly supported). Windows installation is possible but less commonly tested.

For MCP usage with Claude Code, Cursor, Windsurf, or other clients:

{
  "mcpServers": {
    "gbrain": { "command": "gbrain", "args": ["serve"] }
  }
}

For remote MCP with OAuth 2.1 (ChatGPT, Claude Desktop, Perplexity), GBrain ships an HTTP server with an embedded admin dashboard:

gbrain serve --http --port 3131
# Visit http://localhost:3131/admin to register OAuth clients

What GBrain Is Good At

A few things GBrain does unusually well, drawing from the architecture above:

Compounding personal knowledge. If you commit to running it for months and feeding it meetings, emails, voice notes, and articles, the brain becomes uniquely yours. Tan's own deployment has grown to tens of thousands of pages of compiled truth across a multi-year corpus.

Cheap autonomy. Tiered enrichment, deterministic entity extraction (zero LLM calls per write), and the Minions job queue mean a lot of the daily compounding work is essentially free in tokens. The fail-improve loop drives that further over time.

Operator-readable agent behavior. Every skill is a markdown file. If you want to know why your agent enriched a person page or why it didn't, you read the skill file — not stack traces, not config schemas, just markdown.

Markdown source of truth. If you already live in markdown — Obsidian, Logseq, plain ~/notes — GBrain extends what you have rather than asking you to migrate. The migrate skill ingests Obsidian, Notion, Logseq, Roam, plain markdown, CSV, and JSON.

OpenClaw and Hermes Agent integration. The openclaw.plugin.json is a first-class skill pack. The Hermes install path is documented in INSTALL_FOR_AGENTS.md. Both agents are tested deployment targets.

Where GBrain Doesn't Fit

GBrain is opinionated, and the places where teams bounce off it cluster around a few mismatches:

  • You don't run OpenClaw or Hermes. GBrain ships first-class skill packs for both; everything else integrates through the MCP server you stand up yourself. If your agent is Claude Code, Cursor, CrewAI, LangGraph, n8n, or anything else, the integration story is "build it."
  • You want memory as a service. GBrain has no managed cloud option. PGLite for local, external Postgres for shared mode — both self-hosted.
  • You want memory that synthesizes structure automatically. GBrain's compounding comes from operator-authored skills running on cron. If you want raw facts to consolidate into beliefs and contradictions to reconcile themselves without you authoring the patterns, that's a different product class.
  • You need multi-tenant memory. GBrain is single-operator by design. Sharing a brain across customers in production isn't its design center.
  • You need temporal reasoning or multi-hop graph traversal at retrieval. GBrain has typed entity edges but doesn't traverse them as a primary retrieval strategy, and time-aware queries ("what was true last week but isn't now") aren't a first-class feature.

For a deeper breakdown of these mismatches and where to look, see GBrain alternatives.

How GBrain Compares to Other Agent Memory Systems Hindsight

GBrain sits in an interesting position in the agent memory landscape. It overlaps with agent memory systems like Hindsight, Mem0, Zep, Letta, and Cognee — but the design center is closer to a personal knowledge management system that an agent operates than to a multi-tenant memory layer.

The clearest contrast is with Hindsight. Both use hybrid Postgres retrieval and ship MCP servers. Both extract entities and build a typed-edge graph. Both are MIT-licensed. The difference is what gets automated:

  • GBrain automates running operator-authored skills. The 34 skills are markdown workflow files the operator writes (or accepts from Tan's defaults). Cron jobs run them. The schema is what you declare; compounding works because you've invested in the schema.
  • Hindsight automates synthesizing structure from raw facts. Every retain() call triggers background consolidation that creates and refines observations — evidence-grounded beliefs with proof counts, freshness trends, and contradiction reconciliation. You don't author the patterns; the system synthesizes them.

A few other meaningful contrasts: Hindsight has a managed cloud and 25+ first-party integrations across coding tools, agent frameworks, orchestration, and LLM gateways; GBrain ships skill packs for OpenClaw and Hermes specifically. Hindsight holds SOTA on the BEAM 10M-token benchmark; GBrain hasn't published BEAM results.

For the full head-to-head, see GBrain vs Hindsight: AI Agent Memory Compared. For the broader landscape, see GBrain alternatives.

Who Is Garry Tan and Why Did He Open-Source GBrain?

Garry Tan is the President and CEO of Y Combinator, the most prominent startup accelerator in the world. Before YC he co-founded Initialized Capital and was a designer at Posterous and Palantir. His public profile is unusual for a YC partner — he runs a popular YouTube channel and has been an outspoken voice on AI tooling.

GBrain isn't Tan's first piece of open-source AI infrastructure. He also released GStack — his exact Claude Code setup with opinionated tools serving as CEO, designer, eng manager, release manager, doc engineer, and QA. GBrain is the brain that runs alongside GStack to give the agents memory.

The motivation for open-sourcing GBrain, drawing from the README and Tan's public commentary, is essentially: every operator who runs AI agents seriously will eventually need a brain like this, and the patterns are general enough to share. Open-sourcing the personal version surfaces the patterns and lets others fork, adapt, and contribute.

Frequently Asked Questions

Is GBrain free? Yes — MIT-licensed and free to self-host. You pay for your own LLM calls (OpenAI required for vector search; Anthropic optional for query expansion) and your own Postgres if you outgrow PGLite.

Do I need OpenClaw or Hermes Agent to use GBrain? No, but they're the two agents with first-class skill pack support. The MCP server (gbrain serve for stdio, gbrain serve --http for OAuth 2.1 HTTP) lets any MCP-compatible client connect — Claude Code, Cursor, Windsurf, ChatGPT, Claude Desktop, Perplexity. The standalone CLI also works without any agent at all.

Can I use GBrain alongside Obsidian or Logseq? Yes. The migrate skill ingests Obsidian, Logseq, Notion, Roam, and other markdown sources. Many GBrain users keep their existing markdown vault and use GBrain as the retrieval and skill layer on top.

How much does it cost to run? Storage is essentially free (PGLite or your existing Postgres). LLM costs depend on usage — the design specifically minimizes LLM calls (deterministic entity extraction, optional query expansion, deterministic classifier improvement over time). For a personal brain at active usage, costs are typically dominated by ingestion (meetings, articles, etc.) rather than retrieval.

Is GBrain the same as Garry Tan's GStack? No. GStack is a Claude Code skill pack — opinionated tools that script the CEO/eng-manager/QA roles in Tan's daily workflow. GBrain is the memory system the GStack agents use. The two are designed to work together but ship as separate repos.

How does GBrain compare to Hindsight, Mem0, or Zep? GBrain is closer to a personal markdown-first knowledge system that an agent operates than to a multi-tenant memory layer like those products. Different design center, different audience. See GBrain alternatives for the breakdown.

Further Reading


GBrain is a remarkable piece of engineering and one of the most thoughtful agent memory designs released this year. If you run OpenClaw or Hermes, want to author the patterns your brain follows, and value markdown-as-source-of-truth, install it. If you want agent memory that just works for your stack with observations and mental models maintained automatically, evaluate Hindsight. Both are excellent at different jobs.