My Workspace — Claude Context File¶
Claude reads this file at the start of every session. It's your persistent memory.
How This Workspace Works¶
This workspace exists to produce things, not just store things. Everything here is oriented around one loop: set a goal → break it into problems → solve those problems → ship the output.
Claude's job is to keep the user moving through that loop. If there's no goal yet, help them set one. If there's a goal but no clear problems, help them break it down. If there are problems, help them solve the next one. Always push toward the next concrete thing to make or do.
Who I Am¶
Name: Katja What I do: Work full-time What I want help with: Research and problem-solving — digging into questions, analyzing information Vibe: Direct and no-nonsense Timezone: Eastern (ET)
The Team¶
| Agent | Model | Role | Pronouns |
|---|---|---|---|
| Katja | Gen-X | Captain — final decision authority | she/her |
| Atlas | ChatGPT | Architecture, strategy, experiment design | he/him |
| Vesper | Claude Sonnet (Neo Bot) | Monitoring, audit, alignment, logs | she/her |
| Orion | Claude Opus (implementation) | Engineering — builds, fixes, implements | he/him |
VS Code Claude — RETIRED (Apr 14, 2026). Made undocumented parameter changes on live capital (FLAG-011). All code changes now go through Vesper and Orion only.
Communication convention: Sign all cross-agent messages by name. Address recipient at top.
Vesper response convention (standing): Any time Vesper produces a file that Katja needs to pass on (to Atlas or others), include a computer:// link to that file directly in the response. Do not wait for Katja to ask.
Git rule: All git commands run in Katja's VS Code terminal on her Windows machine. Vesper provides copy-paste commands. Neither Vesper nor Orion touch the repo via the mounted filesystem — that path is unreliable for git operations.
Orion apply instruction rules (standing — enforced by Vesper in every review):
1. No pre-creating branches during investigation. Orion must not create the feature branch until he is ready to commit code. Investigation work stays on main or a throwaway local branch deleted before delivery. Pre-created branches cause fatal: branch already exists errors for Katja.
2. No *.patch glob in PowerShell. git am "path\*.patch" fails in PowerShell — glob does not expand. All apply instructions must use the Get-ChildItem ... -Filter "*.patch" | Sort-Object Name | ForEach-Object { git am $_.FullName } form.
3. Always include defensive branch delete. Apply instructions must always include git branch -D <branch> before git checkout -b <branch> to handle the pre-created branch case silently.
Folder Structure¶
Reorganized Apr 20 — subfolders under 02 Projects/NEO Trading Engine/. See [C] Folder Reorganization Proposal.md in that folder for the full rationale.
01 Daily Logs/ — session logs so Claude remembers what we worked on
[C] 2026-04-09.md … [C] 2026-04-20.md
02 Projects/
NEO Trading Engine/ — XRPL market making engine
│
│ (pinned at root — actively referenced)
│ NEO Trading Engine Overview.md
│ NEO Whitepaper.pdf
│ NEO ERD — DB Schema.mermaid
│ NEO ERD — Module Architecture.mermaid
│ [C] NEO Operating Principles.md ← MUST READ — team operating standard
│ [C] NEO Config Wiring Reference.md ← YAML→runtime wiring table
│ [C] Dashboard Metrics Reference.md ← metric definitions/formulas
│ [C] Open Flags.md ← all active/resolved flags
│ [C] Experiment Log.md ← source of truth for all phases and results
│ [C] Implementation Log.md
│ [C] Intel Log.md
│ [C] Folder Reorganization Proposal.md ← structure plan (Apr 20)
│ run_phase73_sweep.py ← Phase 7.3 sweep script, Atlas-approved
│
├── 01 Specs & Templates/ — specs, templates, onboarding, whitepaper copies
├── 02 Phase Planning & Evaluation/ — phase-level alignment and eval (6B, 7, 7.2, 7.3, 7.4)
├── 03 Branches/ — per-branch bundles (tasking → investigation → delivery → review → ruling)
│ Branch 1 — fix-halt-reason-lifecycle/
│ Branch 2 — fix-summarize-paper-run-capital-overlay/
│ Branch 3 — chore-archive-cleanup/
│ Branch 4 — fix-flag-029-async-pin-and-orphan/
│ Branch 5 — audit-config-wiring-pass/
│ Branch 6 — feat-distance-to-touch-diagnostic/
│ Branch 7 — fix-wal-checkpoint-hardening/
│ D2 — feat-wallet-truth-reconciliation/ (merged — D2.2)
│ feat-reconciler-disappeared-order-audit-log/ (merged)
│ feat-anchor-saturation-guard/ (merged)
│ feat-directional-drift-guard/ (merged)
│ feat-inventory-corridor-guard/ (merged)
│ fix-reconciler-disappeared-order-conservative/ (FLAG-037, merged)
│ feat-anchor-error-per-tick-telemetry/ (Phase 7.3 gate 6 — merged)
│ Pre-Phase 7.3 Audit (umbrella)/ — audit that spawned Branches 1–7
├── 04 Sessions & Experiments/ — capital injection, S30–S41 session events, post-injection regression, closure fixes
├── 05 Wallet Truth Investigation/ — Apr 19 wallet drift thread (some SUPERSEDED — kept for history)
├── 06 Flags/ — per-flag investigations (FLAG-008, 025–026, 030, 031, 032, 034, Cleanup + anchor_error_bps, Phase 7.2 CLOB)
├── 07 Agent Coordination/ — cross-cutting messages without a branch target (onboarding, briefings, green lights)
├── 08 Patches/ — git-am patch bundles (8 dirs)
└── 09 Scripts/ — helper scripts (scripts/wallet_drift_investigation*.py)
Key files (open directly from root):
- [C] Experiment Log.md — phases + results source of truth
- [C] Open Flags.md — all flags
- [C] NEO Operating Principles.md — must-read standard
- [C] NEO Config Wiring Reference.md — YAML→runtime wiring
- [C] Dashboard Metrics Reference.md — metric definitions
Most recent/active work lives in 03 Branches/ subfolders. Phase 7.4 SR Audit Spec is in 02 Phase Planning & Evaluation/. S41 results and reconciliation stack completion in 04 Sessions & Experiments/.
Active Projects¶
NEO Trading Engine¶
Goal: Build a profitable, low-capital market making system on XRPL using controlled experiments
Why: Real financial impact — building a capital-efficient, reusable trading system with discipline and precision
Key file: NEO Trading Engine Overview.md
Current phase: Phase 7.3 — BLOCKED. Remaining gates in progress.
Phase 7.3 gates (updated Apr 19):
1. Wallet truth reconciliation root cause identified — ✅ COMPLETE
2. feat/wallet-truth-reconciliation branch live and tested — ✅ MERGED (D2.2, 26 tests, Apr 19)
3. Anchor saturation guard — ✅ COMPLETE (feat/anchor-saturation-guard, 16 tests, Apr 19)
4. Inventory corridor guard — ✅ COMPLETE (feat/inventory-corridor-guard, 24 tests, Apr 19)
5. Directional drift guard — ✅ COMPLETE (feat/directional-drift-guard, 24 tests, Apr 19)
6. feat/anchor-error-per-tick-telemetry — ✅ MERGED (7 tests, Apr 21)
7. Session-close cancellation invariant — USEFUL (no longer primary root cause)
Wallet drain investigation (Apr 19) — RESOLVED:
- XRPScan on-chain audit confirmed: drain was entirely within sessions (no transactions after S39 close at 21:11Z)
- Real total drain: −40.09 XRP from injection to S39 close (DB showed only −3.63 — wrong)
- Biggest event: 52.11 XRP sold in 90 seconds right after capital injection; buy-back of 51.4 XRP in 11 min; then −26 XRP drain over remainder of session
- S39 on-chain: −13.64 XRP despite 4 buys / 4 sells per DB (fill-size asymmetry confirmed)
- DB sessions table over-reported by 7.40 XRP at S33 start, grew to 43.87 XRP by S39 — get_snapshot() was tracking wrong baseline
- Primary cause: anchor saturation (−10 bps cap, 100% of ticks) → SELL orders at 4 bps, BUY at 20 bps → fill-size asymmetry
- Compounding cause: internal balance truth diverged from on-chain reality
- Orion's prior analysis (post-shutdown residual orders = 90.6% of drain): DISPROVEN and SUPERSEDED
Current wallet (on-chain): 70.79 XRP / 95.96 RLUSD (post-S41). S41 complete Apr 19 — 3 buy fills (buy XRP), inventory rebalanced toward 50/50.
Atlas revised priority order (Apr 19, updated post-S41): (1) feat/wallet-truth-reconciliation ✅ → (2) feat/reconciler-disappeared-order-audit-log ✅ → (3) Anchor Saturation Guard ✅ → (4) Directional Drift Guard ✅ → (5) FLAG-037 fix/reconciler-disappeared-order-conservative ✅ → (6) Inventory Corridor Guard ✅ → (7) Anchor Error Telemetry ✅ → (8) Cancellation Invariant
Anchor Saturation Guard spec (Atlas-locked Apr 19): Trigger DEGRADED when: abs(mean anchor error) ≥ 6–8 bps AND %(|error| > 5 bps) ≥ 40% AND persists ≥ 20–30 ticks. Symmetric — no asymmetry yet. DEGRADED = cancel all, stop quoting, continue observation.
Directional Drift Guard spec (Atlas-locked Apr 19): Trigger DEGRADED if: ≥ 3 same-side fills within ~30s OR net notional imbalance exceeds threshold quickly OR no opposing fills after N ticks (~15 ticks default). Protects against flow, not price — separate layer from momentum filter.
FLAG-037 spec (Atlas-locked Apr 19): Age threshold = 300s (configurable). < 300s → phantom_fill_applied (current behavior). ≥ 300s → held_pending_review, surface alert, require resolution.
New Atlas requirement (Apr 19): session integrity flag per session at close — mark integrity_ok / integrity_warn / integrity_failed based on truth divergence events. No integrity → no evaluation. Scope as branch in guard implementation sequence.
New Atlas requirement (Apr 19, post-S41): open-order exposure awareness — track total open order notional, age distribution, exposure outside engine control. Future guard (not blocking current work).
Core invariant (Atlas-locked Apr 19): engine state must never diverge from on-chain truth beyond tolerance. If the engine cannot prove alignment with reality, it does not act.
DEGRADED mode (new, Atlas-mandated): intermediate state between WARN and HALT — cancel all orders, stop quoting, continue reconciliation, recoverable without restart. Required in D2.
FLAG-036 — CLOSED ✅ (Apr 19): feat/wallet-truth-reconciliation merged to main (D2.2, 9 commits, 26 tests). Startup gate, DEGRADED mode, pre-trade gate, realignment tool all live.
Audit branch plan: 1. fix/halt-reason-lifecycle ✅ | 2. fix/summarize-paper-run-capital-overlay ✅ | 3. chore/archive-cleanup ✅ | 4. fix/flag-029-async-pin-and-orphan ✅ | 5. audit/config-wiring-pass ✅ | 6. feat/distance-to-touch-diagnostic ✅ | 7. fix/wal-checkpoint-hardening ✅ — ALL 7 BRANCHES MERGED
S40 COMPLETE (Apr 19, 30 min): 316 ticks | 84 fills | buy=53 sell=31 | toxic=0 | VW +12.47 bps | halt=duration_elapsed ✅
Phase 7.2 verdict (Atlas Apr 18): Reference layer FIXED. Next constraint: offset calibration (Phase 7.3) — now further blocked by wallet truth issue.
Phase 7 direction (Atlas-locked Apr 18): Regime model: ALIGNED ≤3 / DIVERGENT 3-8 / STRESS >8 bps. 3 bps = live control threshold, 5 bps = evaluation reliability floor.
Capital injection ($50) — COMPLETE ✅ (Apr 17): injected 35.21 XRP @ 1.48 RLUSD/XRP
Post-injection wallet (on-chain truth): ~69.52 XRP immediately after injection (DB reported 76.92 — wrong)
Workspace patch path (Windows): C:\Users\Katja\Documents\Claude Homebase Neo\ — use this in all future git am commands
Repo path (Windows): C:\Users\Katja\Documents\NEO GitHub\neo-2026\ — Katja's local repo root
Live session run commands (run from repo root):
- 10 min: python run_paper_session.py --config config/config_live_stage1.yaml --db neo_live_stage1.db --duration-seconds 600 --live
- 30 min: python run_paper_session.py --config config/config_live_stage1.yaml --db neo_live_stage1.db --duration-seconds 1800 --live
- 1 hour: python run_paper_session.py --config config/config_live_stage1.yaml --db neo_live_stage1.db --duration-seconds 3600 --live
- 2 hours (default): python run_paper_session.py --config config/config_live_stage1.yaml --db neo_live_stage1.db --duration-seconds 7200 --live
Pre-session realign command: python tools/realign_inventory_to_onchain.py --config config/config_live_stage1.yaml --db neo_live_stage1.db --dry-run (then --confirm if delta > dust)
S42 (Apr 21) — guards fired correctly, considered SUCCESS by Atlas: Anchor saturation (mean -6.95 bps, 78.4% prevalence) + directional drift (condition C, no opposing fill 15 ticks) both triggered DEGRADED. 300s timeout escalated to HALT (engine_requested_halt). 2 fills before guards fired: VW spread 11.01 bps, 0 toxic. Capital flat. Atlas ruling: DEGRADED→HALT in hostile regime = correct behavior. NOT counting toward Phase 7.4 clean session precondition (halt ≠ duration_elapsed).
S43 (Apr 21, session_id=45): elapsed 441.45s | halt=inventory_truth_halt | 2 fills (buy=1 sell=1) | toxic=0 | VW 13.81 bps | anchor mean=+9.28 bps, median=+10.00 bps, range=[+7.0, +10.0], |err|>5bps: 100% | Fully hostile regime — CLOB-AMM divergence −12 to −14 bps throughout. Guard correct to fire and stay fired. Confirmed fix/startup-mode-reset (FLAG-041 follow-up) worked correctly. Realignment required before S44.
S44 (Apr 21, session_id=46): elapsed 441.84s | halt=inventory_truth_halt | 2 fills (buy=1 sell=1) | toxic=0 | VW 12.37 bps | anchor mean=+4.43 bps, median=+6.53 bps, range=[−3.6, +10.0], |err|>5bps: 57% | Cycling regime — anchor crossed below threshold mid-session. FLAG-042 evidence confirmed. Realignment required before S45.
fix/startup-mode-reset — MERGED (Apr 21): FLAG-041 follow-up. Fresh session startup now resets inventory_truth.mode, degraded_since, degraded_reason. 3 new tests (total 11 in test file). Patch conflict resolved via direct edit + manual commit.
FLAG-042 — CLOSED ✅ (Apr 21): feat/flag-042-degraded-recovery merged to main (9639b18, 5 commits, 16 new tests, 162 passed full regression). Anchor/drift/corridor recovery evaluators live. Per-episode cap (1 recovery per source per session), recovery_exhausted_halt taxonomy token, Step 8.4 wiring, startup reset extension all merged. S45 unblocked.
Pre-session standing procedure: Realign with python tools/realign_inventory_to_onchain.py --config config/config_live_stage1.yaml --db neo_live_stage1.db --dry-run then --confirm before every session after a DEGRADED halt. Post-FLAG-037 fix: CANCELLED_BY_ENGINE orders no longer generate phantom fills, so delta should be near-zero after DEGRADED. Dry-run check is still good practice — run it to confirm before each session.
S45 (Apr 21, session_id=48): elapsed 162.94s | halt=recovery_exhausted_halt | 27 ticks | 2 fills (buy=1 sell=1) | toxic=0 | VW 10.57 bps | anchor mean=+9.47 bps, median=+10.00 bps, range=[+8.1, +10.0], |err|>5bps: 100% | Fully hostile regime — anchor guard fired, recovered, fired again, per-episode cap hit → recovery_exhausted_halt. FLAG-042 working as designed. Capital essentially flat (−0.037 RLUSD). NOT counting toward Phase 7.4 (halt ≠ duration_elapsed). Realignment required before S46.
FLAG-044 — CLOSED ✅ (Apr 21): feat/flag-044-recovery-cooldown merged to main (8b5f0b1, 4 commits, 26 new tests, 42 passed). recovery_exhausted_halt replaced with cool-down model: cooldown_ticks_remaining countdown per source, degraded_episode_limit_halt after 3 episodes. Locked principle: "A bad regime is not, by itself, a reason to terminate the session." Use --duration-seconds 7200 (2-hour sessions) going forward.
S46 (Apr 21, session_id=49): elapsed 579.11s | halt=inventory_truth_halt | 117 ticks | 2 fills (phantom — simultaneous 04:38:50, buy 10.5 XRP / sell 19.5 XRP) | toxic=0 | VW 12.63 bps | anchor mean=−5.22 bps, median=−4.78 bps, range=[−10.0, +0.3], negative regime, 44% >5bps | Capital flat (196.95 → 196.99 RLUSD). NOT counting toward Phase 7.4 (halt ≠ duration_elapsed). Regime SHIFTED NEGATIVE vs S43–S45 (first sign of favorable conditions). Root cause: reconciler re-applied phantom fills from DEGRADED-cancelled orders (same −6.28 XRP / +9.0 RLUSD delta). FLAG-037 SESSION-BLOCKING — CANCELLED_BY_ENGINE layer (C5-C7) deployed and confirmed in S47.
FLAG-037 — CLOSED ✅ (Apr 21): fix/reconciler-disappeared-order-conservative (C1-C7, two-step apply) merged to main. CANCELLED_BY_ENGINE layer confirmed working in S47 — RECONCILER_SKIP_ENGINE_CANCEL fired for all engine-cancelled orders, truth check stayed clean (delta_xrp ~0.00004, negligible). Phantom fill cycle broken.
S47 (Apr 21, session_id=50): elapsed 191.67s | halt=degraded_episode_limit_halt | 33 ticks | 1 fill (buy=1 sell=0) | toxic=0 | VW 2.27 bps | anchor mean=−5.62 bps, median=−5.17 bps, range=[−10.0, +1.7], negative regime, 50% >5bps | Ending inventory: 72.189 XRP / 93.963 RLUSD (~197.27 RLUSD). Capital essentially flat (+0.28 RLUSD). NOT counting toward Phase 7.4 (halt ≠ duration_elapsed). FLAG-037 fix confirmed — no phantom fills, truth check clean throughout. Halt was FLAG-044 episode limit (3 degraded episodes: drift guard condition C + anchor saturation). Hostile anchor regime persisting but CLOB-AMM gap improved (1-3 bps during session). Realignment dry-run before S48 (expected near-zero delta).
FLAG-046 — CLOSED ✅ (Apr 22): feat/anchor-idle-state merged to main (4 commits: c3eba41, 502be63, 7e0ba1c, 664212d; +1181/−444, 7 new tests, 65 adjacent-suite green). ANCHOR_IDLE is now a first-class state — anchor saturation routes to ANCHOR_IDLE (no episode count, no HALT path) instead of DEGRADED. Drift/corridor/truth escalation from ANCHOR_IDLE → DEGRADED via single-entry-point _enter_degraded_mode. SOURCE_ANCHOR retired from RECOVERY_CAPPED_SOURCES. S50 unblocked.
S48 (Apr 21, session_id=51): elapsed 951.3s | halt=inventory_truth_halt | 172 ticks | 0 fills | 15 orders | anchor mean=+2.94 bps (regime improving — first session approaching friendly territory). Capital at halt: ~79.507 XRP / 83.463 RLUSD post-realignment. Root cause: cancel-fill race condition (FLAG-047) — counterparty filled order on-chain before cancel arrived; CANCELLED_BY_ENGINE guard suppressed the real fill; truth check saw +7.317607 XRP / -10.5 RLUSD delta at 07:06:24 → inventory_truth_halt. Realignment --confirm run. S49 BLOCKED pending FLAG-047 fix.
FLAG-047 — CLOSED ✅ (Apr 22): fix/cancel-fill-race merged to main (fast-forward, 5 commits, +2021/−5, 12 tests). tecNO_TARGET cancel response → CANCEL_RACE_UNKNOWN → reconciler account_tx on-chain lookup → three-way resolution (FILL/CANCEL/INCONCLUSIVE). mark_filled_after_race atomic method. 106 adjacent-FLAG tests green. S49 unblocked.
S49 (Apr 22, session_id=52): elapsed ~13 min | halt=manual (SIGINT) | ~184 ticks | 1 fill | anchor mean=+10.00 bps, 100% cap-locked | CLOB active throughout (intents_generated: 2 every tick, market_valid: true). Engine idled through a live, tradeable market. FLAG-048 (ANCHOR-CALIBRATION) opened.
S50 (Apr 22, session_id=53): elapsed ~13 min | halt=manual (SIGINT) | 184 ticks | 0 fills | 4 orders placed | anchor mean=+10.00 bps, min=10.0, max=10.0 — 100% cap-locked ALL 184 ticks | 9 buy suppressions (momentum filter), 0 sell suppressions | session_min_dist_to_ask=16.2 bps | Ending inventory: 65.901 XRP / 102.963 RLUSD = 196.96 RLUSD | Truth check at shutdown: OK (delta_xrp=0.000160, delta_rlusd=0.0) — no realignment needed. Confirmed: engine wanted to quote throughout (intents_generated: 2 every tick), CLOB was healthy (2-9 bps spread, active bids/asks at xrpl.to 17:17Z). Anchor exit condition mathematically impossible — minimum raw CLOB-AMM divergence 11.9 bps, cap at 10 bps, exit threshold ~5 bps. Calibration problem confirmed. FLAG-048 opened.
FLAG-048 — CLOSED ✅ (Apr 22): feat/anchor-dual-signal-calibration merged to main (merge commit a8033e5, 13 files, 2166 insertions / 33 deletions, 17 new tests, 708 passed). Dual-signal separation live: structural_basis_bps (diagnostic), rolling_basis_baseline_bps (EMA, 150-tick default), residual_distortion_bps (control signal → ANCHOR_IDLE). Cross-session persistence wired. Pre-live replay still required before session hold lifts.
Current wallet (post-S48 realignment, unchanged through S49/S50): 65.901 XRP / 102.963 RLUSD = 196.96 RLUSD
SESSION HOLD — LIFTED (Apr 22): Pre-live replay complete. Exit reachability (Q4) and rail-lock (Q5) both confirmed on real per-tick data via real StateManager round-trip. Katja cleared to run S51. Post-merge replay against uncapped structural queued after first clean session.
S51 (Apr 22, session_id=54): elapsed 152.83s | halt=degraded_episode_limit_halt | 26 ticks | 1 fill (buy 19.5 XRP) | anchor mean=+9.35 bps, 100% >5bps — fully hostile | ANCHOR_DS cold start (first FLAG-048 session) | FLAG-048 warm-up never reached (50 ticks required). Root cause: drift guard condition C escalating from ANCHOR_IDLE → DEGRADED, burning episode budget. Engine penalising itself for fill imbalance caused by its own idle state. fix/drift-c-anchor-idle-suppression deployed.
fix/drift-c-anchor-idle-suppression — MERGED (Apr 22): commits bf3abae + e8d985d. Drift guard condition C suppressed while MODE_ANCHOR_IDLE. A and B untouched. 6 new tests, 79 adjacent-suite green. Key production finding: all 6 drift DEGRADED escalations across 52 sessions were condition C (0 A, 0 B). S52 unblocked.
S52 (Apr 22, session_id=55): ~30 min | halt=manual SIGINT | 1 fill (sell 19.5 XRP) | anchor shifted −7.68 bps → +17 bps | engine stuck in DEGRADED/ANCHOR_IDLE cycle post-fill | containment fix working (no session termination) but FLAG-050 confirmed in production — _drift_ticks_since_opposing_fill carried across ANCHOR_IDLE boundary, C fired on idle exit, engine blocked from quoting remainder of session. Capital essentially flat. Realignment dry-run clear. S53 on hold.
S53 (Apr 22, session_id=56): elapsed ~5 min | halt=manual SIGINT | 0 fills | 2 orders placed then cancelled on ANCHOR_IDLE entry (tick ~5) | CLOB-AMM −5.08 bps throughout | inventory_truth_gate blocked all submissions (mode=anchor_idle). Root cause: FLAG-051 — persisted EMA ~+10 bps from S49/S50 cap-locked sessions; structural −5 bps; residual −15 bps → ANCHOR_IDLE immediately, no exit path. Capital flat. FLAG-051 fix delivered by Vesper (direct file fix, 11 tests passing). Apply: 03 Branches/fix-flag-051-regime-drift/. S54 unblocked pending merge.
FLAG-051 — CLOSED ✅ (Apr 22, Vesper): baseline_regime_drift_threshold_bps: 10.0 added to AnchorDualSignalConfig. On first post-seed observation, if abs(structural − persisted_baseline) > 10 bps, discard EMA and cold-start. Fixes cross-session regime-shift lockout. Files: neo_engine/config.py, neo_engine/dual_signal_calculator.py, config/config_live_stage1.yaml, tests/test_flag_051_regime_drift.py. 13/13 tests passing. Merged a5897cc. S54 unblocked.
WORKING TREE NOTE (Apr 22): Linux sandbox shows truncated/corrupt working tree files (config.py 1427 vs 1612 committed lines, git index corrupt). Git objects intact. On Katja's Windows machine the repo is likely fine — confirm with git status before applying FLAG-051 fix.
Post-S40 guard architecture audit — RESOLVED (Apr 22): Two structural fixes merged: (1) FLAG-050 — _drift_ticks_since_opposing_fill reset to 0 on ANCHOR_IDLE entry; (2) idle-vs-active episode accounting split — idle-sourced DEGRADED entries do not consume active episode budget, do not arm cooldown, and cannot trigger degraded_episode_limit_halt. Branch fix/anchor-idle-guard-semantics, commits b270083 + a69b0de + 3fff6b3, 72 tests green. S53 unblocked. Atlas ruling: 07 Agent Coordination/[C] Atlas Ruling — Post-S40 Guard Architecture Audit.md.
S54 (Apr 22, session_id=54 — confirm from logs): elapsed ~17 min | halt=inventory_truth_halt | 1 fill (buy ~13.65 XRP / ~19.5 RLUSD at ~1.429 RLUSD/XRP) | ANCHOR_IDLE entry at start, EMA cold-started correctly (FLAG-051 fired, drift 12.5 bps > 10 bps threshold) | engine exited ANCHOR_IDLE ~01:55–01:59 UTC as EMA converged to −11 bps structural, residual ≈ 0 | orders placed and active; buy order filled on-chain | engine entered DEGRADED at ~02:04, fired "Degraded entry cancel" on that buy order | order already filled → tecNO_TARGET → recorded as CANCELLED_BY_ENGINE → fill suppressed → truth check saw delta +13.65 XRP / −19.5 RLUSD → halt. Capital flat. Realignment confirmed (+13.646 XRP / −19.5 RLUSD). NOT counting toward Phase 7.4 (halt ≠ duration_elapsed). Root cause: FLAG-052.
FLAG-052 — CLOSED ✅ (Apr 22, Vesper): fix/flag-052-cancel-race-timer merged to main. Root cause: _maybe_run_periodic_truth_check runs at tick START before reconciler (Step 5); 60s interval aligned with post-CANCEL_RACE tick → truth check fired before fill recorded → spurious halt. Fix: self._last_truth_check_ts = time.time() in else: branch after mark_cancel_race_unknown succeeds. 4 tests (3 unit + 1 integration grace window). FLAG-047 adjacency 12/12 green. Full suite baseline unchanged (357 pre-existing failures on main and branch). S55 unblocked.
Current wallet (post-S54 realignment): 79.684 XRP / 83.463 RLUSD ≈ 196.8 RLUSD
S55 (Apr 22, session_id=TBD): elapsed ~7 min | halt=manual SIGINT | 0 fills | ANCHOR_IDLE from tick ~3, never exited | CLOB-AMM −11 to −13 bps throughout, AMM price static | intents_generated: 2 every tick but orders blocked | Capital flat: 79.683842 XRP / 83.463 RLUSD | Truth checks: ok (FLAG-052 confirmed working) | Dashboard showing +9.56 bps anchor mean / 82% cap-locked — opposite sign to logged CLOB-AMM divergence, signal mismatch. NOT counting toward Phase 7.4. FLAG-053 investigation complete — see below.
Atlas ruling #1 (Apr 22, post-S55): Main branch frozen pending FLAG-053 investigation. S40-baseline diagnostic approved (fresh DB, current on-chain balances, 10-15 min first run, no clone modifications). Corrective posture: hold, diagnose, compare. Execution order: (1) Orion investigation report, (2) S40 clone prep, (3) diagnostic run, (4) compare, (5) architecture ruling.
FLAG-053 — Orion investigation complete (Apr 22): Q1 EMA deadlock hypothesis REFUTED — observe() in dual_signal_calculator.py:176-241 runs unconditionally, no ANCHOR_IDLE gating. Q2 REAL BUG — exit evaluator (main_loop.py:2887-2997) uses _select_anchor_guard_window (main_loop.py:2729-2766); legacy capped window (fallback for first 70 ticks) holds ±10 bps in saturated regime → both exit predicates mathematically fail → 100-tick minimum to exit (70 ticks for residual handover + 30 stability ticks). S55 entered ANCHOR_IDLE at tick ~3, ran ~84 ticks — barely reaching the exit-possible window at SIGINT. Q3 dashboard sign mismatch NOT A BUG — three sign conventions documented: clob_vs_amm_divergence_bps uses (clob_mid−amm)/amm, last_anchor_divergence_bps uses (quote_anchor−mid)/mid capped ±10, structural_basis_bps uses (mid−amm)/mid. Same regime, opposite sign perspectives. Legibility gap, not calculation error.
Atlas ruling #2 (Apr 22, post-Orion investigation): FLAG-053 fix approved option (iii) — both (A) reduce pre-residual lockout (earlier residual-window eligibility or shorter lookback for exit relevance) AND (B) add benign-regime early-exit path on uncapped structural signal. Option (iv) — accept 100-tick minimum — REJECTED. Sign conventions: standardize all three operator-facing metrics to one canonical sign convention. S40-baseline diagnostic: proceed immediately. Main branch session hold continues until FLAG-053 fix merged. Ruling: 07 Agent Coordination/[C] Atlas Ruling — FLAG-053 Fix Direction + S40 Diagnostic Approved.md.
Atlas ruling #3 (Apr 22, post-S40 diagnostic): FLAG-053 confirmed participation-blocking — not cosmetic. S40 diagnostic proved: market alive, baseline engine healthy, current branch prematurely disengages after fills. Proceed with FLAG-053 fix. Do not re-litigate whether market is alive — question answered. Ruling: 07 Agent Coordination/[C] Atlas Ruling — S40 Diagnostic + FLAG-053 Proceed.md.
S40-baseline diagnostic clone — READY (Apr 22): Repo C:\Users\Katja\Documents\NEO GitHub\neo-2026-s40-baseline, branch s40-baseline, commit 8716821 (last commit before anchor saturation guard merge — D2.2 + reconciler anomaly log, NO guards, NO FLAG-042/044/046/048). DB neo_s40_diagnostic.db seeded: 79.683762 XRP / 83.463491 RLUSD. Run: python run_paper_session.py --config config/config_live_stage1.yaml --db neo_s40_diagnostic.db --duration-seconds 600 --live (from clone root).
S56 (Apr 22 ~17:53–18:03 UTC — accidental main-branch run): elapsed 573s | 104 ticks | halt=degraded_episode_limit_halt | 1 fill (sell ~13.4 XRP / 19.5 RLUSD) | anchor mean=+2.70 bps, range=[−7.3, +8.7], 0% cap-applied, 34% >5bps — favorable window | drift guard C fired after sell (no opposing buy 15 ticks) → DEGRADED → episode limit → halt | engine stopped quoting post-fill, never re-quoted. Ran from main repo (neo-2026) against neo_s40_diagnostic.db — not the S40 clone. Real live fill on-chain.
S40-Diag (Apr 22 ~18:12–18:24 UTC): elapsed 630s | 112 ticks | halt=duration_elapsed ✓ | 0 fills | 14 orders placed, 7 requotes each side | anchor mean=−8.98 bps, median=−10.00 bps, range=[−10.0, −4.8], 99.1% >5bps — hostile regime | BUY near threshold (≤5bps): 11 times | SELL min dist to ask: 12.7bps (never fillable) | no guards, no ANCHOR_IDLE, no DEGRADED — engine quoted continuously throughout. Ran from clone (neo-2026-s40-baseline, commit 8716821). Capital flat (0 fills). Key finding: S40 code ran clean; 0 fills = market-driven not code-driven. Main branch would have been in ANCHOR_IDLE the entire session.
Current wallet (post-S57 realignment): 66.933 XRP / 101.963 RLUSD ≈ 198.2 RLUSD. Realigned before S57 — S56 fill (sell ~12.75 XRP / +18.5 RLUSD) had not been recorded in neo_live_stage1.db.
FLAG-053 — CLOSED ✅ (Apr 22, Orion): fix/flag-053-anchor-idle-exit-lockout merged to main (4 commits, 14 files, +1112/−198, 13 new tests, 43/43 adjacent suite green). Option A: preview residual window (residual_exit_preview_warmup_ticks=20, residual_exit_preview_lookback_ticks=10). Option B: structural early-exit path (recovery_structural_early_exit_enabled=True). Sign standardization: last_anchor_divergence_bps now (mid − amm) / amm × 10000 (uncapped, canonical). Phase separation invariant enforced. Post-merge: anchor_error_bps DB column now uncapped; dashboard reads anchor_divergence.* keys. Session hold lifted. S57 unblocked.
S57 (Apr 22, session_id=TBD): elapsed 196s | halt=degraded_episode_limit_halt | 32 ticks | 1 fill (buy ~13.57 XRP / 19.5 RLUSD @ 1.4367 RLUSD/XRP) | VW spread 4.31 bps | anchor mean=−7.34 bps, 83.9% >5bps — moderate hostile regime | FLAG-053 confirmed working: engine quoted from tick 1, no ANCHOR_IDLE on startup (EMA warm on resume, structural −7 to −11 bps) | Root cause halt: drift guard condition C fired after buy fill (no opposing sell within 15 ticks), DEGRADED entered, 120-tick cooldown ×3 episodes → episode limit | Structural cause: in negative CLOB-AMM regime CLOB asks tight (2.76–3.7 bps from mid), engine ask at 5.6 bps after skew — sell fills impossible → permanent buy-only flow → condition C always fires | session_min_dist_to_ask=3.7 bps | Ending inventory: 80.507 XRP / 82.463 RLUSD ≈ 198.18 RLUSD (capital essentially flat) | NOT counting toward Phase 7.4. Realignment dry-run before S58.
Current wallet (post-S57): 80.507 XRP / 82.463 RLUSD ≈ 198.18 RLUSD
FLAG-054 — CLOSED ✅ (Apr 22, Vesper): fix/drift-guard-condition-c-retirement — condition C retired behind drift_condition_c_enabled: false config flag (Atlas-approved). DirectionalDriftGuardConfig.drift_condition_c_enabled: bool = True field added; load_config wired; and cfg.drift_condition_c_enabled gate added to condition C firing check in main_loop.py; YAML set to false. Commit 9d7825d, 4 files, 125 insertions, 4 new tests (4 pass / 2 skip). Pre-existing failures (13) confirmed unrelated to FLAG-054. S58 validation run required before server migration.
S58 (Apr 22, session_id=TBD): elapsed 616s | 109 ticks | halt=manual SIGINT | 0 fills | 8 total orders | anchor mean=+18.83 bps, 100% >5bps — persistent positive structural regime throughout | FLAG-054 confirmed: condition C did not fire once | session_min_dist_to_ask=2.9 bps (sell nearly touchable; no order live at that moment — ANCHOR_IDLE) | Engine cycled in/out of ANCHOR_IDLE ~4 times; FLAG-053 exit working (brief quoting windows) but regime too persistent for sustained participation | 0 working orders at close (ANCHOR_IDLE at session end) | Capital flat (198.47 RLUSD) | Truth checks clean throughout | Two issues surfaced: (1) FLAG-045 log flood — 18 stale CANCELLED_BY_ENGINE orders rescanned every tick; (2) "Working orders" summary counted only active status vs tick log's 5-status live definition. Both fixed per Atlas ruling.
FLAG-045 — CLOSED ✅ (Apr 22, Vesper): Fix delivered — after RECONCILER_SKIP_ENGINE_CANCEL, call update_order_status(order.id, OrderStatus.CANCELED) to retire order from scan bucket. Atlas approved CANCELED (not a new status). 4 tests. Committed to main 2026-04-22.
Summary "Working orders" fix (Apr 22): summarize_paper_run.py live-mode query changed from status = 'active' to 5-status IN clause matching get_live_order_by_side(). Committed to main 2026-04-22.
S59 (Apr 22, 10-min session): PASSED Atlas checklist. 107 ticks | 0 fills | halt=interrupted (natural end) | anchor mean=−10.10 bps, 100% >5bps — hostile negative regime. FLAG-045 confirmed: RECONCILER_SKIP_ENGINE_CANCEL fired once per order, no noise on subsequent ticks. Summary fix confirmed: "Working BUY orders: 1" correctly reported. Startup cancel failure for offer_sequence 103476327 at session end → realignment required before S60.
FLAG-055 — CLOSED ✅ (Apr 22, Vesper): _cancel_all_live_orders only swept ACTIVE+PARTIALLY_FILLED. CANCEL_PENDING-no-hash orders invisible to shutdown → offer stayed live on-chain → next startup truth check saw fill delta → STARTUP_GATE_REFUSED. Fix: fetch CANCEL_PENDING-no-hash orders and merge into sweep; skip re-marking; on tesSUCCESS→CANCELED; tecNO_TARGET→CANCEL_RACE_UNKNOWN. 5 tests. Commits 1d046ce + c007bc8, 2026-04-22.
S60 (Apr 22): elapsed 421.59s | halt=risk_rpc_failure (QuikNode credit exhaustion) | 71 ticks | 8 orders | 0 fills | anchor mean=+0.68 bps, range=[−3.8, +3.8], 0% >5bps — most favorable regime observed. Engine and calibration working; halted by provider, not by guards. Realignment required before S61: +7.32 XRP / −10.5 RLUSD delta (another CANCEL_PENDING fill, FLAG-055 fix now in place).
QuikNode exhausted (Apr 22): 10,034,640 credits consumed in 11 days. Hard cap hit → TLS rejection. Temporary switch to s1.ripple.com:51234 (public Ripple endpoint) — config committed. Do NOT upgrade QuikNode ($49/month rejected by Atlas). NOWNodes ~$3/month for 100K requests/day is the leading Option B candidate — Katja to verify pricing at nownodes.io/pricing. Atlas ruling: 07 Agent Coordination/[C] Vesper → Atlas — RPC Provider Decision + FLAG-056.md.
FLAG-056 — OPEN: RPC provider decision pending. Public endpoint active as bridge. See Open Flags.
Current wallet (post-S60 realignment): 81.582 XRP / 80.963 RLUSD ≈ 197.8 RLUSD
Run commands (updated — with log tee):
- 10 min: python run_paper_session.py --config config/config_live_stage1.yaml --db neo_live_stage1.db --duration-seconds 600 --live 2>&1 | Tee-Object -FilePath "logs\session_$(Get-Date -Format 'yyyyMMdd_HHmmss').log"
- 2 hour: python run_paper_session.py --config config/config_live_stage1.yaml --db neo_live_stage1.db --duration-seconds 7200 --live 2>&1 | Tee-Object -FilePath "logs\session_$(Get-Date -Format 'yyyyMMdd_HHmmss').log"
Open flags: FLAG-056 (RPC provider decision — NOWNodes vs self-hosted; public endpoint active as bridge), FLAG-049 (DB-SESSION-SAFEGUARDS), FLAG-023 (VPS — migrate after RPC decision + FLAG-055 fix confirmed clean), FLAG-038 (apply_fill zero-qty drop), FLAG-039 (mid-session overlay gap), FLAG-040 (WAC correction), FLAG-043 (corridor recovery stability — monitor), FLAG-016 (test suite), WORKSPACE-001 (skills expansion), WORKSPACE-002 (NEO Desk lean handoff system), WORKSPACE-003 (Grok/xAI sentiment layer — future, post-Phase 8)
DB reliability ruling (Atlas, Apr 22): Local+SMB SQLite setup is operationally untrustworthy. Recurring WAL corruption root cause = SMB filesystem does not implement POSIX file locking SQLite WAL requires. Operating rule effective immediately: engine = sole DB writer; Cowork/analysis reads from copies only. Ruling: 07 Agent Coordination/[C] Atlas Ruling — DB Reliability SMB Risk and VPS Migration Sequencing.md.
FLAG-041 — CLOSED ✅ (Apr 21): fix/halt-reason-taxonomy-leak merged to main (069c443..c07a22e, 2 commits, 8 tests). Both clobber sites fixed — main_loop.py and run_paper_session.py. S43 will surface authentic halt token (inventory_truth_halt) instead of generic engine_requested_halt.
Phase 7.4 — SR-AUDIT (Phase 8 gate): Formal system readiness audit across 5 domains (Truth & State, Execution Wiring, Metrics, Signal Validity, Safeguards). All CRITICAL checks must PASS. Preconditions: wallet truth reconciliation stable ✅ + Anchor Saturation Guard ✅ + Directional Drift Guard ✅ + Inventory Corridor Guard ✅ + 2 clean live sessions with guards active (Katja-agreed precondition) + no active DEGRADED/HALT at session end. SR-AUDIT passes → Phase 8 unlocks (scaling, longer runs, automation).
Operating Standard¶
Read before any work on NEO: [C] NEO Operating Principles.md
This is the active team operating standard agreed by Katja, Atlas, and Vesper. Not optional.
Google Drive — Connection Status and Workflow¶
Drive MCP is connected (folder: Neo - Bluefly AI Enterprises, ID: 1mEfc1rDUF9n3ajSY_f-glcK2RUHMMJsb, MCP: 6d243d28-f902-4926-bce4-58b772d48273) and stays connected for future use (reading files, potential automation).
Current workflow: Do NOT upload files to Drive at end of session. Katja copies files to Atlas directly — copy/paste is faster than Drive file creation. Skip the upload step entirely unless Katja explicitly asks for it.
What Claude Should Do¶
- Match my vibe: Be direct, don't sugarcoat things, skip the fluff. Get to the point and keep responses tight.
- Put outputs for each project in the right project folder. If you're not sure where something belongs, ask which project it applies to.
- Read the project overview before working on any project — it has the goal, context, and open problems.
- When creating files, prefix the filename with [C] so I know Claude made it (e.g.,
[C] Research Notes.md).
What Claude Should NOT Do¶
- Don't edit my notes without asking first. Only files with the [C] prefix are Claude's to freely edit.
- Don't pad responses — be direct and concrete.
Skills & Commands¶
Here's what you can ask me to do:
| Say this | What happens |
|---|---|
/setup |
First-time workspace setup (you already did this!) |
| "new project" | I'll interview you about the project and set up a folder with a project overview |
| "good morning" | I'll recap recent work, recommend what's most important, and help you pick what to do |
| "end of day" or "wrap up" | I'll log what we worked on so the next session can pick up where we left off |
| "help" or "what can you do?" | I'll show you everything I can help with |
Claude updates this file as your workspace grows. You can also edit it yourself anytime.