AI Search Reference Architecture

The Memory Ledger

A reference architecture built on Cloudflare AI Search. Store decisions, patterns, and context in R2. Recall them with hybrid search. Deploy to your own account.

Hybrid search (vector + keyword) Contextual metadata Dashboard + Chronicle Auto-provisioning Bearer token auth 7 MCP tools + 5 prompts Multi-instance Markdown storage in R2 Save policy config

One command to deploy

npx create-ai-search-memory

Requires Node.js 18+. The setup wizard installs dependencies, deploys the Worker, sets secrets, and configures your MCP client.

Or clone manually:

git clone https://github.com/msdbcardoso/memory-ledger.git
cd memory-ledger
npm run setup
Deploy to Cloudflare Workers

From clone to running in minutes

Install & deploy

Installs dependencies, builds the dashboard, and deploys the Worker. R2 bucket and AI binding are provisioned automatically.

Secrets & auth

Detects your wrangler login, generates an auth token, and sets secrets automatically.

Configure your MCP client

Detects OpenCode, Claude Desktop, or Cursor and writes the MCP config with your Worker URL and token.

Start using it

Your agent can save and recall memories immediately. Open the dashboard at your Worker URL to browse and search.

# You get:
Dashboard  https://<your-worker>.workers.dev
MCP        https://<your-worker>.workers.dev/mcp
API        https://<your-worker>.workers.dev/api/memories

How it works

Save flow Agent saves a memory Markdown + YAML frontmatter written to R2 Indexed by AI Search Searchable immediately
Recall flow Query sent to AI Search (hybrid: vector + keyword) Folder filter scopes to user/project Full memories fetched from R2 in parallel

Seven tools for your agent

memory_save

Store with type, scope, tags, metadata

memory_recall

Semantic search

memory_ask

AI answer from memories

memory_list

List by scope

memory_get

Fetch by ID

memory_delete

Remove by ID

memory_clear

Wipe a scope


Natural language shortcuts

/remember

Save something to memory

/recall

Search memories by meaning

/ask-memory

Question answered from memories

/forget

Delete a memory by ID

/memories

List all stored memories


Full HTTP interface

POST   /api/memories              Save
GET    /api/memories/search?q=...  Recall
POST   /api/memories/ask           AI answer
GET    /api/memories               List
GET    /api/memories/:id           Get
DELETE /api/memories/:id           Delete
DELETE /api/memories               Clear
GET    /api/policy                 Save policy
GET    /api/status                 Status
GET    /health                     Health (public)

Built-in newspaper for your memories

Browse, search, and manage memories from your browser. Switch between list and chronicle views. Filter by scope, type, and importance.

Search

Semantic search across all memories

Filters

Filter by scope, type, importance

Chronicle

Newspaper broadsheet grouped by day

Metadata

Files, branch, repo on each card

Build something with AI Search

This is a reference architecture showing what you can build with Cloudflare AI Search. Questions? Join the Cloudflare Discord or check the docs.