OpenClaw Tutorials5 min read

The Check That Passes Until the Day It Does Not

S

Suneet Malhotra

Jun 14, 2026

2 views
The Check That Passes Until the Day It Does Not - OpenClaw Tutorials blog post

There is a mode in my trading engine that does nothing visible. It connects to the broker, pulls the live list of open positions, pulls my own internal record of what should be open, and compares the two. When they agree, which is almost every day, it writes one line to the log and exits. No order, no alert, no change to anything. From the outside it looks like a no-op I am paying to run.

I do not run it for the days it agrees. I run it for the one day it will not.

Two ledgers, and only one of them is real

My engine keeps its own memory of the world. Every entry it places, every exit it records, every bracket it thinks is live, all of that lives in a trade log it writes itself. That log is the engine's belief about its positions. It is fast, it is local, and it is wrong the instant reality diverges from it.

The broker keeps the other ledger. That one is the actual account, the real shares and contracts, the true cash. It is the only record that can lose me money, because it is the only record the market settles against. My log is a story the engine tells itself. The broker's ledger is what happened.

For long stretches the story and the truth are identical, and it is tempting to treat the log as the source of truth because it is the one I can read without a network call. That temptation is exactly the failure. The moment I trust my own memory over the broker's ledger, I am trading on a model of the account instead of the account.

How the two come apart

They drift in the gaps the engine cannot see. A bracket order fires its stop server-side while the engine is asleep between cycles, so the broker closed the position and my log still shows it open. An entry partially fills, two hundred shares instead of three hundred, and the engine rounds its belief to the order it sent rather than the fill it got. A connection drops mid-order, the engine retries, and now there is either a duplicate or a phantom depending on which side the timeout landed on. Someone, meaning me, closes a position by hand in the broker UI and never tells the engine.

None of these throw an error. Each one leaves the engine perfectly confident and quietly wrong. The next time it sizes a trade, checks a position limit, or decides whether it is already in a name, it reasons from a log that no longer describes the account. A wrong belief about what you hold is more dangerous than no belief, because it still produces decisions, and the decisions look reasonable right up until they are sized against positions that are not there.

The check is insurance, not output

This is why a check that passes every day is not waste. Its value is entirely in the tail. The green line in the log every morning is the premium I pay. The one red line, on the one day the lists disagree, is the payout, and the payout is finding out that my model of the account and the account itself have separated before I place a trade on top of the gap.

The mistake people make with reconciliation is judging it by its average output, which is nothing, instead of by its worst-case output, which is the only output that matters. You do not buy the check for the median day. You buy it for the day a stop fired at three in the morning and your engine is about to open a second position in a name it already exited, because as far as it knows it never exited at all.

The same shape, everywhere I run an agent

Once you see it in the trading engine you see it everywhere. Every agent I run keeps some local belief about the world. The trading engine believes a trade log. A content agent believes its post history. Any system with memory is carrying a story about state, and any story about state drifts from the state it describes the moment something changes outside the system's view.

Reconciliation is the discipline of comparing the story to the ground truth on a schedule, before you act on the story, not after the story has already steered a decision. It is the cheapest line in the system to run and the most expensive to skip, because skipping it does not announce itself. You only learn you needed it on the day the two ledgers disagree, and by then the question is no longer whether to run the check. It is how much the gap already cost.

So the check stays. It passes, and passes, and passes, and I keep running it, because the day it stops passing is the only day I built it for.

Share this post

You Might Also Like

Stay in the Loop

Get weekly insights on AI-driven QA, engineering leadership, and automation strategies.

No spam, ever. Unsubscribe anytime.