Skip to main content
Two directories in the repository: examples/harnesses/trading, a harness for systematic trading strategies, and examples/trading, a task on it. The task is deliberately small: three synthetic instruments with a trend in them, a 20/100 moving-average cross that scores a Sharpe of 0.14 out of sample (measured by us on the example’s evaluator when the example was recorded), a brief that asks for 1.0. A faster cross or a volatility-targeted momentum signal gets there, so there is room, and every discipline of the domain has something to catch.

The harness

examples/harnesses/trading/harness.yaml
kapso harness check examples/harnesses/trading prints check ok (7 skills, 2 agents, 2 servers, 7 hooks) and, on a machine without the harness’s Python requirements, the needs lines for them.

The task

examples/trading/kapso-brief.md
generate.py writes the bars from a seed, so the baseline is the same number on every machine: three instruments, business days from 2021 through 2024, each a random walk whose next return leans on the last twenty days’ average by a weight of 0.35. The development years go under data/, the out-of-sample year under private/, which nothing copies into a workspace; the evaluator reads it through a pointer file beside itself. The evaluator imports signal from the workspace, shifts it by one bar, charges the cost on turnover, scores 2024 as an equal-weight portfolio, writes the two result files the require-results hook asks for, and prints the risk line then sharpe: <value> as its last line.

Run it

The same build from Python:
examples/trading/run.py
The brief’s Harness line names the harness, so the command needs no --harness; load_harness() in the script is the same thing said in Python, and either wins over the line.

What the campaign shows

  1. The setup session runs first. It calls the market-data server’s snapshot on kapso_datasets/bars, which lands under prepared/market-data/ with a MANIFEST.json of hashes, and writes the domain statement: the instruments, the calendar, the window, what it pinned. kapso_task.md carries both.
  2. Each experiment’s implementation session has the backtesting and look-ahead skills, the market-data server and the auditor beside it; a write under prepared/ is denied, a written signal is scanned, and the session cannot end before the result files exist. The stream under .kapso/sessions/<branch>/stream.jsonl shows each decision.
  3. Each scored attempt is verified before it is judged: the verifier reads the diff and the evaluation output under .kapso/verification/<branch>/, runs the scan, asks the auditor where a pattern cannot decide, and writes verdict.json. A centred window or a future shift is a void with its file and line; the attempt stays on its branch and is never delivered.
  4. The judge reads the verdict beside the evaluation and the risk reviewer’s words beside the score.
  5. solution.explain() ends with the harness’s identity and the verdict on the delivered candidate.
Recorded result: a Sharpe of 1.93 out of sample on 2026-10-25, on a fresh machine with Claude Code, in 45 minutes and one experiment: the setup session pinned the snapshot, the implementer wrote a volatility-targeted momentum ensemble and asked the auditor, the verifier’s verdict was valid, the judge called the target met. A second fresh machine scored 1.99 the same way.

Change it

  • The harness. Edit a page under examples/harnesses/trading/instructions/, bump version, run check again. The next build records the new hash; a resume of an older campaign refuses it by name.
  • The target. The data’s trend is worth a Sharpe of about 2 to a 20-day momentum signal; a target above 3 is not there.
  • The evaluator and the data. evaluation/evaluate.py and generate.py are the task’s own; change the metric in the evaluator and in Measured by together, change the trend weight and re-measure the baseline.
Related pages: What a harness is · Use a harness · Write a harness · Harness reference · Your first build Kapso is an open-source framework by Leeroo that builds software toward measurable goals through experiment campaigns. Source code: github.com/Leeroo-AI/kapso · Install: pip install leeroo-kapso · Every page as plain text: llms.txt.