GBrain is an MIT-licensed memory layer that existing AI agents can share over MCP
The GBrain README describes a self-hosted agent memory that stores facts with their sources, supports corrections, and starts keyless with keyword retrieval before optional semantic search.
What it is
GBrain, from the garrytan/gbrain repository, is a TypeScript project under the MIT license that gives an AI agent a memory its user controls. The README says it stores explicit facts with their sources, supports corrections and withdrawal, and makes the same memory available across agents. It starts with keyless memory and keyword retrieval; semantic search, synthesis and background enrichment are optional additions. GBrain is free to self-host, and gbrain.io is optional paid hosting.
The repository was created on 2026-04-05. In the GitHub trending snapshot it had 32068 stars, 215 of them gained in the last day, and 4761 forks; those figures are a point-in-time snapshot. The maintainer describes GBrain as the production brain behind their own OpenClaw and Hermes deployments, which the README puts at 155,795 pages, 24,589 people and 5,340 companies, with 66 cron jobs running autonomously.
Setup options
The README lists three routes: add GBrain to an agent you already use (the recommended one, with guides for Grok Bot, Muse, and Codex / Claude Code), publish a local brain over MCP on a Tailscale tailnet with gbrain mcp expose, or connect an existing hosted brain. Self-hosting needs Bun 1.4.4 or newer:
bun install -g github:garrytan/gbrain#stable
gbrain setup claude-code # or: gbrain setup codex
gbrain init --pglite --no-embedding # any other harness, or no agent
The README warns that GBrain is not distributed on npm: the npm gbrain package is unrelated and can shadow the real binary. gbrain setup shows what it will write first, with --dry-run to preview and --remove to undo. It wires MCP, hooks and a brain-first block into the agent’s instruction file, which --no-instructions skips, and then smoke-tests them. The stated reason for that block is that agents seldom call an MCP server nobody told them about.
Without an agent, a standalone CLI path indexes markdown notes:
gbrain init --pglite --no-embedding # keyless; no server, no Docker
gbrain import ~/notes/ --no-embed # index your markdown
gbrain search "a phrase from a note" --json
gbrain doctor # verify health
Retrieval, synthesis and the graph
Beyond keyword and semantic retrieval, the README describes two optional layers. A synthesis layer returns cited prose across people, companies, deals and ideas, with an explicit note on what the brain does not know yet. A typed knowledge graph extracts references from trusted local page writes without LLM calls when auto-linking is enabled, and answers relationship questions with breadth-first walks. On BrainBench relationship questions, the README reports that relationship retrieval lifts production R@5 from 0.6626 to 0.7241, and notes that 0.9791 is the graph-oracle-parse upper bound, not a product score.
Boundaries the README spells out
The documentation is explicit about limits. For shared company brains, 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, and the authorization tests exercise specific access paths rather than giving a universal no-leak guarantee. Configured cloud embedding, reranking, extraction and synthesis providers can receive text, and the harness model sees recalled memory even in keyless mode. Markdown export is not a full database backup. Always-on ingestion and the overnight dream cycle need a server with 8GB+ RAM and their own API usage.
Source: garrytan/gbrain on GitHub