Transcript
@garrytan open-sourced his production AI infrastructure: 17,888 pages, 4,383 people dossiers, 723 companies. Here's the architecture.
Garry Tan (President & CEO @ycombinator) made public 17,888 pages of his brain. His production system consists of 4,383 people dossiers, 723 companies, 21 autonomous cron jobs created within a span of 12 days. In the first 24 hours this was able to collect over 5,400+ GitHub stars.
It’s a personal knowledge layer for AI agents. By default, all agents are stateless, that is each session begins blank. GBrain provides a structured, searchable long-term memory for each session using an embedded Postgres database and a git-tracked Markdown corpus. The agent uses the brain prior to answering questions and updates the knowledge base with new information following each session. The knowledge grows exponentially.
MIT licensed. TypeScript, runs on Bun. v0.10.1.
Repo snapshot
Three-layer architecture
Brain Repo: A git-backed directory of Markdown files, one per person, company, project, or idea. The repo is the system of record. Edit any file manually and gbrain sync picks up the changes. Tan's own instance includes 13 years of calendar data, 280+ meeting transcripts, and 300+ captured ideas.
Retrieval Layer: Postgres with pgvector. The CLI and MCP server are both generated from a single contract-first interface (src/core/operations.ts, ~30 shared operations). Two pluggable engines: PGLite (embedded Postgres 17.5 via WASM, zero config, boots in 2 seconds) is the default. For corpora over 1,000 files, gbrain migrate --to supabase moves everything to a managed Postgres instance. Migration is bidirectional.
Skills Layer: 25 Markdown skill files organized by RESOLVER.md. The architecture philosophy is "thin harness, fat skills": executable TypeScript handles deterministic operations (search, embed, import, sync). The agent model handles judgment-dependent tasks by reading the skill file and executing it. Skills are plain text and modifiable without touching compiled code.
GBrain is designed as a companion to GStack, Tan's earlier coding-focused agent framework. GStack handles code skills. GBrain handles everything else: memory, enrichment, ingestion, scheduling, and identity.
The knowledge model
Every brain page follows a compiled truth + timeline pattern:
Above the divider: compiled truth, the current best understanding. Gets rewritten when new evidence changes the picture. Below: timeline, append-only evidence trail. Never edited, only extended.
Entity enrichment is tiered and automatic. A person mentioned once gets a stub page (Tier 3). After 3 mentions across different sources, they get web and social enrichment (Tier 2). After a meeting or 8+ mentions, full enrichment pipeline (Tier 1). No manual tagging.
A fail-improve loop runs in the background (src/core/fail-improve.ts): every LLM fallback is logged, and better regex patterns are generated from the failures. gbrain doctor shows the trajectory: "intent classifier: 87% deterministic, up from 40% in week 1."
The search pipeline
Six steps from query to results:
Intent classifier: zero-latency regex, no LLM call. Detects query type: entity, temporal, event, or general. Routes accordingly.
Multi-query expansion: Claude Haiku generates query variants to improve recall.
Parallel retrieval: vector search (HNSW cosine) runs alongside keyword search (tsvector).
RRF fusion: reciprocal rank fusion merges both result lists into a single ranked set.
Compiled truth boost + cosine re-scoring: entity queries get compiled truth chunks ranked higher. Temporal queries skip the boost to surface timeline dates instead.
4-layer dedup: guarantees at least one compiled truth chunk per page in results.
PR #64 (shipped April 14, 2026) benchmarked the pipeline against a 29-page synthetic corpus running in-memory PGLite:
These numbers are from a 29-page corpus. Tan's production brain is 17,888 pages. Performance at that scale is not publicly benchmarked.
The intent classifier is the critical piece. Running the compiled truth boost without it drops source accuracy to 63.2%, because it forces assessment chunks above timeline entries even when the query is asking for dates. The classifier restores accuracy at zero latency by detecting temporal queries and skipping the boost for them.
An eval harness ships with the repo. gbrain eval --qrels queries.json measures P@k, R@k, MRR, and nDCG@k. A/B config testing is built in.
How to get started
Agent path (recommended). If you are already on OpenClaw or Hermes, paste one URL into your agent:
The agent clones the repo, installs GBrain, loads the 25 skills, and registers cron jobs. You answer questions about API keys. About 30 minutes.
Standalone CLI path:
MCP path (Claude Code, Cursor, Windsurf):
Add to ~/.claude/server.json for Claude Code, or Settings > MCP Servers in Cursor. GBrain exposes 30+ MCP tools over stdio.
Data ingestion runs through 7 integration recipes: Gmail, Google Calendar, X/