What MADRE does on your computer, piece by piece.
I’ll walk you through what happens on your computer every time you talk to your agents. Everything I say here comes from code in the repository, and that code has its test.
In short
- MADRE is a small server on your computer: your browser talks to MADRE, MADRE to your agents and each agent to its provider, with your account.
- Everything that happens in a project is written to one file, a line for each thing. Nothing is deleted, and the memory is built from there.
- Each agent works in a box of its own, only with the sessions you already had. If it does not answer in time, MADRE stops it.
- Before an agent edits at
#3, MADRE keeps a copy, and Undo takes everything back.
The map
What runs on your computer and what doesn’t.
MADRE is a tiny server that runs on your computer. Your browser talks to MADRE, MADRE talks to the agents, and each agent talks to its provider using your account. On Windows, all of this runs inside WSL2, and your Windows browser opens it just the same.
Your computer
- Your browserYour projects, at 127.0.0.1
- MADREThe log, the memory and the permissions
- The agentsCodex, Claude Code, Gemini CLI, Cursor and OpenCode, each in its own box
Outside
The log
Everything that happens in a project goes into a file.
Each project has its own. What happens there gets written to that file, one line per thing that happens (an event). New stuff goes at the end and nothing gets erased.
It rebuilds itself. If MADRE restarts, or you open the project from another editor (IDE), the conversation gets put back together from that file.
Two editors at once. If you open the same project in two editors, each write waits its turn thanks to a lock on disk, so neither one overwrites the other.
Handoffs get written down. When a different agent answers, MADRE notes who it passed from and to, and which chunk of the conversation was handed over.
Every tab stays current. Open pages read from the log, so they also see what another process writes. If they disconnect, they pick up where they left off.
#0 Incognito leaves no trace. What happens in Incognito shows up on the open pages, but it never reaches the log.
How much each agent gets. Each agent gets up to 16,000 characters of conversation, starting with the most recent. A message over 20,000 gets rejected without even calling the agent.
The memory
Where the memory comes from.
The memory comes from that same file. If it gets lost, it’s rebuilt from there. An “archivist” agent sums up what matters as notes, and each turn gets the ones it needs.
It gets recorded
Every message that isn’t in Incognito goes into the index with its number.
It gets summed up
Every so many exchanges, or when things go quiet, the archivist writes up to five notes. Each one has a type: a decision, a fact, a preference or a question.
It gets searched
When the conversation no longer fits, each turn gets the notes and exchanges that match what you asked for, without going over the same budget.
It gets linked
Notes that show up together again and again get linked. Bring one, and the other comes too.
Who writes the summary. The first one available, in this order: Ollama, Gemini, OpenCode, Codex and Claude. It makes one call per batch and never during a turn.
Search doesn’t slow turns down. Search by meaning (embeddings) gets prepared in the background, and no turn sits waiting for it.
Measured against a control. Diagnostics checks whether the archive answers, whether it contradicts itself and whether the local model is ready. The first run scored 30 of 30. Against a control, 40%.
The agents
Each agent works in its own box.
Each agent runs on its own, in an isolated space that only has the sessions you already had. If it doesn’t answer in time, MADRE stops it completely, along with anything it opened.
- Codex
- Read-only when you’re asking questions. In #2 Create it gets scoped write access, and in #3 Edit, write access over the project.
- Claude Code
- Local tools for reading, sessions that don’t stick around and, for MCP servers, only MADRE’s.
- Gemini CLI
- Plan mode and a temporary read-only policy. It runs with a home of its own that brings its tokens, but not its hooks, extensions or memory.
- OpenCode
- MADRE hands it the permissions on every run, without touching your global config.
- @madre
- A local Ollama model, not a separate program. It gets the recent conversation and what the memory recalls, but never the document the other agents get.
--sandbox read-only, and environment variables by name only.Edit, inside
What happens when an agent works in #3 Edit.
Before the agent works, MADRE saves a copy. When it’s done, you see what changed and, if you want, you undo it.
Copy
A real commit, saved under
refs/madre/checkpoints/. It includes the files git doesn’t track and respects your.gitignore. Your branch, index and stash stay untouched.Turn
While the agent works, protected files are read-only.
Changes
It gets compared with the copy and you get a list of what changed. If the agent wrote somewhere it shouldn’t (a forbidden zone), that gets reverted and MADRE tells you.
Undo
Puts the whole project back the way it was in the copy.
#2 Create saves the copy too, but there several agents can work at once. What’s new stays. What already existed and changed gets restored.
Usage limits
How much of each plan you have left.
If the provider publishes it. Codex leaves its usage windows on your disk and MADRE reads them right there, with no network. Claude Code publishes its usage, and MADRE asks for it only if you turn that on.
If it doesn’t. Gemini and OpenCode show a local window. It’s a soft budget of 500,000 tokens per agent, counted over a rolling five hours.
Warnings in time. At 80, 90 and 100%, MADRE warns you and suggests another agent. MADRE never makes up the provider’s quota from its own counts.
When something fails
What happens when something breaks.
Half-finished turns. If MADRE stopped in the middle of a turn, when it comes back it marks that turn as failed instead of leaving it hanging.
Closing with Ctrl+C. MADRE stops the agents that are working, lets the open pages know and shuts down.
Plans always end. Steps run one after another, and an agent that got work delegated to it can’t delegate. STOPALL stops whatever’s running.
Tests before every release. No test calls a model. Before every release, MADRE gets packed, installed in an empty folder and the server gets started.