Second Brain
Star on GitHubGet started
second-brain-cloudflaremain
SOURCE FILES
100
LINES
19,178
SUBSYSTEMS
20
MCP TOOLS
14
HTTP ROUTES
55
SCHEDULES
5
BINDINGS
4
MODELS
4
TESTS
253
The Memory Loop: how something gets remembered, and how it comes back WYCKEAONRTd1SvzJUMaiHDkvGVPBXQZTSLIF
CLICK TO READ · THE DOT 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-cloudflare on main. The real coupling view comes from second-brain-graph at a8597c2, which is this exact commit. Flow lines are hand-authored data flow; coupling is measured symbol references. They are deliberately separate views, because they are separate claims.