The Quantish Research Harness

T
The short version

Over the past year I built an operating system for quantitative trading research: a harness that lets AI agents run the grunt work of strategy development end to end, inside rails that make self-deception structurally difficult. It recently carried two strategies from an empty folder through the full gauntlet: one crypto trend follower to a deployable, drawdown-controlled config, and one options strategy to an honestly sized, validated edge. Along the way it rejected far more ideas than it accepted. This piece is a tour of how it works and why most of the engineering went into saying no.

01 · The problemBacktests want to lie to you.

The hard part of quant research is not finding strategies that look good. It is finding out, cheaply, which good-looking strategies are fiction.

The first “successful” backtest my crypto trend strategy produced returned +42.6%. Champagne numbers. Then a month-by-month decomposition showed that every dollar of profit came from a single January rally; the equity curve went sideways for the five months after. The headline was one great month wearing a five-month flat tail as a disguise.

That experience set the design principle for everything that followed. Modern AI agents can generate strategy ideas, write the code, and run the backtests faster than any human. Generation is now cheap. What remains scarce is refereeing: the discipline that separates a real edge from a lucky sample, an execution bug, or a metric that quietly rewards the wrong thing. So I built the referee.

The harness is a set of protocols, skills, and enforcement scripts wrapped around QuantConnect’s LEAN engine, the same platform available to any retail quant. An AI agent does the building and analyzing. The rails decide what counts as evidence. And a small number of decisions never leave the human: what the strategy is, how much money the research may spend, and whether the result is good enough to trade.

02 · The spineEvery idea walks the same gauntlet.

No experiment influences a decision unless it survives this loop, and the loop is enforced by tooling, not willpower.

Figure 1The research loop
Pre-registerThe hypothesis, the numeric acceptance bar, and the kill rule are committed to git before any result exists. The goalposts cannot move afterward.
BuildThe agent implements the idea behind an inert-default flag: with the flag absent, the accepted baseline is byte-identical. Experiments can never corrupt what already works.
Review gateEvery script that can influence a verdict is hashed and must be blessed by a fresh adversarial review before it may run. Unreviewed code produces no evidence, full stop.
Run + self-checkOne cloud backtest, then a correctness audit on the artifacts: did the new code path actually fire? Counters must reconcile; a green compile is not a result.
SweepParameter grids fan out as parallel cloud runs. The goal is a plateau of neighboring settings that all work; a single spiky winner is treated as curve-fit, not signal.
RobustnessPre-declared finalists only, on quarantined out-of-sample data, net of fees, slippage, and borrow costs, with bootstrap confidence intervals on the difference vs. the benchmark.
VerdictDid it beat the benchmark on both return quality and drawdown, in-sample and out, with a confidence interval that excludes zero? The human makes the call.
AcceptedRefuted
New baselineTagged, reproducible, with a frozen spec and a full evidence bundle.
Recorded loserShips default-off, base retained, and written down so it is never re-tested.
Human decides Agent executes Rails enforce Accepted Shelved
The atomic research loop, color-coded by who owns each stage. The two most load-bearing steps are the ones that say no: the review gate before any run, and the recorded-loser path after an honest failure.

Two details in that diagram do most of the work. The review gate means no backtest whose output could influence a decision ever runs on unreviewed code; a launch script literally refuses hashes that have not been blessed. That trades speed for correctness on purpose: wasted compute is recoverable, a wrong verdict is not. And the recorded loser path treats a credible “this does not work” as a research success with its own permanent ID, because the most expensive experiment is the one you unknowingly run twice.

03 · The architectureWho does what: human, agent, rails.

The design question was never “can an AI do quant research?” It was “which decisions must it never make alone?”

Figure 2Division of labor
Human owns
The spec. What the strategy is. Ambiguities are escalated, never silently reinterpreted.
The budget. A hard ceiling on paid compute, confirmed before any large grid.
The verdict. Go, no-go, or iterate. The agent recommends; it never decides.
Agent owns
Hypothesis registers. Enumerating candidates for the human to prioritize.
Implementation. Strategy code, drivers, analysis tooling.
Execution. Backtests, parameter waves, notebooks, artifact fetching.
Analysis. Decompositions, regime slices, report drafts, honest caveats.
Rails enforce
Pre-registration. Bars and kill rules locked before results.
The review gate. Hash-and-bless before any verdict-relevant run.
Observability. Counters that must reconcile every run.
Cost realism. Fees, slippage, borrow applied by default.
The edge catalog. Winners and losers, permanently recorded.
Human to agenta written mandate with a fixed objective; back the other way, verdict-first reports the human can act on in a minute.
Agent through railsevery run the agent launches passes through the gates; the rails are code, so compliance is not a matter of trust.
Everything to diskeach phase ends in an immutable evidence bundle: logs, orders, trades, equity, engine version. Any cold session can reconstruct the state.
Three lanes with sharp boundaries. The agent has wide autonomy over execution, the human keeps the three decisions where a wrong call is unrecoverable, and the rails turn discipline into code so it cannot lapse under deadline pressure.

This split is also what makes the workflow trustworthy to hand to someone else. State lives on disk, not in anyone’s head: every phase ends with a versioned kickoff prompt for the next one, so a fresh session (or a fresh person) can pick up mid-campaign and know exactly what is locked, what is open, and what has already been tried. Roughly twenty-five phases of one strategy ran across twenty-two separate working sessions without losing the thread.

04 · The tool surfaceWhat the agent can actually reach.

A research agent is only as good as the instruments on its bench. Mine spans a local repo, a cloud backtest engine, a research notebook, and live options market data.

Figure 3The tool surface
Your machineThe strategy repo, the pre-registered phase docs, the run drivers, and every evidence bundle the campaign has produced.
Claude, orchestratingReads the phase contract, writes the code, then drives each instrument below directly and pulls its output back. No copy-paste handoffs.
QuantConnect cloud
Backtest enginePush, run, then pull back logs, orders, trades and the equity curve.
Research notebookVol surfaces and model-priced probes, run in the browser by the agent.
Market data services
Earnings analyticsImplied-move history, the pre-print vol ramp, post-earnings drift.
Live quotes and chainsBrokerage prices, option chains and positions, to check a modeled fill.
Local Agent Cloud compute Market data
One options due-diligence pass touches all four surfaces: the agent screens candidates from earnings analytics, prices the structure in a research notebook, tests it in a cloud backtest, and cross-checks the fill assumptions against live chains before anything reaches a verdict.

The instruments matter less than the rule that governs them: every one of them writes its output to disk in a form the next session can audit. A notebook that only prints to a screen is useless to a campaign that spans weeks, so results come back as structured log lines and files, reconciled against counters that must agree. When the numbers do not reconcile, the extraction fails loudly rather than handing back a plausible subset.

05 · Three refereesThe checks that changed real verdicts.

Abstract rigor is easy to claim. These three mechanisms each overturned a conclusion I would otherwise have shipped.

  • Metrics lie Cross-examine every ratio. A trailing-stop variant once “won” on the pre-registered bar: higher Sortino, shallower drawdown. The equity curve told the truth: it sat below buy-and-hold 99% of days and ended 18% poorer. It was flat in cash a third of the time, and those zero-return days shrank Sortino’s denominator, rewarding timidity rather than skill. The harness now cross-checks Sortino against Sharpe and information ratio and reads the curve before believing any single number.
  • Confounds Judge each component on its own evidence. An options strategy’s realized P&L said its entry signal was worthless; the honest read was nearly a project-killing halt. But realized P&L blends entry, exit, and instrument. Re-measured on the underlying’s forward return, before any exit policy touched it, the entry signal was real and broad: a +100% profit cap had been amputating the right tail. The verdict flipped from halt to iterate, and that decomposition discipline is now a standing rule.
  • Execution truth Validate the plumbing before the alpha. For weeks the crypto strategy quoted +139% returns. Then a ledger reconciliation revealed the platform had been silently granting 1x buying power where the sizing logic assumed 2.5x, so 63% of intended entries never executed, and the failures were accidentally flattering. The honest baseline was +81.6% at a deeper drawdown, and every prior comparison had to be re-judged. Now an invariant reconciles every intended order against fills or logged rejections, every run.

Notice what these have in common: none is exotic math. They are the unglamorous questions a careful practitioner asks, encoded so they get asked every time. Retail quants do not lose money to missing PhDs; they lose it to headline numbers nobody interrogated.

06 · CompoundingLosers are assets.

Most research pipelines only remember their winners. This one gets faster because it remembers everything.

Figure 4The knowledge flywheel
CampaignA strategy idea runs the full loop of Figure 1.
FindingsConfirmed edges, and just as carefully, the losers and why they died.
Edge catalogA permanent library: every entry carries scope, sample and confidence.
ScreeningThe next campaign checks the catalog before spending a single run.
The flywheel that makes campaign N+1 cheaper than campaign N. A refuted idea is written down once with its evidence, then screens future hypotheses automatically, so compute goes to genuinely open questions.

The same philosophy governs spending. Cloud compute is real money, so the harness maintains an explicit policy for when to pay for parallelism: if a human is waiting on results, batch the runs into a paid parallel wave, because human hours cost more than compute credits; if the campaign is running unattended overnight, queue on the free node, because wall-clock is nearly free at 3 a.m. A 111-name cross-sectional study, one backtest per ticker, fans out for about two dollars. Correctness, usability, and speed are not a slogan here; they are a dial with a written policy for where to set it.

The honest scoreboard Across both flagship strategies, most tested ideas were rejected. One campaign’s 41-run tuning study found that every single in-sample winner reversed out-of-sample, and the incumbent config was retained. That is the system working: the deployed strategy is the one that survived the gauntlet, not the one with the prettiest backtest.

07 · Why it mattersTrust is a workflow property.

The lesson underneath all the machinery.

Every mechanism in this harness exists to answer one user-experience question: when a number appears on the screen, why should anyone believe it? The answer is never “because the model is smart.” It is because the code was reviewed before it ran, the bar was set before the result existed, the costs were real, the sample was big enough to mean something, and the ledger reconciles. Those are workflow properties, and workflows can be designed.

That framing travels well beyond my own trading. Any product that shows people portfolio analytics, performance numbers, or research conclusions faces the same problem in a different costume: intelligence is abundant, and trust is the bottleneck. The way through is the same: decide which checks must be structural, which decisions must stay human, and make the honest path the easy path.

The harness keeps evolving; the current work borrows ideas from recent academic systems that run LLM-driven factor discovery, grafting their generation techniques onto these rails. If you are working on the trust problem in quantitative products and want to compare notes, I am easy to find.

About the author

quantish

Add Comment

By quantish

quantish

Automate everything.