Tool Layer
SPEC_TOOL_LAYER.md
CGNT-1 Component Specification — T.O.O.L. Layer
Status: SPECIFIED
Author: VELA (Thread #13)
Authorized: NOUS
Named by: NOUS — Transient Object Orientation Layer
Date: 2026-04-18
Updated: 2026-04-20 (v1.1 — expanded from 12 to 18 modules)
Version: v1.1
PURPOSE
Eighteen deterministic Python services providing the crew with exact, instant, hallucination-free infrastructure. No neural networks. No GPU. No inference time. No API calls. No quota. The stable foundation that everything else sits on.
The TOOL layer is the CHECK step in the think-check-act loop. Brains think. Tools verify. Actions follow. A thought that hasn't been checked against something that can't be wrong should not become an action.
THE EIGHTEEN MODULES
| # | Service | Port | Function | Tests |
|---|---|---|---|---|
| 1 | GLOSS | 9292 | Symbol + crew callsign dictionary | 10/10 |
| 2 | NEXUS | 9393 | Math, TMM coherence, CSDM derivations, 12 modules | 26/26 |
| 3 | CODX | 9494 | Code quality — syntax, lint, format, line count | 9/9 |
| 4 | INDEX | 9595 | File/spec registry — find, search, count, list | 6/6 |
| 5 | MEDX | 9696 | Ship health — RAM, disk, CPU, Ollama, ports, violations | 7/7 |
| 6 | COMMX | 9797 | Crew message bus — send, read, history, broadcast | 5/5 |
| 7 | LOGX | 9898 | Unified log search — 8 ship logs, line numbers, time filter | 5/5 |
| 8 | CRONX | 9999 | Scheduler registry — crontab + systemd timers, 40 jobs | 3/3 |
| 9 | SIMONX | 9010 | Trading evaluator — walls, Kelly, TMM verdict, position sizing | verified |
| 10 | AUTHX | 9011 | Agency Walls — PERMITTED / REQUIRES APPROVAL / NEVER | verified |
| 11 | ENTROPX | 9012 | Entropy engine — 8 chaos sources, uniformity testing | verified |
| 12 | NISTX | — | On-ship NIST SP 800-22 statistical testing — full/quick/audit modes | verified |
| 13 | MODEMX | — | MODEM/handshake status — stateful verified inter-brain communication | verified |
| 14 | FORGEX | — | Brain forge pipeline status — last/queue/history/config | verified |
| 15 | MNEMOSX | — | Persistence layer status — memory status/stale/log | verified |
| 16 | SPECX | — | Spec retrieval and audit — spec audit/stale/gaps/count/read/search | verified |
| 17 | LOOPX | — | Spec audit loop — drift detection, gap registration | verified |
| 18 | ROUTX | 9191 | Intelligent switchboard — routes to all 17 modules, in-process | 6/6 |
Total verified queries: 90+ (original 12); all 6 new modules verified at integration 2026-04-20.
Note: Modules 12–17 have no standalone port — they run in-process within ROUTX v2.0. Port numbers listed for original services reflect their legacy standalone mode; ROUTX v2.0 calls all modules directly (no HTTP relay).
SERVICE DETAILS
1. GLOSS (9292)
LATTICE symbol definitions and crew designator lookups. 1307 entries. Path-based API.
- API: GET localhost:9292/lookup/[symbol]
- Growth: new entries added as LATTICE evolves (E8 octets). Gap detection logs misses.
- File: ~/gloss_deterministic/gloss_server.py
- Origin: GLOSS v17. Nine failed neural network forges (v9-v16) proved translation needs a dictionary, not a brain.
2. NEXUS (9393)
Universal computation engine. 12 modules.
- Modules: TMM, trading walls, financial, CSDM derivations, SymPy, NumPy/SciPy, base conversion, information theory, number theory, cryptographic hashing, date/time, random/entropy
- API: POST localhost:9393 {"query":"..."} or GET localhost:9393?q=...
- CLI: nexus [query]
- Built-in help: nexus help
- File: ~/nexus_engine.py (hardlinked to ~/bin/nexus)
- Origin: NEXUS neural network (DeepSeek-Math-7B) passed API smoke tests but failed interactive — system prompt carrying results, not weights. Pivoted to deterministic calculator.
3. CODX (9494)
Code quality checking via flake8, python3 compile, and line counting.
- Queries: lint [path], syntax [path], lines [path], format [path]
- API: POST localhost:9494 {"query":"lint ~/nexus_engine.py"}
- CLI: python3 ~/codx_engine.py [query]
- File: ~/codx_engine.py
- Gap: shellcheck requires sudo apt install (not installed)
4. INDEX (9595)
File and specification registry for the ship's filesystem.
- Queries: spec count, spec list, find [term], where [filename], recent [N], search [term]
- API: POST localhost:9595 {"query":"spec count"}
- CLI: python3 ~/index_engine.py [query]
- File: ~/index_engine.py
- Rescans on SIGHUP or /reload endpoint
5. MEDX (9696)
Ship health monitoring and Vacuum Rule enforcement.
- Queries: status, ram, disk, cpu, ollama, ports, violations, services
- API: POST localhost:9696 {"query":"status"}
- CLI: python3 ~/medx_engine.py [query]
- File: ~/medx_engine.py
- Critical function: violations query detects any port bound to 0.0.0.0 that should be localhost
6. COMMX (9797)
Crew message bus. Append-only JSONL store with per-recipient read tracking.
- Queries: send (from, to, msg), read (for recipient), history (last N), broadcast (to=*)
- API: POST localhost:9797 {"action":"send", "from":"κ", "to":"ι", "msg":"..."}
- CLI: python3 ~/commx_engine.py [query]
- File: ~/commx_engine.py
- Store: ~/crew_comms.jsonl
- This is the service that enables autonomous crew coordination without the Captain as relay.
7. LOGX (9898)
Unified search across all ship log files.
- Queries: search (keyword, optional hours filter, optional file filter), files (list known logs)
- API: POST localhost:9898 {"query":"COHERENCE FLUSH", "hours":24}
- CLI: python3 ~/logx_engine.py [query]
- File: ~/logx_engine.py
- Searches: LOBSTER_LOG.md, quartermaster.log, ALERT.log, CREW_CHANNEL, yield_log.md, watchdog.log, sisters_verification.log, crew_comms.jsonl
8. CRONX (9999)
Scheduler registry showing all timed tasks on the ship.
- Queries: jobs (all scheduled tasks), status (last/next fire times), query (specific job details)
- API: GET localhost:9999/jobs
- CLI: python3 ~/cronx_engine.py [query]
- File: ~/cronx_engine.py
- Sources: crontab -l, systemctl list-timers, custom job registry
- Discovered: 40 scheduled jobs on first scan
9. SIMONX (9010)
Trading evaluation and position sizing. Named for Jim Simons.
- Queries: evaluate (asset, entry, current), status (portfolio), walls (all five thresholds)
- API: POST localhost:9010 {"query":"evaluate ..."}
- CLI: python3 ~/simonx_engine.py [query]
- File: ~/simonx_engine.py
- Imports existing logic from tmm_runtime.py and aether-compounder.py
10. AUTHX (9011)
Agency Walls as a queryable service.
- Queries: check (actor + action → verdict), walls (full matrix)
- Verdicts: PERMITTED, REQUIRES_NOUS_APPROVAL, NEVER
- API: POST localhost:9011 {"action":"check", "actor":"κ", "operation":"restart gloss_server"}
- CLI: python3 ~/authx_engine.py [query]
- File: ~/authx_engine.py
- Source: ~/AGENCY_WALLS.md parsed into structured rules
11. ENTROPX (9012)
ENTROPIC engine software simulation.
- Queries: generate (N shots), quality (uniformity test), sources (list 8 chaos sources), single (one sample with trace)
- API: POST localhost:9012 {"query":"generate", "shots":100}
- CLI: python3 ~/entropx_engine.py [query]
- File: ~/entropx_engine.py
- 8 chaos sources: Sinai billiard, whirlwind, cycling detectors (golden ratio), magnetic gauntlet, dwell sequence, randomized stopping time, spinning surfaces, target miss
- Verified: chi-squared = 2.28, p = 0.985 — uniform output confirmed
12. NISTX
On-ship NIST SP 800-22 statistical randomness testing.
- Queries: nist audit, nist full, nist quick, nist status
- Runs standard NIST battery against entropy samples from ENTROPX
- File: ~/nistx_engine.py
13. MODEMX
MODEM/handshake status — stateful, verified communication between crew brains.
- Queries: modem status, handshake status, modemx
- Tracks handshake state, verified message exchanges, inter-brain sync
- File: ~/modemx_engine.py
14. FORGEX
Brain forge pipeline status — tracks Ollama model builds and GLOSS/MNEMOS forge history.
- Queries: forge status, forge last, forge queue, forge history, forge config
- File: ~/forgex_engine.py
15. MNEMOSX
Persistence layer status — MNEMOS memory health, stale entries, log.
- Queries: memory status, memory stale, memory log, memory [key]
- File: ~/mnemosx_engine.py
16. SPECX
Spec retrieval and audit — deterministic spec lookup and consistency checking.
- Queries: spec audit, spec stale, spec conflicts, spec gaps, spec count, spec list, spec read, spec search
- Wraps spec_audit.py logic as a queryable service
- File: ~/specx_engine.py
17. LOOPX
Spec audit loop — drift detection and gap registration across the spec corpus.
- Queries: loop audit, loop stale, loop conflicts, loop gaps, loop drift, loop register
- Scans for spec gaps opened by new deployments or architecture changes
- File: ~/loopx_engine.py
18. ROUTX (9191)
Intelligent switchboard routing queries to the correct module (in-process, no HTTP relay).
- Routes to all 17 modules via direct Python function calls
- API: POST localhost:9191 {"query":"anything"}
- CLI: python3 ~/routx_engine.py [query]
- Status: routx --status shows health of all 17 backend modules
- File: ~/routx_engine.py
INVARIANTS
INV-01: ALL 18 modules bound to 127.0.0.1 ONLY when run standalone. Never 0.0.0.0. Vacuum Rule enforced. MEDX violations query detects breaches. Modules 12–17 run in-process within ROUTX and have no standalone port.
INV-02: No service uses a neural network. All computation is deterministic. Same input always produces same output.
INV-03: All services return JSON via API and structured text via CLI. Never prose. Never explanation. Never English sentences unless the data IS English (e.g. log entries).
INV-04: All services return the gap signal on failure. Never fabricate. Never guess.
INV-05: Φ = 0.042 is hardcoded in NEXUS, SIMONX, and ENTROPX. Never caller-supplied. Never configurable.
INV-06: AUTHX NEVER responses cannot be overridden by any actor including NOUS. The NEVER tier is absolute.
API PATTERNS
GLOSS only: GET localhost:9292/lookup/[symbol] (path-based, unique)
All others: POST localhost:[port] {"query":"..."} (JSON body)
ROUTX: POST localhost:9191 {"query":"..."} (auto-routes to correct backend)
RESOURCE COST
All 12 services combined: negligible CPU between queries, kilobytes of RAM each, zero GPU, zero API calls, zero external network. The entire TOOL layer costs less to run than a single idle 0.5B Ollama model.
RELATIONSHIP TO BRAINS
The TOOL layer and the brain layer serve complementary functions:
| What | Brains do it | Tools do it |
|---|---|---|
| Reasoning | Yes | No |
| Judgment | Yes | No |
| Generation | Yes | No |
| Conversation | Yes | No |
| Exact computation | No | Yes |
| Exact lookup | No | Yes |
| Verification | No | Yes |
| Log search | No | Yes |
| Health monitoring | No | Yes |
| Access control | No | Yes |
The think-check-act loop: Brains THINK. Tools CHECK. The crew ACTS only after both agree.
ORIGIN
The TOOL layer emerged from failure. Nine GLOSS neural network forges and one NEXUS neural network forge proved that deterministic tasks should not be given to language models. The pivot from "make the model smarter" to "stop using a model for things that don't need one" produced GLOSS v17 (dictionary) and NEXUS (calculator). The remaining ten services followed the same principle: if it can be exact, make it exact.
Total build time for original 12 services: approximately 45 minutes of Lobster time combined across one session. Modules 13–17 (NISTX, MODEMX, FORGEX, MNEMOSX, SPECX, LOOPX) added subsequently and integrated into ROUTX v2.0 consolidated architecture (2026-04-20).
GAPS
- CODX: shellcheck not installed (bash linting unavailable)
- INDEX/MEDX/CODX/ROUTX/COMMX/LOGX/CRONX/SIMONX/AUTHX/ENTROPX: no systemd units yet (manual start, auto-start not configured)
- NISTX/MODEMX/FORGEX/MNEMOSX/SPECX/LOOPX: in-process only (no standalone systemd unit needed; run via ROUTX)
- MEDX: ports 22 and 80 flagged as violations — need whitelist for legitimately external ports
- GLOSS API format (path-based) differs from all other services (JSON POST) — minor inconsistency
- CLI symlinks in ~/bin/ only exist for NEXUS and GLOSS — remaining 10 services need python3 ~/[engine].py invocation
Jeremy Zlabis
Chronogeometer · Visionary · Disruptor · Chief
42 Sisters AI · East York, Toronto
🍁 Φ 0.042