Right of the line is the future
Look-ahead bias is the backtest bug where a decision uses information that did not exist yet when the decision would have been made. It is hard to find because it is directional: it always flatters the result, so nothing looks broken. Nobody files a bug report saying the strategy works too well.
There is one question to ask at every bar of a backtest: which bars did you touch to compute this number? Drag the line below. Left of it is what you knew at time t; right of it has not happened yet. Pick one of four common leaks and see what the signal reads at t.
All four look innocent in code. shift(-1) is an index slip. center=True gives a moving average that looks smoother on a chart. A scaler fit on the whole sample is the first line of every machine-learning tutorial. bfill is one of two ways to fill a gap; it happens to be the wrong one, because it fills the gap with a later value.
Cut the leaks one by one
Now put all four leaks into one strategy. It takes a position from the average of four parts: one-day momentum, reversion towards a moving average, reversion to the long-run mean, and short momentum on data with gaps. Each part has a leaking and a causal version. With all of them leaking, the equity curve climbs like a dream.
As the leaks go off, the curve fades and ends where a random walk should leave it: a small return that comes from chance, not from an edge. The order does not matter; each leak you close takes a piece of the return with it, because that piece came from reading the future. Real research has no such buttons. You only have the final curve, and code review does not tell you which part of it belongs to the future.
So the checker catches a leak by behaviour, not by reading. If the signal up to t changes when the data is cut at t, the signal reads what comes after t. That is truncation invariance, and it catches all four leaks above; even the full-sample fit, because the mean of the cut data differs from the mean of all of it.
The same trick in LLM agents
If an LLM agent decides “as of a trade date”, every tool it calls is a potential leak. The price tool may return the newest bar, the news tool the newest headline, the filings tool a figure revised later. There is no shift(-1) in the agent’s code; the leak lives inside the tool, and no audit of the strategy file can see it.
kairos tries a structural answer: its reasoning layer reaches market perception only through a CausalPerceptionBus. Writes go through record, reads through as_of, window_before and aggregate_before; a read is a single bisect over sorted timestamps. record refuses a write stamped earlier than the last one, and a bare date reads as the end of that day. Look-ahead safety becomes a property of the access path, not of the caller’s discipline. You can poke at the order book and the one-line cheat on the kairos lab page.
The door’s limits matter as much as the door. It only guards what goes through its own accessors; the bus’s raw lists and latest are still there. An adversarial review found a clock mix-up, where a bus built on step indices and queried with a date returned the newest percept; it was closed with ClockDomainError. At the pinned commit (de493b0) a NaN cutoff passes as_of: every comparison is false, the bisect runs to the end and the newest percept gets through. main closed the hole on 25 November 2026 (9a6feb7) and now rejects non-finite cutoffs. That is why ledger claim kairos-001 speaks only for finite cutoffs, and the hole is written up in the graveyard. The details are in the look-ahead bias note.
Take your strategy to court
The checker runs this essay’s tests on your code: truncation invariance, a lag stress of one to five bars, shuffling what comes after t, six code rules and, if you tell it how many trials you ran, the deflated Sharpe. Python and pandas run in your browser through Pyodide, loaded from this site; your code and data never leave your device. You get a printable indictment that names the test, the bar and the line.
An acquittal does not prove the strategy honest. The checker cannot see values the vendor revised later, survivorship bias or leaks inside agent tools. Those need someone reading the code, the data and the pipeline together; I do that as a full audit.
Not investment advice; no signals.
Reference: for the deflated Sharpe, D. H. Bailey and M. López de Prado, “The Deflated Sharpe Ratio”, Journal of Portfolio Management 40(5), 2014. Pinned kairos commit: de493b0.