Memory

~10 min read

Why Your Bot Needs Memory

Without memory, every conversation starts from zero. Your bot would not remember your name, your goals, or what you talked about yesterday.

Memory changes everything. Your bot stores every conversation, learns facts about you, tracks your goals, and searches past messages to give better answers. It does not just remember. It understands context.

How It Works

Three layers work together:

  • Conversation history. Every message you send and every response gets saved to a database. Your bot can look back at what you discussed last week or last month.
  • Semantic search. Your bot does not just search for keywords. It understands meaning. If you talked about “feeling overwhelmed at work” last Tuesday, and today you ask about stress, it finds that conversation because it understands the connection.
  • Facts and goals. When you share something worth remembering (“I have a meeting Friday” or “my daughter’s name is Mija”), the bot stores it as a permanent fact. When you set a goal, it tracks it. When you complete it, it marks it done.

Where Your Data Lives

Supabase is the database. It is open-source, hosted in the cloud, and you choose the hosting region when you create your project — so you control where your data is stored. This matters for data privacy, especially if you are in the EU or have specific data residency requirements. Supabase uses enterprise-grade security: encrypted at rest, encrypted in transit, and row-level security policies.

Your memory persists even if you restart your computer, reinstall the bot, or switch devices. It lives in the cloud, always available.

What Are Edge Functions?

Edge Functions are small programs that run on Supabase’s servers — not on your computer. Think of them as little helpers that live next to your database and do specific jobs automatically.

In this setup, Claude Code deploys two Edge Functions for you:

  • Store function. Every time a new message is saved to your database, this function automatically converts it into a mathematical representation of its meaning (called an embedding). You never call this yourself — it runs in the background on every new message.
  • Search function. When your bot needs context from past conversations, it calls this function. It takes your current message, generates an embedding for it, and finds the most similar past conversations by meaning — not just by matching words.

You do not need to understand how Edge Functions work under the hood. Claude Code deploys them for you, and they run silently in the background.

Set Up Supabase

  1. Go to supabase.com and sign up. You can use your GitHub or Google account.
  2. Create a new project. Pick any name. Choose a region close to you — this is where your data will be stored.
  3. Wait about two minutes for it to provision.
  4. Click Connect in the top bar. Under API Keys, you will find your Project URL and anon key. Copy both.

Give these to Claude Code when it asks. It saves them to your .env file.

Connect Claude Code to Your Database

Claude Code can manage your database directly through the Supabase MCP server (Model Context Protocol). This lets it create tables, run queries, and deploy functions without you clicking around dashboards.

Tell Claude Code you want to set up the database. It will ask for a Supabase access token. Get one at supabase.com/dashboard/account/tokens.

Claude Code then creates the tables, installs the search functions, and verifies everything works. The automated setup handles all of this — you just paste credentials when asked.

Set Up Semantic Search

For semantic search, you need an OpenAI API key. This is separate from your Anthropic subscription.

  1. Go to platform.openai.com and create an account.
  2. Go to API keys and create a new key. Copy it immediately — once you click done, you will not be able to see it again.
  3. In your Supabase dashboard, go to Edge Functions. Click Add a Secret. The name must be exactly OPENAI_API_KEY (all capitals). Paste your key as the value.

Claude Code then deploys the two Edge Functions described above and verifies semantic search is working.

Don’t want to use OpenAI? The embedding model can be swapped for any other provider — we use OpenAI’s text-embedding-3-small for simplicity, but the architecture supports alternatives. If you prefer a different embedding provider, that is totally possible down the road.

Cost

Service Cost Notes
Supabase Free Free tier gives you 500 MB of database storage. Since we are storing text messages (which are tiny), it will take a very long time before you come anywhere near that limit. You can use this for months or even years without upgrading.
OpenAI embeddings Pennies $0.02 per 1 million tokens. An embedding is just a string of numbers — extremely cheap to generate. For normal personal use, expect to pay somewhere between a few cents and maybe a dollar per month. New OpenAI accounts get $5 in free credits, which is enough for hundreds of thousands of messages.

Time: About 10 minutes.

// READY_FOR_MORE

Want voice, tools, and multi-agent features?

This free course covers the basics. The full GoBot system includes 25+ features — voice calls, tool integrations, proactive AI, and more. Built by 366+ professionals inside Autonomee.

Full Course Overview Join Autonomee