System Map

Package inventory (src/nexus_scalp/)

nexus_scalp/
├── domain/            frozen Pydantic contracts (TickData, TradeProposal, …)
├── ports/             IMT5Port · IGatewayPort        ← the hexagon seam
├── adapters/          mt5/ (Win32 IPC) · gateway (ZMQ) · paper/ · database/ (AuditRepository, WAL)
├── features/          scalp_features (50D) · schema registry · schema_contract (70D SSoT)
│                      liquidity_engine · regime_classifier · temporal (research)
├── models/            ScalpNet (dual-path TCN + self-attention)
├── training/          walk_forward_trainer · labeling/ (triple-barrier)
├── signals/           policy · rule matrix (~30 SMC rules)
├── strategies/        factory (+ provider_gate for LLM/AI services)
├── risk/              RiskEngine (Kelly sizing, clamps, kill switch)
├── execution/         order_manager (+ protection_ledger · position_state_machine ·
│                      recovery_budget extracted seams)
├── accounting/        core · aggregation · retention
├── application/       live_engine (async orchestrator)
├── experience/        ledger · outcome_recovery · evaluator (autopsy intelligence)
├── intelligence/      behavior detection · lifecycle · store
├── mslie/             market-structure perception (advisory)
├── research/          dataset · discovery · pipeline · backtest · walkforward · oos ·
│                      streaming_replay · forward_test · counterfactual · evidence · observability
├── model_generation/  artifact-first factory (datasets/experiments/models + manifests)
├── model_lifecycle/   candidate staging, champion/challenger
├── governance/        14-gate verify · promotion transaction · rollback preview
├── shadow/            shadow70 runtime (zero order authority)
├── news/              ingest · analysis · bounded gate · database (schema/articles/analysis/queries)
├── incidents/         correlation · lineage · impact · reports · worker
├── forensics/         health engine · deploy gate · experience_gap · trend
├── hygiene/           retention · quarantine · consistency · index health
├── observability/     logging (severity-split) · telegram notifier (read-only)
├── web/               server + domain route modules · debug_snapshot · db_console
├── release/           CLI shim · updater · verifier · packaging
├── settings/          service (settings DB authority) · secret_store
└── configuration/     AppConfig (bootstrap) · RuntimeConfigStore (authoritative snapshots)

Databases (SQLite, WAL)

DBResponsibility
artifacts/audit.dbtrading ledger, experience outcomes, accounting, research registry, strategy lifecycle, incidents
artifacts/news.dbnews ingestion, analysis, consensus, impacts

Writes queue through AuditRepository's background worker thread — the tick

path never waits on the database (INV-001). Migrations are additive and

checksummed (nexus db); hygiene is AUDIT_ONLY by default.

Workers (all off the tick hot path)

Model artifacts

artifacts/models/… + artifacts/model_generation/… — versioned bundles

(model, scaler, manifest with schema hash + dataset ID + git commit). The

10-gate load gate validates every bundle before attach; width/hash mismatch

blocks loudly. See Model pipeline.