# gbrain

> A shared memory for AI agents that stores sourced facts and answers with citations

- Repository: https://github.com/garrytan/gbrain
- Category: Memory, RAG & data
- Stars: 31,083 · Forks: 4,653 · Language: TypeScript · License: MIT
- Experience: Some experience
- Page: https://ir.adyog.com/repos/garrytan/gbrain/

Agents forget things between chats, and most note-search tools only hand back a list of pages to read yourself. GBrain stores explicit facts with their sources, lets you correct or withdraw them, and makes the same memory available to several agents.

You can start with keyless memory and keyword retrieval. Later you can add semantic search, a synthesis layer that writes a cited answer and says what the brain doesn't know yet, and a typed knowledge graph for questions like who works at a company. Agents connect over MCP or through guided installs, and the brain can run on your own machine, reachable over Tailscale.

The author, Garry Tan, runs it as the memory behind his own OpenClaw and Hermes agents, with background jobs that ingest and enrich data overnight. That always-on mode costs the most, since it needs a server and API usage. The README notes that its benchmark numbers compare whole systems and are not a general guarantee.

## What it does

- **Sourced, correctable memory**: Facts are saved with their sources and can be corrected or withdrawn. Durable facts are shared across agents, while transient task state stays local.
- **Keyless start**: Memory with keyword retrieval works without API keys. Semantic search, reranking, extraction and synthesis are optional and use providers you configure.
- **Cited synthesis with gaps**: An optional layer writes a prose answer with citations and notes what the brain doesn't know yet, instead of returning raw chunks.
- **Typed knowledge graph**: Local page writes can extract references into a graph when auto-linking is on, so you can ask relationship questions. Remote writes need maintenance or explicit link calls.
- **Remote and shared access**: One command, gbrain mcp expose, publishes the brain over MCP on a Tailscale tailnet. Remote clients are limited by source and operation grants, with documented limits.

## What you could build

- Add persistent, correctable memory to Codex or Claude Code across conversations.
- Prepare for a meeting by asking for a cited summary of a person, open items, and what is missing.
- Run an always-on agent that ingests meetings, email and notes and enriches people and company pages overnight.
- Share one memory between several agents by exposing it over MCP on your tailnet.
- Set up a company brain with source-level and operation-level access grants.

## Who it's for

Suits people who already use a coding or personal AI agent and want durable memory; you should be comfortable with a terminal, Bun, and the idea of MCP.

## Get started

Don't install from npm, because the package named gbrain there is unrelated. Install from GitHub with Bun 1.4.0 or newer, or paste the README's prompt into your existing agent so it follows INSTALL_FOR_AGENTS.md. It starts keyless and verifies a remember, recall, correct and withdraw round trip.

```
bun install -g github:garrytan/gbrain
```

Tags: agent-memory, mcp, knowledge-graph, claude-code, typescript
