rahilp/second-brain-cloudflare
A Cloudflare Worker memory layer shared by AI clients over MCP and REST.
Automated SPDX check for reference only — not legal advice. Disclaimer
GitHub Star History
Full-history star trajectory from GitHub official history. Switch ranges or hover any point for exact counts.
Evidence-Backed Technical Brief
AI Deep ReviewArchitecture & Core Mechanics
Second Brain is a TypeScript application built around a single Cloudflare Worker. REST and MCP expose the same persistent memory system to AI clients and capture integrations. D1 backs memory storage and ranked full-text retrieval; Vectorize and Workers AI provide semantic search, with KV also part of the Worker stack. Captured records are classified, checked for duplicates and contradictions, linked to related records, and indexed for recall. Recall can follow those relationships and return source-backed context.
The package uses @cloudflare/workers-oauth-provider and the @modelcontextprotocol/client, @modelcontextprotocol/server, and @modelcontextprotocol/sdk packages. The repository separates src/, db/, integrations/, and installer/, with wrangler.jsonc for Worker configuration. Workspace is the access boundary; projects group records by subject and can overlap without changing who can read them. Tags and source provide separate facets for classification and provenance.
Key Capabilities & Differentiators
Retrieval supports both semantic recall and relevance-ranked full-text matching. The latter matters for ticket IDs, versions, names, and exact phrases, and remains available alongside capture when Vectorize is unavailable. New deployments use the full-text index immediately; existing deployments build it over nightly runs. The shipped embedding models favor English, with a multilingual option in desktop settings. Memory operations include as-of recall, timestamped updates, history, undo, explicit relationships, and status changes. brief surfaces outstanding items, while digest reads the latest existing summary.
Team Edition gives each member a private workspace and exposes a shared workspace as company in the API, CLI, and MCP tools. Sharing moves one canonical record; only its author or an admin can edit or remove the shared record. Admins do not gain access to personal workspaces. For agent gateways, get_prompt_capsule exposes a deterministic, read-only projection of canonical core or project entries. It emits slots in fixed order, skips malformed entries, and reports ambiguous slots instead of selecting one silently.
Trade-offs & Limitations
Compared with assembling MCP, storage, embeddings, and a retrieval pipeline around a general-purpose vector database, Second Brain ships a usable memory product with editing, history, export, and sharing. The tradeoff is that its operational path and retrieval design are tied to Cloudflare primitives. Self-hosting here means deploying into an account you control, not running offline or on arbitrary infrastructure. A local-first store is a better starting point if offline operation is mandatory; a bespoke stack is a better fit if storage, ranking, or tenancy must be independently controlled.
Each brain currently supports one shared team. The optional team parameter and list_teams tool do not imply that the dashboard can create or switch between multiple teams. Without the Vectorize workspace metadata index, recall searches the broader candidate pool before applying access limits. Unauthorized records are not returned, but they can crowd eligible records out of the nearest matches. Treat free-tier fit as workload-dependent: traffic and migration backfills consume managed-service allowance, and a full re-embed uses Workers AI allowance for every memory.
Hardware & Deployment Guide
The desktop installer, Deploy to Cloudflare flow, and manual CLI path provision the same application in your Cloudflare account. The manual path uses Node/npm and Wrangler tooling: run npm install, npm run vectors:create, then npm run deploy. The documented Vectorize settings are 384 dimensions and cosine similarity. Connect MCP clients at /mcp, using OAuth where supported or a strong randomly generated AUTH_TOKEN in an Authorization: Bearer header for static clients. Query-string token authentication was removed in v3.
vectors:create also creates the workspace_id metadata index. When adding it to an existing deployment, check /health for workspaceFilter.supported and plan the documented reset and re-embedding steps together: adding the index without re-embedding can remove older records from semantic recall. The installer-v4.0.7 release provides macOS .dmg and Windows .exe downloads, with separate update artifacts. Existing deployments should be upgraded to 4.0.4 or later before December 5, 2026, to avoid the older behavior where client connections stop working 90 days after setup.
recall supports as-of queries, history exposes previous text, and undo can restore trashed memories.workspace_id metadata filtering is important for team recall.Individuals and single teams that want several AI clients to recall the same decisions, preferences, and project history from a Cloudflare deployment they control.
You need offline or on-premises operation, multiple independently administered teams in one instance, or a retrieval stack with replaceable storage and ranking components.
Quick Start & Installation
npm install npm run vectors:create npm run deploy
Comparison vs. Top RAG, Data & Memory Alternatives
Full comparison →| Repository | Stars | 7d Trend | Stack | License | Core Positioning |
|---|---|---|---|---|---|
| second-brain-cloudflare ★ | 886 | +8 | TypeScript | MIT | A Cloudflare Worker memory layer shared by AI clients over MCP and REST. |
| claude-mem | 121.7k | +1.4k | TypeScript | Apache-2.0 | Hook-driven memory and hybrid search for coding agents that need cross-session r |
| Scrapling | 108k | +1.5k | Python | BSD-3-Clause | Python HTTP and browser crawlers that turn websites into RAG-ready Markdown |
| hindsight | 64.9k | +1.1k | Python | MIT | A bank-based memory service that turns agent interactions into durable knowledge |
AI Context Briefing (for Claude / Cursor / Windsurf)
Standardized architecture summary & quickstart commands ready to paste into coding agents.
curl -sL https://repoforai.com/repo/rahilp/second-brain-cloudflare.md
Active README embeds unlock Hot-Tier 6h Telemetry Refresh automatically (zero pay-to-rank).
Frequently Asked Questions about second-brain-cloudflare
How do multiple clients connect to the same memory store?
https://YOUR-WORKER-URL/mcp. Use OAuth where supported or an Authorization: Bearer header for static clients. REST provides a separate integration surface. The clients share state because they connect to the same Worker; they do not synchronize copies of the database with one another.Do I need a GPU, and what determines runtime overhead?
Can we use it commercially, and does self-hosting satisfy compliance requirements?
How does it compare with building on a vector database or using local-first notes?
Upstream README & Documentation
This profile focuses on independent engineering analysis and live telemetry. Read the full upstream README, changelog, and examples directly on GitHub.
Top 10 Breakout Open-Source AI Repos, Every Thursday
Signal-only digest of fast-growing AI repos, SPDX license alerts, and architecture picks. Zero spam.
Zero spam · 1-click unsubscribe · Privacy Policy