Your coding agent finished the task, and the chat that held the decision is gone. The next agent — Claude Code today, Codex tomorrow, Cursor next week — starts from zero, re-reads the same files, and asks the same questions you already answered. Every agent has amnesia, and every one of them has it separately. That is the problem GBrain is built for, and it is why a project by Garry Tan — the founder behind OpenClaw's agent brain — surfaced on GitHub's daily trending list on December 3 with nearly 34,000 stars.

GBrain gives your AI agents shared, cited memory over plain Markdown. Your notes stay Markdown files on your disk — [[wikilinks]] and front matter become typed edges in a knowledge graph — and every agent that connects to the brain reads the same memory, whether it is Claude Code, Codex, Cursor, or ChatGPT over MCP. The default brain is keyless: it runs on a local PGLite database, retrieves with keyword search and the typed graph, and makes zero model calls. Synthesis — turning retrieved notes into an answer — happens in your agent, using its own model, or with a chat key you add deliberately. It is MIT-licensed, free to self-host, and at version 0.60.794.0 on the stable channel as of this writing.

This tutorial verifies the whole loop hands-on. Every command below was run in a sandbox: the release-binary install, a keyless brain, a real import of three linked notes, search with citations, the memory verbs, the MCP handshake, and the health check. Two things were not run here and are flagged as such: a live Claude Code session reading the brain, which needs your own Claude Code subscription, and the hosted gbrain.io path, which is a paid service. One genuine gotcha turned up in testing — bulk import does not build the graph links — and it is documented in step 4 with the workaround, because it is exactly the kind of thing that makes you distrust a tool for the wrong reason.

What you'll need#

  • macOS or Linux. The release binary covers macOS Apple Silicon and Linux x86-64 (glibc). Windows users should use WSL.
  • Bun 1.4.4 or later — or nothing at all. The binary installer needs no Bun, no git, and no API key. The Bun path is the alternative.
  • A folder of Markdown notes — or none at all; step 3 builds a three-note demo from scratch so you can follow along with nothing of your own.
  • Nothing else for the first five steps. The keyless brain makes no model calls and costs nothing. Wiring in a real agent needs that agent's CLI and whatever subscription it already uses. Embedding-based search and the hosted service are opt-in extras with their own costs.

1. Install GBrain#

The README offers two installs. The binary installer is the one to use: it downloads the release binary for your platform, verifies its SHA-256 against the build-provenance attestation from the project's own release workflow before unpacking or running anything, and installs it into ~/.local/bin. It then creates a keyless local brain unless one already exists:

f="$(mktemp)"; trap 'rm -f "$f"' EXIT; curl -fsSL https://raw.githubusercontent.com/garrytan/gbrain/stable/scripts/install.sh -o "$f" && bash "$f" --setup claude-code

The --setup claude-code flag also wires the agent up, which step 6 covers in detail; omit it for the binary and the keyless brain only, with --no-init if you want the binary alone. The installer refuses to proceed if the provenance check fails — a rate-limited GitHub API or a hash mismatch stops the install with nothing changed.

The alternative, for machines with Bun 1.4.4 or later, installs from the #stable branch:

bun install -g github:garrytan/gbrain#stable
gbrain --version

One warning from the README is worth heeding: GBrain is not on npm. The gbrain package on npm is unrelated; install only from GitHub or the release binary. Whichever path you take, the version check is the same — the sandbox reported gbrain 0.60.794.0, the stable release promoted on December 2.

2. Create a keyless brain#

One command creates the brain. --pglite selects the embedded Postgres engine, and --no-embedding keeps it keyless:

gbrain init --pglite --no-embedding

The brain lives under ~/.gbrain as a PGLite database — a single local file, no server process, no port. Nothing here needs a key: retrieval is keyword search plus the typed graph, and the CLI tells you so every time it searches, noting that no query text is sent to an embedding provider. That is a deliberate design decision, not a missing feature — the README's comparison table is explicit that the keyless brain retrieves and cites, and that synthesis needs a connected agent or a chat key (ANTHROPIC_API_KEY or OPENAI_API_KEY) for the standalone gbrain think command.

Two limits of the default engine are worth knowing before you build on it. Local PGLite is single-writer, so concurrent clients need Postgres with pgvector instead — gbrain migrate --to postgres --plan previews that move. And the project is 0.x with frequent releases; the #stable channel tracks soaked builds with a 14-day, two-release deprecation window for documented CLI, MCP, and page contracts, while the opt-in Rust engine is experimental and off by default.

Before importing your own notes, try the offline sample brain. It is fifteen company pages, isolated from your files, and it makes no provider calls:

gbrain sources demo company-brain

The sandbox run confirmed the claim in its own output: "No user brain or repository was changed. No provider was called." It is the fastest way to see what cited retrieval looks like before committing any of your own notes.

Diagram of GBrain's architecture: Markdown files flow into a local database, then into search and a knowledge graph, then out to coding agents
GBrain's architecture: Markdown on disk, a local PGLite index, keyword search plus a typed graph, and agents over MCP. Illustration: AI Frontier Post.

3. Import your notes and search them#

Make three small notes with wikilinks and front matter — the shape GBrain is designed around. A company page, a person page, and a meeting note, linked to each other:

---
type: company
stage: Series B
sector: fintech
---

# Acme Corp

Acme is a Series B fintech. [[people/alice]] leads engineering there.
We sent a 500-seat enterprise quote on April 25; no reply recorded yet.
---
type: person
company: "[[companies/acme]]"
role: Head of Engineering
---

# Alice Chen

Alice leads engineering at [[companies/acme]]. Her security review was due May 1.
---
type: meeting
date: 2026-04-22
attendees:
  - "[[people/alice]]"
---

# Pricing call with [[companies/acme]]

Discussed the enterprise tier. Security review from Alice due May 1.

Import the folder with embeddings off. The --no-embed flag skips the embedding step entirely, so the import touches no provider:

gbrain import ~/notes-demo --no-embed

The sandbox run imported all three pages in 1.2 seconds — 3 pages imported, 0 skipped, 3 chunks created. Re-running the import is safe: the second run reported 0 pages imported and 3 skipped as unchanged, so the import is idempotent and you can re-run it after editing notes without duplicating anything.

Now search. Keyword search is the default on a keyless brain, and it answers with the page and a quoted excerpt, not just a filename:

gbrain search "pricing"
Keyword matches: 1 page (pages containing these words, not a count of these rows).
[1.0000] meetings/2026-04-22-pricing -- [quoted transcript] # Pricing call with [[companies/acme]]

Discussed the enterprise tier. Security review from Alice du…

That quoted transcript is the point of the design: the answer carries its source with it, so an agent (or you) can check the claim instead of trusting a summary. gbrain get reads a whole page back, front matter intact:

gbrain get people/alice
---
type: person
title: Alice Chen
role: Head of Engineering
company: '[[companies/acme]]'
---

# Alice Chen

Alice leads engineering at [[companies/acme]]. Her security review was due May 1.

Your notes stay plain Markdown on disk, and the database is a rebuildable index over them. If GBrain vanished tomorrow, the notes would still be readable files in git history — the same property that makes a Markdown board outlive its tool.

Here is the step that will trip you up, because it tripped up this tutorial's own verification. Those three notes are full of wikilinks: Alice's page links to Acme, the meeting links to both. So ask for the links into the Acme page:

gbrain backlinks companies/acme
[]

Empty. Not an error — an empty list. The pages are imported and searchable, but the typed graph has no edges for them. Re-running the import changes nothing, and neither does gbrain projections drain, which reported zero projections rebuilt. The --all-sources flag makes no difference either.

The edges appear when a page is written through GBrain itself rather than bulk-imported. Write one follow-up note with gbrain put:

printf -- '---\ntype: note\n---\n\n# Follow-up\n\nMet [[people/alice]] again; [[companies/acme]] still owes the security review.\n' | gbrain put notes/followup

Now the same query returns the edge, with its type and context:

gbrain backlinks companies/acme
[
  {
    "from_slug": "notes/followup",
    "from_source_id": "default",
    "to_slug": "companies/acme",
    "to_source_id": "default",
    "link_type": "mentions",
    "context": "# Follow-up Met [[people/alice]] again; [[companies/acme]] still owes the security review.",
    "link_source": "markdown",
    "origin_slug": null,
    "origin_source_id": null,
    "origin_field": null
  }
]

So the rule, verified twice: import indexes pages for search but does not extract wikilink edges; put does. Pages an agent writes over MCP build edges the same way put does, which is why the graph fills in during normal agent use and stays empty after a bulk import. If you import a large existing vault and then wonder why the graph looks dead, this is why — and the fix is to let the agent (or put) rewrite the pages that matter, rather than assuming the import built the graph. One related dead end, documented so you do not waste time on it: gbrain sync --repo does not apply to the default source at all. It fails with a clear error directing you back to the import path, because the brain's content directory is GBrain-owned, not a git checkout.

5. Teach it a fact: remember and recall#

Pages are the slow memory; facts are the fast one. GBrain's memory verbs save single claims, each attached to an entity and each requiring a provenance string — where you learned it. The requirement is enforced: leave provenance off and the command fails with an explicit error telling you to pass one.

gbrain remember "The Q3 launch moved to October 12." --entity companies/acme --provenance "user stated 2026-12-03"
gbrain recall --entity companies/acme
📌 id=1 [companies/acme] The Q3 launch moved to October 12. (fact, conf 1.00)

Two details in that output matter. First, the fact is saved with a confidence of 1.00 because you stated it — facts carry provenance and confidence, not just text. Second, the command printed a warning on the way in: with no embedding provider configured, duplicate detection only catches exact duplicates, so a near-duplicate phrasing of an existing fact inserts a second fact. Recall first when you are unsure whether a fact is already saved. The same verbs are what your agent calls over MCP — remember and recall are tools, not just CLI commands — so a fact you save here is a fact any connected agent can recall in a new session, with its source attached.

Diagram of the memory loop: a person saves a fact, it is stored in the brain archive, and a later agent session retrieves it with its citation
The memory loop: save a fact once, with provenance, and any connected agent recalls it — cited — in a later session. Illustration: AI Frontier Post.

6. Wire it into Claude Code#

This is the step the whole tutorial builds toward, and it is the one you should preview before running. setup with --dry-run prints exactly what it will write, and it runs without Claude Code installed:

gbrain setup claude-code --dry-run
Target (Claude Code, user scope):
  brain      existing PGLite brain at ~/.gbrain/brain.pglite
  source     the brain's default source (unpinned)
  transport  stdio MCP: ~/.gbrain/hook-launcher/gbrain-hook /path/to/gbrain serve --surface starter --advertise verbs
  owner      none yet; setup will own 'gbrain'
  files      ~/.claude.json (MCP), ~/.claude/settings.json (hooks)
Decisions:
  wiring     user scope; hooks SessionStart, UserPromptSubmit [default]
  capture    declined (no Stop/SessionEnd hooks, no transcript capture; accept with --capture) [default]
  providers  declined (keyless: setup configures no paid provider; accept with --providers) [default]
  would write instructions brain-first block in new file ~/.claude/CLAUDE.md [default; opt out with --no-instructions]

Read the defaults, because they are the product's privacy posture in miniature. Transcript capture is declined by default — no Stop or SessionEnd hooks, so your sessions are not archived into the brain unless you opt in with --capture. Providers are declined by default — the setup configures no paid provider, keeping the brain keyless unless you accept one. And the wiring adds a brain-first instruction block to CLAUDE.md, telling the agent to check memory before answering. Run the same command without --dry-run to apply it; --remove undoes it, and the README says the setup is reversible.

The MCP server itself is a stdio process, and the handshake was verified in the sandbox: send a JSON-RPC initialize, then tools/list, and the server answers with its real tools — remember, entity, and the rest of the starter surface. The README documents the same wiring for Codex (swap claude-code for codex), for Cursor and other stdio MCP clients via a mcp.json entry pointing at gbrain serve --surface starter --advertise verbs, and for the hosted path over HTTPS at gbrain.io/mcp. The live-agent half of this step — an actual Claude Code session asking the brain a question and getting a cited answer — was not run here; it needs your Claude Code subscription, and the README's own verification script is to tell a session "Remember that the Q3 launch moved to October 12", open a new session, and ask "When is the Q3 launch?"

7. Check the brain's health#

GBrain ships a doctor, and it is worth running after your first import:

gbrain doctor
Brain checks:  95/100  (category penalty)
Skill checks:  90/100
Ops checks:    100/100
Meta checks:   100/100

Overall health score: 85/100. All checks OK (some warnings).

The score is less interesting than what it measures: pack currency, dangling aliases, type proliferation, and a weighted brain score across embeddings, links, timeline density, orphans, and dead links. A three-note demo scores low on the brain-quality sub-score — it has no embeddings, no links from import, and almost no entities — while scoring perfectly on operations. That split is honest: the tool is telling you the import built a searchable index, not yet a rich graph, which is exactly the gotcha from step 4 showing up as a number. As the brain grows through agent-written pages, the link and density components are the ones that move.

When to use GBrain — and when not to#

GBrain fits when more than one agent works from the same notes and you want them to share memory without sharing a vendor. It fits a solo developer who runs Claude Code and Codex side by side and is tired of re-explaining the same decisions, and it fits a small team that wants per-page permissions on shared notes without standing up a hosted service — the HTTP MCP path enforces per-member permissions on remote callers, while the local path stays keyless. The deciding properties are the ones on disk: Markdown files you can read in git, an index you can rebuild, telemetry off by default, and retrieval that cites its sources instead of paraphrasing them away.

It is not the right call when your notes fit inside one prompt window — the README says so itself — or when you are a single user grepping huge chat logs with no need for shared access or permissions. A managed memory API like Mem0 is a better fit if you want an SDK and a hosted service and do not care where the notes live. A temporal knowledge graph like Graphiti (covered in the blog's Graphiti and Relate tutorial) is a better fit if your core problem is tracking what changed when, rather than sharing notes across agents. And plain grep is still the right tool for exact-text lookup in a small folder; GBrain earns its setup cost when the notes are many, the agents are several, and the answers need citations.

Two honest caveats from the project's own documentation. The benchmark table — personal-notes Q&A at 86.7% with GBrain against 13.3% with no retrieval, LongMemEval at 93.6% against 89.0% for plain Postgres hybrid — is self-reported from the project's own eval harness, with methodology and confidence intervals in its proof doc, and the README itself warns that published LongMemEval scores are not comparable across vendors. The same table shows GBrain behind on very long chat logs, where an agent with grep scores 67.4% against GBrain's 55.2%. And the project is young and fast-moving — 0.x, frequent releases, an experimental Rust engine — so read the changelog before depending on a documented contract, and pin the #stable channel rather than tracking master.

The takeaway#

GBrain's bet is that agent memory should be files first and a service second: Markdown on disk, a local index over it, citations on every answer, and no key required until you decide you want one. The implementation is small enough to verify in an afternoon — the keyless brain, the import, the search, the memory verbs, and the MCP handshake all ran here with no account and no model call. Start with the binary installer and gbrain sources demo company-brain. If the cited answers it returns are the ones your agents have been guessing at, import your notes — and remember the gotcha: the import builds search, not the graph. Write the pages that matter through the brain, and the links will follow.