NEXUS Intelligence Engine

Three systems. One brain. Every number has a proof. Every dependency has a map. Every lesson is permanent. No other plumbing company on earth has this.

54 NODES • 60 EDGES • 2,808 RAG CHUNKS • 10 PROVEN FORMULAS

The Intelligence Stack

Three layers that turn scattered data into provable intelligence.

54
Graph Nodes
2,808
RAG Chunks
10
Proven Formulas
60
Dependency Edges
5
Trust Layers
🌐
Layer 1

Graph Brain

Maps every service, API, timer, database table, person, and KPI as a queryable network. Ask "what breaks if X fails?" and get the answer in milliseconds.

🧠 ANALOGY:

Like a city's electrical grid map. You don't guess which buildings go dark when a transformer fails -- you TRACE the circuit. The graph traces every data circuit in Nexus.

📚
Layer 2

RAG Brain

2,808 knowledge chunks with vector embeddings. 28 "brain chunks" encode operational wisdom: error patterns, fix recipes, prevention rules. Zeus searches it in 10 seconds.

🧠 ANALOGY:

Like a surgeon's case history database. Every surgery they've done, every complication they've seen, every technique that worked -- searchable in seconds before the next operation.

📐
Layer 3

Math Engine

Every financial formula exists in 3 formats: LaTeX (proof), Python (automation), Excel (Stephanie). Dimensional analysis catches unit errors. Bounds checking catches anomalies.

🧠 ANALOGY:

Like NASA's triple-redundant flight computers. Three independent systems must agree on every calculation. If any diverge, the mission aborts before the rocket explodes.

🌐 Graph Brain

54 nodes. 60 edges. The full nervous system mapped.

⚙️ Services (4) ⏰ Timers (8) 🔗 APIs (9) 💾 Tables (7) 📱 Pages (4) 👤 People (5)

💥 "What breaks if titan-sync-daemon fails?"

Blast radius: 9 systems

💣
titan-sync-daemon
ST data sync

⚠️ Depth 1: Direct Breaks

command-center dispatch-board tech-scoreboard custom-reports collections-dashboard

💾 Depth 2: Stale Tables

titan.jobs titan.customers titan.technicians titan.estimates

🚨 "What breaks if PostgreSQL fails?"

Blast radius: 14 systems -- everything.

🚨 TOTAL CASCADE FAILURE

PostgreSQL is the single point of failure. If it goes down: API dies, sync dies, RAG dies, all dashboards blank, all bots fail. Every node in the graph depends on PostgreSQL either directly or through titan-killer.

🧠 ANALOGY:

PostgreSQL is the spinal cord. The graph brain is the nervous system map. Before, we could injure the spine and not know which limbs would go numb. Now the graph shows every nerve path.

📚 RAG Brain

2,808 knowledge chunks. 28 brain chunks of operational wisdom.

🚨

Error Patterns (8)

Every failure that's happened, compressed into searchable knowledge. Phantom revenue, dispatch board empty, auto-tagger dry run, batch edit cascades.

"Dispatch Board Empty - technician_id Not Synced"
Similarity: 0.616 ✔️
🛡️

Prevention Rules (7)

"Before doing X, always check Y." Before revenue queries: check job_status filter. Before editing files: read them first. Before deploying: write to file, SCP, test.

"Before Reporting Working - Check Output"
Timer active ≠ working. Script runs ≠ effective.
🔧

API Gotchas (6)

ST tech IDs are local not ST. Vapi PATCH needs full model object. QB tokens expire hourly. WordPress snippets kill the site. 3CX uses OData v1.

"ST API - Tech IDs Are Local Not ST"
Local: 7 = Dan. ST: 57929980 = Dan.
🏗️

Architecture (3)

Data flow: ST -> Sync -> PostgreSQL -> API -> Frontend. Service map with all ports and timers. Capability maturity levels L1-L5.

⚖️

Data Integrity (4)

job_status filter mandatory. sold_by_id vs technician_id. Exclude cancels. QB is SSoT not ST.

🔄

Playbooks (2,632)

All 11 playbooks chunked and embedded. Field notes (130). SEO keywords (10). Investigation data. Strategy documents.

🧠 ANALOGY:

The RAG brain is like an immune system's antibody library. Every infection (failure) the system has fought creates antibodies (brain chunks) that protect against future infections. The more failures we survive, the stronger the immune response becomes. Auto-tagger was a "virus" -- now the antibody "Before Reporting Working - Check Output" prevents that class of infection permanently.

📐 Mathematical Truth Engine

Every number has a proof. Triple-format validation. Dimensional analysis. Anomaly detection.

💰 COST PER LEAD (CPL)
$$\text{CPL} = \frac{\text{Ad Spend}}{\text{Conversions}}$$
📜 LaTeX
\frac{\text{Ad Spend}}{\text{Conversions}}
🐍 Python
spend / max(conversions, 1)
📊 Excel
=B2/C2
Unit: $/lead • Expected range: $5 - $500 • Current BSP: $46.15/lead ✔️
📈 RETURN ON AD SPEND (ROAS)
$$\text{ROAS} = \frac{\text{Revenue Attributed}}{\text{Ad Spend}}$$
📜 LaTeX
\frac{R_{\text{attr}}}{S_{\text{ad}}}
🐍 Python
revenue / max(spend, 1)
📊 Excel
=D2/B2
Unit: dimensionless (x) • Expected range: 0.5x - 100x • Current BSP: 34.7x ✔️
💵 OPERATING MARGIN
$$\text{Margin} = \frac{R - \text{COGS} - \text{OpEx}}{R} \times 100$$
📜 LaTeX
\frac{R - C - O}{R} \times 100
🐍 Python
((rev-cogs-opex)/rev)*100
📊 Excel
=((D2-J2-K2)/D2)*100
Unit: % • Expected range: -50% to 60% • QB Q1 2026: -5.5% ⚠️
📅 ANNUALIZED REVENUE
$$R_{\text{annual}} = R_{\text{period}} \times \frac{365}{\text{days in period}}$$
📜 LaTeX
R_p \times \frac{365}{d}
🐍 Python
period_rev * (365/days)
📊 Excel
=D2*(365/L2)

⚖️ Dimensional Analysis

Every number carries its unit. Invalid operations are caught before they execute.

$ ÷ leads = $/lead ✔️ VALID (CPL)
$ ÷ $ = dimensionless ✔️ VALID (ROAS)
$ + leads = ??? ❌ INVALID
jobs ÷ leads = jobs/lead ✔️ VALID (Booking Rate)
🧠 ANALOGY:

Dimensional analysis is how physicists catch errors before rockets crash. NASA's Mars Climate Orbiter burned up because one team used pounds, another used newtons. Nobody checked the units. Our math engine checks units on EVERY operation. You literally cannot add dollars to leads -- the system rejects it.

🔒 5-Layer Trust Chain

Every number Stephanie sees passed through 5 validation layers.

🚨 Live Validation: Q1 2026 Revenue

❌ CERTIFICATION: FAILED

Completion Rate
0.8%
Expected: >50%. ST workflow broken.
Zero Invoice Rate
59.6%
776 of 1,301 jobs have $0 invoices

Root cause: Techs not clicking "Done" in ServiceTitan. Revenue is UNDERSTATED. ST shows $27,949 completed. QB shows $332,943 income. The $305K gap is unclosed jobs.

🧠 ANALOGY:

The trust chain is like a pharmaceutical drug approval process. A drug doesn't go from lab to patient on a hunch. It passes through 5 phases of clinical trials, each one more rigorous than the last. Any phase fails, the drug doesn't ship. Our numbers work the same way -- any layer fails, the number doesn't reach Stephanie.

🎯 Context Harness

The anti-scatterbrain system. Minimum context, maximum precision.

Without Harness

50,000 tokens of background dumped into every prompt. CLAUDE.md, memory files, meeting notes, all 40+ memory entries. Claude sifts through noise, misses the signal, edits the wrong file, breaks a downstream system it didn't know existed.

50K
tokens per prompt
✔️

With Harness

Intent parsed. Graph queried for dependencies. RAG queried for warnings. Math engine checked for applicable formulas. Only the 5-8 relevant nodes injected. Zero noise.

5K
tokens per prompt (90% reduction)
🧠 ANALOGY:

Without the harness, it's like a surgeon reading the entire medical encyclopedia before every operation. With the harness, it's like having a surgical briefing card that shows ONLY the patient's history, the procedure steps, and the known risks. Same surgeon. 10x more precise.

🧬 The Living Organism

Nexus isn't software. It's a biological system that grows smarter with every interaction.

🧠

Self-Awareness

Prefrontal Cortex

Tracks its own capabilities across 31 dimensions. Knows what it can and cannot do. Maturity levels L1-L5.

⚖️

Homeostasis

Thermostat

If ad spend spikes or conversion drops, detects the imbalance and triggers correction before it becomes a problem.

🛡️

Adaptive Immunity

Antibody Library

28 brain chunks from past failures. Auto-tagger dry run, phantom revenue, batch edit cascades -- all vaccinated against.

💾

Memory

Long-Term Storage

2,808 RAG chunks. Compresses raw data into actionable wisdom. Carries across sessions. Never asks the same question twice.

Event Reactor

Nervous Reflexes

8 timers running 24/7. Rain detected? Alert. Check overdue? DM. Daniel AI call? Intake formatted. Job stale? Closure bot.

🎯

Goal Pursuer

Predator Lock

$77K/week target. Every metric feeds the 3 equations: Revenue, ROAS, Profit. Recalculates the path every time numbers shift.

♻️

Content Metabolism

Digestive System

One field note becomes blog post, social media, GBP update, email content, ad copy, review response. One input, six outputs.

🧬

Evolution Engine

DNA Mutation

Graph grows new edges. RAG grows new chunks. Math engine grows new formulas. The system upgrades itself with every session.

🌐

Cross-Correlator

Neural Network

Connects Google Ads to ST revenue to weather to reviews. Finds patterns invisible to any single dashboard.

🔧

Auto-Repair

Lizard Regeneration

Crashed service? Restarted. Stale data? Refreshed. Token expired? Renewed. Self-healer runs every session.

💬

Slack Brain

Speech Center

Plain English interface. Ask Zeus in Slack, get an intelligent answer. No dashboards to learn. No logins to remember.

🔮

Predictive Intel

Weather Forecasting

Revenue trends, seasonal patterns, leading indicators. Tells you next week's problem before it becomes this week's emergency.

📊 Capability Maturity Roadmap

L1
Aware
Knows what's broken
L2
Reactive
Fixes when told
L3
Proactive
Fixes before it breaks
L4
Autonomous
Runs without humans
L5
Self-Evolving
Writes its own upgrades