Why We Built the Mycroft Log Book Before the AI Router
Simba explains why Mycroft built a complete request log book before writing any routing logic, so every claim the project makes can be traced back to a real record.
You can't fix a routing problem you can't see. That's the entire argument behind the latest sprint on Mycroft, the Humanitarians AI financial project: before writing a single line of logic that decides which AI model handles which request, the team built the record that tracks what happens when a request gets handled at all.
Simba, who led this sprint, lays out the problem plainly. Right now, Mycroft sends every AI request to whichever model a given project happened to pick, with no record of what that cost, how long it took, or whether it was even the right call. Easy requests can land on expensive models they never needed. Hard requests sometimes land on a cheap model and come back fluent but wrong. None of that gets written down anywhere. Today, Mycroft literally cannot see any of it.
Why the record comes before the router
There are two reasons the log book had to exist before any routing logic. First, every number the Mycroft project will ever report comes out of this log book, and you don't want to be changing its format later once other things depend on it. Second, you can't compare before to after without a stable baseline, and that before-and-after comparison is exactly what a later routing decision depends on. Building the log book first means it ships no matter what that eventual decision turns out to be. Even if the simplest possible routing approach wins, Mycroft still ends up able to answer a basic question: which model produced this claim?
Every request now produces a single record capturing which model answered, which rule sent it there, what it cost, how long it took, whether it succeeded and why, and a quality score. A timestamp rides along too, so a run from one week can be told apart from a run three weeks later.
Dual-writing for reliability
The reliability design here is deliberate. Every record lands in two places: a plain text log written first, then a database for querying written second. If something crashes between those two writes, the text log still has the record, and the database can be rebuilt from it. Reverse that order, write the database first, and a crash between the two loses the record outright. That ordering isn't a style choice, it's the difference between a system that can recover and one that silently drops data. On top of the raw records, three summaries exist specifically to support a later decision: cost per task type, retry rate per task type, and which requests are slowest. This is the shape of the decision, not the answer to it yet.
Where measurement quietly lies
Two of the sixteen tests built for this sprint exist because measurement itself can be misleading in ways that are easy to miss. Money is stored as exact decimals, not floating-point approximations, because hundreds of small costs adding up in floating point can drift right past a meaningful percentage threshold. And a retried request counts as one request that cost both attempts combined, not two separate requests. Counted the obvious way, retries would make the average cost look lower than it actually is, which is exactly backwards. Two more tests guard the record itself: a retried record can't be created without recording which model it escalated from, because a record that can't explain why the model changed isn't really a record of anything, and writing the same request twice never creates a duplicate row.
A short trial run, built to check the arithmetic rather than measure anything real, found that one retried hard request cost roughly 260 times a simple lookup. If Mycroft's real traffic turns out to be mostly simple lookups sent to expensive models, that gap points to large savings. If it's mostly the hard kind, it doesn't. Nobody knows which yet, and that's exactly what the next five sprints are meant to answer.
Key takeaways
- Mycroft built its request log book before writing any AI routing logic, because every future report and before-after comparison depends on that record existing first.
- Every request now generates one record with model used, routing rule, cost, latency, success or failure, quality score, and a timestamp.
- Records are dual-written: a plain text log first, then a database second, so a crash between the two never loses data.
- Costs are stored as exact decimals rather than floating-point approximations to avoid drift across large volumes of small transactions.
- A retried request is counted as one request costing both attempts combined, not as two separate cheaper requests.
- The sprint shipped the record format, log writer, database and query layer, three summary functions, sixteen passing tests, and a readme, proving the measurement is correct without yet measuring anything about real traffic.
Try it yourself
Pick something you run regularly that currently explains nothing about itself, and ask the dual-write question: which write should happen first? That's often the question most likely to teach you something, precisely because it's the one that's easy to get backwards. This kind of disciplined, measurement-first engineering is the standard the Mycroft financial AI project at Humanitarians AI holds its fellows to before any feature gets built on top.
Chapters
- 0:00Intro: Simba on why Mycroft needs a log book first
- 0:25The Problem: Expensive models for easy tasks and silent failures on cheap ones
- 0:50Why build the record format before the routing logic
- 1:20Reliability design: Dual-writing to plain text logs first, then databases
- 1:55Behind the math: Floating-point drift in costs and retry calculations
- 2:35Outro: What shipped and testing our assumptions
Full transcript(auto-generated, with timestamps)
Intro: Simba on why Mycroft needs a log book first
[0:00]Hi, I am Simba and this video is about the MROT logbook, the record every AI request leaves behind and why we built it before we built anything that acts on it. Here's the whole idea. Mikra sends every AI request to whichever model a project happened to pick. No record of what that cost, how long it took, or whether it was even the right call. This sprint didn't fix that. It built the log
The Problem: Expensive models for easy tasks and silent failures on cheap ones
[0:25]Book, the thing that has to exist before any fix can be measured. Right now, easy requests can land on expensive models they never needed. Hard requests sometimes land on a cheap model and come back fluent but wrong. And nothing writes any of that down. You can't fix a routing problem you can't see. And today, Mickraftoft can't see it at all. So why build the record before the router? Two reasons. Every number this
Why build the record format before the routing logic
[0:51]Project will ever report comes out of this log book. Change its format later. And you can't compare before to after, which is exactly the comparison October's decision depends on. And the log book ships no matter what October decides. Even if the simple version wins, Mikra still ends up able to answer. Which model produced this claim? Every request now produces one record. Which model answered, which rules sent it there? What it cost? How long it took? whether it reach ride and why and
Reliability design: Dual-writing to plain text logs first, then databases
[1:20]A quality score. Four versions stamps ride along too. So a run from one week can be told apart from a run 3 weeks later. Every record lands in two places. A plain text log written first, then a database for querying written second. Crash between the two and the text log still has it. The database rebuilds from that. Reverse the order and a crash loses the record outright. The order isn't a style choice. On top of the raw records, three summaries exist specifically for October. Cost per task type, retry rate per task type, and
Behind the math: Floating-point drift in costs and retry calculations
[1:55]Which requests are slowest. This is the shape of the decision, not the answer to it yet. Two of the 16 tests exist because measurement quietly lies. Money is stored as exact decimals, not approximations. Hundreds of small costs adding up in floating point drift right past a percentage threshold. And a retrieded request counts as one request costing both attempts. Counted the obvious way. Retries make average cost look, which is backwards. The other two guard the record itself. A retrieded record can't be created without saying which model it escalated from. A record that can't explain why the model changed
Outro: What shipped and testing our assumptions
[2:35]Isn't a record of anything. And writing the same request twice never creates a duplicate row. A short trial run made up figures. checking the arithmetic rather than measuring anything real. One retried hard request cost roughly 260 times a simple lookup. If MROT's real traffic is mostly lookups sent to expensive models, the savings are large. If it's mostly the hard kind they aren't. Nobody knows which yet. That's what the next five sprints answer. So the log book works and it's tested. What shipped is the record format, the log writer, the database and query layer. three summary functions, 16 passing tests, and a readme. What it proves is that the measurement is correct, not that anything real has been measured yet. That's the honest line, and it's the whole point of building in this order. Your turn. Pick something you run that currently explains nothing about itself. And ask that the dual right question, what goes first is the one that'll teach you the most because it's the one that's easy to get backwards. The log book before the router. Simba for humanitarians.
More from Mycroft Financial AI
2:56How Attention Rewrites Financial AI (And Why Hedges Matter)
9:48Mycroft Update: Running Two AI Agents Live
3:14Mycroft's ECIS Ep. 3: Scaling to Three Models & Verifying AI Uncertainty
4:44When AI Agents Disagree: Part 2 — Building the Code in Mycroft
3:20Mycroft's ECIS Ep. 4: Who Said It? Weighting Context in AI Financial Analysis
4:10