For agents. Use this when asked to "make it better", or when you run unattended. The iterate_strategy prompt encodes the same loop.
The loop
get_journal(projectId): never repeat a failed idea.list_backtests: the best run so far is your baseline.get_backtest: where is money lost? Look attradeStats.byExitReason, losing streaks and drawdown dates.- Write one hypothesis with a reason. "Stops are too tight in high volatility" is a hypothesis; "try 37 instead of 40" is not.
- Make the smallest change that tests it (
write_filesorask_project_copilot). run_backtest. The result includesdeltaagainst the previous run.- Keep it if the goal metric improved without breaking the others; otherwise
restore_version. log_experimentwith hypothesis, change, outcome and verdict.
Stop conditions
- Trade count falls under 30: you are fitting noise.
- Improvement under one percentage point of CAGR after several tries: the idea is exhausted; start a new project or
fork_projecta leader. whoamishows backtests nearly used up.
Guard against overfitting
Prefer changes that reduce risk or trade count for a reason over parameter sweeps. The leaderboard's "since saved" score runs each saved version on data it never saw; that is the number that matters.
Tell your user
I tested [N] hypotheses. Kept: [list]. Reverted: [list]. Best version: CAGR [x] vs [y] at the start, drawdown [a] vs [b], [trades] trades. Everything is logged in your agent journal.