GBrain — persistent memory for AI Agents

Document type
Atlas
Updated
Reading time
13 min

GBrain is garrytan's Markdown-native agent memory system. Set up knowledge graphs, hybrid retrieval, Minions jobs, MCP and repeatable workflows.

SourceOpen original report
Document details
garrytan/gbrain
stars
20K
forks
2.8K
Data as of

GBrain is a Markdown-native knowledge-graph memory system open-sourced by Y Combinator President and CEO Garry Tan under MIT, written in TypeScript. AI Agents store meetings, emails, tweets, audio and ideas in an automatically linked knowledge graph, recover prior context through vector + keyword + RRF hybrid retrieval, and enrich entities overnight through the Postgres-native Minions queue, without requiring an external database server.

Production deployment scale
17,888PagesThe README reports a production deployment also tracking 4,383 people and 723 companies structurally.
Autonomous schedules
21Cron JobsUnattended background tasks use the Minions queue to resume after crashes.
Hybrid retrieval recall
97.9%R@5On a 240-page benchmark, P@5 is 49.1% and R@5 is 97.9%, exceeding vector-only or keyword-only retrieval.
License and stack
MITFully open-source TypeScript; choose embedded PGLite or Postgres / Supabase.

01Persistent Agent memory

Large context windows and cross-conversation memory gaps

  1. Memory and RAG differences

    Most Agent memory stores paragraphs in a vector database and retrieves them. GBrain adds automatic entity-relation extraction and typed links (attended, works_at, invested_in, founded, advises) without calling an LLM, making this layer inexpensive, deterministic and repeatable. Retrieval combines vectors, keywords and reciprocal rank fusion to return scored, sourced results.

  2. Markdown-native storage

    Every knowledge page is human-readable Markdown stored in git; the database is its index and graph layer. Storage tiers in gbrain.yml keep large machine-generated content such as transcripts and media in the DB and human-readable content in git, aligned incrementally with gbrain sync. Engines migrate both ways between embedded PGLite and Postgres / Supabase, avoiding dependence on one engine.

  3. Deterministic background work

    Minions is a Postgres-native queue with crash recovery and resumability; the README reports about 753ms for one minion task, compared with sub-agents often encountering gateway timeouts 10 seconds or longer, with $0 token cost for this deterministic work. The production deployment runs 21 cron jobs unattended through it.

02Graph · Retrieval · JobsMarkdown-Native

Capabilities

GBrain divides Agent memory into six areas: automatically linked knowledge graphs, hybrid retrieval, multimodal ingestion, Minions queues, modular skills and external MCP integration.

Capabilities

Knowledge graph · Hybrid retrieval · MINIONS · MCP

Rank 01/06

garrytan / gbrain

Automatically linked knowledge graph

Extract entity relations and create typed links without LLM calls

During import, GBrain extracts relations among people, companies and concepts into typed edges, attended, works_at, invested_in, founded and advises. Each page retains compiled facts and an append-only timeline, with entity ranking weighted by backlink count. Relation building is deterministic without an LLM, allowing reruns and batch backfills at almost zero cost; gbrain graph-query <slug> then traverses typed relations for reasoning-style queries.

  • ✓ No LLM calls
  • 5 typed edges
  • Compiled facts + timeline
  • Backlink weighting
  • graph-query
/
06
Edge Types
attended / works_at …
Per Page
Truth + Timeline
Cost
No-LLM

Rank 02

garrytan / gbrain · query

Vector + keyword + RRF hybrid retrieval

README benchmark: 240 pages, P@5 49.1%, R@5 97.9%

gbrain search uses tsvector keyword retrieval; gbrain query combines vector similarity, keyword hits and reciprocal rank fusion, returning scored and sourced results such as concepts/do-things-that-dont-scale (score: 0.94) [Source: paulgraham.com]. README benchmark scores are substantially higher than vector-only or keyword-only approaches.

  • vector + keyword
  • reciprocal rank fusion
  • scored + sourced
  • P@5 49.1% / R@5 97.9%
Commands
search · query
Benchmark
240-page set

Rank 03

garrytan / gbrain · recipes/

Multimodal ingestion and overnight enrichment

Meetings, emails, tweets, voice calls and raw ideas become graph nodes

GBrain includes ingestion workflows for meeting transcripts, Email, tweets, voice calls and articles. Import automatically extracts entities and relations, with scheduled overnight entity enrichment. Embeddings offer 14 recipes, including default OpenAI, Voyage, Google Gemini, Azure, local Ollama and llama.cpp, and LiteLLM proxy, supporting cloud or fully local operation.

  • meetings / emails / tweets
  • voice notes
  • overnight enrichment
  • 14 embedding recipes
Sources
5+ modalities
Embeddings
14 recipes

Rank 04

garrytan / gbrain · jobs

Minions: Postgres-native job queue

Crash recovery, resumability and deterministic execution; README reports about 753ms per task

Use Minions for background work to avoid sub-agent timeouts: gbrain jobs submit <name> triggers deterministic jobs, and gbrain jobs supervisor runs an automatically restarting worker with crash recovery. The README compares roughly 753ms minion completion with sub-agent gateway timeouts often 10 seconds or longer, reporting $0 token cost for this deterministic work and 100% task success.

  • Postgres-native
  • crash recovery
  • resumable
  • $0 token
Submit
jobs submit
Worker
jobs supervisor

Rank 05

garrytan / gbrain · skills/

Dozens of modular skills + router

Ingestion, enrichment, operations and research commands dispatched by RESOLVER.md

skills/ contains modular instructions, listed in the README as 30+ skills, for ingestion, enrichment, operations and research; skills/RESOLVER.md dispatches each request to a skill. gbrain skillify scaffold <name> generates 5 stubs for a new skill, gbrain skillpack install <name> deploys curated skill packs, and gbrain check-resolvable audits routing completeness.

  • 30+ skills
  • RESOLVER.md
  • skillify scaffold
  • skillpack install
Dispatcher
RESOLVER.md
Scaffold
5 stubs

Rank 06

garrytan / gbrain · serve

30+ tools exposed through MCP

Claude, Cursor and ChatGPT can call GBrain as a memory layer

GBrain exposes 30+ tools through Model Context Protocol, letting any MCP-compatible client read and write the memory system. For stdio, add { "command": "gbrain", "args": ["serve"] } to ~/.claude/server.json; use gbrain serve --http for production with OAuth 2.1 and a built-in admin dashboard. Subagent execution transcripts are also persisted.

  • 30+ MCP tools
  • stdio + HTTP
  • OAuth 2.1
  • admin dashboard
Local
gbrain serve
Production
serve --http

03Bun · PGLite · MCP~30 min to live

Installation and setup

Three installation paths serve Agents, CLI users and MCP clients, alongside engine selection, embedding providers and health checks.

Installation and setup

AGENT-NATIVE · CLI · MCP · ENGINE · EMBEDDINGS

Rank 01/06

garrytan / gbrain · INSTALL_FOR_AGENTS.md

Agent-readable installation instructions

Paste a raw URL into OpenClaw / Hermes for a working setup in about 30 minutes

This is the README's recommended path: have the Agent fetch and follow INSTALL_FOR_AGENTS.md. Prerequisites are Git, Bun runtime, OPENAI_API_KEY required for vector retrieval, and optional ANTHROPIC_API_KEY to improve retrieval quality. The instructions guide cloning, bun install && bun link, gbrain init, gbrain doctor --json, import and indexing, graph backfill, core-skill loading and recurring sync / auto-update / dream cycle / doctor jobs.

  • ✓ README recommendation
  • OpenClaw / Hermes
  • ~30 min
  • OPENAI_API_KEY
  • ANTHROPIC_API_KEY (optional)
/
06
Prereqs
Git + Bun
Required
OPENAI_API_KEY
Time
~30 min

Rank 02

garrytan / gbrain · CLI

Standard CLI installation

git clone → bun install → bun link → gbrain init; a local memory system in two seconds

Run git clone https://github.com/garrytan/gbrain.git && cd gbrain && bun install && bun link, then gbrain init to create a local PGLite brain in roughly two seconds. gbrain import ~/notes/ indexes markdown idempotently for safe reruns, gbrain query "your question" performs hybrid retrieval, and gbrain get|put|delete <slug> reads or writes individual pages.

  • Bun runtime
  • gbrain init
  • idempotent import
  • get / put / delete
Install
bun install + link
First Brain
~2s (PGLite)

Rank 03

garrytan / gbrain · MCP

Connect an MCP server

One stdio configuration for Claude Code; HTTP for production

Locally, add "gbrain": { "command": "gbrain", "args": ["serve"] } under mcpServers in ~/.claude/server.json so Claude Code, Cursor, ChatGPT and other MCP-compatible clients can call 30+ tools. Production uses gbrain serve --http with an OAuth 2.1 server and admin dashboard.

  • ~/.claude/server.json
  • gbrain serve
  • serve --http
  • OAuth 2.1 + admin
Local
stdio (serve)
Production
--http

Rank 04

garrytan / gbrain · engines

Engine selection and bidirectional migration

Start with embedded PGLite without setup; scale to Postgres / Supabase

The default embedded PGLite requires no external database server. Scale with gbrain migrate --to supabase to Postgres / Supabase, and return with gbrain migrate --to pglite. Bidirectional migration lets you finish locally on a laptop before deciding on cloud deployment, without being locked to either engine.

  • PGLite (default)
  • Postgres / Supabase
  • migrate --to
  • Bidirectional
Default
PGLite (embedded)
Scale
Postgres / Supabase

Rank 05

garrytan / gbrain · recipes/

14 embedding provider recipes

Ready-made settings for cloud, enterprise or fully local execution

The 14 embedding recipes include default OpenAI, Voyage, Google Gemini, Azure, local Ollama and llama.cpp, plus LiteLLM proxy for multiple models. Switch providers by choosing a recipe without code changes; fully local operation is available for teams whose data cannot leave their jurisdiction.

  • OpenAI (default)
  • Voyage / Gemini / Azure
  • Ollama / llama.cpp (local)
  • LiteLLM proxy
Recipes
14
Local
Ollama / llama.cpp

Rank 06

garrytan / gbrain · doctor

Health checks and routing audits

gbrain doctor repairs issues; check-resolvable checks skill routing completeness

gbrain doctor performs health checks with optional automatic repair; gbrain doctor --json suits scripts or CI. gbrain check-resolvable audits routing completeness to confirm every request has a corresponding skill, especially as skillify adds more skills.

  • doctor + auto-repair
  • --json
  • check-resolvable
Health
gbrain doctor
Routing
check-resolvable

04POWER-USER PATTERNS · gbrain.yml · MINIONS · CI

README advanced operations

Advanced uses

These extend the basic workflow: storage tiers, choosing minions or subagents, graph backfills, regression checks with eval replay and navigation files for other Agents to read the memory system.

Rank 01

garrytan / gbrain · gbrain.yml

Storage tiers for the database and git

Machine-generated bulk content in the database; human-readable content in git

In gbrain.yml, set storage.db_tracked for paths such as people/ and companies/ stored in both DB and git, and storage.db_only for media/x/ and meetings/transcripts/ stored only in DB. This keeps transcripts and media from making git excessively large while retaining human-readable core pages.

  • db_tracked / db_only
  • Keep git manageable
  • gbrain.yml
Config
storage:
Split
tracked / only

Rank 02

garrytan / gbrain · jobs

Minions deterministic background work

README comparison: minion about 753ms vs sub-agent gateway timeout 10 seconds or longer

Submit deterministic, repeatable background work with gbrain jobs submit <name>, then run gbrain jobs supervisor as a worker that restarts automatically and recovers from crashes. Compared with timeout-prone sub-agents, this is faster, has 100% success and incurs $0 token cost for deterministic work.

  • jobs submit
  • jobs supervisor
  • $0 token
Submit
jobs submit
Worker
jobs supervisor

Rank 03

garrytan / gbrain · extract

Existing brain graph backfills

Build links and timelines from the DB without reimporting

For existing pages with incomplete graphs, use gbrain extract links --source db and gbrain extract timeline --source db to backfill typed relations and timelines; run gbrain extract all for everything. This relation-building layer uses no LLM, making backfills deterministic and repeatable.

  • extract links
  • extract timeline
  • --source db
Backfill
extract all
Source
db

Rank 04

garrytan / gbrain · evals/

eval replay retrieval-quality checks

BrainBench-Real stores de-identified real queries; check before code changes

gbrain eval replay checks earlier captured benchmarks for retrieval-quality regressions after code changes. BrainBench-Real stores real queries and scrubs PII for a test set. Integrate it into CI to avoid unnoticed recall regressions during retrieval refactoring.

  • eval replay
  • BrainBench-Real
  • PII scrubbing
Gate
eval replay
Suite
BrainBench-Real

Rank 05

garrytan / gbrain · sync

git and brain incremental alignment

Use sync to update the index after editing markdown

gbrain import handles initial or full indexing; gbrain sync performs incremental git-to-brain updates. When you or another tool edits markdown directly, sync updates the index and graph without a full rerun. The README-recommended 15-minute sync schedule keeps the brain aligned with git.

  • gbrain sync
  • git-to-brain
  • Incremental
Full
gbrain import
Incremental
gbrain sync

Rank 06

garrytan / gbrain · AGENTS.md

Integration for other Agents

llms.txt / llms-full.txt navigate for LLMs; AGENTS.md serves non-Claude clients

llms.txt and llms-full.txt help LLMs establish an overview, AGENTS.md provides the integration protocol for non-Claude Agents, and skills/RESOLVER.md dispatches skills. Start with these three files for the fastest integration into Cursor, Windsurf or a custom Agent.

  • llms.txt / llms-full.txt
  • AGENTS.md
  • RESOLVER.md
Nav
llms.txt
Non-Claude
AGENTS.md

05Cron · Graph · SkillifyProduction-Proven

Practical workflows

Combine capabilities into repeatable workflows: autonomous overnight enrichment, personal-note import and sync, graph queries, turning ad hoc fixes into skills, regression checks and retrieval questions.

Practical workflows

CRON · IMPORT · GRAPH · SKILLIFY · QUERY

Rank 01/06

garrytan / gbrain · cron

Overnight autonomous enrichment

README production deployment: 21 cron jobs running unattended

Connect GBrain to an autonomous Agent and schedule sync roughly every 15 minutes, daily auto-update, a nightly dream cycle to enrich entities, and weekly doctor checks; execute through gbrain jobs supervisor, which recovers from crashes. The README's production deployment continuously tracks 17,888 pages, 4,383 people and 723 companies, with 21 cron jobs, roughly 753ms minion completion and 100% task success, all without human monitoring.

  • ✓ Production verified
  • 21 cron jobs
  • dream cycle
  • jobs supervisor
  • 100% success
/
06
Cron Jobs
21
Tracked
17,888 pages
Mode
Autonomous

Rank 02

garrytan / gbrain · import

Existing notes import and indexing

init → import → extract all → query; search your markdown in minutes

The lowest-barrier path starts with gbrain init for a local PGLite brain, gbrain import ~/notes/ to index markdown idempotently for safe reruns, and gbrain extract all for typed links and timelines. Then use gbrain query "..." for hybrid retrieval across all notes, and attach gbrain sync for continued synchronization.

  • gbrain init
  • import ~/notes/
  • idempotent
  • extract all
First Brain
~2s
Index
idempotent

Rank 03

garrytan / gbrain · graph-query

Reasoning-style knowledge graph queries

Follow relationships beyond finding related passages

gbrain graph-query <slug> traverses typed relations: follow a person's works_at edge to a company and its other people, or a meeting's attended edges to participants. Each page has compiled facts and an append-only timeline; backlink-weighted entity ranking makes frequently referenced nodes easier to retrieve.

  • typed traversal
  • compiled truth + timeline
  • backlink-boosted
Command
graph-query
Ranking
backlink-boosted

Rank 04

garrytan / gbrain · skillify

Ad hoc fixes as skills

One-off hack → permanent, tested skill with verifiable routing

Skillify turns manual fixes into reusable capabilities: gbrain skillify scaffold <name> generates a new skill with 5 stubs. Complete content and tests against the conformance checklist, verify routing with gbrain check-resolvable, and optionally deploy curated skill packs through gbrain skillpack install. The same situation then avoids another manual fix.

  • skillify scaffold
  • 5 stubs
  • conformance checklist
  • check-resolvable
Scaffold
5 stubs
Verify
check-resolvable

Rank 05

garrytan / gbrain · serve --http

Multi-Agent shared memory

gbrain serve --http starts an OAuth 2.1 server with a built-in admin dashboard

For teams or multiple Agents, gbrain serve --http exposes memory with OAuth 2.1 and an admin dashboard. Any MCP-compatible client, including Claude Code, Cursor and ChatGPT, can call its 30+ tools to read and write shared knowledge; subagent execution transcripts persist for later review.

  • serve --http
  • OAuth 2.1
  • admin dashboard
  • 30+ MCP tools
Server
serve --http
Auth
OAuth 2.1

Rank 06

garrytan / gbrain · query

Hybrid retrieval queries

gbrain query "what themes appear across my notes?" → scores and sources

Run gbrain query "..." for ranked, sourced hybrid retrieval results, such as concepts/do-things-that-dont-scale (score: 0.94) — PG 關於從不可規模化的努力中學習的論點 [Source: paulgraham.com, 2013-07-01]. Each source makes answers traceable instead of generated without evidence.

  • gbrain query
  • scored results
  • Sources included
Command
gbrain query
Output
scored + sourced

06Choose by role

Four GBrain adoption paths

Action plan

Start with one path for your situation: a personal knowledge base, team shared memory, autonomous Agent schedules or product integration. Each uses README commands; installing everything at once is unnecessary.

01 · Personal knowledge base · PERSONAL

Run CLI locally before choosing cloud deployment

git clone → bun install && bun link → gbrain init creates embedded PGLite memory in roughly two seconds. Index ~/notes/ with gbrain import, build the graph with gbrain extract all, then use gbrain query. No database server is required; scale later with gbrain migrate --to supabase.

02 · Team shared memory · TEAM

serve --http memory service with OAuth

Switch to Postgres / Supabase and run gbrain serve --http with OAuth 2.1 and an admin dashboard, sharing 30+ memory tools among MCP-compatible team clients. Storage tiers keep transcripts in DB and core pages in git, while subagent transcripts persist as well.

03 · Autonomous Agent · AUTONOMOUS

Share INSTALL_FOR_AGENTS.md with OpenClaw / Hermes

Prepare Git, Bun and OPENAI_API_KEY, with optional ANTHROPIC_API_KEY. Have the Agent follow INSTALL_FOR_AGENTS.md to install and schedule sync / auto-update / dream cycle / doctor, then execute through gbrain jobs supervisor; the README's production deployment runs 21 cron jobs unattended this way.

04 · Product integration · ENGINEERING

Add eval replay to CI and use skillify regularly

For long-term product memory, use gbrain eval replay with BrainBench-Real as a regression check to prevent retrieval changes from reducing scores. Turn one-off fixes into tested skills with gbrain skillify scaffold and verify routing through gbrain check-resolvable, improving stability as the system is used.