
Gbrain
Portable, source-backed memory for your AI agents
Replaces Mem0, Zep

Who it's for
A developer or founder who uses Claude Code, Codex, or ChatGPT daily runs GBrain to persist meeting notes, research, and decisions across sessions. Before a call, they ask the agent about a contact and receive a cited summary of open items, last contact date, and what the brain does not yet know, in seconds.
you only use a single agent and its native context window is sufficient for your workload
A 10 to 50-person team connects a shared GBrain instance backed by Postgres with pgvector. Authenticated remote clients access it over MCP with source and operation grants. Meeting notes, Slack digests, and customer context accumulate in one queryable store rather than scattered across individual agents.
your team already has a well-integrated knowledge base and does not use AI agents heavily
An investor with hundreds of founder relationships runs GBrain to ingest meetings, emails, and notes into typed person and company pages. `gbrain think` synthesizes meeting prep in seconds, surfacing open commitments, last contact dates, and hiring signals with citations.
your deal volume is low enough to manage with a single CRM and manual notes
An operator running OpenClaw or Hermes on a dedicated server points it at GBrain for persistent memory. The overnight dream cycle deduplicates, enriches, and consolidates the brain while the agent sleeps, so each morning's context is richer than the night before.
you do not have a server with 8 GB or more of RAM available for always-on operation
The problem
AI agents lose all context between sessions and cannot share what they learn across different tools. Native memory in products like Claude or Cursor is siloed, opaque, and cannot be corrected or audited. When you use multiple agents across a workday, each one starts cold, forcing you to repeat context, re-explain relationships, and manually reconcile what different tools know about the same people, companies, and projects.
How it works
Every fact is stored with its source page. Facts support explicit correction and withdrawal, so the brain stays accurate rather than accumulating stale claims with no way to fix them.
`gbrain search` ranks pages by vector + keyword + RRF + source-tier boost + reranker. `gbrain think` runs the same retrieval and then composes a cited answer with a gap analysis that tells you what the brain does not know yet, so you act on evidence rather than guessing at completeness.
Trusted local page writes extract typed relationships via pattern matching, with no LLM calls required. Breadth-first graph walks are measured in milliseconds on dense clusters. On BrainBench, relationship retrieval lifts R@5 from 0.6626 to 0.7241.
`gbrain setup claude-code` or `gbrain setup codex` wires the brain into your existing agent via MCP stdio. `gbrain mcp expose` publishes it on a Tailscale tailnet for cloud agents like ChatGPT and Grok Bot. Per-client guides cover Claude Code, Codex, ChatGPT, Cursor, Perplexity, Hermes, OpenClaw, and others.
The default `gbrain-base-v2` pack defines 15 canonical types. `gbrain schema detect` clusters your actual filesystem into proposed types, `gbrain schema suggest` refines them with an LLM pass, and `gbrain schema review-candidates --apply` promotes the ones you accept.
Cron-driven enrichment runs overnight: deduplicating people pages, fixing citations, scoring salience, and surfacing contradictions. The cycle runs on your own hardware, your own database, and your own API keys.
Features
- Sourced, corrigible memory
- Hybrid retrieval with synthesis
- Typed knowledge graph
- MCP-native multi-agent access
- Schema packs for any knowledge shape
- 24/7 dream cycle
How to install
bun install -g github:garrytan/gbrain#stable gbrain setup claude-code # or: gbrain setup codex gbrain init --pglite --no-embedding
Recommended for this setup
Strengths
- Works with the agents you already use: GBrain attaches to an existing agent identity over MCP rather than requiring a new one. It supports Claude Code, Codex, ChatGPT, Cursor, Windsurf, Perplexity, Hermes, OpenClaw, Grok Build, Grok Bot, and Muse through per-client setup guides.
- Zero-config start, production-scale ceiling: PGLite (Postgres 17 via WASM) requires no server or Docker and handles personal brains up to roughly 50K pages. The same BrainEngine contract scales to Postgres with pgvector on Supabase or self-hosted for shared or large deployments.
- Keyless entry point: Keyword search and core memory operations require no model API key. Cloud embedding, reranking, extraction, and synthesis are opt-in additions. The brain is usable immediately after `gbrain init --pglite --no-embedding`.
- Gap analysis as a first-class output: `gbrain think` explicitly notes when a page is stale, when a claim is uncited, when two pages contradict each other, and when there is a hole to fill. This turns retrieval into actionable preparation rather than a pile of pages to read.
Trade-offs
- Always-on enrichment needs dedicated compute: The 24/7 dream cycle and background ingestion require a server with 8 GB or more of RAM running continuously with its own API configuration. The brain is useful without it, but the overnight enrichment loop that keeps it sharp is not a lightweight addition.
- Not distributed on npm: GBrain must be installed via `bun install -g github:garrytan/gbrain#stable`. The `gbrain` package on npm is unrelated and can shadow the real binary. Bun 1.4.4 or newer is required; the project does not support npm or yarn installs.
- Markdown export is not a full backup: DB-only pages, unresolved facts, history, and operational state live only in the database. A Markdown export preserves the file-backed subset but not the full brain. Teams sharing a Postgres instance need a database backup strategy separate from the repository.
- Shared access requires careful trust boundary setup: Authenticated remote clients are constrained by source and operation grants plus visibility filters, but local files and shared database credentials are a different trust boundary. The authorization tests cover specific access paths, not a universal no-leak guarantee. The sharing boundaries documentation must be read before setting up multi-user access.
Tech stack
FAQ
No. GBrain attaches to an existing agent over MCP without replacing its identity or instructions. The recommended setup is to run `gbrain setup claude-code` or `gbrain setup codex`, which wires GBrain into an agent you already use rather than creating a new one.
In keyless mode, GBrain runs keyword search and core memory operations without any model API key. You can remember and recall facts immediately after `gbrain init --pglite --no-embedding`. Semantic search, synthesis, and background enrichment require configuring embedding and chat providers separately.
Yes. `gbrain mcp expose` publishes the brain on a Tailscale tailnet so cloud agents like ChatGPT, Grok Bot, and Muse can reach it. For team brains, a Postgres backend with pgvector supports multiple authenticated remote clients constrained by source and operation grants.
Install only via `bun install -g github:garrytan/gbrain#stable`. The `gbrain` package on npm is unrelated and can shadow the real binary. Never run `npm install -g gbrain` or `bun add -g gbrain`. If the wrong package was installed, run `gbrain doctor` for the fix.
`gbrain search` returns the top pages ranked by hybrid scoring (vector + keyword + RRF + source-tier boost + reranker) with no answer generation. `gbrain think` runs the same retrieval and then composes a synthesized, cited answer that also includes a gap analysis noting stale pages, uncited claims, contradictions, and missing information.