GBrain: Garry Tan's Open-Source AI Agent Brain With Self-Wiring Knowledge Graph
GBrain is an open-source AI agent memory system built by Garry Tan, President and CEO of Y Combinator, to power his personal agents in production. It features a self-wiring typed knowledge graph, hybrid vector + graph search with P@5 of 49.1%, and a fully autonomous doctor command that optimizes brain health without human intervention.

What Is GBrain?
GBrain is an open-source AI agent memory system built by Garry Tan — President and CEO of Y Combinator — to run his actual AI agents. It's not a demo or prototype: the production brain currently manages 146,646 pages, 24,585 people, 5,339 companies, and 66 cron jobs running autonomously.
The core thesis: your AI agent is smart but forgetful. GBrain gives it a brain that wires itself.
How the Knowledge Graph Self-Wires
Every page write to GBrain automatically extracts entity references and creates typed links — attended, works_at, invested_in, founded, advises — with zero LLM calls. The graph builds itself as the agent ingests content, meaning:
- Ask "who works at Acme AI?" and get answers vector search alone can't reach
- Ask "what did Bob invest in this quarter?" and get structured timeline results
- Backlink-boosted ranking surfaces the most-connected knowledge automatically
Benchmark Performance
GBrain has been benchmarked against standard retrieval baselines on a 240-page Opus-generated rich-prose corpus:
- P@5: 49.1%, R@5: 97.9% — full hybrid graph mode
- +31.4 points P@5 over graph-disabled variant
- Outperforms ripgrep-BM25 + vector-only RAG by a similar margin
The default embedding model as of v0.36.2.0 is ZeroEntropy (zembed-1 at 1280d via Matryoshka), which is 2.2× faster and 2.6× cheaper than OpenAI embeddings while winning 11 of 20 head-to-head queries.
Autonomous Brain Maintenance
GBrain v0.36.4.0 introduced an autonomous health optimization loop:
gbrain doctor --remediate --yes --target-score 90 --max-usd 5
This single command computes a dependency-ordered remediation plan, submits each phase as a background job, re-checks the brain health score between steps, and refuses to exceed a user-defined cost cap. Cron can run it unattended nightly.
Installation
GBrain installs in under 30 minutes and runs in three modes: as a skillpack scaffold for agent platforms (OpenClaw, Hermes), as a standalone CLI, or as an MCP server for any MCP-compatible client (Claude Code, Cursor, Windsurf). PGLite mode requires no server or Docker — database ready in 2 seconds.
bun install -g github:garrytan/gbrain
gbrain init --pglite
gbrain doctor
Full documentation at github.com/garrytan/gbrain.
Enjoyed this?
Get more posts like this delivered to your inbox.
Google Open-Sources AX: A Distributed Agent Runtime Built for Reliability and Resumption
Next →Khala 1.0: The Open-Source Music Generation Model From Beijing's Central Conservatory
Related Articles
Datalab Launches Marker 2.0: An Open-Source PDF-to-Markdown Tool Built for RAG Pipeline
5 min read
Microsoft Announces v2.0 of Official MCP C# SDK: Stateless by Default & Interactive via MRTR
4 min read