feat: add autonomous paper-trading and calibration pipeline

This commit is contained in:
ImBenji
2026-08-03 14:03:27 +01:00
parent 5a9a2e4c6d
commit c4028cc394
46 changed files with 2246 additions and 115 deletions
+53
View File
@@ -0,0 +1,53 @@
# Duriin autonomy runtime
The autonomy runtime is additive to the existing archive and intelligence
tables. It is deliberately disabled until the paper-trading cutover is
approved.
## Services
- `api`: HTTP only; no background scheduler when `DURIIN_RUN_SCHEDULER=false`.
- `autonomy`: bounded archive reconciliation and live/historical job creation.
- `coordinator`: LLM proposal extraction only. It cannot create an order.
- `autonomy-outcomes`: resolves matured predictions against market and benchmark returns.
- `calibration`: creates empirical calibration snapshots and deterministic decisions.
- `intelligence`: legacy worker, available only under the `legacy` Compose profile.
Start only the API by default:
```bash
docker compose up -d api
```
The new runtime is explicitly opt-in:
```bash
docker compose --profile autonomy up -d autonomy coordinator autonomy-outcomes calibration
```
## Authority rules
The coordinator may return categorical, evidence-backed proposals. It may not
return probabilities, returns, position sizes or trade actions. Proposals must
reference existing archive article IDs and instruments in
`autonomy_instruments` with `active=1` and `tradable=1`.
Calibration is computed from resolved market-relative outcomes. The policy
engine emits `BUY`, `SELL`, `HOLD` or `ABSTAIN`; an LLM is not in this path.
Paper order intents use deterministic client IDs and are bounded by the
execution validator. A broker adapter must be explicitly configured; the
included simulator is the default test adapter.
## Database initialization
The autonomy schema is initialized additively by the autonomy workers and
maintenance scripts in the intelligence database. To create the initial
reconciliation job without starting workers:
```bash
npm run autonomy:init
```
Legacy predictions remain legacy records and are not silently included in
calibration. New prospective predictions are the trusted learning set.