← / WorkMemory · MCP· 2026, ongoing

Brain.

A persistent memory primitive that follows you across Claude.ai, ChatGPT, the CLI, and your tools.

Live. Used daily across Claude Code, Claude.ai, ChatGPT, and the GUI.
Search algorithm
Tokenized · OR-match · tag-weighted
Result count returned
Top 20 with [score=N] prefix
Transport
Streamable HTTP, stateless
Surfaces wired
Claude Code · Claude.ai · ChatGPT · CLI · GUI
Backing store
Postgres or SQLite
Stack
NestJS · TypeScript · MCP SDK · Cloud Run
/ Intro

Project Memory, ChatGPT Memory, Claude Memory. Three vendors converging on the same lock-in. The thing each one calls “memory” lives inside their product and only inside their product. Switch vendors and it does not come with you.

Brain is the inversion. One server. Your Postgres. A single MCP endpoint that every Anthropic and OpenAI surface mounts. The data lives where you put it and follows you wherever you go.

/ What this fixes

Anyone running a serious LLM workflow accumulates context. Decisions. Project notes. Architectural patterns. That context becomes infrastructure, but the labs treat it as a feature. Brain treats it as infrastructure.

Tokenized recall with tag-weighted scoring. OR-match across content, tags, and category. A score prefix on every result so you can judge ranking quality. Streamable HTTP transport so a single Cloud Run instance can serve every client without sticky sessions.

/ How it is built

A NestJS server with a clean Memory module sits in front of a Postgres database. The same module is wrapped twice. Once as a REST API for the CLI and GUI clients. Once as an MCP tool surface for Claude.ai, ChatGPT, and Claude Code custom connectors.

The MCP layer uses Streamable HTTP in stateless mode. The session ID generator is undefined. Each request brings its own auth and spins up a fresh transport. That means no session affinity is required on Cloud Run, so instances can scale to zero between requests.

01Surface
Claude.ai connector · ChatGPT connector · Claude Code stdio · CLI · GUI
02Transport
Streamable HTTP (stateless) · OAuth 2.1 / API key auth
03Server
NestJS Memory module · MCP wrapper · REST API
04Storage
Postgres (Cloud SQL or self-hosted) · SQLite for local dev
/ Key decisions

The trade-offs worth defending.

/ 01

Tokenized OR-match over substring LIKE

The first version did a single LIKE on the whole query. “60 day financial health review” returned nothing. The rewrite tokenizes on word boundaries, OR-matches each token across content, tags, and category, and scores by match count with tag and category hits weighted higher. The score prefix on every result lets callers see ranking quality.

/ 02

Stateless Streamable HTTP, not SSE

Persistent SSE connections combined with session affinity pinned instances permanently. That blocked Cloud Run from scaling down. Stateless Streamable HTTP serves every request fresh, lets instances die between calls, and eliminates the session-affinity requirement.

/ 03

Auth on GET /sse only, not POST /messages

Earlier SSE work showed that the SDK-generated session ID is itself the auth token for follow-up POSTs. Applying middleware to both endpoints breaks claude.ai connectors because the SSE endpoint URL does not carry forward the original credentials. Auth on the handshake, sessionId on the follow-up.

/ Stack
NestJSTypeScriptPostgresMCP SDKStreamable HTTPCloud RunCloud SQL