Give your AI agent a memory that cites its sources

4 months ago

Your AI agent starts every session from zero. GBrain gives it a memory. A local brain, ready in two seconds, no server to run. Two commands to wire it into Claude Code or Codex. And it is the same brain Y Combinator's Garry Tan built to run his own agents.

Ask about this presentation

Chapters

  1. 0:00Give your AI agent a memory that cites its sources
  2. 0:14Search finds the pages. The brain writes the answer.
  3. 0:37Every page you write wires itself into a graph.
  4. 1:02Your brain is a git repo of markdown.
  5. 1:28Run it under an agent and it becomes a daemon.
  6. 1:55The full setup installs itself.
  7. 2:19Already in Claude Code or Codex? Two commands.
  8. 2:42No agent at all? It's a CLI.
  9. 3:02Agents don't need to be smarter to be more useful.They need to remember.
Show transcript
  1. Your AI agent starts every session from zero. GBrain gives it a memory. A local brain, ready in two seconds, no server to run. Two commands to wire it into Claude Code or Codex. And it is the same brain Y Combinator's Garry Tan built to run his own agents.

    Slide text
    GitHub Trending · Ep 15 · Jul 19, 2026
    A local brain, ready in two seconds.
    2 s
    to a working local brain
    2 commands
    to wire into Claude Code or Codex
    gbrain TypeScript MIT CLI + MCP
  2. Say you have a meeting with Alice tomorrow, and you ask what you need to know. Most tools hand you five pages to go read yourself. GBrain reads them for you and writes the answer. Who she is, when you last talked, the three things still open between you. Every claim cites a source page. And this part is the differentiator. It tells you what it does not know. Six weeks of silence on Alice gets flagged, not hidden.

    Slide text
    what search gives you
    1 people/alice
    2 meetings/2026-03-15-alice-q1
    3 meetings/2026-01-08-acme-kickoff
    4 customers/acme
    5 notes/2026-04-22
    what gbrain gives you
    Alice runs engineering at Acme. You last spoke April 22.
    Still open: her security review (due May 1) · your 500-seat pricing (sent, no reply) · the CISO intro you promised.
    and it flags what it does not know: nothing new on Alice in six weeks — she may have replied where the brain can't see
    garrytan/gbrain README — the project's worked example ("What this looks like")
  3. Here is the clever part. Every time a page is written, GBrain pulls out the people and companies it mentions and draws typed edges. Alice works at Acme. The pricing chat connects them. No language model call, just pattern matching, on every single write. So a question like who works at Acme stops being a similarity guess and becomes a graph hop. On the project's own benchmark, the graph puts the right page in the top five thirty-one points more often than vector search alone.

    Slide text
    alice
    person
    works_at →
    acme
    company
    ← attended
    2026-04-22 pricing chat
    meeting
    "who works at Acme?"
    a graph hop, not a similarity guess
    on the project's own 240-page benchmark: right page in the top five +31.4 points vs vector-only retrieval (gbrain-evals)
    garrytan/gbrain README — capabilities · gbrain-evals (project's own eval) · zero LLM calls on write
  4. The system of record is plain markdown in a git repo. You own it. You can grep it. You can walk away with it. GBrain syncs that repo into Postgres for retrieval. On your laptop that is PGLite, Postgres compiled to WebAssembly, zero setup. For a team it is real Postgres with pgvector. Both engines implement one contract of about forty-seven operations, and the CLI and the MCP server are both generated from it.

    Slide text
    markdown brain repo
    the system of record — yours, grep-able, portable
    →
    PGLite
    Postgres via WASM · zero config · to ~50K pages
    Postgres + pgvector
    Supabase or self-hosted · team scale
    →
    one contract, ~47 ops
    the CLI and the 30+ MCP tools are generated from it
    garrytan/gbrain README — architecture · src/core/engine.ts
  5. Run it under a full agent and it becomes a daemon. Every message gets scanned for things worth keeping. Every answer checks the brain before any external call. Every write links itself into the graph. Then a dream cycle runs overnight. It dedupes people, repairs citations, and hunts for contradictions. Tan runs his own agents on this. He reports a brain of a hundred and forty-six thousand pages and twenty-four thousand people, fed by sixty-six cron jobs. Even his phone calls land as pages.

    Slide text
    signal → search → respond → write → auto-link → sync
    overnight dream cycle — dedupes people, repairs citations, scores salience, hunts contradictions
    the author's production brain (self-reported)
    146,646
    pages
    24,585
    people
    5,339
    companies
    66
    cron jobs
    phone calls land as pages (Twilio + realtime voice)
    garrytan/gbrain README — the loop · docs/images/voice-client.png
  6. If you want the whole autonomous setup, you do not install GBrain. Your agent does. Running OpenClaw or Hermes, or deploying one fresh, there are one-click templates for Render and Railway. Then you paste a single instruction: retrieve and follow the install file. The agent creates the brain, asks you for API keys, loads forty-three skills, and wires up the overnight cycle. The project says about thirty minutes, and you only answer questions.

    Slide text
    OpenClaw
    AlphaClaw — one-click deploy on Render
    Hermes
    agent template — one-click deploy on Railway
    # paste into your agent:
    Retrieve and follow the instructions at:
    …/gbrain/master/INSTALL_FOR_AGENTS.md
    the agent creates the brain, asks for your API keys, loads 43 skills, wires the dream cycle — ~30 minutes, per the project
    garrytan/gbrain README — install (project's setup figures)
  7. And you do not need any of that to get the good part. In Claude Code, it is two commands. Init builds the local brain. Two seconds, no Docker, no server. One MCP add and your coding agent can capture thoughts and query everything you ever told it. Codex is the same shape. If your brain already lives on a server, one connect command points your laptop at it and smoke-tests the token. Cursor, Windsurf, Claude Desktop, and ChatGPT connect too.

    Slide text
    $ gbrain init --pglite
    $ claude mcp add gbrain -- gbrain serve
      # codex: codex mcp add gbrain -- gbrain serve
    zero server · zero token · zero tunnel
    brain already on a host? gbrain connect https://…/mcp --token … --install wires it up and smoke-tests the token
    Cursor Windsurf Claude Desktop ChatGPT
    garrytan/gbrain README — quick start: Claude Code or Codex · docs/mcp/
  8. No agent at all? It is still a good CLI. One bun install, point it at your notes folder, and start asking questions. It also runs as a company brain. Everyone queries the same memory, and each login sees only its own slice. The team fuzz-tested every read path for leaks and reports zero. MIT licensed, TypeScript, and it all runs on your hardware.

    Slide text
    $ bun install -g github:garrytan/gbrain
    $ gbrain import ~/notes/
    $ gbrain query "what themes show up in my notes?"
    company brain — everyone queries the shared memory, each login sees only its slice; the team fuzz-tested every read path and reports zero leaks
    TypeScript MIT self-hosted
    garrytan/gbrain README — CLI standalone · company brain (team's own fuzz-test)
  9. So if your agent keeps asking you things you already told it, this is the fix. Give it a brain, and every day it knows you a little better. The link is on screen. New repo tomorrow.

    Slide text
    github.com/garrytan/gbrain
    New repo tomorrow.

What happened in AI today, in your inbox

One short email each evening. Read it and you’re caught up.

Built with ❤️ in New York