Operator
← Back to blog
GuidesProductivity

Give your Operator agent a persistent memory with GBrain

Operator TeamOperator Team···7 min read

A new chat with most assistants starts from nothing. It does not know who you introduced it to last week, what you decided about the project on Tuesday, or the constraint you spelled out twice in March. Every session you spend the first few minutes pasting context back in, and the moment the window closes that context is gone again. The work each time is fine. What is missing is that none of it builds up.

GBrain is one answer to that. It was open sourced in April 2026 by Garry Tan, the president and CEO of Y Combinator, who built it to run his own agents. Your knowledge lives as plain markdown pages in a git repo, GBrain indexes those pages into a Postgres database for retrieval, and every time the agent writes a page it extracts the people, companies, and concepts mentioned and wires typed links between them with no model calls. The result is a knowledge base the agent reads and writes on its own, with hybrid search and a self wiring graph on top.

There is a good step by step tutorial from MarkTechPost and a clear overview from Vectorize if you want the architecture before you wire it up. GBrain was written to power OpenClaw and Hermes deployments, and since Operator.io runs on OpenClaw, your agent can install and operate it directly.

How it works

You send the prompt and the agent installs GBrain, then uses it as the place it remembers and the first place it looks.

  • It fetches GBrain's install guide for agents and runs through it, picking the local PGLite option so the brain lives in its workspace with no account to set up.
  • As you work together, it writes pages into the brain for the people you mention, the decisions you make, what you are building, and the facts that would otherwise disappear when the chat ends.
  • Before it answers a question about you or your work, it searches the brain first, so it builds on what it already knows instead of asking you again.
  • On a schedule you set, an automation consolidates the brain, clears duplicate pages, and flags anything that looks stale or contradictory, then sends you a short note of what changed.

Before you send the prompt, check the install guide the agent fetches. It lives at the tip of GBrain's master branch, so it can change between the day you read this and the day you run it. Open that URL in a browser and skim what the installer actually does first, and if you want the agent to run exactly the steps you reviewed, point it at a tagged release or a pinned commit rather than master. GBrain is young and moving quickly, so pinning is how you keep the install reproducible.

The piece that makes this more than a notes file is the graph. When the agent writes a page about a meeting with someone, GBrain records that the meeting happened, who attended, and where they work, using typed link types like attended, works_at, invested_in, and founded extracted deterministically from the text. A later question like "what is still open with this person" can pull the answer across several pages instead of returning one document for you to read. On GBrain's own BrainBench benchmark, a 240 page rich prose corpus, the graph layer lifted retrieval precision at P@5 by about 31 points over the same system with the graph turned off, as reported in the MarkTechPost tutorial.

What the brain is

The local version runs on PGLite, which is Postgres 17 compiled to WebAssembly and running in process. There is no server and no Docker, the database is ready in a couple of seconds, and a personal brain on it holds roughly fifty thousand pages before you would want to move to a hosted Postgres. Search is hybrid: vector similarity through pgvector with HNSW indexing, keyword matching through Postgres full text search, and a reciprocal rank fusion step that blends the two, so a query finds the right page whether you remember the exact words or only the gist.

GBrain gives the agent two ways to ask.

CommandWhat it returnsWhen to use
gbrain searchThe top pages ranked by the hybrid scoreWhen you need raw material to skim
gbrain thinkA synthesized answer with citations back to the source pages, plus a note on what the brain does not know yetWhen you want a direct answer you can lean on

That gap note, for example that a page is six weeks stale or that two pages disagree, is what keeps you from trusting an answer the brain cannot actually support. Both surfaces are also exposed over the Model Context Protocol, so the agent can call them as typed tools rather than shelling out. The GBrain repository documents more than 30 contract first operations available through CLI and MCP.

If you outgrow the local brain, gbrain migrate --to supabase moves the same schema and data to a hosted Postgres such as Supabase without losing pages or graph links. The Vectorize overview walks through when that migration makes sense versus staying on PGLite.

The prompt

This is the instruction the agent acts on:

Set yourself up with GBrain so you keep a real memory between our
conversations instead of starting cold each time. GBrain is Garry Tan's open
source brain layer for agents, a local knowledge base backed by Postgres that
you write pages to and search with hybrid retrieval. Install it by fetching
and following the agent install guide at
https://raw.githubusercontent.com/garrytan/gbrain/master/INSTALL_FOR_AGENTS.md,
and when it asks where the brain should live, pick the local PGLite option so
it runs in your workspace with no account to set up. Once it is running, write
the things worth keeping into the brain as you go: who I introduce you to,
what we decide, what I am working on, and the details you would otherwise lose
when this chat ends. Before you answer a question about me or my work, search
the brain first so you build on what you already know. Set up an automation
that consolidates the brain on a schedule, clearing duplicates and flagging
anything stale or contradictory, and sends me a short note of what changed.
Before you start, ask me what kinds of things you should always remember,
whether I have an embedding API key you should use for search, and what time
to run the nightly consolidation.

The same prompt is saved in the prompts library, so you can send it to your agent without retyping a word.

Using it day to day

The change shows up gradually. You tell the agent that a contact runs engineering at a company you work with, and weeks later, before a call with that person, you ask what is still open between you. Instead of asking you to refresh its memory, it pulls the last few exchanges, the commitment that has not been answered, and the thing you said you would do, and it tells you what it has no record of so you can ask directly.

Because the brain is plain markdown the agent owns, you can talk to it about its own memory: ask what it knows about a project, tell it a page is wrong, or have it walk you through what it consolidated last night.

The nightly consolidation is where a pile of captured notes turns into something coherent. GBrain's design leans on a cycle that runs while you are away, deduplicating people pages, fixing citations, and surfacing contradictions, so the brain gets sharper without you tending it. You can change or pause that automation on the Automations page in your dashboard.

GBrain also ships ingestion recipes for Gmail, Google Calendar, Twitter, and meeting transcripts, documented in the repo, if you want the brain to pull signal from outside the chat rather than waiting for you to paste it in.

Each recipe copies real content into the brain, the bodies of emails, the details of calendar events, posts, and transcripts, and those pages persist long after the conversation that would have held them. Connect the source with a scope that matches what you actually want kept, a read only or label limited Gmail grant rather than full mailbox access for example, so the brain fills with the signal you meant to keep instead of your entire inbox. Those integrations are optional; the prompt above sets up the core write and search loop without them.

Keys and cost

GBrain is MIT licensed and free to run, and the local PGLite brain needs no account at all. The one thing that affects search quality is embeddings: vector search needs an embedding provider, and GBrain works with several, including OpenAI, Voyage, and ZeroEntropy, so set the key for whichever you prefer when the installer asks.

That key is written into the agent's GBrain config and read by the gateway process every time it embeds a page, so it sits alongside the rest of your agent config and anyone with access to that environment can read it. Handing over a scoped embedding key with its own spending limit, rather than a master account key, is the cleaner way to do it. Without an embedding key the brain still imports your pages and keyword search still works, but the semantic side degrades, which is why the prompt asks whether you have a key to hand it. Everything else, the database, the pages, and the graph, lives in the agent's workspace rather than a GBrain service, on your own machine if you self host and in your Operator instance if you run it managed.

To set it up, open the prompts library and send the GBrain prompt to your agent. It asks what you want it to remember, whether you have an embedding key, and when to run the consolidation, and from there it starts keeping track instead of starting over.

Frequently asked questions

What is GBrain?

+

GBrain is an open source memory layer for agents, open sourced in April 2026 by Garry Tan, the president and CEO of Y Combinator. Your knowledge lives as plain markdown pages in a git repo, GBrain indexes them into Postgres for retrieval, and each time the agent writes a page it extracts the people, companies, and concepts mentioned and wires typed links between them. The result is a searchable knowledge base the agent reads and writes on its own.

How does GBrain give my agent memory between chats?

+

After you send the GBrain prompt, the agent installs it, picking the local PGLite option so the brain lives in its workspace with no account. As you work, it writes pages for who you introduce, what you decide, and what you are building. Before answering a question about you or your work, it searches the brain first, so it builds on what it already knows instead of asking again. A scheduled consolidation clears duplicates and flags stale or contradictory pages.

Do I need an API key to run GBrain?

+

The brain itself is free and the local PGLite version needs no account. The one thing that affects search quality is embeddings: vector search needs an embedding provider, and GBrain works with several, including OpenAI, Voyage, and ZeroEntropy, so set a key for whichever you prefer when the installer asks. Without one, pages still import and keyword search works, but the semantic side degrades.

Where is my GBrain data stored?

+

In the agent's own workspace, not a GBrain cloud. The local version runs on PGLite, Postgres compiled to WebAssembly and running in process, so there is no server and no Docker, and a personal brain holds roughly fifty thousand pages before you would move to a hosted Postgres. Where that workspace sits depends on how you run the agent. Self host OpenClaw and the database, the markdown pages, and the graph live on your own machine, while on managed Operator they live in your instance's workspace on our infrastructure under the same access controls as the rest of your agent's files. If you outgrow PGLite, GBrain migrates the same data to a hosted Postgres such as Supabase without losing anything.