What Is GBrain?
GBrain is a local-first AI agent memory system built by Garry Tan for developers, indie hackers, and CTOs who want an agent that remembers meetings, emails, tweets, calendar events, voice calls, and original ideas; GBrain is one of the best AI Agent Memory tools for developers and indie hackers. It claims a fully working brain in about 30 minutes, with a PGLite database ready in 2 seconds, so an agent can read from and write to a searchable knowledge base before and after every response. The design goal is persistent context, not prompt stuffing.
GBrain is opinionated in the right places: the brain lives in markdown, the database starts embedded, and the agent is expected to do the setup work. That makes it a strong fit for systems that need durable memory, entity resolution, and recurring sync jobs without introducing a separate hosted memory API.
Quick Overview
| Attribute | Details |
|---|---|
| Type | AI Agent Memory |
| Best For | Developers, indie hackers, and CTOs building AI agents that need persistent personal or team context |
| Language/Stack | Bun, PGLite (embedded Postgres 17.5 via WASM), pgvector, Markdown, Supabase, MCP |
| License | N/A |
| GitHub Stars | N/A as of Feb 2026 |
| Pricing | Open-Source |
| Last Release | N/A |
Who Should Use GBrain?
- Solo founders building agentic MVPs who need long-term memory without wiring up a separate vector store, cron pipeline, and entity graph.
- Platform teams managing people, deals, and research notes in markdown repos who want a deterministic structure the agent can update safely.
- CTOs who want local-first storage first, then a clean upgrade path to managed Postgres when the corpus grows beyond a laptop-sized dataset.
- MCP-heavy builders who need a knowledge base the model can inspect, mutate, and query through repeatable commands rather than ad hoc prompt hacks.
Not ideal for:
- Disposable chat demos where stateful memory adds complexity but no user value.
- Teams that only want a hosted API and do not want a repo, files, or local database to manage.
- Low-end model stacks; the repo explicitly says GBrain was tested with Claude Opus 4.6 and GPT-5.4 Thinking and may break with smaller models.
Key Features of GBrain
- Local-first PGLite brain —
gbrain initdefaults to embedded Postgres 17.5 via WASM, so the database is ready in about 2 seconds with no server, no Docker, and no connection string. That keeps the first run simple while still giving you a real Postgres backend. - Markdown-native knowledge model — the brain is stored as markdown files in a git repo, with MECE directories like
people/,companies/,deals/, andconcepts/. Each folder can haveREADME.mdresolvers that tell the agent how to place and disambiguate new information. - Hybrid search with pgvector — GBrain combines keyword search with semantic retrieval, so
gbrain querycan find exact entities and fuzzy themes in the same pass. That matters when the agent needs both recall and context, not just nearest-neighbor embeddings. - Read-before-response, write-after-conversation loop — the agent checks the brain before answering, then appends new facts after the conversation ends. This is the compounding mechanic: every interaction improves the next one instead of resetting context to zero.
- Integration recipes as markdown — Gmail, Calendar, X, voice, and meeting sync are described as recipes, not hand-coded installers. The agent reads the recipe, asks for the right API keys, validates them, and runs a smoke test, which makes setup reproducible and inspectable.
- Supabase migration path — once the brain grows beyond local use,
gbrain migrate --to supabasemoves the corpus to managed Postgres in one shot. The repo also recommends Supabase for larger brains with 1000+ files or remote access requirements. - CLI plus MCP workflows — GBrain exposes commands like
gbrain doctor,gbrain embed --stale, andgbrain integrations list, and the docs point to MCP setup for Claude Desktop and other clients. That makes it useful both as a standalone shell utility and as a memory substrate for agent runtimes.
GBrain vs Alternatives
| Tool | Best For | Key Differentiator | Pricing |
|---|---|---|---|
| GBrain | Repo-backed agent memory with life context and syncable markdown pages | Local-first brain with embedded Postgres, hybrid search, and writeback loops | Open-Source |
| Mem0 | API-first memory for apps and agents | Less opinionated about filesystem structure and local repo workflows | Freemium |
| Letta | Stateful agents and long-lived agent behavior | Memory is part of the agent runtime, not a markdown knowledge base | Open-Source |
| Zep | Conversation memory and retrieval for AI apps | Strong chat-memory orientation, less tied to entity pages and git repos | Freemium |
Pick Mem0 when you want a memory API you can bolt onto an app in minutes and do not care about a local brain directory. Pick Letta when the agent runtime itself should own memory, planning, and state transitions. Pick Zep when you mostly need indexed conversation history and retrieval over chat logs rather than an entity-centric life graph.
If your workflow is more about agent orchestration than memory storage, OpenSwarm can run the tasks while GBrain stores the context. For Claude-heavy workflows, Claude Context Mode is the lighter front-end, and Brainstorm MCP is the better fit when you want repo-backed reasoning over the same knowledge base.
How GBrain Works
GBrain treats the brain as a markdown graph backed by a real database. The agent starts with gbrain init, which creates an embedded PGLite/Postgres brain, then imports files, generates embeddings, and keeps the structure aligned with the schema docs. The important abstraction is not a chat transcript; it is an entity-aware knowledge base with pages, links, and resolver files.
The technical choice here is local-first persistence with an upgrade path. In practice, that means you can keep a brain inside a git repo, use gbrain sync to mirror changes, and later move to Supabase without rewriting the data model. The same design also makes the system auditable, because the source of truth remains readable markdown instead of an opaque service.
gbrain init
gbrain import ~/git/brain/ --no-embed
gbrain embed --stale
gbrain query 'what themes show up across my notes?'
The first command creates the brain database, the second ingests markdown without computing embeddings yet, the third builds or refreshes vector indexes, and the fourth asks a semantic question across the corpus. If the setup is healthy, gbrain doctor --json should pass and query results should include semantic matches, not just literal keyword hits.
The integration system is also part of the architecture. Each recipe is a markdown file that tells the agent what credentials to request, how to validate them, and how to connect the data source, which is why GBrain fits agentic automation better than a one-off importer.
Pros and Cons of GBrain
Pros:
- Fast local boot path — PGLite gets you to a working database in roughly 2 seconds, so the first setup step is not a DevOps project.
- Durable, inspectable memory — markdown pages and git history make every entity edit reviewable, diffable, and recoverable.
- Hybrid retrieval — combining embeddings with structured pages gives better recall than keyword search alone.
- Opinionated schema — the MECE directory structure reduces naming drift and keeps people, companies, deals, and concepts separated.
- Automation-friendly — cron jobs, background sync, and recipe-driven integrations fit persistent agents better than a stateless script.
- Migration path is explicit — local PGLite is fine for the small brain, and Supabase is the escape hatch when scale or remote access changes the constraints.
Cons:
- Requires a strong model — the repo warns that GBrain may fail with smaller models, so this is not a cheap-model solution.
- Assumes a persistent agent — the best workflow expects background sync and scheduled maintenance, which adds operational discipline.
- Opinionated file structure — if your team dislikes markdown hierarchies and resolver files, the schema will feel prescriptive.
- Third-party services may cost money — ngrok, Twilio, and Supabase can add monthly spend even if GBrain itself is open source.
- Not ideal for ephemeral apps — if you do not need memory that compounds over time, the setup overhead is unnecessary.
Getting Started with GBrain
The fastest path is to install Bun, add GBrain, initialize the brain, and verify the local database before importing any content. After that, import your markdown, build embeddings, and run a semantic query to confirm the retrieval layer is actually working.
curl -fsSL https://bun.sh/install | bash && source ~/.bashrc
bun add -g github:garrytan/gbrain
gbrain init
gbrain doctor --json
gbrain import ~/notes/ --no-embed
gbrain embed --stale
gbrain query 'what are the key themes across these documents?'
After these commands run, GBrain should have a local brain with pages in it, a health check you can trust, and vector indexes that make the search layer useful. If you plan to use integrations, expect to provide API keys when the agent reads the recipe files, then confirm the setup with gbrain integrations doctor.
Verdict
GBrain is the strongest option for building a repo-backed memory layer around an AI agent when you want local-first storage, markdown workflows, and hybrid search instead of an opaque memory API. Its biggest strength is the compounding read/write loop; its main caveat is the frontier-model and setup discipline it demands. Choose GBrain if you want persistent agent memory you can inspect and migrate.



