By the end of this tutorial you'll have your own AI agent running on a server you control, talking to you over Telegram, with a brain that remembers everything you tell it. About two hours end-to-end, $100 to $150 a month sustained.
This is the install I'd run if I were setting up the whole stack from scratch today. I documented it live during a setup session with a collaborator (we used Granola to capture the screen because "this is already too complicated for an archetypical person"). The tutorial is the cleaned-up version of that session.
"This is the Apple I, we're just soldering breadboards over here."
If you only want the brain layer (no agent, no Telegram, just gbrain as memory for an MCP client you already use), skip to the CLI standalone install in INSTALL.md. If you want the whole agent shared with a team, read the company brain tutorial instead. This tutorial is the solo, full-stack, talk-to-it-on-Telegram path.
A personal AI agent with four pieces:
Architecture:
Telegram → AlphaClaw (harness) → OpenClaw (agent) → GBrain (knowledge/skills) → Supabase (embeddings/search)
Git repo is the system of record. The whole thing is multiplayer by default: any agent that hooks into the repo works. Conflicts resolve through git.
| Requirement | Why |
|---|---|
| GitHub account (org or personal) | For the two repos that store the agent + brain |
| Render account | For hosting the agent runtime |
| Telegram account | For talking to your agent |
| API keys: OpenAI, Anthropic at minimum | Embeddings + the Claude model |
| About $100 to $150 a month | Render Pro + Supabase + API usage |
You need two repos, not one.
your-org/myagent. Private.your-org/myagent-brain. Private.GitHub → New Repository → your-org/myagent (workspace)
GitHub → New Repository → your-org/myagent-brain (brain)
Both repos start empty. GBrain will populate the brain repo with its default structure on first install.
GitHub → Settings → Developer Settings → Personal Access Tokens → Fine-grained tokens.
myagent-tokenGitHub's fine-grained PAT UI is painful. You may need to reload the page after creating repos before they appear in the selector. This is the worst part of the whole setup. Push through.
Save this token. You'll need it for the AlphaClaw setup.
/newbotAlphaClaw is the setup harness that manages OpenClaw deployment.
your-org/myagentRender will build a Docker container with the harness. First deploy takes about 5 minutes.
Memory matters. If the instance runs out of memory during install, upgrade to Render Pro. The base tier is too small for GBrain + OpenClaw together. My production instance runs 48 cores and 64GB RAM (about $1,500 a month) but that's overkill for a new setup. Pro tier ($85 a month) is the minimum viable.
In the AlphaClaw UI (Providers tab):
You can use the same keys across multiple agents.
Once OpenClaw is running:
gbrain install
This installs:
GBrain populates the brain repo with its default directory structure, skill files, and configuration. From this point, the agent has working memory and access to every skill.
GBrain uses Supabase for vector embeddings and full-text search at scale. There are three setup gotchas I hit the hard way. Walk through them in this order.
vector (the pgvector extension) and toggle it on.Skip this and every embed write fails with "type vector does not exist" the moment GBrain tries to create its schema. pgvector is what stores the embeddings; the schema migrations refuse to run without it. Five seconds in the UI; an hour of debugging if you forget.
In the Supabase dashboard, click Connect in the top navigation bar, then Connection String. Supabase shows three options. They look almost identical. Use the right one.
db.YOUR-PROJECT.supabase.co). Talks straight to the Postgres instance. IPv6-only. Will fail if your Render host doesn't have IPv6 outbound (most don't by default).aws-0-...pooler.supabase.com). Talks through Supabase's pooler (Supavisor) in transaction mode. Works over IPv4. Survives connection storms from parallel workers. GBrain is tuned for this one: it auto-disables prepared statements on port 6543 and routes migrations, DDL, and worker locks to a separate direct connection (see 7c).aws-0-...pooler.supabase.com). Also works over IPv4, with full session features. You don't need it as your main URL, but it's the free way to fix the IPv4 gotcha in 7c.You want the Transaction pooler string. Format looks like:
postgresql://postgres.YOUR-PROJECT:YOUR-PASSWORD@aws-0-us-west-1.pooler.supabase.com:6543/postgres
Configure it via:
gbrain config set database_url "postgresql://postgres.YOUR-PROJECT:YOUR-PASSWORD@aws-0-us-west-1.pooler.supabase.com:6543/postgres"
The transaction pooler (7b) carries your normal reads and writes over IPv4. But GBrain runs schema migrations, DDL, and background-worker locks on a direct connection, which it derives from your pooler URL by swapping the host to db.YOUR-PROJECT.supabase.co:5432. That direct host is IPv6-only. On an IPv4-only host (most Render plans), reads work but migrations hang and worker locks orphan, often silently.
Two ways to fix it. The free one first:
Free: point GBrain's direct connection at the Session pooler. The session pooler is the same Supavisor host on port 5432, and it's IPv4. Copy the Session pooler string from the same Connect → Connection String panel and set it as the direct-connection override:
export GBRAIN_DIRECT_DATABASE_URL="postgresql://postgres.YOUR-PROJECT:YOUR-PASSWORD@aws-0-us-west-1.pooler.supabase.com:5432/postgres"
Now both pools — reads on the transaction pooler (6543), DDL and locks on the session pooler (5432) — run over IPv4 at zero extra cost.
Paid: buy Supabase's IPv4 add-on. About $4 a month, Pro tier or higher. It makes the direct db.*.supabase.co host reachable over IPv4, so the derived direct connection just works with no extra config. In the Supabase dashboard, Project Settings → Add-ons → IPv4 address. Toggle on, wait a minute, retry.
Either fixes it. If gbrain doctor still shows connection failures that mention "network unreachable" or hangs forever on connect, you haven't done one of these yet.
gbrain doctor
Green checks on schema, connectivity, pgvector extension, embedding provider. If any of those are yellow, the message will tell you which gotcha you hit (and which of 7a / 7b / 7c to revisit).
Supabase is usually the scaling bottleneck, not CPU or LLM calls. If you're doing heavy ingestion (emails, calendar, Slack streaming in), upgrade from small to large DB instance early. Don't wait for the small instance to choke; the symptoms (silent failed inserts, sync timeouts, embedding backfill stalls) all look like different bugs but are the same bug.
Send a test message. If it responds with context-awareness and can search the brain, you're live.
The brain repo IS the brain. Any agent that can read and write to the git repo can participate. This makes the architecture inherently multiplayer: multiple agents can share a brain, work on different parts, and resolve conflicts through git.
The goal for GBrain is to make the thin client as awesome as the fat client. Most users will start thin and grow.
GBrain exposes a Model Context Protocol server that enables inter-agent communication and integration with external systems. This is how you add read and write access to your product's API, databases, or other services.
Brains share through git. My main agent can populate another agent's brain by pushing content to its repo. The MCP layer enables cross-agent brain queries. Just push to the git repo and the other agent picks it up on next sync.
| Component | Monthly cost |
|---|---|
| Render Pro (minimum viable) | about $85 |
| Supabase (small) | free to $25 |
| OpenAI API (embeddings) | $5 to $20 (much less if you use ZeroEntropy as the default) |
| Anthropic API (Claude) | $50 to $500 (usage dependent) |
| Total minimum | about $100 to $150 a month |
My production setup is about $10,000 a month, but that's 10 instances, 200 crons, processing email and Slack and calendar in real time, running sub-agents. Not what you need on day one.
"Next year it's not going to cost $10,000 a month. It'll cost $1,000 a month. And then the year after that, it'll be $100 a month, and then everyone will have it."
You now have a personal AI agent running on Render, talking to you on Telegram, with a brain that ingests and remembers everything you tell it. Every conversation gets indexed, every new entity (person, company, deal, concept) gets its own page, the overnight enrichment daemon dedupes and consolidates while you sleep. You wake up with a smarter agent than the one you went to bed with.
Where to go next:
docs/integrations/ for per-source recipes.docs/mcp/ for per-client setup.docs/architecture/ for the full cycle reference.Questions, gotchas, or wins worth sharing? Open an issue at github.com/garrytan/gbrain.