← Back to directory
G

GBrain

Community
An open-source brain layer for your AI agents, with synthesis, graph traversal, and gap analysis.
GitHub source repository ↗
★ 29.1k Stars Category · Other Very popular Source revision 77bb9d8c2165
66FMRS · C
Reliability
8/20
Security and permissions
13/20
Maintenance
16/20
Documentation
16/20
Setup experience
13/20

GBrain is a feature-rich knowledge graph and RAG engine offering unique synthesis and gap analysis capabilities. It suits individuals and teams looking to enhance their AI agents' memory, but requires a technical background for deployment and configuration. Security-wise, local storage and multi-user isolation are well-designed, but care must be taken with API keys and tokens. During installation, ensure you get it from GitHub to avoid npm confusion. Overall, for those needing a true 'brain' rather than just search, this is a powerful choice.

Read the FMRS scoring method →

GBrain is an open-source knowledge graph and retrieval-augmented generation (RAG) engine built by Garry Tan, President of Y Combinator, to power his own AI agents. It offers hybrid search (vector + keyword + reranker), a self-wiring knowledge graph, and a synthesis layer (think) that returns cited answers with gap analysis. It supports both personal use and team-wide 'company brain' with multi-user isolation via OAuth scopes. It can be used via CLI, MCP (stdio/HTTP), or integrated into clients like Claude Code, Codex, Cursor, etc. It uses PGLite (zero-config) or Postgres + pgvector as backend.

Tools

search
Hybrid retrieval, returns raw list of pages ranked by score.
think
Synthesizes retrieval results into a cited answer with gap analysis.
put_page
Writes a page and automatically extracts entity relationships (zero LLM calls).
graph-query
Performs multi-hop knowledge graph traversal.
schema_apply_mutations
Batch-apply schema mutations (admin scope, remote accessible).
capture
Captures a thought or file contents as a page.
agent
Runs sub-agents through the Minions queue to execute think operations.
sync
Syncs data sources (e.g., import, sync).
import
Imports files or directories into the brain.
query
Performs retrieval or synthesis queries (alias).

Setup

Installation steps: 1. Install the Bun runtime. 2. Run bun install -g github:garrytan/gbrain (note: the gbrain package on npm is unrelated, do not use it). 3. Initialize a local brain: gbrain init --pglite. 4. Verify installation: gbrain doctor. 5. Connect the MCP server to your client: e.g., for Claude Code use claude mcp add gbrain -- gbrain serve; or for remote use gbrain connect https://your-host/mcp --token gbrain_xxx --install.

Fit and risk

Best for

  • Personal knowledge management that requires actual answers beyond search (synthesis + gap analysis)
  • Teams wanting to build shared institutional memory (with OAuth scoping)
  • AI agents needing persistent memory (automatic ingestion, enrichment, consolidation)

Not for

  • Scenarios requiring real-time data streams (depends on scheduled syncs and crawling)
  • Users without API keys or willing to configure an embedding provider (requires at least one)
  • Users wanting a fully managed cloud service (requires self-hosting)

Required permissions

  • Read/write access to local filesystem (for brain repo and imports)
  • Network access to external APIs (unlocks embedding providers, LLMs, ingestion webhooks)
  • Environment variable access for API keys (e.g., OPENAI_API_KEY, etc.)
  • Local database (PGLite or Postgres)

Risks and side effects

  • Package confusion: the 'gbrain' package on npm is unrelated and may cause conflicts; install only from GitHub
  • Data privacy: local data is secure, but remote deployments must secure OAuth tokens and API keys
  • LLM costs: 'think' and synthesis features consume LLM API calls, incurring expenses
  • Performance issues: large brain syncs may take time or stall (troubleshooting provided)

Troubleshooting

  1. `gbrain init --pglite` crashes on macOS 26.x: use native Homebrew PostgreSQL + pgvector
  2. `gbrain import` fails with dimension mismatch: run `gbrain doctor` and follow the repair command
  3. Cron sync timeouts: use `--break-lock --all --max-age` and per-source loops
  4. Dream cycle losing links: upgrade to v0.41.19.0+ and use retry environment variables
  5. PGLite single-writer conflicts: stop `gbrain serve` before large syncs

Use cases

Getting a synthesized brief before a meeting (e.g., 'What do I need to know before my meeting with Alice?')
Querying relationships in the knowledge graph (e.g., 'Who works at Acme AI?')
Serving as a team's shared institutional memory with per-user scoping (company brain)
Providing long-term memory for coding agents to avoid amnesia about non-code context

Supported clients

Claude DesktopFull support
Claude CodeFull support
CodexFull support
CursorFull support
WindsurfFull support
PerplexityFull support
ChatGPTFull support
Claude CoworkFull support