About garrytan/gbrain
garrytan/gbrain is an open-source project on GitHub, mainly written in TypeScript. Garry's Opinionated OpenClaw/Hermes Agent Brain It currently holds 30,646 stars and 4,596 forks with 0 open issues, and was last pushed on an unknown date (repository created unknown).
Project Overview
AI Homed tracks it on the Today's Trending board, currently at rank #32 with 40 new stars today.
GitHub Repository Details
README
GBrain
Give the agent you already use a memory you control. GBrain stores explicit facts with their sources, supports corrections and withdrawal, and makes the same memory available across your agents. Start with keyless memory and keyword retrieval; add semantic search, synthesis, and background enrichment when you need them.
Keep skills beside knowledge. New local brains include memory skills in their content root. Agents can join an authorized catalog; only approved editors can publish. Managed coding-agent installs add an owned native router; restart and real-use verification are separate steps. Staged migration preserves sharing choices and personal edits. See shared brain skills.
Choose your setup
1. Add GBrain to my existing agent — recommended. Keep your agent's identity and save memory inside its environment. No new personal-agent identity or private repository is required. Start with the guide for Grok Bot, Muse, or Codex / Claude Code. Other harnesses.
2. Use the brain on my own computer from everywhere. One command publishes it over MCP on your Tailscale tailnet and keeps it running: gbrain mcp expose (add --funnel for cloud agents such as Grok Bot, Muse and ChatGPT). Follow use your brain from anywhere over MCP. Say to your agent: "use my brain over mcp" — "put my brain on tailscale".
3. Connect my existing hosted brain. Follow hosted harness access to choose native OAuth or a private machine connection. For dashboard login, clients, and permissions, use MCP administration with the server's separate owner credential. Delegation is an explicit choice.
Grok Bot and Grok Build are different products. Muse's personal agent and Muse Code are different products too. Muse already has native editable memory; GBrain adds an explicit, portable record with provenance and shared access. See each guide's dated evidence and remaining verification steps.
I'm Garry Tan, President and CEO of Y Combinator. I built GBrain to run my own AI agents. It's the production brain behind my OpenClaw and Hermes deployments: 155,795 pages, 24,589 people, 5,340 companies, 66 cron jobs running autonomously. My agent ingests meetings, emails, tweets, voice calls, and original ideas while I sleep. It enriches every person and company it encounters. It fixes its own citations and consolidates memory overnight. I wake up smarter than when I went to bed — and so will you.
It works as a company brain too. Authenticated remote clients are constrained by source and operation grants plus visibility filters. Local files and shared database credentials are a different trust boundary: sources alone do not isolate those callers. The authorization tests exercise specific access paths, not a universal no-leak guarantee. Read the sharing boundaries and company-brain tutorial before setting up shared access.
Alongside keyword and semantic retrieval, GBrain offers two optional ways to use your stored knowledge:
- A synthesis layer that gives you the actual answer. Synthesized, well-cited prose across people, companies, deals, and ideas. Not "here are 10 chunks that mention your query"; an actual answer with citations and an explicit note on what the brain doesn't know yet. The gap analysis is the part that changes how you use the brain.
- A typed knowledge graph. Trusted local page writes extract supported references without LLM calls when auto-linking is enabled. Remote
put_pagedoes not extract graph edges inline: stdio has best-effort startup/idle sweeps; HTTP needs explicit maintenance or authorizedadd_linkcalls. Ask "who works at acme-example?" to use stored relationships. On BrainBench relationship questions a graph adapter scored P@5 0.3421, R@5 0.9791 vs 0.1917 / 0.6874 plain hybrid (2026-09-09 refresh): whole systems, not a graph-only lift or a general guarantee.
It's easier to ship a daemon that runs 24/7 to ingest, enrich, and consolidate than it is to keep an agent in chat working hard. GBrain is that daemon, generalized. Install in 30 minutes. Your agent does the work. As my personal agent gets smarter, so does yours.
Start keyless. Your harness subscription and any separately configured model API usage are different costs. The optional personal-agent bootstrap takes about 15 minutes; always-on enrichment needs its own compute and API configuration.
Durable preferences and facts can be shared across agents; transient task and harness configuration state stay local. Configured cloud embedding, reranking, extraction, and synthesis providers can receive text, and the harness model sees recalled memory even in keyless mode. Markdown export is not a full database backup. Read memory boundaries.
LLMs: fetchllms.txtfor the documentation map, orllms-full.txtfor the same map with core docs inlined in one fetch. Agents: start withAGENTS.md(orCLAUDE.mdif you're Claude Code).
What this looks like
Say you have a meeting with Alice tomorrow. You want to walk in remembering what she works on, when you last talked, and what's still open between you. Here's what you'd type, and what you'd get back.
You ask:
"What do I need to know before my meeting with Alice tomorrow?"
Most personal-knowledge tools give you back a list of pages. Something like:
1. people/alice — Alice runs engineering at Acme...
2. meetings/2026-03-15-alice-q1 — Q1 product review with Alice...
3. meetings/2026-01-08-acme-kickoff — Kickoff meeting with Acme team...
4. customers/acme — Acme is a series-B fintech we work with...
5. notes/2026-04-22 — Quick chat with Alice about pricing...
Five pages you now have to open and read yourself to actually prepare. The tool found the right material, but it didn't do the work.
GBrain gives you back the answer, with sources:
Alice runs engineering at Acme (a series-B fintech). You last spoke
on April 22 in a quick pricing chat. Three things are still open
from that conversation:
1. She owes you the security review for the new tier
(deadline was May 1; no update since).
2. You committed to pricing for a 500-seat tier
(you sent it April 25; no response yet).
3. She mentioned they're hiring a CISO; you said you'd intro
someone from your network.
Heads up: nothing's been added to the brain about Alice or Acme
since April 22, six weeks ago. She may have replied through email
or Slack DM, channels the brain doesn't see. Worth asking her to
catch up before assuming any of this is still current.
Every claim has a source page behind it. The "heads up" at the end tells you what the brain doesn't know yet, so you can ask Alice about it directly instead of being surprised. The brain just did your meeting prep.
This is the difference between a search engine and a brain. Search finds the pages. The brain reads them for you and writes the answer.
Install
Requires Bun 1.4.0 or newer. Existing worker installations should follow the authorization and queue upgrade guide before restarting services with this version.
[!WARNING]
GBrain is NOT distributed on npm. The npm package named gbrain is an unrelated
package with no connection to this project. Do not run npm install -g gbrain or
bun add -g gbrain — you'll get something else, and it can shadow the real binary on
your PATH. Install and upgrade ONLY via the documented paths below
(bun install -g github:garrytan/gbrain, orgit clone+bun install && bun link).
If you already ran the npm install by mistake: npm uninstall -g gbrain /
bun remove -g gbrain, then reinstall from GitHub.gbrain doctordetects a
shadowing npm install and prints the fix.
Start with the agent you already use. For Grok Bot and Muse, the dedicated guides above install an isolated launcher, repairable runtime, and memory in a verified persistent directory. For a coding agent, paste:
Add GBrain memory to this existing agent. Read and follow:
https://raw.githubusercontent.com/garrytan/gbrain/master/INSTALL_FOR_AGENTS.md
Keep my current identity and instructions. Start keyless, preserve unrelated
configuration, and use the memory-only path. Do not create a personal-agent
identity or private repository. Show me the required search-mode choice.
Verify a unique remember/recall/correction/withdrawal round trip using observed
GBrain calls, then tell me how to verify recall in a new conversation.
Codex guide · Claude Code guide · Memory-only walkthrough · CLI standalone.
The following bootstrap paths are optional: use them when you want GBrain to help create a new persistent personal agent, including identity files and a private repository.
For Codex — optional personal-agent bootstrap
Turn Codex into your persistent personal agent. (Just want the brain + skills without the full agent? codex plugin marketplace add garrytan/gbrain@codex-plugin then codex plugin add gbrain@gbrain — see docs/mcp/CODEX.md. The paste block below builds the whole agent.) Works in the ChatGPT desktop app (open Codex on a folder) and in the Codex CLI (codex in a terminal) — same install, same result. Open Codex in a new, empty folder (not an existing code project) — that folder becomes your agent's own private GitHub repo, which bootstrap creates and privacy-verifies for you. Then paste:
Read and follow every step of:
https://raw.githubusercontent.com/garrytan/gbrain/latest-stable/BOOTSTRAP_FOR_AGENTS.md
Goal: set yourself up as my persistent personal agent in this folder, with gbrain
as your memory. Interview me before writing any identity file — never invent
answers. Ask before anything destructive. You are not done until
gbrain bootstrap verify exits 0.
Bootstrap creates identity files from your answers, a local keyless brain, MCP registration, and a private repository. Command approvals are normal. Verify a saved fact in a fresh conversation; identity-file recall alone is not that test. The repo is not a complete backup. For private-repo adoption, optional providers, cloud behavior, and uninstall, read the bootstrap guide.
For Claude Code — optional personal-agent bootstrap
Works in the desktop app and in the CLI (claude in a terminal) — identical harness, identical result. Open Claude Code in a new, empty folder (not an existing code project) — that folder becomes your agent's own private GitHub repo, created and privacy-verified for you. Then paste the same block:
Read and follow every step of:
https://raw.githubusercontent.com/garrytan/gbrain/latest-stable/BOOTSTRAP_FOR_AGENTS.md
Goal: set yourself up as my persistent personal agent in this folder, with gbrain
as your memory. Interview me before writing any identity file — never invent
answers. Ask before anything destructive. You are not done until
gbrain bootstrap verify exits 0.
Claude Code also supports per-turn context and persistence hooks, with opt-outs. A fresh-conversation recall test must observe actual GBrain calls, not infer the source from the answer. See bootstrap for cloud setup, private-repo adoption, hooks, recovery, and removal.
For OpenClaw or Hermes — GBrain as intended, always on
This is GBrain used the way it was designed to be used: a server-hosted agent with 24/7 crons, continuous ingestion, and the overnight dream cycle that enriches your brain while you sleep — your agent works whether your laptop is open or not. It's also the highest-cost path: a deployed server (8GB+ RAM) plus raw API token usage that scales with how hard your agent runs, well beyond a chat subscription. Start here if you want the full experience from day one; start with Codex above if you want to feel it first. If you don't have a platform running yet, both deploy in one click:
- OpenClaw — deploy AlphaClaw on Render (one click, 8GB+ RAM)
- Hermes — deploy on Railway (one click)
Retrieve and follow the instructions at:
https://raw.githubusercontent.com/garrytan/gbrain/master/INSTALL_FOR_AGENTS.md
The agent starts with keyless memory and verifies it. API keys, automatic capture, paid enrichment, and the dream cycle are separate opt-in choices; the install prompt does not authorize all of them.
Never set up an AI agent platform before? The personal-brain tutorial walks the whole path end-to-end — picking OpenClaw vs Hermes, deploying it, pointing it at INSTALL_FOR_AGENTS.md, getting the API keys, and verifying the first query. Start there if any of the above is new.
Lighter ways in
Just want a memory for your coding agent — no identity, no repo. Spin up a local brain and connect it in two commands — zero server, zero token, zero tunnel. --surface verbs gives your agent the seven-verb memory protocol (recall, remember, entity, synthesize, forget, context_pack, delta — MEMORY_VERBS v1, frozen + additive-forever) instead of the full tool wall; drop the flag for every operation:
gbrain init --pglite --no-embedding # keyless local brain (no Docker)
claude mcp add gbrain -- "$(command -v gbrain)" serve --surface verbs # or: codex mcp add gbrain -- "$(command -v gbrain)" serve --surface verbs
If claude is not found, install Claude Code first — or use the per-harness blocks in the protocol doc. Heads-up: memories agents save default to brain-wide visibility (every connected agent can recall them); pass visibility: "private" for local-only facts.
Already have a brain on a remote host (OpenClaw, Hermes, or any gbrain serve --http)? Point your laptop agents at it with one command each — --install wires it up and smoke-tests the token before handoff:
gbrain connect https://your-host/mcp --token gbrain_xxx --install # Claude Code
gbrain connect https://your-host/mcp --token gbrain_xxx --agent codex --install # Codex
Onboarding a whole agent harness onto a shared brain? On the brain host, gbrain agent register --harness claude-code mints a scoped OAuth client plus a 30-day token and prints the paste-ready wiring block — presets for daily-driver and write-isolated coding agents. The onboarding decision table says which path fits.
Brain-only install into another coding agent (Cursor, Claude Cowork, or anything that can fetch a URL and run shell commands) — paste the OpenClaw/Hermes block above (INSTALL_FOR_AGENTS.md). It starts with keyless memory without replacing the agent's identity. Skills, automatic capture and the dream cycle are separate choices; verify activation in the intended harness.
→ Full walkthrough: give your coding agent a memory — the memory-only paths end to end, plus the brain-first protocol you paste into CLAUDE.md / AGENTS.md and the four habits that make it actually change how you work.
CLI standalone (no agent)
bun install -g github:garrytan/gbrain
gbrain init --pglite --no-embedding # keyless; no server, no Docker
gbrain doctor # verify health
gbrain import ~/notes/ --no-embed # index your markdown
gbrain search "a phrase from a note" --json
Postgres-at-scale, Supabase, and thin-client setup paths live in docs/INSTALL.md.
For an existing keyless brain, follow the memory-only upgrade path
to keep daemon installation and paid reindexing opt-in.
Connect GBrain to your AI client (MCP)
For a hosted brain, start with the native OAuth and private machine connection guide. To open the dashboard, register clients, edit access, or invalidate tokens, use MCP administration. A profile controls MCP authority; a surface controls which granted tools are visible. Neither grants owner dashboard access. New memory profiles use the starter surface. --surface verbs retains exactly the seven memory verbs, with orientation available through gbrain://capabilities. Thin CLI connections use the full surface and remain restricted by their grants.
Choose the connection instructions for your actual product:
Upgrading a brain indexed before v0.48.3.0: its search chunks need rebuilding before remote chunk retrieval returns them. Semantic result caching is temporarily disabled; stored contradiction reports and code-inspection tools have local-only limits. Follow the upgrade recovery guide for rebuild commands, embedding costs, and the restrictions that remain after rebuilding. Say to your agent: "Upgrade gbrain and check whether my search index needs rebuilding."
- Claude Code — plugin:
/plugin marketplace add garrytan/gbrain+/plugin install gbrain@gbrain(MCP + skills; persona variantsgbrain-coding/gbrain-dailyinstall curated subsets; pick one). Marketplace-free skills:gbrain skillpack scaffold --harness claude-codecopies a persona-curated skill set into your user-scope skills dir. Or local one-liner:claude mcp add gbrain -- "$(command -v gbrain)" serve. Remote with just a bearer token:gbrain connect https://your-host/mcp --token gbrain_xxxprints a paste-ready block (or--installwires it up and smoke-tests the token). - Codex — plugin (recommended):
codex plugin marketplace add garrytan/gbrain@codex-plugin+codex plugin add gbrain@gbraininstalls the MCP server AND the curated skill set. Or connect-only:gbrain connect https://your-host/mcp --token gbrain_xxx --agent codex(or--install); the token path reads$GBRAIN_REMOTE_TOKENat runtime, while the private-handoff installer writes a private managed HTTP header so the connection survives a new shell. - Cursor / Windsurf / any stdio MCP client — same shape, add
{"command": "gbrain", "args": ["serve"]}to your MCP config. - Hermes —
printf 'Y\n' | hermes mcp add gbrain --env GBRAIN_HOME=$HOME --connect-timeout 60 --command $(which gbrain) --args serve. Keep--argslast, and verify withhermes mcp test gbrain(the add exits 0 even on failure). - Grok Bot — recommended: keep the brain on your computer, publish it with
gbrain mcp expose --funnel, grant the Bot amemory-writerclient and install the thin CLI at/workspace/gbrain; or install memory inside the Bot computer when no machine of yours stays online. Bots share local files and credentials; sources organize memory without isolating Bots. Say to your agent: "connect grok bot to my brain". - Muse personal agent — first verify its durable user-files location; then either connect it to your published brain (
gbrain mcp expose --funnel+ thin CLI) or install the local CLI there. Native MCP configuration and skill activation are not assumed. Say to your agent: "connect muse to my brain". - Grok Build —
grok mcp add gbrain -e "GBRAIN_HOME=$HOME" -- "$(command -v gbrain)" serve --surface verbs. The add is lazy (exit 0 without connecting) — verify withgrok mcp doctor gbrain, which spawns the server and reports7 tools discovered. Verified against Grok Build v1.0.4. - opencode (opencode.ai / SST — not OpenClaw) —
opencode mcp add gbrain --env GBRAIN_HOME=$HOME -- "$(command -v gbrain)" serve --surface verbs, or letgbrain bootstrap hooks --harness opencodewrite the config for you (opencode is a bootstrap-supported harness — it reads AGENTS.md natively). The add is lazy — verify withopencode mcp list, which spawns the server (✓ gbrain connected). Remote:gbrain connect https://your-host/mcp --token gbrain_xxx --agent opencode [--install]— the config stores only the{env:GBRAIN_REMOTE_TOKEN}interpolation. Verified against opencode v1.18.18. - OpenClaw — the ClawHub bundle plugin registers gbrain automatically (
openclaw.plugin.jsonships in this repo), or register the stdio server withopenclaw mcp add gbrain --command "$(command -v gbrain)" --arg serve --env GBRAIN_HOME=$HOME(absolute path: the launchd gateway PATH lacks~/.bun/bin); verify withopenclaw mcp list. - Claude Desktop (Cowork) — Settings → Integrations → add the URL of your HTTP server. Remote only; the local
claude_desktop_config.jsondoes not work for remote servers. - Claude Cowork (team plan) — org Owner adds the connector under Organization Settings → Connectors.
- Perplexity Computer — choose native OAuth or a managed bearer connection according to the actual connector settings. The owner registers the matching client and delivers any confidential credentials privately.
- ChatGPT — native OAuth with PKCE. Register the exact callback and token authentication method shown in its MCP settings, then start the connection in ChatGPT and complete owner consent.
gbrain serve # stdio MCP (local subprocess; for Claude Code, Cursor, Windsurf)
gbrain serve --http # HTTP MCP with OAuth 2.1 + admin dashboard at /admin
# (required for Claude Desktop, Cowork, Perplexity, ChatGPT)
gbrain mcp expose # publish serve --http on your Tailscale tailnet with HTTPS + a user service
gbrain mcp expose --funnel # same name, public HTTPS — for agents that run in a vendor's cloud
gbrain mcp expose is the recommended way to run the server from your own computer: it installs Tailscale if needed (after a consent prompt), signs in, publishes the server on https://your-machine.your-tailnet.ts.net/mcp, keeps the admin token in a private file, installs a launchd / systemd user service, and prints separate owner-login, native OAuth, and machine-client next steps (--status re-checks, --remove undoes only its own changes). Local coding agents on the same machine: gbrain bootstrap harness --yes --port 3131 on a Postgres brain; on PGLite mint a token before the service runs (gbrain auth create local-agents --scopes read,write) and pass --token, or grant a scoped client through the running server (gbrain mcp grant … --admin-token-file ~/.gbrain/serve/admin-token). Tailnet-only by default; --funnel is the explicit