CaBrain — memory infrastructure for AI agents
Persistent memory, hybrid retrieval and an entity graph, exposed to any agent over MCP.
The problem
An agent forgets everything when the conversation ends. Each new session re-reads the same repository, re-asks the same questions and repeats decisions that were already made. A bigger prompt does not fix it: what an agent needs is somewhere durable to put what it learned, and a way to get the relevant part back — including the relationships between things, which plain search does not carry.
What I did
- Agent
- MCP
- Hybrid recall
- Entity graph
- Postgres · pgvector · BM25
An agent calls CaBrain as an MCP server, so the same memory works from Claude Code, an IDE or a server-side job without an SDK per client. Writes go through one decision path that embeds, indexes and redacts secrets; reads fuse vector similarity with BM25, rerank the result, and can expand into the entity graph for everything connected to what was found.
Technical detail
Hybrid recall, not just vectors
Vector similarity and BM25 are fused with reciprocal rank and then reranked, so an exact name or phrase is found by the half of the search that is good at names, and a vague question by the half that is good at meaning.
A typed entity graph
Memories connect to entities — ventures, repositories, people, goals — and one spine query returns a whole neighbourhood grouped by role, with the true total beside a capped sample, instead of a hand-written recursive query per question.
Connectors as plugins
Data sources — text, markdown, a crawler, GitHub, SQL, webhooks — register themselves by kind, so a new source is a plugin rather than a change to the core. On sync each document is chunked and written through the same path as any other memory.
Self-contained by design
The brain owns its schema in Go and provisions it at runtime, with hand-written pgx queries for the parts that do not round-trip through code generation — vector columns, BM25, partitioned tables. It ships as a ToGO plugin, not as a fork of the host application.
Where it stands
CaBrain runs in production as the memory behind this studio's agents, reached over MCP from Claude Code sessions, with its own app and documentation. No latency or adoption numbers appear here because none have been measured and published yet — when they are, they will appear with their source.
All projects