The trader. It reads one contract, sizes a book from it, and refuses to trade when the contract does not hold.
This is not the experiment harness. The harness is
nousergon/crucible — public, AGPL,
and the durable product. The two systems are coupled by two documents and
nothing else:
| Document | Key | Written by | Read here |
|---|---|---|---|
| Champion pointer | champions/{slot}/current.json |
crucible experiment.grade |
every session |
| Predictions feed | predictions/{trading_day}.json |
crucible serving.publish |
every session |
The harness must complete every acceptance test with the trader switched off, and the trader must run a week on a frozen champion with the harness switched off. That mutual independence is the test that they are separate systems, and it is why nothing in this repository reaches into the harness's job machinery, and nothing in the harness reaches into this one.
A champion that nothing trades is a verdict. A trader that trades a champion nobody checked is an incident. This repository is the one place where the second is structurally impossible:
- It refuses an unattested champion.
crucible.champion.read_championre-derives the producing run's manifeststatuson every read and raisesChampionUnusableErrorwhen it is notok; an S-slot champion whosepit_parityattestation is notPASSraises the same way. The trader calls that reader — a second implementation of the refusals here would be the defect, not the deliverable. - It distinguishes "no champion" from "a champion I must not serve." An absent pointer is a hold and, past the absence deadline, a page. An unusable pointer is a page now and a book that trades nothing. Collapsing the two would make a refused champion look like a quiet day.
- There is no fallback. It never serves yesterday's feed, never falls back to a different slot, and never sizes on a partial read. A refusal flattens or holds the book and exits non-zero.
The fleet's standing rule confines LLM calls to research. This repository makes
none and has no LLM dependency — direct or transitive through crucible's own
optional extras. The control is the absence itself: there is no call site to
register in alpha-engine-config/private-docs/LLM_CALLSITE_REGISTRY.yaml, which
declares call sites and has no row shape for a repository that has none. Adding a
model dependency here is a policy change, not a code change.
Requires Python 3.12 and uv.
uv sync --frozen
uv run --frozen python -c "from crucible_trader.settings import Settings; print(Settings.from_env())"
Every command is uv run --frozen. A bare python3 -m pytest here measures the
laptop's global interpreter, not this repository, and produces false failures.
uv run --frozen ruff check
uv run --frozen ruff format --check
uv run --frozen pytest -q --cov=crucible_trader --cov-config=pyproject.toml
The coverage floor in pyproject.toml is a ratchet: set at the measured
value, raised as coverage improves, never lowered to make a change pass. It is
measured over the whole crucible_trader package ([tool.coverage.run] source),
not over the files a test happened to import, and omit and exclude_lines are
both empty so the denominator cannot be narrowed into a flattering number.
The trader runs the same wheel as the harness (plan §4.11) and pins a
release: it reads trader/release_pin from the store and installs
releases/{sha}/. It never follows releases/current. Promotion of a release to
the trader is an explicit, off-market-hours action gated by the trader's own
smoke (connect to the paper gateway, read the book, place no order).
In this repository's own dependency graph, crucible is pinned by git sha in
pyproject.toml and locked in uv.lock — the same sha the wheel is built from,
so what CI grades and what the box installs are the same code.
The trader runs on the executor box beside IB Gateway paper (Brian's ruling of
2026-09-24 on alpha-engine-config-I11545). The box's units live in
crucible-executor/infrastructure/systemd/ and each one runs the PINNED
release (trader/release_pin) in a fresh virtualenv:
| When (NYSE sessions, New York time) | Entry point | Writes |
|---|---|---|
| 10:45 | scripts/trader_pinned.sh daily_session |
runs/trader.session/{day}/run.json, trader/evidence.json, trader/execution_shortfall/{day}.json |
| 16:45 | scripts/trader_reconcile.sh |
runs/trader.reconcile/{day}/run.json, trader/reconciliation/{day}.json, trader/broker_statements/{day}.json |
| 11:00 | scripts/trader_pinned.sh shadow_books_daily |
trader/shadow_books/{decision_day}.json |
The box runs from about 08:15 to between 17:10 and 17:50 New York time. The v2
data-daily run publishes the day's panel at 18:30. So the shadow books for the
last closed session are advanced the next morning, and the broker is reconciled
before the box stops.
A routed session starts only in market hours (alpha-engine-config-I13447).
With routing on, a session that starts outside 09:30 ET to the close on a
trading day (13:00 on an early-close day) is held: the run is ok, its
trader_session_served metric is 0 and says "outside market hours", and no
router or gateway connection is opened. The check is made only at the start.
Shadow and simulated sessions are not checked. The run's calendar_date is the
New York date.
A shadow session counts as a served day (ruling 2). With routing off, the
session resolves the champion, builds the book, records the day in
trader/evidence.json with session_modes[day] = "shadow" and files a
no_orders shortfall; no order leaves the trader. The phase-4 gate counts
shadow and live days alike and names the split.
crucible_trader.order_router turns the target book into IB paper orders.
It sends nothing unless CRUCIBLE_TRADER_ORDER_ROUTING=ib_paper is set in the
trader's environment on the box. Unset, or off, gives a shadow router that
yields no batch. Any other value raises. Nothing in this repository sets the
variable. Setting it is an operator decision, not a merge.
When it is set, the router also requires CRUCIBLE_TRADER_IB_ACCOUNT (a DU…
paper account and the only account the gateway session manages), the gateway
on the paper port 4002, and two caps with no defaults:
CRUCIBLE_TRADER_MAX_ORDER_NOTIONAL_USD and
CRUCIBLE_TRADER_MAX_SESSION_NOTIONAL_USD. It checks the kill switch before
every order. It never trades a position its own book does not name. Its
orderRef is keyed by trading day and symbol, so a retried session adopts the
orders it already sent and does not send them again.
Orders wait for the right moment (crucible_trader.entry_timing; the buy
triggers are ported from the v1 executor). Each buy is held and sent when the
price pulls back 2% from the day's high, is 0.5% below the day's VWAP, or sits
within 1% above its 20-session low, or from 15:30 ET when it is within 1% of
the price it was sized at, or unconditionally at 15:55 ET (earlier on a half
day). Each sell is the mirror: sent on a 2% rally off the day's low, or from
15:30 ET when it is within 1% below the price it was sized at, or
unconditionally at 15:55 ET, so no exit is carried overnight. A buy spends only
the book's cash plus what its sells have actually filled: one that needs a
waiting sell's proceeds waits for that sell. The session therefore runs until
the last order is sent. While it waits, trader/entry_watch/{day}.json lists
every waiting order and what released each one.
CRUCIBLE_TRADER_ENTRY_TIMING=immediate sends every order at the start
instead, sells first.
A held name that gaps down is sold whole first (crucible_trader.gap_stop,
the v1 executor's catastrophic gap stop). At the session start every held name
is priced live against the book day's close; one 15% or more below it is sold in
full at once, as the session's first batch, whatever the book wants, and is not
bought that day. It never waits for the sell-timing trigger the other sells wait
for: hard risk outranks timing. Every check, fired or not, is recorded at
trader/gap_stop/{day}.json. CRUCIBLE_TRADER_GAP_STOP_PCT overrides the
threshold; off disables it.
| You need | Go to |
|---|---|
| Repo conventions for agents | AGENTS.md (symlinked from nous-ergon-ops/agent-instructions/crucible-trader/) |
| The binding plan | alpha-engine-config/private-docs/crucible_v2_rebuild_plan_260901.md §3, §4.11, §9.5 |
| The tracker | nousergon/alpha-engine-config — issues are alpha-engine-config-I<N> |
| The epic | alpha-engine-config-I9751 |
| The harness | nousergon/crucible |
AGPL-3.0-or-later. See LICENSE and NOTICE.
See SECURITY.md. This repository is on the money path: treat every credential, account identifier and tolerance in it as tier-1 content.