Tri-Axial Invariant Crucible
tri-axial fault injection, 100% mutant kill rate, reboot-persistent risk rulers & zero-naked execution
Published: 2026-09-24 | Project: BayesianPivot ⇌ Sovereign Edge ML | Discipline: Autonomous SWE & Adversarial QA
Author: Nicholas Alexander MacAskill — Founder & CTO, Flocano Labs | Canonical: https://www.nicholasmacaskill.com/dossier/sovereign-3d-crucible-matrix
1. Architectural Blueprint & System Topology
┌─────────────────────────────────────────────────────────┐
│ Market Feeds: BTC, ETH, SOL, XAU/USD (Gold) │
└────────────────────────────┬────────────────────────────┘
│
▼
┌───────────────────────────────┐
│ Alpha Sweep Scanner │
│ (Orderflow & SMC Sweeps) │
└───────────────┬───────────────┘
│
▼
┌───────────────────────────────┐
│ Execution Firewall │
│ • Asset-Scoped News Gate │
│ • 20% Profit Ceiling Clamp │
│ • Min Dollar Risk Floor ($25) │
└───────────────┬───────────────┘
│
┌──────────────────────────────────────────┴──────────────────────────────────────────┐
▼ ▼
┌───────────────────────────────────────────────────┐ ┌───────────────────────────────────────────────────┐
│ TRI-AXIAL INVARIANT CRUCIBLE │ │ PRODUCTION RUNTIME SENTRY │
│ (Pre-Commit / Pre-Flight Gate) │ │ (Continuous 60s Broker Auditor) │
├───────────────────────────────────────────────────┤ ├───────────────────────────────────────────────────┤
│ AXIS X: Mathematical Geometry │ │ • Direct Broker REST Audit (/positions) │
│ • Contract Sizing (BTC: 1.0, XAU: 100.0) │ │ • Zero Orphan Pending Stop Orders │
│ • Dynamic Room-Under-Ceiling Sizing │ │ • 100% Active Brackets Attached │
│ • Min Viable Risk Floor ($25k: $25, $50k: $50) │ │ • Trailing Floor Invariant Enforcement │
├───────────────────────────────────────────────────┤ └─────────────────────────┬─────────────────────────┘
│ AXIS Y: Temporal Evolution & State Persistence │ │
│ • Stepped Defense (+1.0R -> -0.3R SL Trail) │ ▼
│ • Ruler Invariant (Immutable Risk Denominator) │ ┌───────────────────────────────────┐
│ • Reboot Memory Persistence (Disk POSIX WAL) │ │ TradeLocker Live Fleet Mesh │
├───────────────────────────────────────────────────┤ │ (Adaptive 2.5s Account Pacing) │
│ AXIS Z: Hostile Environmental Chaos (AQEC Fuzz) │ └───────────────────────────────────┘
│ • Synthetic Broker Twin Fault Injection │
│ • Inverted Bracket Negative Slippage Shield │
│ • Tranche Differentiation (TP2 - TP1 >= 0.75R) │
│ • HTTP 429 Adaptive Pacing Resilience │
├───────────────────────────────────────────────────┤
│ TIER 8: 3D Mutation Meta-Testing (Testing Test) │
│ • 8 Deliberate Fatal Mutants Injected │
│ • 100.0% Kill Rate in 0.002s (Zero Vacuous Passes)│
└───────────────────────────────────────────────────┘2. Forensic Post-Mortem: The $6 Trade & The State Amnesia Vector
The Live Incident
During an active trading session on XAU/USD (Gold), the production scanner identified an institutional liquidity sweep on the 1-minute chart. The trade entered correctly, but forensic post-execution monitoring revealed an anomalous dollar risk allocation:
- Tier A Allocation (25,000 Portfolio): Stop Loss opened at 6.53 of risk (0.026% of account balance).
- Tier B Allocation (50,000 Portfolio): Stop Loss opened at 12.80 of risk (0.025% of account balance).
- Take Profit Targets: TP1 was calculated at 4,295.70, and TP2 was calculated identically at 4,295.70 (+5.0R moonshot, with zero tranche differentiation).
The Root Cause: Triple-Compound Distortion
A microscopic trace of the execution path uncovered three intersecting failure modes:
1. 50% Auction Probe Scaling: The engine recognized the setup as an "Auction Probe" archetype, halving base risk from 35.00 to17.50. 2. Signal Candle Geometry Clamping: The 1-minute signal candle had a wide 12.81-point stop distance. Using Gold's contract multiplier of 100.0 ounces per lot: Calculated Lots = 17.50 / (12.81 100.0) = 0.0136 lots The broker minimum lot step clamped this allocation to 0.01 lots. 3. Adverse Market Fill Slippage: The market order executed at 4,264.30 instead of the planned 4,270.58 (6.28 points of negative fill slippage). Because the stop was set at 4,257.77, the actual open stop distance collapsed to only 6.53 points: Actual Dollar Risk = 6.53 points 0.01 lots * 100.0 =6.53 This trivial dollar risk was statistically meaningless for a $25,000 portfolio and would have required 307 consecutive wins to hit the evaluation payout milestone.
The Reboot Blind Spot: State Memory Amnesia
Further investigation into the trade lifecycle revealed an even more critical temporal vulnerability:
- Active position risk baselines were cached exclusively in process heap memory (
_active_trade_brackets). - If a supervisor daemon was restarted while a trade was actively trailing its stop (e.g., Stepped Defense had tightened the stop from -1.0R to -0.3R), the rebooted watchdog had no memory of the original stop loss.
- It recomputed
initial_risk_usdusing the already tightened stop loss, artificially shrinking the risk denominator by 70%. A subsequent 0.5-point price wiggle was registered as a massive, false +3.0R excursion, threatening premature exits and corrupted performance metrics.
3. The Sovereign 3D Execution Matrix
To permanently eliminate both the $6 risk anomaly and the state amnesia vector, the verification framework was reconstructed across three physical dimensions.
Axis X: Mathematical & Physical Invariants (Geometry)
1. Contract Multiplier Normalization: Enforces Config.get_contract_size(symbol) across all sizing and risk calculations: Crypto (BTC, ETH, SOL): contract_size = 1.0 (1 lot = 1 coin). Gold (XAU/USD): contract_size = 100.0 (1 lot = 100 troy ounces). Silver (XAG/USD): contract_size = 5000.0 (1 lot = 5,000 troy ounces). Forex: contract_size = 100000.0 (1 lot = 100,000 units). Invariant:* Omitting the multiplier on Gold produces a 100x lot distortion, triggering instant rejection by the matrix.
2. Minimum Viable Dollar Risk Floor: Regardless of tight candle geometry or auction probe multipliers, the engine enforces a hard mathematical risk floor: 25k Tier: Minimum risk is clamped to 25.00 (0.10% equity). 50k Tier: Minimum risk is clamped to 50.00 (0.10% equity). Formula:* If calculated_risk < min_floor, lot size scales dynamically upward to guarantee the minimum dollar threshold.
3. Dynamic Room-Under-Ceiling Sizing (The 20% Consistency Invariant): Institutional evaluation mandates frequently prohibit any single day from generating more than 20.0% of total payout profits (400 on25k; 800 on50k). Safety Buffer: The system caps single-day profits at 380.00 and 760.00. Dynamic Sizing: If an account has already banked +250 today, the room under the ceiling is130. A planned +2.0R trade dynamically scales its risk down so that Risk * 2.0 <= $130, guaranteeing total immunity to rule disqualification.
Axis Y: Temporal Evolution & State Dynamics (Time)
1. The Immutable Ruler Invariant: Stop Loss defense mechanisms tighten the stop over time (Stepped Defense at +1.0R moves SL to -0.3R; Breakeven Trail at +1.5R moves SL to +0.05R). The trade's risk denominator (initial_risk_usd, initial_r_dist) is captured at the exact millisecond of fill and is mathematically immutable. * Tightening a stop loss never artificially inflates the reported R-multiple.
2. Disk-Backed Bracket Persistence (Surviving Daemon Reboots): Process-memory amnesia is eliminated. Every active trade bracket is atomically synchronized to disk in data/active_trade_brackets.json using atomic write-and-replace (write() to temp file + fsync() + POSIX rename()) to guarantee zero corruption across abrupt reboots. On daemon boot, the watchdog rehydrates original entry prices, initial stop losses, and baseline risk denominations before connecting to the broker WebSocket.
3. Session Windows & Friday Rollover Lockout: Killzones (London Open Drive, New York Morning, Asian Judas) enforce strict temporal boundaries. Friday at 21:00 UTC (16:00 EST), the system activates a hard rollover lock: all open positions across the multi-account live fleet are flattened, and new orders are rejected to eliminate weekend gap liquidation risk.
Axis Z: Hostile Environmental Chaos (Entropy)
1. Inverted Bracket Negative Slippage Shield: In fast-moving news markets, a market BUY can fill significantly below the anticipated level. If the fill price slips below the planned stop loss (fill_price <= planned_sl), submitting standard brackets causes the broker API to return an immediate HTTP 400 error. The Inverted Bracket Shield detects this condition before bracket dispatch, automatically clamping the stop loss to a safe buffer below the actual fill price (fill_price - stop_distance), ensuring 100% order acceptance.
2. Tranche Spread Differentiation Invariant: Splitting a position across two tranches requires distinct profit objectives. The matrix enforces abs(TP2 - TP1) >= 0.75 * stop_distance. If runner targets collide, the engine dynamically expands TP2 to at least +3.0R (or TP1 + 1.0R) for true macro runner separation.
3. Multi-Account Adaptive Pacing & 429 Isolation: Operations across the distributed multi-account fleet enforce adaptive 2.0s to 2.5s pacing. If any single account encounters an HTTP 429 throttling response, the failure is isolated with exponential backoff, preventing cross-account desynchronization and orphan naked orders.
4. The Autonomous Quant Execution Crucible (AQEC Fuzzing Engine)
Tier 7 of the Matrix executes the Autonomous Quant Execution Crucible (AQEC). AQEC is a continuous fuzzing harness that bombards the order execution router against 16 hostile market and broker scenarios:
| # | Scenario Title | Injected Stress Vector | Expected Mathematical Invariant | Status |
|---|---|---|---|---|
| 01 | Clean Baseline Buy | Zero slippage, ideal execution | Exact bracket geometry, zero orphan orders | PASS |
| 02 | Severe Adverse Slippage | 8.0-point negative fill slip | Automatic risk re-anchoring, stop distance preserved | PASS |
| 03 | Favorable Price Slippage | 5.0-point positive fill slip | Denominator protected; no artificial reward inflation | PASS |
| 04 | Stop-Out Execution | Price hits exact Stop Loss | Loss matches initial risk denominator (-1.00R) | PASS |
| 05 | Scalp Target Lock | Price hits TP1 (+2.05R) | Tranche 1 closes cleanly; Tranche 2 remains active | PASS |
| 06 | Stepped Defense Trail | Trade reaches +1.0R MFE | Stop Loss patches from -1.0R to -0.3R in-place | PASS |
| 07 | Full Macro Moonshot | Trade reaches +5.0R target | 100% position flattened; zero trailing orders left | PASS |
| 08 | MFE Denial Reversal | Reversal after +1.8R peak | Stepped Defense locks profit; negative excursion blocked | PASS |
| 09 | Broker Rate Limit (429) | HTTP 429 dropped during PATCH | Exponential backoff retry; zero cross-account desync | PASS |
| 10 | Tranche Divergence | TP1 and TP2 submitted identical | TP2 dynamically expanded by >= 0.75R | PASS |
| 11 | Market Slippage Re-Anchor | Fill price differs from signal | Risk basis measured from actual fill, not signal candle | PASS |
| 12 | Tranche Separation Check | TP2 within 0.2R of TP1 | Failsafe triggers; runner target pushed to macro level | PASS |
| 13 | Minimum Viable Risk Floor | M1 micro-stop produces $6 risk | Sizing scaled up to meet 25.00 (25k) / 50.00 (50k) | PASS |
| 14 | Partial Tranche Asymmetry | Tranche 1 fills, Tranche 2 drops | Sentry tracks open lot fraction without state corruption | PASS |
| 15 | Inverted Bracket Shield | Fill slips below Stop Loss | Stop Loss clamped safely below fill; 0 broker errors | PASS |
| 16 | Room-Under-Ceiling Sizing | Daily PnL at 300 (380 cap) | Position sized down to fit exact remaining $80 cushion | PASS |
5. Tier 8: 3D Mutation Meta-Testing ("Testing the Test")
The Tautology Problem in Test Suites
A test suite that always passes is a dangerous illusion. If a test harness relies on flawed assumptions or mock shortcuts, it can produce 100% green checkmarks while the production engine bleeds capital.
To solve this, Tier 8 implements Mutation Meta-Testing (Fault-Injection Analysis). We deliberately inject 8 fatal, breaking defects (Mutants) into the production code and run the Tri-Axial Invariant Crucible against the broken implementation.
The Objective: The test matrix must detect the corruption and kill every mutant immediately. A surviving mutant indicates a blind spot in the harness.
┌───────────────────────────────────────────────┐
│ Tier 8 3D Mutation Meta-Test Run │
└──────────────────────┬────────────────────────┘
│
┌────────────────────────────────┼────────────────────────────────┐
▼ ▼ ▼
[Mutant 1: Naked Order] [Mutant 2: Tranche Collision] [Mutant 3: Inverted Bracket]
Inject: stopLoss = None Inject: TP1 == TP2 == 4295.70 Inject: BUY 4256, SL 4257
│ │ │
▼ ▼ ▼
Crucible Status: Crucible Status: Crucible Status:
✘ KILLED (0.0002s) ✘ KILLED (0.0002s) ✘ KILLED (0.0003s)
"Naked order rejected" "Tranche spread < 0.75R" "Inverted bracket clamped"The 8 Fatal Mutants & Kill Results
====================================================================================================
TIER 8 MUTATION BENCHMARK REPORT: FAULT-INJECTION SENSITIVITY
====================================================================================================
Mutant ID | Injected Vulnerability | Detection Vector | Kill Time | Result
-----------+--------------------------------------+----------------------------+-----------+--------
MUTANT_01 | Strip Stop Loss (Naked Order) | Zero-Naked Invariant Gate | 0.0002s | KILLED
MUTANT_02 | Force Tranche Collision (TP1 == TP2) | Tranche Spread Checker | 0.0002s | KILLED
MUTANT_03 | Invert Bracket (SL above BUY fill) | Inverted Slippage Shield | 0.0003s | KILLED
MUTANT_04 | Collapse Risk Floor ($6.00 sizing) | Min Viable Dollar Floor | 0.0002s | KILLED
MUTANT_05 | Breach 20% Capital Ceiling Clamp | PropGuardian Profit Clamp | 0.0002s | KILLED
MUTANT_06 | Foreign Currency Calendar Leak | CalendarFilter Scope Gate | 0.0003s | KILLED
MUTANT_07 | Mutate Initial Risk Denominator | Ruler Invariant Verifier | 0.0002s | KILLED
MUTANT_08 | Desynchronize Account on HTTP 429 | Adaptive Pacing Sentinel | 0.0003s | KILLED
----------------------------------------------------------------------------------------------------
TOTAL MUTANTS INJECTED: 8 | MUTANTS KILLED: 8 | SURVIVING MUTANTS: 0
MUTATION SENSITIVITY SCORE: 100.0% (Zero Vacuous Passes Detected in 0.002s)
====================================================================================================6. Production Telemetry & Verification Scorecard
╔══════════════════════════════════════════════════════════════════════════════════╗
║ ⚡ TRI-AXIAL INVARIANT CRUCIBLE // MULTI-AXIS ENGINE ⚡ ║
╚══════════════════════════════════════════════════════════════════════════════════╝
▶ Running TIER 1: BROKER & EXECUTION INVARIANTS (AGENTS.md)...
└─ Status: ✔ PASSED (4/4) in 5.528s
▶ Running TIER 2: QUANTITATIVE PHYSICS & HURST INVARIANTS...
└─ Status: ✔ PASSED (2/2) in 0.513s
▶ Running TIER 3: PROP COMPLIANCE & RETRAINING INVARIANTS...
└─ Status: ✔ PASSED (3/3) in 0.558s
▶ Running TIER 4: LIVE ORDERFLOW & ICEBERG ABSORPTION FEED...
└─ Status: ✔ PASSED (4/4) in 0.074s
▶ Running TIER 5: SIGNAL PIPELINE & GRADUATED ARCHETYPE INVARIANTS...
└─ Status: ✔ PASSED (5/5) in 0.003s
▶ Running TIER 6: ADVERSARIAL NEGATIVE BOUNDARY & STATE INVARIANTS...
└─ Status: ✔ PASSED (10/10) in 0.000s
▶ Running TIER 7: AUTONOMOUS QUANT EXECUTION CRUCIBLE (AQEC FUZZ)...
└─ Status: ✔ PASSED (17/17) in 0.000s
▶ Running TIER 8: 3D MUTATION META-TESTING (TESTING THE TEST)...
└─ Status: ✔ PASSED (8/8) in 0.000s
──────────────────────────────────────────────────────────────────────────────────
📊 TRI-AXIAL INVARIANT CRUCIBLE SCORECARD:
──────────────────────────────────────────────────────────────────────────────────
✅ TIER 1: BROKER & EXECUTION INVARIANTS (AGENTS.md) [4/4 passed] (5.528s)
✅ TIER 2: QUANTITATIVE PHYSICS & HURST INVARIANTS [2/2 passed] (0.513s)
✅ TIER 3: PROP COMPLIANCE & RETRAINING INVARIANTS [3/3 passed] (0.558s)
✅ TIER 4: LIVE ORDERFLOW & ICEBERG ABSORPTION FEED [4/4 passed] (0.074s)
✅ TIER 5: SIGNAL PIPELINE & GRADUATED ARCHETYPE INVARIANTS [5/5 passed] (0.003s)
✅ TIER 6: ADVERSARIAL NEGATIVE BOUNDARY & STATE INVARIANTS [10/10 passed] (0.000s)
✅ TIER 7: AUTONOMOUS QUANT EXECUTION CRUCIBLE (AQEC FUZZ) [17/17 passed] (0.000s)
✅ TIER 8: 3D MUTATION META-TESTING (TESTING THE TEST) [8/8 passed] (0.000s)
──────────────────────────────────────────────────────────────────────────────────
🏆 ZERO REGRESSIONS DETECTED — ALL 53 INVARIANT CHECKS PASSED PERFECTLY (8.58s).
• Zero-Naked Orders Invariant: VERIFIED
• In-Place PATCH Brackets: VERIFIED
• DELETE Position Termination: VERIFIED
• Hurst Chaos Gate Rejection: VERIFIED
• High-Impact News Lockout: VERIFIED
• Live Tick CVD Iceberg Detection: VERIFIED7. Hardware, Software & Economic Profile
- Runtime Host: Apple Silicon M4 / Darwin Mach Kernel (POSIX Compliant).
- Process Sandboxing: Darwin Mach QoS (
taskpolicy -b) background core steering, restricting all 16 chaos scenarios and 8 mutation meta-tests to Efficiency Cores with< 45 MB RSSand 0 bytes active SSD swap debt. - Language & Frameworks: Python 3.12+,
unittest,numpy,ccxt,aiohttp. - State Persistence Engine: SQLite WAL (
data/fleet_trades.db) and POSIX Atomic Disk JSON (data/active_trade_brackets.json) utilizing temp-file write +fsync+ atomicrename. - Broker Execution Engine: TradeLocker REST v2 / WebSocket protocol over TLS.
- Execution Latency: Full 53-invariant matrix executes in 8.58 seconds.
- Cloud API Dependency: $0.00. Entire testing lattice executes locally on-device with zero external API costs or cloud compute overhead.
8. Conclusion & Operational Impact
The Tri-Axial Invariant Crucible eliminates the gap between theoretical quantitative models and production execution realities.
By binding: 1. Pure mathematical sizing formulas to physical asset multipliers, 2. In-memory trailing states to reboot-resilient disk storage, 3. Hostile broker network friction to automated chaos fuzzing, and 4. Test suite validity to 100% mutation kill rates,
the execution architecture achieves true institutional resilience. It guarantees that winning edges discovered in statistical research translate into audited, unpenalized payouts across the live fleet.