DEV Community

Cover image for I gave Claude a persistent memory for $0/month using Cloudflare
Rahil Pirani
Rahil Pirani

Posted on

I gave Claude a persistent memory for $0/month using Cloudflare

I gave Claude a persistent memory for $0/month using Cloudflare

Claude is great. But every time you start a new conversation, it forgets everything. Your projects, your preferences, what you decided last week — gone.

The official memory feature exists, but it's vague and you can't really control it. You can't query it, tag it, or search it semantically. It's a black box that occasionally surfaces something useful.

So I built my own.

What it is

It's a self-hosted MCP server that runs on Cloudflare Workers. Four tools: remember, recall, list_recent, forget. Claude calls them automatically. You never think about it.

The interesting part is how recall works — it's not keyword search. Every note gets embedded as a 384-dimensional vector using bge-small-en-v1.5 on Workers AI. When you ask Claude something, it searches by meaning, not exact words.

Store: "users drop off at the payment step."

Query: "onboarding problems."

It finds it. No keyword overlap needed.

Why Cloudflare

Honestly, cost. The whole stack — Workers, D1 (SQLite), Vectorize, Workers AI embeddings — runs on Cloudflare's free tier at personal scale. You don't even need a credit card to get started.

The other reason is deployment. There's a one-click deploy button that provisions everything automatically. It takes about 3 minutes to go from zero to a running second brain connected to Claude Desktop.

How to set it up

1. Deploy — click the button in the repo, Cloudflare provisions D1 + Vectorize and deploys the Worker.

2. Run the schema — one SQL snippet in the Cloudflare dashboard.

3. Set your auth token — one command with wrangler.

4. Connect Claude Desktop — add a few lines to your config JSON:

{
  "mcpServers": {
    "second-brain": {
      "command": "npx",
      "args": ["mcp-remote", "https://<your-worker-url>/mcp"]
    }
  }
}
Enter fullscreen mode Exit fullscreen mode

That's it. Claude now has persistent memory across every conversation.

What I actually use it for

I have Claude set up to call recall at the start of every conversation, before it says anything. So when I open a new chat and say "continue the onboarding work from last week," it already knows what that means.

I also capture from everywhere — there's a browser bookmarklet that saves any highlighted text or page with one click, and iOS Shortcuts for voice capture on the go. "Hey Siri, brain dump" and I can dictate a note that shows up in Claude's memory immediately.

What it doesn't do (yet)

There's no UI for browsing your memory. You can hit the /list endpoint, but it's raw JSON. I want to build a proper dashboard eventually — something that shows your memory visually, lets you edit or delete entries, maybe shows what Claude has recalled most often.

Also, the local dev experience is slightly annoying because Vectorize and Workers AI don't run locally — you end up pointing at remote resources for real testing. Not a dealbreaker, but worth knowing.

The repo

Everything is open source under MIT. One-click deploy, manual setup instructions, iOS Shortcuts templates, bookmarklet source — it's all there.

github.com/rahilp/second-brain-cloudflare

If you use it, I'd genuinely like to know what you end up storing in it. That's the part I'm most curious about — what people actually find worth remembering.

Top comments (0)