🦞 BigClaw Trading System

Architecture v4.0 β€” current wiring and the SAL target state. Reasoning proposes; deterministic gates validate; one engine executes; everything leaves evidence.

8
pm2 processes
1
live desk (base)
5
nightly loops
10
herman checks
~85%
of SAL shape
Live Paper Dry-run Halted Partial Planned Known gap
1 Β· Observe β€” what watches the world
Market, account, derivatives, research, and system state β€” each with its own freshness guard.
Live
πŸ“Š
Market Data
Coinbase WS/REST + IBKR feed, 3-tier price fallback, 30s polls, staleness flags
Live
πŸ“ˆ
Derivatives Aggregator
OKX funding / open interest / liquidations / long-short β†’ partitioned Supabase tables, pg_cron auto-roll
shared/dist/pricing/derivatives/worker.js
Live
🌊
Atlas Scout (02:30)
6 sources: RSS quant feeds, Reddit, Serper, X (explore→score→exploit scoreboard), Hyperliquid liq levels · $0.15/night cap
conductor/src/atlas/scout.ts
Live
🩺
Herman Sweeps
10 checks, single pm2 snapshot per sweep, daemon-as-precondition, 3-consecutive-failure promotion
hermes/src/checks/
Partial
πŸ”
Position Reconciler
Boot + 5-min: detects untracked / orphaned / mismatched positions β€” advisory only, never corrects (audit N2)
base/src/execution/reconciler.ts
β–Ό
2 Β· Decide β€” trading desks & strategy pipeline
Shared strategy library across desks. Strategies emit TradeProposals β€” never orders.
Live Β· $25K
πŸͺ™
Base β€” Coinbase
Spot + CFM futures Β· 5 strategies + multi-TF confluence β†’ risk/reward sizing Β· CAPITAL_CEILING_USD clamps sizing & risk-gate math Β· sub-$5 signals floored up, not dropped
base/src/strategy Β· loop.ts:2307
Paper
πŸ›οΈ
Stocks β€” IBKR
Same execution-gate pattern, bracket orders, dry-run engine flag, persisted cooldowns (base still in-memory β€” N8)
stocks/src/execution/engine.ts
Halted
🧊
IKA β€” DEX Γ—3
SUI / SOL / ETH dWallet desks β€” HALTED_BOTS boot gate exits before module init
shared/src/monitoring/crash-logger.ts:223
Dry-run
πŸ’§
Dip-Booster
Target-aware DCA (3 dip tiers, tiered cooldowns, $5K/run cap) Β· bypasses the execution engine β€” must be routed through it before DIP_LIVE (N1)
base/src/dca/dip-booster.ts:330
β–Ό
3 Β· Validate β€” the layer that didn't exist in March
Every path from reasoning to live behavior now crosses a deterministic gate. LLMs propose; math disposes.
Live
πŸ“
Param Catalog
46 gate ranges + global bounds, canonical in shared Β· reject-at-write (conductor) + clamp-at-read (all 3 param-store paths) Β· blocked writes alert #ops-room
shared/src/strategy/param-catalog.ts
Live
πŸ§ͺ
F2 Statistical Gates
Holdout β†’ Welch-t β†’ Benjamini-Hochberg FDR Ξ±=0.10 β†’ 3-promotions/night budget β†’ 3-day TTL Β· live-shadow renew (21d cap) or revoke on deterioration Β· old gate: 56 promotions β†’ new: 2
conductor/src/experiments/statistics.ts Β· live-outcomes.ts
Live
βš”οΈ
Atlas Gauntlet + Sealed Vault
Min-sample β†’ purged walk-forward β†’ BH-FDR + PSRβ‰₯0.90 vs deflated Sharpe β†’ 200-seed Monte Carlo β†’ one-shot OOS vault (spend-before-read ledger) Β· max award: candidate β€” no path to live
conductor/src/atlas/gauntlet.ts Β· vault.ts
Live
πŸ”
Boot & Auth Assertions
LIVE_TRADING + secret <16 chars β†’ refuse to start Β· /api/params, /kill, /api/withdraw Bearer-only Β· reflection proposals double-validated (max 8/cycle)
base/src/webhook/server.ts:79
β–Ό
4 Β· Execute β€” one gate per venue
All orders funnel through executionEngine.execute(). One dormant bypass is the top open finding.
Live
βš™οΈ
Execution Engine (base)
Circuit breaker (3 losses β†’ 10min) Β· BalanceGuard (2-min snapshot age) Β· idempotency keys Β· 5% slippage auto-exit Β· futures SL retryΓ—2 β†’ flatten β†’ fatal-if-flatten-fails Β· phantom breaker (3-fail evict + fatal)
base/src/execution/engine.ts
Gap N6
🎯
Futures Exits
Resting SL βœ“ Β· take-profit is still the in-memory 4-stage trailing stop β€” needs the bot alive every 30s. Target: resting reduce-only TP at stage-2
Bypass N1
⚠️
Dip-Booster Direct Orders
createMarketOrder() without breaker / guard / journal β€” dormant (DIP_LIVE=false, verified) Β· route through the engine before any live flip
Live
πŸ›‘
Brakes (never gated)
HALT.flag + exit 42 Β· HALTED_BOTS hard gate Β· Bearer /kill flatten Β· auto-kill triggers (daily loss / drawdown) Β· margin-health pause
β–Ό
5 Β· Record β€” the evidence spine
Outcomes are strong; intents are the remaining gap (N3).
Live
πŸ“’
Supabase Spine
trade_journal (experiment-tagged, GIN-indexed) Β· experiments / experiment_outcomes Β· strategy_params (validated, TTL, provenance) Β· dsl_strategies Β· process_crashes
Live
🧠
Walrus Memory Brain
Append-only: brain-v2 (312 curated learnings) Β· hypotheses ledger β€” every Atlas verdict incl. failures Β· journal / reference namespaces
conductor/src/atlas/walrus-memory.ts
Partial N3
🚫
Rejection Records
Killed/paused + research-only rejections persisted βœ“ Β· dedup / cooldown / balance / breaker rejections still debug-log only Β· no intents / intent_decisions tables yet
Open N7
πŸ’¬
LLM Transcripts
Cost tracked, content discarded β€” bad-promotion forensics ends at "the LLM proposed it"
β–Ό
6 Β· Evaluate Β· Reflect Β· Discover β€” the nightly brain
Four scheduled loops, all bounded. The maker never grades its own work.
01:00
πŸ”¬
Karpathy Experiment Loop
4 phases, hypotheses β†’ replay eval β†’ collect β†’ BH-FDR β†’ budget β†’ validated promotion Β· wiki knowledge compounds across cycles
conductor/src/experiments/runner.ts
02:30
πŸ”­
Atlas Research Slice
Deterministic liquidation-fade oracle + scout β†’ LLM bridge (economy tier, strict {dsl | event-study | data-req | discard}) β†’ gauntlet β†’ #research-lab digest + x-scoreboard credit
conductor/src/atlas/orchestrator.ts
03:00
πŸ“‰
Live-Outcome Shadows
Aggregates real trades per experiment β†’ renewOrRevokeShadows: min 10 live trades, Sharpe ≀ 0 β†’ immediate revoke + alert Β· only TTL is ever mutated
conductor/src/experiments/live-outcomes.ts
4-hourly
πŸͺž
Charlie Reflection
Memory + 7d stats β†’ max 8 validated param proposals + 3 research requests Β· cannot touch strategy status, execution flags, or env
conductor/src/llm/reflection.ts
β–Ό
7 Β· Supervise β€” Herman & the humans
Bounded auto-remediation with months of scar tissue; Discord is the human interface.
Live
🐺
Herman (hermes)
bot-health Β· pm2 + memory Β· heartbeat Β· base-bot-faults (HALT.flag, port-aware orphan kills, WASM signature) Β· tunnel Β· derivatives freshness Β· wallet Β· conductor Β· data quality Β· IBKR session
Live
πŸ”§
Bounded Auto-Fix
pm2_restart with cooldowns, crash-loop breaker, fingerprint dedup, 3-strike chronic-collapse escalation Β· Charlie may annotate & request β€” never mutate
Live
πŸ’¬
Discord (3 channels)
Tag-on-critical escalation Β· off-machine CF-worker heartbeat monitor Β· param-block alerts Β· nightly research digest
Human
πŸ§‘β€βœˆοΈ
Human Touchpoints
HALT.flag Β· HALTED_BOTS env Β· Bearer /kill Β· IBKR weekly login Β· DIP_LIVE / FUTURES_ENABLED / capital moves β€” env-controlled, human-only
🎯 Target State β€” the SAL control plane (what's left of the ideal)
Validation exists but is distributed across three sites. The target: one thin control plane, a unified intent ledger, and a human lane for risk-increasing changes. Full detail in the audit.
SAL elementStatusCurrent β†’ target
Structured intentspartial TradeProposal / param writes / gauntlet verdicts are intent-shaped β†’ formal intent envelope in shared/src/control-plane/ with actor, evidence refs, risk_direction, policy version
Deterministic validate()built, distributed Catalog reject/clamp + F2 stack + gauntlet β†’ extract behind one pure, versioned, replayable function
Intent ledgerplanned Partial rejection records β†’ intents / intent_decisions tables; every proposal gets a disposition row, including dedup/cooldown/balance/breaker rejections (N3)
Human approval laneplanned Everything bounded-automatic β†’ Discord button approval for risk-increasing param promotions (N5); auto-apply stays for risk-reducing / in-range
Single execution gate1 bypass Dip-booster routes through executionEngine.execute() before DIP_LIVE ever flips (N1)
Self-correcting stateplanned Advisory reconciler β†’ auto-adopt/evict after 2 consecutive confirmations under a size ceiling, logged as intents; fatal halt stays as backstop (N2)
Forward falsificationbuilt (Phase D) Paper-shadow live since Jul 4 (03:45 cron): nightly walk-forward OOS re-run + Discord stage/kill buttons into a label-only staging status β€” see machine flow; open: shadow query limit-100 vs 568 candidates (D1)
Full evidence chainpartial Outcomes + hypotheses ledger strong β†’ add LLM transcripts (N7), params-hash on trades, human overrides as ledger events
Cross-bot exposureplanned Each bot sees only itself β†’ hermes aggregate exposure sweep first (observability), enforcement later (N4)
Derivatives β†’ decisionsplanned Collected but unconsumed β†’ wire funding/OI/liq microstructure into strategies as gauntlet-tested event studies (N14)