garrytan/gbrain
Markdown-backed agent memory with Postgres hybrid search and cited retrieval
Automated SPDX check for reference only — not legal advice. Disclaimer
GitHub Star History
Full-history star trajectory from GitHub official history. Switch ranges or hover any point for exact counts.
Evidence-Backed Technical Brief
AI Deep ReviewArchitecture & Core Mechanics
GBrain separates the knowledge source from the retrieval index. Its TypeScript/Bun runtime parses Markdown, frontmatter and wikilinks into searchable pages and typed relationships. Local brains use @electric-sql/pglite; shared deployments can use PostgreSQL with pgvector. Git-backed writes commit back to disk, making file-backed content both diffable and suitable for rebuilding the index. Database-only pages fall outside that recovery path and need a database backup.
The gbrain CLI and MCP clients use the same retrieval engine. The manifest includes @modelcontextprotocol/sdk, Express and AI SDK adapters for Anthropic, Google, OpenAI and OpenAI-compatible endpoints. Local clients can use stdio; remote HTTP MCP enforces per-member permissions. gbrain serve --surface starter --advertise verbs is a concrete stdio entrypoint for clients that need a smaller tool surface.
Key Capabilities & Differentiators
Without credentials, GBrain can import Markdown and query it using keyword search and typed graph traversal without making model calls. For example, a company field in frontmatter can link a person to an organization and give the agent related pages to cite. Adding an embedding key enables keyword-plus-vector retrieval. For standalone CLI synthesis, gbrain think can use Anthropic or OpenAI credentials; an MCP-connected agent uses its own model.
In the published gbrain-evals results at commit 898e0ebf, personal-notes Q&A went from 13.3% without retrieval to 86.7% with GBrain across 98 tasks. On the 500-question LongMemEval dev set, GBrain scored 93.6% versus 89.0% for plain PostgreSQL hybrid retrieval and 94.2% for full-context input, with measured answer-reader costs of $0.023 versus $0.172 for full context. The role-scoped test put restricted documents into neither context nor answers in 100 runs; that is evidence for the tested setup, not a general security guarantee.
Trade-offs & Limitations
Compared with Markdown plus grep, GBrain adds linked evidence, citations and permissioned remote access at the cost of a separate index and service configuration. Compared with plain PostgreSQL hybrid RAG or a standalone vector database, it brings the source files, typed relationships and trust labels into one retrieval workflow. That complexity does not consistently improve accuracy: GBrain scored 55.2% versus 67.4% for an agent with grep on BEAM-10M, and 80.0% versus 84.2% for full-context input on LoCoMo.
The MIT license allows self-hosting without a software subscription, but operators own backups, access boundaries and provider configuration. Telemetry is off by default. Keyless GBrain retrieval avoids model calls, but that does not make the connected agent local: its own model may still receive retrieved material. Enabling provider-backed embeddings or chat can also send indexed text, including archived sessions, to the configured provider. Check both data paths before importing sensitive material.
Hardware & Deployment Guide
The documented self-host path is macOS or Linux with Bun 1.4.4 or later. Install from github:garrytan/gbrain#stable, not the unrelated npm package, or use the release binary for macOS Apple Silicon or Linux x86-64 glibc. gbrain init --pglite --no-embedding creates a keyless local brain, and gbrain import <path-to-markdown-folder> --no-embed keeps the initial import embedding-free. The visible Compose files, docker-compose.ci.yml and docker-compose.test.yml, are for CI and testing; don't assume they are production deployment manifests.
PGLite is single-writer. For concurrent clients, move to PostgreSQL or centralize access through one shared HTTP server. Remote self-host access can use HTTPS over Tailscale; the paid gbrain.io option uses HTTPS MCP with OAuth. Start by sizing disk for Markdown and the database index, then measure import and query load at your expected concurrency. Release v0.60.798.0 added preview-first identity backfill and owner fact relinking without re-extraction, and improved handling of Git imports and embedding backfills.
Individuals or small teams that keep knowledge in Markdown and want several agents to retrieve the same cited decisions, with local-first storage or permissioned remote access.
Your notes fit comfortably in one prompt, your main task is grepping huge chat logs, or you only need a vector index without document relationships or agent integration.
Quick Start & Installation
bun install -g github:garrytan/gbrain#stable gbrain --version gbrain setup claude-code # initializes ~/.gbrain (PGLite), wires MCP, and adds agent hooks (reversible)
Comparison vs. Top RAG, Data & Memory Alternatives
Full comparison →| Repository | Stars | 7d Trend | Stack | License | Core Positioning |
|---|---|---|---|---|---|
| gbrain ★ | 33.9k | +208 | TypeScript | MIT | Markdown-backed agent memory with Postgres hybrid search and cited retrieval |
| firecrawl | 216.5k | +4.6k | TypeScript | AGPL-3.0 | Local and hosted web ingestion that turns sites into RAG-ready Markdown |
| claude-mem | 121.7k | +1.4k | TypeScript | Apache-2.0 | Hook-driven memory and hybrid search for coding agents that need cross-session r |
| markitdown | 199.7k | +909 | Python | MIT | Python library and CLI that turn mixed-format documents into Markdown for RAG in |
AI Context Briefing (for Claude / Cursor / Windsurf)
Standardized architecture summary & quickstart commands ready to paste into coding agents.
curl -sL https://repoforai.com/repo/garrytan/gbrain.md
Active README embeds unlock Hot-Tier 6h Telemetry Refresh automatically (zero pay-to-rank).
Frequently Asked Questions about gbrain
How do I share one memory store between Claude Code and Codex?
Does a local deployment need a GPU, and what should I size for?
Can a company self-host GBrain, and what needs a compliance review?
When is GBrain a better choice than grep or plain PostgreSQL hybrid search?
Upstream README & Documentation
This profile focuses on independent engineering analysis and live telemetry. Read the full upstream README, changelog, and examples directly on GitHub.
Top 10 Breakout Open-Source AI Repos, Every Thursday
Signal-only digest of fast-growing AI repos, SPDX license alerts, and architecture picks. Zero spam.
Zero spam · 1-click unsubscribe · Privacy Policy