Loop Engineering: Why a Self-Improving Quant System Is the Hardest Thing to Trust
Mahdi Salmanzade
Co-Founder & CTO of CLRT
There is a comfortable story going around that a self-improving trading system is mostly a generation problem. You point a capable model at market data, ask it for signals, give it the ability to run on a schedule, and the edge compounds while you sleep. The story is wrong in a specific and expensive way. The part that generates ideas is the easy half, the half that demos beautifully in an afternoon. The part that decides what to throw away, what to refuse to trade, and when to stop is the half that actually determines whether the system survives a year of real markets. That second half is not a feature you bolt on. It is the entire discipline, and it is the reason these systems are so much harder to trust than they look.
Start with the asymmetry the market keeps ignoring. In most software, a confident wrong answer is an annoyance you correct later. In trading, a confident wrong answer is a position, and a position is money already committed before anyone notices the reasoning was hollow. So the value of a quant loop does not live in how many ideas it can produce. It lives in how reliably it destroys the bad ones before they become trades. Almost every retail attempt inverts this. People pour their energy into the generator because that is the part that feels like genius, and they treat verification as a checkbox. The result is a system that is brilliant at manufacturing plausible reasons to lose money on a schedule.
The deepest trap is one that sounds like a detail and is actually structural. The agent that produced a signal cannot be the agent that approves it. It is not a question of model quality. An agent that generated a thesis is already committed to the path it created, so it will rationalize weak statistics in a confident voice and wave through exactly the problems it should be hunting for. The discipline is to make the maker and the checker genuinely adversarial: a separate role, a separate prompt, ideally a separate model, whose only job is to try to kill the trade. Most teams discover the need for this distinction only after a clean-looking backtest has quietly drained an account, because the failure is invisible while it is happening. Knowing to build the hostile reviewer first, and knowing what it must be ruthless about, is judgment, not a recipe.
Then there is the failure mode that almost no in-house build is engineered against, because it never appears in a demo. A loop that lacks a measurable, external stopping condition does not crash. It exits politely. The agent decides the work is done, the run completes, the logs look clean, and a bad position sits open in the dark while the system reports health. Done is not a stopping condition. The strategy looking good is not a stopping condition. A real stop has to be measurable from outside the agent's own opinion, and designing those conditions for a live market means anticipating the precise circumstances under which a competent system will confidently believe it has succeeded while it is actively losing. That is a governance problem disguised as an engineering problem, and it is where most home-grown loops fail silently.
This is why the gap between a weekend prototype and a system you would route capital through is not a gap of effort. It is a gap of kind. The prototype is the part that is easy precisely because the model commoditized it. The system is the unglamorous lattice underneath: the separation of generation from approval, the state that has to be true across runs and not merely remembered, the risk monitor that runs on its own heartbeat and refuses to negotiate, the kill switch that fires on a number rather than a feeling. None of that is where the intelligence appears to be, which is exactly why teams skip it, and exactly why their loops work once while someone is watching and break the first night nobody is. The hard part was never pointing AI at the market. The hard part is knowing where to point it, where to forbid it, and how to make the whole thing trustworthy when no human is in the chair.
Most builders spend all their energy generating ideas and almost none destroying bad ones. In trading, the bad ideas are the ones that cost you.
A deeper dive
Look closely at the verifier, because it is where retail quant systems quietly die and where the real expertise becomes visible. A serious checker is not asking whether a strategy looks promising. It is interrogating the result for the specific ways alpha turns out to be an illusion: a Sharpe that collapses out of sample, a return that one or two lucky trades explain entirely, a t-statistic that does not survive correction for autocorrelation, a backtest that only works under one perfect parameter setting and falls apart a notch in either direction, performance that depends on a single market regime, and the subtle data leakage that lets a model peek at information it would never have had in real time. Each of these is a trap that an enthusiastic generator will sail straight past, because each one produces a beautiful curve. Curve fitting does not announce itself. It looks exactly like success until capital is involved, and the difference between a checker that catches it and one that does not is years of having been fooled before.
The harder layer still is governance, the part that decides what the system is allowed to do to itself over time. A self-improving loop is, by definition, a system that rewrites its own rules from its own experience, and that is a powerful idea and a dangerous one in the same breath. Memory compounds in both directions: every loss that becomes a rule makes the system wiser, and every spurious correlation that becomes a rule makes it more confidently wrong. Deciding which lessons are real, bounding how much authority the loop has to change its own behavior, and building stop conditions that the system cannot argue its way around is not something you configure once. It is an ongoing exercise in judgment about where machine reasoning is trustworthy and where it must be fenced. That judgment, applied to a live environment that punishes mistakes in cash, is the scarce thing. The model is not the moat. The discipline around it is.
Work with CLRT
If you want a quant system that researches, tests, ruthlessly rejects, executes, monitors its own risk, and learns without you sitting inside it, the build is not the prompt. It is the verification, the governance, and the judgment about where to let AI act and where to forbid it. That is the work CLRT does. Talk to us about designing the loop you can actually trust with capital.

Mahdi Salmanzade
Mahdi Salmanzade is the Co-Founder and CTO of CLRT, building agentic systems, developer tools, and local-first AI. Reach him at mahdi@clrtstudio.com or on LinkedIn.


