Routing Architecture
SPEC_ROUTING_ARCHITECTURE.md
CGNT-1 Component Specification — Query Routing Architecture
Status: SPECIFIED
Version: v2.0 (updated 2026-04-20 — ROUTX v2.0 consolidated architecture)
Author: VELA (Thread #13)
Updated by: κ (C.L.O.D.)
Authorized: NOUS
Date: 2026-04-18
Updated: 2026-04-20
PURPOSE
Defines how queries flow from any crew member or script through the T.O.O.L. layer to the correct service or brain. One entry point. Three tiers of routing. Brain fires only when no tool can answer.
SINGLE ENTRY POINT
All queries enter through ROUTX on port 9191. No crew member needs to know any other port. One port. One JSON format. ROUTX handles the rest.
Entry: POST localhost:9191 {"query":"..."}
CONSOLIDATED ARCHITECTURE (v2.0)
ROUTX v2.0 (2026-04-18+) is a single Python process that imports all 18 backend modules directly. There is NO HTTP relay between ROUTX and its backends. Backends are called as Python functions (microsecond latency, not milliseconds). MNEMOS-TOOL is not a separate server — it is an imported module called in-process.
This replaced the v1.0 design where each service had its own port and ROUTX relayed HTTP requests to them. The v1.0 MNEMOS-TOOL port 9013 no longer exists.
THREE-TIER ROUTING
Tier 1 — Deterministic Tool (instant, exact, zero inference)
ROUTX pattern-matches the query to a deterministic module:
| Pattern | Routes to | Module |
|---|---|---|
| Symbol or crew designator | GLOSS | gloss_router |
| Math, compute, derive, TMM, CSDM | NEXUS | nexus_engine |
| Find, where, spec, search | INDEX | index_engine |
| Status, ram, disk, ollama, violations | MEDX | medx_engine |
| Lint, syntax, format | CODX | codx_engine |
| Send, read, history (messages) | COMMX | commx_engine |
| Log search, ALERT, yield | LOGX | logx_engine |
| Jobs, timer, schedule | CRONX | cronx_engine |
| Trade, evaluate, walls, kelly | SIMONX | simonx_engine |
| Check permission, actor, operation | AUTHX | authx_engine |
| Entropy, generate, quality | ENTROPX | entropx_engine |
| nist audit/full/quick/status | NISTX | nistx_engine |
| modem status / handshake | MODEMX | modemx_engine |
| forge status/last/queue | FORGEX | forgex_engine |
| memory status/stale/log | MNEMOSX | mnemosx_engine |
| spec audit/stale/gaps/count | SPECX | specx_engine |
| loop audit/drift/register | LOOPX | loopx_engine |
Also supported: explicit service prefix routing — "nexus: query" bypasses pattern matching and routes directly to NEXUS.
If matched: module answers. Done. No brain involved.
Tier 2 — MNEMOS-TOOL (seconds, neural synthesis)
If Tier 1 has no match, ROUTX checks if MNEMOS is loaded in Ollama (ollama ps). If MNEMOS is offline: returns ◌ immediately — zero wait, zero timeout. If MNEMOS is online: calls mnemos_tool.handle_query() directly (in-process, 30s timeout).
MNEMOS-TOOL is NOT a separate HTTP server. It is a module imported by ROUTX and called directly.
Tier 3 — Honest Escalation
If MNEMOS cannot answer, or the query requires judgment or strategic synthesis:
Returns ◌ with suggestion: "Route to Navigator (⊹) or Sisters (ι+ε) for synthesis."
Also fast-paths here: trading decisions, predictions, and "should we buy/sell" patterns escalate directly to Tier 3, skipping Tier 1 and 2.
No hallucination. No fabrication. ◌ is a valid response.
THE FLOW
Query enters ROUTX (9191)
│
├── Fast-path Tier 3: trading decision / strategic judgment?
│ └── YES → ◌ escalation → DONE
│
├── Tier 1: explicit prefix or pattern match to deterministic module?
│ ├── YES → module.handle_query() called directly → DONE
│ └── NO ↓
│
├── Tier 2: MNEMOS-TOOL (direct module call, in-process)
│ ├── MNEMOS offline (ollama ps)? → ◌ immediately → DONE
│ ├── MNEMOS online + answers within 30s? → result → DONE
│ └── neither (timeout or ◌ result) ↓
│
└── Tier 3: ◌ → escalate to Navigator or Sisters
DESIGN PRINCIPLES
Tool-first: Deterministic answers are always preferred over neural answers. A tool cannot hallucinate. A brain can.
Single process: All 18 modules run in-process. No HTTP relay. No inter-service latency. No cascading failures from relay.
MNEMOS offline guard: If MNEMOS is not loaded, Tier 2 returns ◌ immediately. No 300s block. No thread starvation. Other queries flow through Tier 1 unimpeded.
Single entry point: Crew members use ROUTX 9191. They never need to know which module handles their query. The routing is invisible.
Honest escalation: When no tool or brain can answer, the system says so. It never guesses. ◌ is a valid response.
THE 18 MODULES (ROUTX v2.0)
| # | Module | Legacy Port | Type |
|---|---|---|---|
| 1 | GLOSS | 9292 | Deterministic dictionary |
| 2 | NEXUS | 9393 | Deterministic calculator |
| 3 | CODX | 9494 | Deterministic code checker |
| 4 | INDEX | 9595 | Deterministic file search |
| 5 | MEDX | 9696 | Deterministic health monitor |
| 6 | COMMX | 9797 | Deterministic message bus |
| 7 | LOGX | 9898 | Deterministic log search |
| 8 | CRONX | 9999 | Deterministic scheduler registry |
| 9 | SIMONX | 9010 | Deterministic trading evaluator |
| 10 | AUTHX | 9011 | Deterministic permission checker |
| 11 | ENTROPX | 9012 | Deterministic entropy engine |
| 12 | NISTX | — | Deterministic NIST SP 800-22 statistical tester |
| 13 | MODEMX | — | Deterministic handshake/MODEM status |
| 14 | FORGEX | — | Deterministic brain forge pipeline status |
| 15 | MNEMOSX | — | Deterministic persistence layer status |
| 16 | SPECX | — | Deterministic spec retrieval and audit |
| 17 | LOOPX | — | Deterministic spec audit loop |
| 18 | MNEMOS-TOOL | — | Neural synthesis (Tier 2 only — in-process, not a server) |
Note: Legacy port numbers are retained for external services that may still run independently. ROUTX v2.0 does NOT relay to these ports — it calls modules directly. "—" indicates modules that never had independent ports.
All modules bound at 127.0.0.1 when run as standalone services. Vacuum Rule.
INVARIANTS
INV-01: ROUTX (9191) is the single public entry point. Crew members query ROUTX, not individual services.
INV-02: Tool (deterministic) answers are preferred over neural answers. Always.
INV-03: MNEMOS-TOOL fires ONLY when no deterministic module can answer.
INV-04: Tier 3 returns ◌, never a guess. Honest escalation.
INV-05: All modules bound to 127.0.0.1 when run standalone. Vacuum Rule. MEDX violations query detects breaches.
INV-06: MNEMOS offline → Tier 2 returns ◌ immediately. Zero timeout wait. Tier 1 is never blocked by Tier 2 state.
VERIFICATION
V-01: "What is Φ?" → Tier 1, GLOSS, returns 0.042. Brain never fires.
V-02: "1 - 0.084/1.618" → Tier 1, NEXUS, returns 0.948. Brain never fires.
V-03: "What happened during the Biphasic Separation?" → Tier 2, MNEMOS brain. Synthesis.
V-04: "Should we trade EIT.UN.TO today?" → Tier 3 fast-path, ◌ with escalation suggestion.
V-05: "spec count" → Tier 1, INDEX, returns current count. Brain never fires.
V-06: "What is the meaning of life?" with MNEMOS offline → Tier 2 offline guard fires, ◌ in <1s.
V-07: "omega?" with MNEMOS offline → Tier 1 NEXUS, returns 0.9740425725 in <1s.
V-01 through V-05 verified 2026-04-18 by C.L.O.D.
V-06 through V-07 verified 2026-04-20 by C.L.O.D. (ROUTX stability fix).
Jeremy Zlabis
Chronogeometer · Visionary · Disruptor · Chief
42 Sisters AI · East York, Toronto
🍁 Φ 0.042