UV's own audit showed the identical brain losing −758 USDT on friction alone while BLUE
netted +2.5%/day — **execution is where the parity gap is made of money.**
## 1. Lineage — what this spec unifies, and the standing on each part
| # | Asset | What it contributes | Status / evidence |
|---|---|---|---|
| L1 | **PINK drive loop** (`prod/clean_arch/runtime/pink_direct.py:931-1210`) | THE starting point (operator ruling). ~280 lines of scar tissue: TTL sweep, fill-vs-cancel race reclassification, venue-truth requote gate, exit escalation. Every branch is a real incident. | Production-run since 2026-06-11; `maker_both` ACTIVE. **Port behavior warts-and-all — do NOT rewrite** (transcribe-the-mess doctrine, same ruling as the ADVSL port). |
| L2 | **PINK `ExecutionRouter`** | Pure maker/taker POLICY: stdlib-only, zero I/O, 265 tests incl. live VST E2E. The whether-maker machine + `pre_submit` hook (may return a replacement plan). | Genuinely portable, a day's work. Test corpus comes with it. |
| L4 | **DITAv2 kernel + venue seam** | The FSM, intent idempotency, identity-collision detection, ns-timed receipts, `u-`/`m-` clientOrderId discipline, multi-leg capability (`exit_leg_ratios` — built, unproven), sync+async submit paths, M2 ExecIoLoop (one owned venue-I/O lane), M4 VenueReadiness fail-DARK. | The chassis this layer bolts into. Async path is the only sanctioned one (D5 ruling: no sync sign-off). |
| L5 | **Execution-truth doctrine** (bdc54fb + BUGCLASS_INDETERMINATE_OUTCOME) | NOT_ATTEMPTED / REFUSED / **INDETERMINATE** triage; *unknown is never flat*; post-ack failures may never veto an accepted order; `VenuePostAckError` fence. | Codified after the 6-orphan incident; fault-injection matrix exists. Inherited wholesale (§8). |
| L6 | **Priority doctrine A–G → P0–P4** (`UV_EXEC_PRIORITY_LADDER_20260713.md`, fix `b34eb4c`) | Session safety > execution truth > capital preservation > profit/maintenance > entry. Bounded P1 burst (16) so truth can't starve a hard SL. Mutation-verified 2026-07-14. | LIVE in the flight series. This layer's dispatch inherits it (§9). |
| L7 | **mm_'s order-type normalization** (`MALKHUT/malkhut/training/order_types.py`) | FIX-annotated order SEMANTICS (BaseType/TimeInForce/Conditional/Instruction/Compound) + per-venue dialect tables + `normalize_to_exchange`/`is_type_available`. The interlock plane between MALKHUT and this layer. | Adopt as the order-vocabulary (S9) **after the two corrections**: (a) POST_ONLY/IOC/FOK are BingX `timeInForce`, not `type` — the map must split namespaces; (b) `trailing_stop→TRIGGER_MARKET` silently un-trails — BingX has native `TRAILING_STOP_MARKET` + `TRAILING_TP_SL`. |
| L8 | **Venue characterization** (BingX) — PRIMARY SOURCE: `BingX_FILL_CHARACTERIZATION_AND_ADVANTAGES.md` (2026-04-24 live sweep, 10 symbols × 4 order families, + cmd-PASS8 savings addendum) | RTT anatomy: ~40 ms to CF edge, ~195 ms edge→origin, warm-TLS saves 20–85 ms; REST-only order entry (no WS trade, no FIX — CCXT-verified); 10 req/s order endpoint; GOAWAY recycle ≈ every 8.5 k requests (benign); `.pro` backup trust anchor fixed (`7155de2`); offline symbols ack `code==0` with empty data (fabricated-fill fence landed); dashed wire symbols; VST `allOrders` time-filter broken (filter client-side). | Measured 2026-07-10→14. Constants in this spec cite this row, not vibes. |
| L9 | **WS price lane** (P0–P3, LIVE in Flight 6, `e35ac0b`) | Push mark prices ~0.8 s fresh (vs ≤1 s poll + RTT), `PriceStore` wait-free reads, frame journal for deterministic replay, REST fallback age-gated. Mark = risk-geometry truth; OB top = execution truth; last/close = brain-parity truth — **three price truths, never conflated**. | This layer reads OB for placement and mark for protective geometry; it never touches the brain's price. |
| L10 | **mm_'s OB microstructure study** — PERSISTED: `MALKHUT/docs/OB_MICROSTRUCTURE_STUDY.md` (12 sections, 13 assets, live Binance/BingX + Bouchaud/Cont-Stoikov/Cartea-Jaimungal calibrations) | Majors' spread = 1 tick (0.0016 bps — maker capture ≈ 0 on Binance majors, material on BingX); 100-level book spans ~13 bps (deep-depth metrics need the 5000-level feed); best-bid depth BTC ≈ $212 K. Parameterizes SmartPlacer offsets + fill_simulator per venue. | Persistence requested; numbers feed `_constants.py` provenance. |
| L11 | **MALKHUT** (future, "advise-bearing") | Game-theoretic fulfilment: `FulfilmentAction` (kind, qty_fraction, order_type, post_only, reduce_only, cancel/replace) + `RiskDecision` approval envelope + adversarial self-play training. | NOT an authority over this layer — an **advisor** (§5). Compatibility is BY CONSTRUCTION, not retrofit. |
## 2. The Contract — "an asset, a size, and a prayer" (agnosticism doctrine)
The operator's ruling, made precise: **the execution layer knows NOTHING about the
caller's world.** Not leverage math, not dual-leverage flight machinery, not postures,
not commit-chains, not capital, not why. Compatibility with the Flight series (or
anything else) is therefore not a feature — it is the *absence* of coupling.
### 2.1 Input — `ExecutionRequest` (the whole surface; nothing else may leak in)
| **T1** | **Better orders** | The operator's point, verbatim intent: *"fire trades better than costly MARKET, try and MM, cut fees in half by simply using better order types — usable RIGHT NOW."* Concretely: GTX/post-only-first with bounded quote lifetime → cross at TTL; CATASTROPHIC passes through as MARKET untouched; nothing else. No SmartPlacer, no advice, no chase logic. This is a PORT, not an invention: PINK's `maker_both` ran production since 2026-06-11 (L2, 265 tests), and short-lived GTX is the ONLY L8-certified fill-improvement technique (§4-16). Entry gate: Q1 (measure the maker fee — one VST GTX fill). Prize at 50-75% maker conversion: ~$43-64K on BLUE's historical volume (§4-20). **WHY T1 exists (operator, verbatim): usable RIGHT NOW, WITHOUT WEIRD BUGS.** Its simplicity is a SAFETY property, not a convenience: every weird bug in Appendix D came from complexity at this seam (races, rollbacks, phantom state). T1 adds exactly ONE new state (resting GTX with TTL) and ONE new transition (TTL→cross) — both de-bugged in PINK production for a month — and inherits every truth/idempotency guarantee unchanged. No chase ⇒ no requote races. No advice ⇒ no clamp bugs. No book model ⇒ no misread books. The only new wire op is cancel-at-TTL, and cancel-INDETERMINATE is already law (§8). The bug surface is, by construction, the smallest nonzero one available. | FIRST SHIPPABLE INCREMENT — buildable immediately on unpark, pre-adjudication |
| **T4** | Full drive loop | PINK port complete (§7): chase budgets, requote gate, fill-vs-cancel races, exit escalation | the v1-spec vision |
| **T5** | Fast plane | WS/shm price seam (L9) in the loop; C1 location-independence exercised (colo-ready); session-aware constants (App. E) | |
| **T6** | Multi-leg | `exit_leg_ratios` proven end-to-end (Q6); ADVSL partial retraction legs ride the layer | |
| **T7** | Advised | MALKHUT advice plane live (§5) — she suggests, layer clamps, telemetry closes her training loop | |
| **T8** | Self-tuning | constants auto-updated from own friction telemetry (provenance-logged, operator-gated) | |
| **T9** | Multi-venue | second dialect module (§11); Binance pre-staged by L7 tables + App. E | |
| **T10** | **MALKHUT game-theoretic placement** | she doesn't advise placement — she IS placement (fulfilment policy executes through the same contract, same promises) | the north star |
| T11–T12 | Unassigned | headroom — the ladder expects rungs we can't name yet | |
| **T13** | Reserved | ASI. (If the market is still imperfect enough to need an executor, §0 still applies.) | reserved by operator |
| **S1** | walks visible levels (expected walk ≥ spread) | alts at current sizing already here (enter-slip −24 bps says so) | T2+ prices the walk into give-up/cross decisions |
| **S2** | exceeds book capacity in the urgency window | future capital | must be SLICED — refused whole, loudly, below T14 |
| **S3** | size IS the market (footprint changes MM behavior) | the 1MM-era problem | MALKHUT/VIBRASS game-theoretic territory |
**The composability ruling** (the operator asked; the contract answers):
- **COMPOSABLE (sub-rung style, `T*.s`, available at any tier ≥ T1):** slicing/
scheduling — TWAP/VWAP/participation-rate slicers are CALLERS: they decompose one
parent request into N child `ExecutionRequest`s over time, each child inheriting
urgency and S0/S1 grade. The agnostic contract makes this free — the layer cannot
tell a slicer from a brain, by design. Ships as a separate `sizer` module ABOVE
the contract; the layer itself gains only a `parent_request_id` journal field so
friction telemetry can aggregate families. (VIBRASS's "TWAP/VWAP at size" future,
per the dual-clock north star, lands exactly here.)
- **NOT composable (wholesale tiers, T14+):** size-aware tactics INSIDE a working
order — venue-native iceberg (dialect where supported), live-depth-adaptive child
The operator flagged that no inventory existed of what the Flight series taught us by
*actually executing* at-exchange. This is it — every lesson has a scar-commit:
| # | Lesson | Evidence / fix |
|---|---|---|
| F-1 | Register protective watches from the FILL, never the intent (qty-0 ghost watches: 10 entries, 0 exits, day 1) | `da4163b` — bridge.last_intent registration |
| F-2 | Post-ack failure may never veto an accepted order (telemetry signature skew synthetically REJECTED every 200-OK ENTER → 6 orphan SHORTs) | `b46ebd2` + `VenuePostAckError` fence; class-fix, not instance-fix |
| F-3 | Exits must not ride the scan clock (scan-synchronous drain = 12 s exit delivery) | M6 steel lane; measured F5: decision→dispatch median 4 ms, max 58 ms |
| F-5 | Kernel slot state must advance on venue-fill-confirm, not submit-accept (desyncs both ways: SLOT_BUSY refusals + phantom exits) | dirty-25 root-cause, `d0ae6a1`+`bcd3798` |
| F-6 | clientOrderId must propagate caller→venue end-to-end (kernel-minted p-e/p-x ids broke venue joins; time+qty joins are the fallback, never the design) | promo_client_id metadata propagation |
| F-7 | VST `allOrders` startTime/endTime filters are BROKEN (return empty) — filter client-side | flight recorder + sentinel both hit it |
| F-8 | Measured venue round-trip through the full stack: bridge→receipt median 0.36 s, p90 0.66 s, max 1.21 s (n=95) | F5 timing sweep 2026-07-14 |
| F-9 | Wire values are quantized (wallet 4 dp) — compare at wire precision, exactly at decision level | E-TRIPWIRE fix `d70eb68` (121 false CRITICALs) |
| F-10 | Trigger→fill costs ≤4 bps at 1 s detection (TP prints +0.28/+0.28/+0.32 vs 0.28% effective trigger) — detection granularity, not tactics, was the binding constraint; WS lane (L9) attacks exactly this | F5 exit anatomy + tp_exit_ingress evaluations |
| F-11 | Runners die silently (F4 03:11, F5 16:47 SIGKILL mass-event) — the exec layer's host needs supervision + log-stall watchdog; a dead client is why the venue-attached backstop (§10) exists | F6 watchdog; FL7 wants supervisord |
| F-12 | Arm gates must be fresh-per-call env+file, and kill-switch drills find alias traps (`rm -i` silently no-ops on EOF) | kill-switch drill 2026-07-13, passed 2nd attempt |
| F-13 | Per-order venue leverage set-calls work and are cheap (`leverage SET symbol=LTC-USDT 2→1` inline pre-order) — confirms §2.1: `ensure_symbol_mode` as idempotent pre-trade plumbing | F5/F6 logs |
| F-14 | Journal-lane degradation must be spool-and-loud, never blocking, never silent (404 storm: 933 rows spooled, zero lost, flushed later) | M6 journal clock + 2026-07-14 replay |
## Appendix E — Microstructure priors (mm_'s study; SPECIFIC beats general)
From `MALKHUT/docs/OB_MICROSTRUCTURE_STUDY.md`. Two provenance grades — MEASURED
(live API, congruent with our own numbers: adopt) and CALIBRATED (literature-fit
models: adopt as priors, validate against our tapes in A1 before constants ship).
**MEASURED — BingX vs Binance (the dialect-layer economics table):** perp spreads
1.7–12.6× wider on BingX; BTC depth ~20× thinner; taker 1.25× higher (0.05% vs