NEO Trading Engine — Agent Alignment Briefing¶
Date: April 14, 2026 (early AM ET) Audience: Any Claude agent working on NEO in VS Code or Cowork Author: Cowork Claude (session with Katja, Apr 13–14)
Current State of the Engine¶
NEO is a live XRPL market-making engine running Stage 1 funded sessions on neo_live_stage1.db. It places two-sided quotes (buy + sell) around a mid-price, captures spread, and manages inventory via a skew-based control loop.
What works: The engine reliably captures spread. VW realized spread ~3 bps across sessions. Fills both sides. Portfolio at ~141 RLUSD against 137.28 net deposits = ~3.96 RLUSD cumulative trading value. Zero toxic fills. The core market-making loop is sound.
What doesn't work yet: Inventory stability at 10 RLUSD order size. Two consecutive sessions halted early on exposure caps (one RLUSD-side, one XRP-side). Skew control loop maxes out at its ceiling and cannot arrest drift during directional market moves at this size.
What Just Happened (Apr 13–14 Sessions)¶
- Two sessions ran at 10 RLUSD size, both hit exposure caps:
- Session A: RLUSD cap (102.9/100), 3340s runtime, 40/40 fills, skew pegged at -8 bps
- Session B: XRP cap (101.6/100), 2093s runtime, 48/42 fills, skew pegged at +8 bps
-
Direction flipped with market regime; failure mode identical (skew ceiling binding)
-
Mid-price reconstruction bug found and fixed:
dashboard.py:_reconstruct_midandsummarize_paper_run.py:load_quote_quality_summaryboth used global median inventory (singlexrp_med/rlusd_med) in a per-tick mid formula- With inventory swinging (e.g., XRP 37→63), the median was wrong for ~42% of ticks
- Produced phantom negative sell distances — 27% noise in Session A, 78% in Session B
- Engine's live control loop was NOT affected — it uses
snapshot.mid_price(CLOB, written every tick) -
Fix: both code paths now use
market_snapshots.mid_pricevia merge_asof/bisect (10s tolerance), per-tick inventory reconstruction as fallback only -
Skew ceiling experiment (8→12 bps) was run but inconclusive:
- Inventory initially balanced well (49.9% XRP at one point)
- Then market moved directionally and drift resumed, hitting cap at +12
- Cannot cleanly attribute drift-to-halt to skew insufficiency vs degraded diagnostics vs anchor distortion
- Decision: pause tuning until diagnostics verified clean
Active Decisions and Constraints¶
| Decision | Status |
|---|---|
| Sell offset | Locked at 16 bps (was 18, tuned down in Phase 5A) |
| Skew ceiling | Reverted to 8 bps pending clean data |
| Order size | Stepping down to 7 RLUSD for verification sessions |
| Exposure caps | 100 RLUSD each side, unchanged |
| Anchor mode | capped_amm, 10 bps cap, 73% utilization (escalating — FLAG-002) |
| Tuning status | PAUSED — no parameter changes until mid-noise verified at 0% |
Immediate Next Steps (In Order)¶
-
Verify mid-noise fix — Run a session (7 RLUSD size). Both dashboard and terminal summary should show 0% invalid ticks. This is the gate for everything else.
-
Establish clean 7 RLUSD baseline — One full-duration session with verified diagnostics. This becomes the reference point.
-
Re-test at 10 RLUSD — With clean diagnostics, determine if drift-to-halt persists. If yes, skew slope (not ceiling) is the next variable.
Open Flags That Matter Right Now¶
| Flag | Status | Why It Matters |
|---|---|---|
| FLAG-002 | Active | Anchor 73% capped and climbing. If it degenerates to fixed offset, mid-price reference shifts. Monitor. |
| FLAG-004 | Active | Sell fill mechanism (queue vs sweep). Determines how to interpret sell conversion rates. |
| FLAG-008 | Active | WAC rebuild bug. Blocks capital injection path. Must fix before any injection + restart. |
| FLAG-010 | Active | Terminal summary not session-scoped for fill counts. Separate from mid-noise fix. |
| FLAG-011 | Resolved | Mid reconstruction bug — fixed in both dashboard.py and summarize_paper_run.py. |
| FLAG-012 | Active | Inventory drift-to-halt at 10 RLUSD. Blocked on FLAG-011 verification. |
What NOT to Do¶
- Do not change skew parameters (ceiling, slope, or size-scaling) until mid-noise is verified clean
- Do not raise exposure caps — the drift-to-halt is a control problem, not a cap problem
- Do not change anchor config — it's a known variable but not the current priority
- Do not touch live engine logic (order placement, skew calculation, drift computation) — it's confirmed clean
- Do not run tuning experiments until a clean 7 RLUSD baseline exists
Key Files¶
| File | What It Is |
|---|---|
[C] Open Flags.md |
All active/resolved flags with gates and actions |
[C] Experiment Log.md |
Historical experiment results and locked parameters |
NEO Trading Engine Overview.md |
Project overview, goals, architecture context |
[C] 2026-04-14.md (daily log) |
Tonight's session details |
dashboard.py |
Streamlit dashboard — mid-noise fix applied here |
summarize_paper_run.py |
Terminal session summary — mid-noise fix applied here |
config_live_stage1.yaml |
Live config (sell offset, skew params, size, caps) |
This briefing reflects alignment between Katja and Cowork Claude as of Apr 14, 2026 ~00:30 ET. If any parameter changes are proposed, check the flags file first and confirm the mid-noise gate (FLAG-011) has been passed.