Second Brain
SOURCE FILES
76
LINES
10,892
SUBSYSTEMS
19
MCP TOOLS
11
HTTP ROUTES
36
SCHEDULES
4
BINDINGS
4
MODELS
3
TESTS
139
WYCKEAONRTd1SvzJUMaiHkvGVXPBQZTSLIF 15121111887777665444333322222211111111111 CAPTURERECALLTEXTGRAPHMODEL CALLSDATABASE
→ CLICK TO READ · ● MEANS IT OPENS · DRAG TO PAN · SCROLL TO ZOOM · ESC TO COME BACK OUT
SECOND BRAINarchitecture

The Memory Loop

how something gets remembered, and how it comes back

WHAT THIS IS

This repository is one Cloudflare Worker that remembers things on your behalf and gives them back by meaning rather than by wording. Text arrives from an AI client, a browser, a mailbox or a calendar. It is checked against what is already known, classified, cut into chunks, embedded, and written to a database and a vector index at once. Asking a question runs that in reverse: the question is embedded, two different searches run against it, their results are fused, aged, and thinned, and what survives is trimmed to fit the asker's context window.

The diagram is a loop because the system is one: capture → cut up → embed → store → connect → recall → answer → and the answer becomes the next thing worth remembering. Everything to the left of the loop is how the outside world reaches it. Everything below runs on a clock, without anybody asking. Everything to the right is what a person actually opens.

Nearly every hard problem here turned out to be a threshold problem rather than an architectural one — how similar is too similar to store twice, how old is too old to still rank, how different two results must be before both are worth returning, how strong a link has to be before it is worth drawing. The structures with an orange edge are the ones holding a number that had to be chosen, defended, and in several cases changed after it went wrong in production.

HOW TO READ IT

Footprint is files: one cell per source file in that directory. Height is lines, scaled against the tallest Worker subsystem — the dashboard and the desktop app are larger than that and are drawn clamped, because letting the front end set the scale flattens everything the loop is made of. The four flat plates are Cloudflare bindings: this repository uses them but does not implement them, so they are ground rather than building. The dashed yard is the test suite, drawn beside the system rather than in it, and deliberately not to scale — at one cell per file it would be bigger than the rest of the map combined.

Hover anything for a plain description. How it's built gives the implementation, the constraint it is working inside, and why it ended up this shape. → go inside opens a structure that has an ordered sequence within it.

Two sources. Counts and sizes come from the working tree of second-brain-template on feat/v2.3.2. The real coupling view comes from second-brain-graph at 371a8f9, which is not the commit drawn here (617e0e4). Coupling may lag the sizes. Flow lines are hand-authored data flow; coupling is measured symbol references. They are deliberately separate views, because they are separate claims.