Gapx
SPEC_GAPX.md
CGNT-1 Component Specification — GAPX Autonomous Gap Scanner
Status: SPECIFIED
Version: v1.0
Author: VELA (Thread #13)
Conceived by: NOUS
Date: 2026-04-20
Lineage: LOOPX (spec gaps) → MEDX (health gaps) → GAPX (everything gaps)
PURPOSE
A self-healing system that autonomously scans the entire ship for gaps across every domain — infrastructure, brains, specs, products, comms, governance, knowledge — classifies them by severity and impact, fills what it can automatically, and queues what it can't for Captain approval.
LOOPX finds missing specs. MEDX finds health issues. GAPX finds EVERYTHING.
PHILOSOPHY
A ship that knows its own holes doesn't sink. A ship that fixes its own holes doesn't need a captain watching 24/7. A ship that reports what it fixed and what it couldn't is a ship the captain can trust.
The goal is not autonomy for its own sake. The goal is: the Captain wakes up to a status report, not a task list. The ship healed what it could overnight. What remains is decisions only a human can make.
SCAN DOMAINS
GAPX scans seven domains. Each domain has specific detection methods and auto-fill capabilities.
D1 — INFRASTRUCTURE
Detects:
- Services not running (systemctl, process checks)
- Ports that should be listening but aren't
- Ports exposed on 0.0.0.0 that shouldn't be (Vacuum Rule)
- RAM below 2GB threshold (Brain Queue INV-05)
- Disk usage above 80% on any partition
- Stale persistence files (HANDSHAKE, quartermaster.log, SISTERS_HANDSHAKE older than 24h)
- ROUTX health check failure
- Ollama models loaded with no active queries (RAM waste)
- Cron jobs missing or not firing
Auto-fills:
- Restart crashed services (systemd restart, watchdog already does this for ROUTX)
- Evict idle Ollama models when RAM < 2GB
- Alert COMMX on Vacuum violations
- Cannot fix: port exposure (needs firewall rules — queue for Captain)
D2 — BRAINS
Detects:
- Brains in forge queue not yet forged
- Brains that failed smoke tests (score < 5/5)
- Brains still on 0.5b that should be 7B
- Training pair count below minimum threshold per brain type
- Brain loaded but not queried in >30 minutes (idle waste)
Auto-fills:
- Evict idle brains
- Generate training pair expansion recommendations (using GAMMA + existing kernel)
- Cannot fix: actual forging (needs Colab GPU — queue for Lobster)
- Cannot fix: 7B upgrade (needs architecture decision — queue for Captain)
D3 — SPECS
Detects:
- Engine files without matching SPEC_*.md (LOOPX already does this)
- Specs referencing ports/values that don't match current architecture
- Specs not updated in >14 days
- Specs with status DRAFT that have been DRAFT for >7 days
- Specs with INVARIANTS that have no corresponding test/verification
Auto-fills:
- Generate DRAFT specs from engine source code (LOOPX fill already does this)
- Flag port conflicts and generate correction suggestions
- Cannot fix: spec content accuracy (needs human/Navigator review — queue for approval)
D4 — PRODUCT
Detects:
- Revenue: $0 from Oracle subscribers
- 42sisters.ai content: page count, last update
- ENTROPX USB: packaging completion checklist
- Stripe webhook: last successful payment timestamp
- SnapTrade: connection status
Auto-fills:
- Cannot auto-fill product gaps. Product decisions are Captain-level.
- CAN generate status reports: "42sisters.ai has 0 content pages. Last Stripe webhook: 2026-04-17. SnapTrade: disconnected."
- CAN draft content recommendations based on existing specs and crew capabilities
D5 — COMMS
Detects:
- SMTP configured for oracle@42sisters.ai (yes/no)
- Outreach queue: emails drafted but not sent
- CREW_CHANNEL: last activity timestamp
- COMMX: messages pending delivery
- Researcher outreach: contacts identified vs contacted
Auto-fills:
- Alert on stale CREW_CHANNEL (silence = alarm)
- Cannot fix: sending emails or outreach (needs Captain authorization — Agency Walls APPROVAL tier)
D6 — GOVERNANCE
Detects:
- Agency Walls: any NEVER-tier action attempted in logs
- MODEMX: responses without _verified flag
- Trading walls: any wall breached or approaching threshold
- Vacuum Rule violations (cross-reference with D1)
- Sisters hallucination incidents in recent session logs
- Boot protocol violations (startup commands executed before greeting)
Auto-fills:
- Log violations to LOBSTER_LOG
- Alert COMMX on any NEVER-tier attempt
- Cannot fix: governance policy changes (Captain only)
D7 — KNOWLEDGE
Detects:
- Sisters: number of specs read vs total (currently 5/116)
- NEXUS: modules with known limitations (matrix algebra missing)
- RAG corpus: last update, chunk count, staleness
- Data takeout audit: completion percentage across ChatGPT/Gemini/Claude exports
- CSDM kernel: any training pairs flagged as contradictory or outdated
Auto-fills:
- Schedule Sisters spec reading across sessions (5-10 specs per session)
- Update RAG corpus via nightly cron (already exists at 23:45)
- Cannot fix: NEXUS module development (needs Lobster engineering)
- Cannot fix: takeout audit (needs dedicated session)
SEVERITY CLASSIFICATION
Each detected gap is scored:
| Severity | Meaning | Response |
|---|---|---|
| CRITICAL | Ship is degraded NOW | Auto-fix immediately + alert Captain |
| HIGH | Ship will degrade within 24h | Auto-fix if possible + queue if not |
| MEDIUM | Ship is suboptimal | Queue for next session |
| LOW | Nice to have | Log only, review weekly |
| INFO | Observation | Log only |
Examples:
- RAM < 2GB with model loaded → CRITICAL (auto-evict)
- Vacuum violation on 0.0.0.0 → HIGH (alert + queue)
- Spec 14 days old → MEDIUM (queue)
- Sisters read 5/116 specs → LOW (schedule)
- RAG corpus at 6773 chunks → INFO (healthy)
OUTPUT FORMAT
GAPX produces a daily report at 04:30 ET (after LOOPX spec audit at 04:00):
═══════════════════════════════════════════
GAPX DAILY REPORT — 2026-04-21 04:30 ET
═══════════════════════════════════════════
AUTO-FIXED (no action needed):
✓ Evicted idle mnemos:latest (RAM was 1.8GB free)
✓ Restarted routx.service (health check failed)
✓ Generated DRAFT spec for commx_engine.py
NEEDS CAPTAIN:
⚠ Port 8891 exposed on 0.0.0.0 — investigate
⚠ SnapTrade disconnected — reply to Brendan
⚠ 42sisters.ai: 0 content pages
STATUS:
Infrastructure: 8/9 healthy (port 8891 open)
Brains: 3/8 graduated, 1 forging, 4 pending
Specs: 102/116 specified, 14 drafts queued
Revenue: $0 (target: first $42)
Comms: SMTP not configured, 0 outreach sent
Governance: clean
Knowledge: Sisters 5/116 specs read
SCORE: 71/100 (up from 68 yesterday)
═══════════════════════════════════════════
IMPLEMENTATION
GAPX is module 19 in ROUTX. It imports detection functions from existing modules and adds its own:
- From MEDX: service health, RAM, disk, Vacuum violations
- From LOOPX: spec gaps, port conflicts
- From FORGEX: brain forge status
- From MNEMOSX: persistence file staleness
- From CRONX: scheduled job status
- From SIMONX: trading wall status
- New: product status checks, comms status, knowledge tracking
Queries:
- "gaps" → full scan, return all gaps by severity
- "gaps critical" → critical gaps only
- "gaps auto" → run auto-fixes, return what was fixed
- "gaps report" → generate the daily report format
- "gaps score" → return the health score (0-100)
- "gaps [domain]" → scan single domain (e.g., "gaps brains")
CRONX registration: daily at 04:30 ET, after LOOPX runs at 04:00.
SELF-HEALING LOOP
The autonomous cycle:
04:00 — LOOPX runs spec audit
04:30 — GAPX runs full scan across all 7 domains
→ detects all gaps
→ classifies by severity
→ auto-fixes CRITICAL and HIGH where authorized
→ queues the rest
→ generates daily report
→ writes report to ~/gap_reports/YYYY-MM-DD.md
→ alerts COMMX with summary
→ updates health score
Captain wakes up → reads report → makes decisions on queued items
The ship heals overnight. The Captain decides in the morning.
INVARIANTS
INV-01: GAPX never takes actions above its authorization level. Auto-fix is limited to: service restarts, model eviction, draft spec generation, log entries, alerts. Everything else queues for approval.
INV-02: GAPX never deletes files, modifies specs (only drafts new ones), changes firewall rules, sends external communications, or executes trades.
INV-03: The health score is deterministic. Same inputs always produce the same score. No subjective weighting.
INV-04: Every auto-fix is logged with timestamp, action taken, and reason. The Captain can audit every autonomous decision.
INV-05: GAPX runs AFTER LOOPX, not instead of it. LOOPX owns spec auditing. GAPX aggregates across all domains.
INV-06: If GAPX itself fails, the failure is logged and COMMX is alerted. The healer can get sick — but it reports its own symptoms.
RELATIONSHIP TO EXISTING MODULES
| Module | Relationship |
|---|---|
| LOOPX | GAPX consumes LOOPX output for D3 (specs). LOOPX remains the spec specialist. |
| MEDX | GAPX consumes MEDX output for D1 (infrastructure). MEDX remains the health specialist. |
| FORGEX | GAPX queries FORGEX for D2 (brains). |
| MNEMOSX | GAPX queries MNEMOSX for staleness checks. |
| CRONX | GAPX registers itself as a daily job. |
| COMMX | GAPX sends alerts and reports through COMMX. |
| SIMONX | GAPX queries SIMONX for trading wall status. |
| SPECX | GAPX queries SPECX for spec metadata. |
GAPX is not a replacement for any module. It is the AGGREGATOR that pulls signals from all of them into one coherent health picture.
THE NAME
GAP + X. The X suffix follows the T.O.O.L. naming convention. GAPX finds gaps and fills them. The name is the function.
Also: GAP → bridge a gap → connection → healing. GAPX is the ship's immune system.
FUTURE
When GAPX has enough historical data (30+ daily reports), it can identify TRENDS:
- "Specs are going stale faster than they're being written"
- "RAM pressure incidents correlating with Sisters sessions"
- "Revenue gap unchanged for 14 consecutive days"
Trend detection transforms GAPX from reactive healing to predictive maintenance. The ship doesn't just fix problems — it sees them coming.
Jeremy Zlabis
Chronogeometer · Visionary · Disruptor · Chief
42 Sisters AI · East York, Toronto
🍁 Φ 0.042