This document is the absolute Master Spine of the QuanuX Ecosystem. It serves as the unyielding architectural constitution governing all biological metaphors, operational topologies, OS verification baselines, and cybernetic governance laws.
QuanuX operates under the paradigm of Biological Sovereignty. The ecosystem is an evolving organism rather than a static codebase. Every operational component is designed based on the "Russian Doll" architectural concept.
Rather than a "block" system where pieces are stacked blindly upon one another, QuanuX layers are stacked inside one another to ensure perfect encapsulation and protection.
The conceptual "Russian Doll" architecture is formally and physically implemented as:
- Habitat (The Outer Doll / Conditioned Soil): The physical or virtual OS boundary (e.g., Ubuntu VM, remote server, or bare-metal edge cluster node). The Habitat provides the conditioned runtime soil.
- Nest (The Core Doll / The "Baby"): The sovereign logic process deployed deep into the Habitat. The core purpose of the node (a trading strategy, HFT engine, observation layer, protocol bridge) exists as the innermost protected Nest. The "Baby" is guarded at the core, all surface receptors perfectly insulated.
To maintain maximum execution speed and organizational sovereignty, QuanuX is strictly partitioned into a 5-Tier layout:
- Tier 1: The Server (Command Center): Orchestrates Nests and acts as the cerebral gateway. Uses Python (
quanuxctl,nats-py). - Tier 2: Polyglot Nests (Flexibility & Intelligence): AI strategy labs and standard API routing. Uses C++, Cython, Python, Golang. Networking relies on CNATS (
libnats-c) or ZMQ for pure local, single-machine setups. - Tier 3: Bare-Metal Nests (The 59ns Compute Engine): Unforgiving high-speed statistics environments on bare-metal Linux. Highly isolated execution. Python/Anaconda are strictly forbidden. Networking: CNATS for telemetry; standard Linux kernel (
epoll,io_uring) for execution. - Tier 4: The Fiber Nests (The Kinetic Edge): Pure hardware warfare and full high-frequency trading colocation. Python strictly forbidden. Networking: Completely abandons standard Linux socket routing in favor of Solarflare network cards leveraging kernel bypass technologies (
ef_viraw DMA, oronload). - Tier 5: The Global Swarm (Future Horizon): Interconnected arbitrage leveraging microwave or millimeter-wave networks between data centers.
Just as an organism rejects foreign pathogens, QuanuX employs a cybernetic immune system against AI hallucination and structural decay.
- Decentralized Context Anatomy: AI ecosystem memory has permanently migrated from JSON files to localized Markdown directives (
*skill.md) bound organically alongside the specific repositories and modules they govern. - The Prime Directive: 00_PRIME_DIRECTIVE.md acts as the ecosystem's cybernetic immune response. It strictly mandates that all AI agents must recursively ingest localized
.mdrules before traversing, modifying, or launching code blocks. Divergence from these codified physical laws is strictly forbidden.
The internal defense mechanisms of QuanuX are designed to protect the Nest against catastrophic failure layers.
- The Ritchie Protocol (FSM): A completely deterministic Finite State Machine ensuring predictable recovery from all market failure modes (from
STATE_VOIDtoSTATE_RECOVERY). It defines hard-coded risk thresholds and apoptosis laws. - The Apoptosis Trigger (
STATE_HALT): If an execution membrane breaches a risk or sanity threshold, the Ritchie FSM instantly invokes cell death (Apoptosis), freezing execution state to prevent kinetic bleeding. - The Sentinel Nucleus: Maintains PTP synchronization and Homeostatic Admin functions spanning the execution mesh.
The physical deployment pipeline engineered for Tier 2-4 Edge Nodes ensures Out-of-Band delivery without network contamination.
- The NATS Handshake: IPC via port 4222 orchestrates a dynamic Collision Matrix synchronization (dynamic NACK/ACK) for Habitat safety logic.
- OOB Payload Transfer: Dedicated background threads explicitly binding to IPv4 to execute Out-of-Band
libcurldeliveries over the Data Plane. This directly bypasses catastrophic asymmetric NAT routing topologies and IPv6 hypervisor gateways. - The Permission Reality: POSIX
chmod()integration actively applies+xprivileges during ingestion to form conditioned execution bounds. - Conditioned SSH Wrapper: Finalized execution mandates happen over a generated
.run_<payload>.shscript wrapped in strict SSH authority rather than automated system processes.
Because the L3 sovereign execution caches are vital to physical latency routing, there is azero-tolerance policy on thread drift.
- The Core 0 Lock: All dynamically spawned C++ background operations (e.g., asynchronous OOB
libcurldownloads launched by the Native Envoy daemon) must instantaneously executepthread_setaffinity_nplocking themselves to Management Core 0. This restricts background OS jitter and forcefully protects the kinetic trading cores from arbitrary scheduler swaps.
The QuanuX infrastructure network configurations strictly rely on verified physical deployments to prevent AI repetition.
- UBUNTU 22.04 LTS (Jammy Jellyfish) serves as the official, unified verification baseline.
- Assorted NAT routing phenomena, VirtualBox UFW port limitations, user-namespace drops by Git (
safe.directory), and required Linux dependencies (libssl-dev) have been rigorously mapped and secured against this precise ecosystem matrix.
The platform operates as a multi-language colossus spanning institutional trading to artificial intelligence. Below is the exhaustive functional mapping of the ecosystem.
- The Tri-Pillar IBKR Architecture (
extensions/cpp/ibkr_fix): A specialized Interactive Brokers ecosystem utilizing pure C++ for sub-millisecond execution. It leveragesQuickFIXfor direct Institutional Gateway access alongside nativeTWS APIwrappers exposing endpoints via Cython. It includes aquanuxctl enhance"Turbo Mode" that recompiles the adapter on the fly usingmimalloc/jemallocmemory paradigms and asynchronousspdlogring-buffers to eliminate blocking I/O. - Pure Cython TopstepX Extension (
extensions/cpp/topstep/cython): The legacy Node.js bridge has been obliterated in favor of a native, memory-safe Cython implementation mapping directly to TopstepX's backend viaSignalRand REST. This handles live market quotes, limit/stop placement, and integer-safe (int64) 2-Billion+ account ID parsings with 100% test parity and massive speed boosts over JavaScript parsing. - Rithmic RApiPlus Integration (
extensions/cpp/rithmic/cython): Institutional direct memory access (DMA) mapped flawlessly from C++ to Python. The engine (PyREngine) leverages C++ struct mapping into Python dictionaries, maintaining zero-copy speed while exposing high-frequency order callbacks (trade_print,LineInfo) directly into the agent pipelines. - The QuickFIX Engine Component (
extensions/cpp/quickfix): A statically-linked implementation of the open-source industry standard. Adhering to the Immutable Rule 0 (Performance = C++), this module permits the QuanuX execution logic to route institutional Fix4.2/Fix4.4 connections directly through the C++ core without Python overhead.
- DuckDB C++ Extension (
extensions/cpp/duckdb): The platform's internal state mechanism for large-batch bulk ingestion. This module utilizes the DuckDB amalgamation (duckdb.cpp) exposed via minimal Cython wrappers using the pure nativeAppenderAPI. This permits QuanuX to achieve near-instantaneousINSERTrates required for ingestion of multi-gigabyte tick data sets locally. - Databento Connectors (
extensions/cpp/databento): A pure Cython translation of Databento's C++ SDK. Exposes thePyHistoricalBuilderand Client architecture for ingesting raw data directly into strategy memory and backtesting simulations without relying on the Databento Python SDK overlay constraints. - QuanuX Indicators (
libquanux-indicators): The master replacement for the agingTA-Libstack. This C++20 header-only library exposes Lazy Evaluation logic utilizing nativestd::rangessyntax (e.g.,prices | quanux::indicators::sma(10)). This prevents the catastrophic memory allocation inherent to standard Python vectors. It features custom Storage Policies (DenseStoragearrays for Futures,SparseStoragemaps for crypto) mapped directly via PyBind/Cython wrappers achieving up to 7x execution acceleration for Python agents.
- The Polyglot Tier 2 Strategy Layer: The Foundry architecture abandons monoliths for "Sovereign Components". Mathematical operations (Indicators, Entries, Risk) are entirely decoupled and generated based on exact JSON Intermediate Representations (
indicator_ir.json). - The
FoundryGeneratorPipeline: Agent interaction routes from natural language into absolute determinism. When prompted, the NATS-enabled FastAPI orchestrator translates the mathematical IR into three separate languages: Python (asyncio.TaskGroupoptimized), Cython (cdefmemory layouts), and C++20 (std::ranges). - The Deterministic Sandbox Validation: Code is never blindly vended. The QuanuX ecosystem simultaneously mocks and executes the Python, Cython, and C++ variations of a generated strategy against a Databento-simulated OHLCV array. If there is a fractional discrepancy (e.g. C++ outputs
1.045, Python outputs1.044), the AI generation job constitutes a failure. Determinism is absolute. - LLM/MCP Web Subscriptions: Artificial Intelligence interactions (such as with the Gemini CLI Extension) are pushed through standard REST triggers (
/api/foundry/forge) but immediately streamed via NATS and Strawberry GraphQL back to human operators, providing real-time token generation telemetry over WebSockets.
- The Distributed Target Matrix (React Native): The platform UI spans 7 independent form-factor targets simultaneously (Car, Foldables, Mega, Mobile, Tablet, Vision, Wear). All targets strictly consume an identical core design system via Expo Router and NativeWind v4 (Tailwind v3 compatibility).
- The Backend-Driven Law: The React frontend nodes are classified as "Dumb Domes". All computation, mathematical parsing, and state logic remains completely isolated on the Rust/Python backends. The UI uses the "Beast Mode" Ref-Buffer (
useRef+requestAnimationFrame) to bypass React re-render penalties, painting raw array data directly onto the DOM without halting the user interface. - The Figma Developer MCP Server: The ultimate Design-to-Code loop. The QuanuX MCP orchestrator inspects active Figma designs via
.figma_tokens, identifies underlying layout math, and programmatically spawns standardShadcn/UITailwind-driven code blocks matching the literal design specification while adhering to the Frontend-Standards mandate. - The
quanuxctlTyper Interface: The C&C Python CLI. Providing exhaustive operational power from creating Topstep keys in the OS Keychain, initiating.sostrategy deployments, to publishing distributed telemetry stop/start signals over NATS IPC to shut down failing Tier 4 nodes remotely.
- HA Zero-Allocation NATS Core (
QuanuX-Annex/): A sovereign C++ telemetry ingestion daemon deployed via Ansible to the outer Habitats. It maps high-velocity NATS JetStream data directly into byte-aligned C++ structs (e.g.MarketTick,ExecutionLog) using<nats/nats.h>, bypassing JVM and Python garbage collection completely. - Tract 1 GCP Historical Lake Integration: A Python pipeline (
gcp_ingestion_pipeline.py) dynamically extracts JetStream events, projects the next append against the exact 37-byte fixed-schema Arrow model, flushes before any limit breach, and fails closed if materializedPyArrowfootprint ever deviates from structural alignment. - Tract 2 Research Database Transparency (DuckDB-to-BQ): GRADUATED PROTOTYPE (Commit
0a7df15). A SQL AST transpiler (QuanuXDuckToBQTranspiler) translating DuckDB subsets into BigQuery standard SQL. It cleanly filters unapproved syntaxes viaTranspilationErrorfail-closures. Its graduation achieved exact Arrow layout parity against actual remote Google Cloud data bindings powered seamlessly by the localquanuxctl secretsOS keyring. - The Sentinel Protocol Pivot: Incorporates rigorous Red Team mitigations for observability. Telegraf is deployed via direct static
.debinjection into the outer droplets, avoiding hypervisor APT repository corruptions, with its telemetry interval dynamically orchestrated viaquanuxctl. - Phase 12 Pipeline Proving Ground (
tests/nats_injector.py): Real-time NATS mocking tools written in Python that map nativestructbyte-alignments to validate the C++ QuanuX-Annex core without requiring a live colocation feed.
To effectively navigate the ecosystem, the repository is sliced along strict functional boundaries:
-
.agent/,server/skills/, andextensions/**/SKILL.md- Purpose: The Decentralized AI Cybernetic Context.
- Integration: The absolute first point of reading for any AI interaction. This replaces the monolithic
.geminiAI prompt folder and embeds exact functional truths right beside the executing source code.
-
extensions/- Purpose: The C++, Cython, Python, Go, and Node execution modules.
- Integration: Holds the high-throughput Broker Adapters (
quickfix,topstep,rithmic,ibkr), external Data Engines (duckdb,databento), and UI integrators (figma).
-
src/,QuanuX-Clustering/, andexecution-node/- Purpose: Hardware Orchestration and Edge Provisioning.
- Integration: Location of
node_init.sh, the OS manifest profiles (tier1_control.yamldown totier4_dma.yaml), and the pure C++20Native Envoyruntime loops mapping execution to hardware affinity contexts.
-
server/- Purpose: The Python Tier 1 Brain.
- Integration: Contains the core REST FastAPI servers, Strawberry GraphQL configurations, the Foundry AI Agent translation loops, the C++
indicatorsengine bridging logic, and the centralquanuxctlCLI tools.
-
client/- Purpose: The Frontend Cross-Platform UX.
- Integration: Contains the React Web, React Desktop (Tauri), and React Native architectures alongside the strict
design-librarymockup lab.
-
QuanuX-Statistics/,QuanuX-Backtesting-Engine/, andQuanuX-Spreader/- Purpose: Low-Latency Quant Mathematics and Routing.
- Integration: The core proprietary computation repositories executing fractional Kelly simulations, event-driven historical tape processing, and the primary 59-nanosecond execution interlocks.