D
DAAVILE Algo Trading
← Back to Research
Research Lab

AGENTIC TRADING LOOP: 9 PHASES, ONE HARD GATE

Nine phases and a 115-command judge gate separate an agent's draft from promotion. See why 6 ms plumbing, 31 tools, and a runner that lied about spread matter.

Agentic Trading Loop: 9 Phases, One Hard Gate
9 phasesthe same path for every draft
115 commandsthe judge gate: no self-promotion
6 ms vs 450 msthe authenticated receipt path
31 toolsthe same surface for agents and humans

An agentic trading loop is useful only when the machine cannot grade its own homework. Our foundry sends every draft through 9 phases and a judge gate of 115 commands before promotion. Agents write code and explore ideas; compilers, testers, and deal-stream checks decide whether the result survives.

A chat box that emits a profit number is easy to build and easy to fool. We wanted a path another person could inspect six months later: what the agent proposed, what each gate returned, and why the final verdict was allowed through.

The loop already pays for that trust in speed. The app talks to the engine through a 6 ms vs 450 ms authenticated path, and agents use the same 31 tools as human operators. Fast plumbing matters only because the receipts are real.

#The agentic trading loop separates proposing from deciding

The foundry runs through three stages, and the boundaries do the work. The agent stage turns intent into proposals. The IDE stage compiles real strategy code. The quantum stage subjects the compiled strategy to backtests, Monte-Carlo checks, walk-forward tests, robustness tests, an oracle check, and a parity diff against the terminal.

The split is the main design choice. A model may suggest an implementation, a search, or a parameter change, but it cannot turn any of those into a passing result. The transition from suggestion to fact happens only after a deterministic gate has produced evidence.

StageJobPower
AgentParse intent, write code, and review proposalsIt proposes; it never concludes
IDECompile strategy code and feed errors backReal compilers accept or reject it
QuantumRun the full verification gauntletOnly a surviving result becomes a verdict
Three-stage foundry pipeline: the agent stage parses intent, the IDE stage compiles code and returns errors, the quantum stage runs the verification gauntlet and terminal parity, and the knowledge vault sends lessons back to the agent
Each stage hands the next a receipt rather than a promise. The knowledge vault sends lessons from earlier verdicts back into the next draft, closing the learning loop.

No stage trusts the one before it. A proposal becomes code only after a compiler accepts it, and code becomes a verdict only after the full gauntlet clears. That is different from a block combiner that rearranges ready-made pieces: this foundry can write arbitrary code, so its gate has to carry more weight.

The stage boundaries also make failures easier to locate. A bad idea belongs to the agent stage, a syntax or type failure belongs to the IDE stage, and a weak trading result belongs to the gauntlet. We can repair the right layer instead of arguing about the final number.

The vault keeps the loop from starting cold. Lessons from earlier verdicts enter the agent's context, and each composer's conversations persist per workspace. "What did we try?" has a durable answer, so a refuted hypothesis is less likely to return with a new prompt.

#Nine phases give every draft the same evidence path

Trust comes from one scale, not one model. The verification pipeline already existed before agents joined it. Every draft, human or machine, clears the same 9 phases, backed by evidence and lessons that remain after the conversation ends.

Pipeline propertyWhat it guaranteesWhy it matters
Nine-phase pipelineEvery draft clears the same rungs in orderAn agent cannot skip the phases it finds inconvenient
Evidence storeOne source of truth for each strategy and rungThe composer reads what is proven before proposing again
Lessons corpusPast verdicts feed the agent’s contextThe loop stops repeating refuted hypotheses
Automatic levelsHuman and agent work earn the same levelMachine output gets no softer scale
Persistent runsState survives engine restartsA verdict outlives the conversation that made it

The evidence store does a second job: it is the composer's memory. Before a new proposal, the loop reads what is already proven. A human team may carry that knowledge in heads and notebooks; an agent needs a queryable record that survives staff changes and restarts.

Automatic levels make that memory consequential. Passing a rung earns the same level whether a person or an agent did the work. There is no hidden bonus for machine output and no automatic penalty either. The gates decide, and the result enters the shared scale.

That shared scale stops the process from becoming self-flattering. The agent does not receive a special promotion path, and its own confidence never changes a level. A pass means the rung produced evidence, regardless of who wrote the draft.

#Backend integrity came before the interface

The execution plan used a four-week grid, and the order mattered more than the screens. Backend work came first because the integrity fixes were uncommitted, the what-if engine needed real engine behavior, and most of the foundry was backend code.

WeekBackend trackFrontend track in parallel
1Land integrity fixes; start the what-if engineContract honesty and the what-if interface shell
2Add autopsy hooks and the foundry compile loopProblem panel, seasonality, and money-management views
3Wire the model and analysis functionsComposer interface and knowledge context
4Polish and run integration testsWalk-forward matrix and parameter surface

The frontend was not waiting for permission. It built the parts that did not depend on engine behavior while the backend handled time, session, and spread filters for real. Screen and engine worked from the same written contract in the same week, which avoids the classic mismatch discovered only at integration.

Sequencing also protects the interface from promising more than the engine can deliver. The time, session, and spread filters live in the backtest path, so the frontend contract can be written against real behavior while that behavior is being built.

This order protects the meaning of the result. A visible switch that pretends to filter by time or spread is worse than a missing switch. The engine has to make the condition real before the interface offers it.

#The 115-command judge gate blocks self-promotion

Agents cannot self-promote. Every compile, test, and iteration step passes through the same judge gate used elsewhere in the system. It contains 115 commands, and no receipt means no passage.

Judge gate diagram showing 115 commands between an agent proposal and promotion, with receipts written for every draft, verdict, and export so no agent can promote its own work
The judge gate is the load-bearing rule: 115 commands stand between a proposal and promotion. A generative loop that could promote its own drafts would be a random number generator with a save button.

The gate turns a claim into four checkable receipts. The compiler accepted the code. The tester ran it. The deal stream matched. The export carries the chain. A reviewer can replay those checks without trusting the agent's summary.

Most of the gate is mechanical on purpose. It is not a second model asking whether the first model did good work. Compilers accept or reject, testers run or fail, and diffs match or do not. Boring, repeatable decisions are easier to trust and harder to persuade.

#Receipts and fast plumbing make reviews repeatable

Every draft, verdict, and export carries a receipt chain. The chain records what was proposed, when, and from which context; what each phase returned with its evidence; and what left the system with that history attached. Restart the engine, reopen the run, and the chain is still there.

Receipts answer the questions a reviewer actually has. They show what the agent proposed and from which context, which phase returned which evidence, and what left the system carrying the full chain. That turns a confident summary into something another person can replay.

Receipt chain diagram showing every draft, compile, test, verdict, and export carrying a provenance receipt, with persistent runs surviving engine restarts so receipts outlive the conversation
The receipt chain is the durable layer; the conversation is not. Each step records what happened and the evidence that produced the next decision.

The receipt path had to be fast enough not to be bypassed. The app speaks the engine's authenticated orchestration protocol directly over its named pipe. That route measured about 6 ms per call against roughly 450 ms for the command-line path: a roughly 70x difference on the lane carrying the receipts.

Agents and humans get the same operating surface. The 31 tools cover configuration, setfiles, the vault, terminals, files, broker terminals, backtests, the foundry, and compilers. There is no shadow path for agents and no extra privilege for them.

Isolation protects parallel work. Branched workers receive their own engine worktrees instead of sharing a dirty directory. A person can watch live output and worker status, while local-model personas run as engine-supervised workers with archived transcripts.

#The runner that lied about spread set the build order

The honest failure came before the feature work. When the foundry plan was written, three audit fixes were still uncommitted. One was a spread-override path that made the runner lie about trading cost; another was a data-file bypass; the third was a stale timer.

A gate on a lying runner produces fast, polished, worthless verdicts. The fix was not a clever prompt or a stricter prompt. We landed and verified the integrity fixes first, before the what-if engine and the foundry loop. It was half a day of work that was already written, but it still needed verification, commitment, and delivery.

This lesson also applies to sealed model tests. Our sealed-truth LLM benchmark records the same standard: a protocol that looks complete on paper has no value if the runner quietly changes the conditions.

#The loop exists to turn drafts into operable results

The compile-and-test loop is the product; the screens are a view of it. The foundry emits run definitions onto the deck, so a generated result and a hand-built result operate through the same interface. Drafts enter the vault at the entry level, and only the ones that clear the gates climb.

A learned model once tried to replace a deterministic parser, but the fix note says it "learned only to copy the deterministic parser," so the model was removed. Where a deterministic path exists, it wins. The agent proposes; the compiler, tester, and diff dispose.

The design is intentionally conservative where it can be. Where a compiler, test, hash, or diff can decide, we avoid asking a model to guess. Models remain useful where the problem is genuinely generative, but they never become the referee.

Takeaways
  • Generation stays separate from judgment: agents propose, and the 115-command judge gate disposes.
  • Every judgment leaves a durable receipt on drafts, verdicts, and exports.
  • The substrate must tell the truth before a gate judges it; the integrity fixes landed first.

Independent findings follow the same evidence rule. The research review council checks claims instead of trusting authors, while full backtest parity across 312 trades proves an implementation at the deal level. Accepted runs appear in the published DAAVILEFX results, and the complete receipt trail can be inspected in the live DAAVILEFX research dashboard.

#Questions we get asked

#How many phases does every draft pass through?

Every draft clears 9 phases backed by an evidence store and a lessons corpus. Human and agent work use the same path and earn the same levels.

#Can an agent promote its own strategy?

No. The judge gate runs 115 commands between a draft and promotion, and the agent cannot issue the pass. No receipt means no passage.

#What is a receipt in this loop?

A receipt is a durable record of what was proposed, what each gate returned, and what left the system. It survives restarts and can be re-checked later.

#Why did the build start with backend integrity fixes?

Three audit fixes were still uncommitted, including a spread-override path that made the runner lie about trading cost. The gate is only trustworthy when its substrate tells the truth.

#What does 6 ms vs 450 ms mean?

The app's direct authenticated protocol path measured about 6 ms per call, compared with roughly 450 ms on the command-line path. The roughly 70x difference keeps the receipt lane from becoming the bottleneck.

Copied
// Software lab RYIUK — local LLM inference, backtesting pipelines, agentic workflows. No signals. No courses.
RYIUK.pro →