A graph-database-backed memory CLI that gives AI coding agents persistent memory with linked relationships across sessions.
garrytan/gbrain
A self-hosted memory layer for AI agents that stores explicit facts with sources and shares one brain across agents, MCP clients and the CLI.
- Stars
- 31,617
- Forks
- 4,710
- Open issues
- 566
- Last commit
- 1 hour ago
What is it?
GBrain gives an AI agent a persistent memory that you control. It stores facts as Markdown pages with their sources, supports corrections and withdrawal of facts, and exposes the same brain to multiple agents through MCP or a CLI. A keyless setup with keyword retrieval runs locally on PGLite; semantic search, synthesis and background enrichment are optional and require configured embedding or model providers.
Beyond retrieval, GBrain can build a typed knowledge graph from trusted local page writes, letting you ask relationship questions such as who works at a given company. The optional synthesis layer returns a cited answer and notes gaps in what the brain knows. Scheduled jobs can ingest, deduplicate and consolidate pages while you are away.
The project targets developers who run coding agents such as Claude Code, Codex or Cursor, or always-on personal agents such as OpenClaw and Hermes. It supports a local PGLite database for personal use and Postgres with pgvector for shared or larger deployments, and ships a remote MCP server with OAuth and scoped access.
Key features
- 01Stores explicit facts with sources and supports corrections and withdrawal.
- 02Works keyless with local PGLite and keyword retrieval; semantic search is optional.
- 03Serves one brain to multiple agents over stdio or HTTP MCP and a CLI.
- 04Builds a typed knowledge graph from trusted local page writes for relationship queries.
- 05Provides an optional synthesis command that returns cited answers and notes knowledge gaps.
- 06Supports Postgres with pgvector for shared or larger deployments.
Use cases
- Giving a Claude Code or Codex coding agent persistent memory across sessions.
- Sharing one searchable knowledge base between several AI clients on a team.
- Running an always-on personal agent that keeps notes, contacts and meeting history.
- Querying relationships between people, companies and deals stored in Markdown notes.
Quick start
- 1
Install GBrain with Bun (requires Bun 1.4.0 or newer; not on npm)
bun install -g github:garrytan/gbrain - 2
Set up GBrain for Claude Code (or run with codex instead)
gbrain setup claude-code
Things to know
- Requires Bun 1.4.0 or newer.
- It is not distributed on npm, and the npm package named gbrain is unrelated and can shadow the real binary.
- Always-on operation needs a deployed server with 8GB+ RAM plus ongoing API token costs.
- Semantic search, synthesis and enrichment need cloud providers or separately configured model API keys.
In collections
Topics
FAQ
- What is gbrain?
- A self-hosted memory layer for AI agents that stores explicit facts with sources and shares one brain across agents, MCP clients and the CLI. GBrain gives an AI agent a persistent memory that you control. It stores facts as Markdown pages with their sources, supports corrections and withdrawal of facts, and exposes the same brain to multiple agents through MCP or a CLI. A keyless setup with keyword retrieval runs locally on PGLite; semantic search, synthesis and background enrichment are optional and require configured embedding or model providers.
- Is gbrain free to use? What license does it have?
- gbrain is open source under the MIT license. Check the license terms before using it in commercial products.
- Is gbrain still maintained?
- Actively maintained. The last commit to gbrain was on Nov 7, 2026.
- What can I use gbrain for?
- Giving a Claude Code or Codex coding agent persistent memory across sessions. Sharing one searchable knowledge base between several AI clients on a team. Running an always-on personal agent that keeps notes, contacts and meeting history. Querying relationships between people, companies and deals stored in Markdown notes.
- How do I install gbrain?
- Install GBrain with Bun (requires Bun 1.4.0 or newer; not on npm): bun install -g github:garrytan/gbrain Set up GBrain for Claude Code (or run with codex instead): gbrain setup claude-code
- Where can I get gbrain?
- The source code and installation instructions are on GitHub: https://github.com/garrytan/gbrain
Summary generated by AI from the project's README. GitHub stats refresh daily.
Related projects
A knowledge-graph memory plugin for DeepSeek Harness and OpenClaw that bounds recent context and recalls exact past Q/A across sessions.
Persistent memory layer for AI agents with Git-style snapshots, branches, merges and rollback, backed by MatrixOne.
A personal collection of OpenCode V2 plugins adding Postgres and MySQL query tools, secret handling, plan-mode switching, session management, and more.
A team-level memory hub for AI Agents that turns chats, docs, and code into shared, governed memory assets usable across agent frameworks.
A RAG framework for LLMs that builds a knowledge graph from documents and uses Personalized PageRank to support multi-hop retrieval and long-term memory.