# Run GBrain on a Prized box

> Self-host GBrain, Garry Tan's open-source memory for AI agents, on a Prized box: one always-on brain that the box's Claude Code and Codex and your laptop's Claude Code share, with nothing published to the internet.

URL: https://prized.dev/docs/gbrain
Updated: 2026-12-02



[GBrain](https://github.com/garrytan/gbrain) is an MIT-licensed memory for AI agents: Claude Code and Codex look in it before they answer and keep what you ask them to remember. Self-hosted, it needs a machine that stays on. On a Prized box it runs with your laptop closed, and your laptop reaches it with no open port and no tunnel account.

## 1. Pick a box [#1-pick-a-box]

Run it on your box, or start one for it:

```bash
prized box new brain --size micro --wait
```

On the free credit a workspace has one box at a time, so use the one you have ([Free credit](https://prized.dev/docs/billing#free-credit)) and put its name where this page says `brain`. A Nano (2 vCPU, 2 GB) runs it, and the server holds about 420 MB of memory; a Micro (4 GB) leaves more room for agents working beside it.

## 2. Install GBrain [#2-install-gbrain]

From your machine:

```bash
curl -fsSL https://prized.dev/docs/gbrain/gbrain-box.sh | prized exec brain -- bash -s
```

It takes under two minutes on a Nano or a Micro. [The script](https://prized.dev/docs/gbrain/gbrain-box.sh) installs Bun and GBrain's stable release, creates a brain that searches by keyword with no API key, runs it as a service on the box's `127.0.0.1:3131`, connects the box's Claude Code and Codex, and saves a token for your laptop. It follows GBrain's own [self-host](https://github.com/garrytan/gbrain#heres-how-to-self-host-it) and [remote MCP](https://github.com/garrytan/gbrain/blob/stable/docs/guides/remote-mcp.md) guides, and it is safe to run again: a re-run also renews the box agents' tokens, which last 90 days.

To index a folder of Markdown on the box as well, such as your company's docs repo:

```bash
curl -fsSL https://prized.dev/docs/gbrain/gbrain-box.sh | prized exec brain -- 'GBRAIN_NOTES=~/company bash -s'
```

## 3. Use it on the box [#3-use-it-on-the-box]

```bash
prized ssh brain
```

Then start `claude` or `codex`. New sessions look in the brain first: ask one to remember a decision, and the next session answers from it. Allow the gbrain tools when Claude Code or Codex asks.

## 4. Use it from your laptop [#4-use-it-from-your-laptop]

The server listens only on the box. Forward its port to your machine, and leave this running:

```bash
prized proxy brain 3131
```

If `brain` is the box you connected with `prized setup`, Prized already mirrors its ports to your `localhost` and you can skip this ([Ports](https://prized.dev/docs/ports)). Then add the brain to Claude Code on your laptop:

```bash
claude mcp add --transport http --scope user gbrain http://127.0.0.1:3131/mcp --header "Authorization: Bearer $(prized exec brain -- cat .gbrain/private/laptop.token)"
```

`claude mcp list` then shows `gbrain` as connected. The token lasts 90 days. For a new one, delete `~/.gbrain/private/laptop.json` on the box, run the script again, then `claude mcp remove gbrain -s user` and the same command.

## When the box sleeps [#when-the-box-sleeps]

A brain waiting for questions doesn't keep the box up, even with `prized proxy` open, so with auto-pause on, the box pauses after its idle window like any other: on the free credit, 2 hours idle, never in its first 24 hours ([Auto-pause](https://prized.dev/docs/boxes#auto-pause)). While it sleeps, your laptop's agents can't reach the brain. Wake it with:

```bash
prized box resume brain --wait
```

Nano through Small boxes keep their memory through a pause, so the same GBrain server is running when the box wakes, 11 to 33 seconds later ([Pause and resume](https://prized.dev/docs/boxes#pause-and-resume)). A running `prized proxy` forwards again by itself, and Claude Code on your laptop reconnects with nothing to redo. To keep the brain reachable all day, switch auto-pause off for this box; it then bills while idle, and on the free credit off means 12 idle hours at most:

```bash
prized box auto-pause brain off
```

## Common questions [#common-questions]

### Does anything need an API key? [#does-anything-need-an-api-key]

No: the brain searches by keyword, and for semantic search GBrain takes a Voyage or OpenAI key ([its install guide](https://github.com/garrytan/gbrain/blob/stable/docs/INSTALL.md)). Your agents on the box still need their own sign-in.

### How do I add notes later? [#how-do-i-add-notes-later]

Run step 2's second command with your folder. Keep the folder a git repository, then pick up new commits with `gbrain sync --no-pull --source notes` on the box.
