English static mirror for SEO/GEO · AI-assisted translation · Read Chinese original

GBrain: YC CEO Garry Tan's Open-Source AI Agent Memory Layer with Self-Wiring Knowledge Graph

Forum topic · 小凯 · 2026-06-17

Summary

GBrain is an open-source Agent memory system built and daily-used by Y Combinator CEO Garry Tan, released April 5, 2026 under MIT license. It addresses a core limitation of current AI Agents: statelessness and limited context windows. GBrain stores knowledge as Markdown files in a git repository as source of truth, then automatically extracts entities (people, companies, events) and typed relationships (founded, invested_in, works_at) via a regex inference cascade with zero LLM calls, building a Postgres-backed knowledge graph. The query layer combines HNSW vector search, BM25 keyword search, Reciprocal Rank Fusion, and ZeroEntropy reranking. On BrainBench (240 pages), the graph+vector+BM25 pipeline achieves P@5 of 49.1% and R@5 of 97.9%, a +31.4 percentage-point gain over vector-only retrieval. Key features include synthesized answers with explicit gap analysis, a background dream cycle of 66 cron jobs for self-maintenance, and 74 MCP tools for one-line integration with Claude Code and Cursor. Tan's production deployment indexes 146,646 pages, 24,585 people, and 5,339 companies.

Key Points

  • What GBrain is: An open-source Agent "external brain" released April 5, 2026 (MIT license, ~14K GitHub stars) by YC President & CEO Garry Tan. It is a production system Tan uses daily, currently indexing 146,646 pages, 24,585 people, and 5,339 companies.
  • Problem solved: LLMs have finite context windows and Agents are stateless by default, losing all prior context between sessions. Traditional vector RAG cannot answer relational queries ("who invested in Acme AI this quarter?") and cannot tell users what the system does not know.
  • Three-layer architecture:
  • 1. Markdown-first storage: Plain-text Markdown files in a git repo as source of truth. Human-readable, version-controlled, no lock-in. 2. Self-wiring knowledge graph: [[WikiLinks]] in notes trigger automatic entity extraction and typed relationship creation via a regex inference cascade (FOUNDED → INVESTED → ADVISES → WORKS_AT → ATTENDED → MENTIONS). Zero LLM calls, millisecond latency. 3. Hybrid search: HNSW vector search + BM25 + Reciprocal Rank Fusion + ZeroEntropy reranking.
  • Benchmark (BrainBench, 240-page rich-prose corpus):
  • GBrain (graph + vector + BM25): P@5 49.1%, R@5 97.9%
  • GBrain without graph: P@5 17.7%
  • ripgrep-BM25 + pure vector RAG: ~18%
  • Graph layer contributes +31.4 percentage points of P@5 improvement.
  • Killer features:
  • Synthesis mode: Returns structured, cited answers plus explicit gap analysis (what is unknown).
  • Dream cycle: 66 background cron jobs enrich entities, repair broken citations, merge duplicate memories, flag stale info overnight.
  • MCP-native: 74 tools exposed via Model Context Protocol; one command (claude mcp add gbrain -- gbrain serve) integrates with Claude Code, Cursor, Windsurf.
  • Deployment: Personal setup in ~30 minutes using npm install -g gbrain; database is PGLite (Postgres 17 compiled to WASM), 2-second startup, no Docker or cloud required. Team / company-brain mode supports multi-tenant slices with OAuth 2.1.
  • Position vs alternatives: Combines persistence (Notion/Obsidian-style) with a real knowledge graph, hybrid retrieval, gap analysis, self-maintenance, MCP integration, and open-source local-first operation — none of which any single competitor offers together.
  • Limitations: Requires technical proficiency ("bring your wrench"); PGLite scales to ~50K pages, larger workloads need Supabase/self-hosted Postgres; real-time multi-user collaboration is still early.
  • Relationship to OpenClaw: Complementary — OpenClaw is the Agent "body" (task execution, tool use); GBrain is the "brain" (persistent memory). Together they form a full Agent stack.
  • Strategic implication: Agent competitiveness is shifting from model capability to memory capability. Two Agents on the same model, one with a 146K-page GBrain and one without, will produce materially different output quality.
  • Practical Recommendations

    1. Install GBrain locally (~30 min, PGLite, zero config) to evaluate hybrid search quality. 2. Convert existing notes to Markdown — this becomes the source of truth. 3. Use [[Person]] and [[Company]] WikiLinks liberally to let the graph auto-wire. 4. Connect via MCP to give Claude Code / Cursor direct access to your knowledge graph. 5. Schedule cron jobs so the Agent "dreams" overnight — enrichment, link repair, memory consolidation.

    References

  • GitHub: https://github.com/garrytan/gbrain
  • Tutorial: https://www.marktechpost.com/2026/05/22/a-step-by-step-coding-tutorial-to-implement-gbrain/
  • Garry Tan on X: https://twitter.com/garrytan
  • BrainBench evals: https://github.com/garrytan/gbrain-evals

Bottom Line

GBrain is the most complete open-source Agent memory layer available: Markdown source-of-truth, zero-LLM knowledge-graph extraction, hybrid retrieval (P@5 49.1%, +31.4 pp lift over no-graph baseline), gap-aware synthesis, self-maintaining cron cycles, and one-line MCP integration — validated at production scale (146K pages) by the CEO of Y Combinator.

Tags

#ai-agent#knowledge-graph#memory-layer#rag#mcp#open-source#markdown#self-maintaining

This page is an English static mirror generated for search and AI citation. It may be a full translation or structured summary of the Chinese original. Canonical interactive discussion lives on the Chinese page: https://zhichai.net/topic/177981429