GHN ROUTING INTELLIGENCE

How KAE decides which Guardian to call — signal extraction, pattern scoring, mode selection

INTERACTIVE DEMO — Select a file path to see routing in action
Systems/Clients/AFW/00-overview.md
Systems/Clients/TechCorp/campaign-plan.md
Systems/Clients/BlockedCo/engagement.md
Systems/Playbooks/demand-gen-v2.md
Systems/Brand/positioning-brief.md
Systems/Finance/invoices/invoice-2026-07.md
Systems/Legal/contracts/retainer-2026.md
Systems/HR/team/contractor-profile.md
STEP 1 — SIGNAL EXTRACTION from file path + content
Select a file above to begin...
STEP 2 — PATTERN SCORING (best match wins)
← Select a file to score patterns
STEP 3 — EXECUTION MODE (based on confidence)
⚡
AUTONOMOUS
score ≥ 0.80
Reuses learned pattern. No API call. Instant + free.
🔍
VERIFY
0.50 – 0.79
Calls Claude API. Guardian verifies & enriches the routing decision.
🌊
FULL
score < 0.50
Full guardian run. Complex analysis. No prior pattern confidence.
ROUTING DECISION
← Select a file to see routing decision
HOW THE GHN SCORING ALGORITHM WORKS
01
Extract Path Signals
Tokenize the file path. Each segment becomes a signal. "Clients" → client_file. "00-overview" → overview_file. "blocked" in content → blocked_status.
signals = extractSignals(filePath, fileContent)
// → ['client_file', 'overview_file', 'status:active']
02
Load All Routing Patterns
The patterns table in kae.db holds all seeded + learned routing rules — the single live rulebook. Each pattern has: event_type, file_pattern, context_signals, route_to[], confidence. ghn-patterns.json is only the original seed file used to import the starting set; it's not read at runtime.
patterns = db.loadPatterns()
// 20+ seeded patterns + learned patterns, all in SQLite
03
Score Each Pattern
For each pattern: check event_type match, check file_pattern match (path key parts), count signal hits, multiply by stored confidence. Highest score wins.
score = (signalHits / totalSignals) × pattern.confidence
if (score < 0.30) → default to APOLLO
04
Determine Execution Mode
score ≥ 0.80 = AUTONOMOUS (reuse cached pattern, skip API call). 0.50–0.79 = VERIFY (call Claude to validate). <0.50 = FULL (complete analysis).
mode = score >= 0.80 ? 'autonomous' : score >= 0.50 ? 'verify' : 'full'
05
Route to Guardians + Queue
Local-only guardians (APOLLO) run synchronously. API guardians are pushed to the 30s sliding window event queue. Routing decision logged to SQLite.
await router.route(file, content, eventType)
// → { primary: 'AETHER', guardians: ['AETHER', 'POSEIDON'], mode: 'verify', confidence: 0.72 }
06
Observe & Learn
Every routing decision is fingerprinted (wildcarded) and recorded via observe(). After 3+ observations where every routed guardian has a REAL executed success recorded via recordOutcome() — work that only sat in the queue never counts — the pattern is promoted into the patterns table in kae.db as a permanent routing rule.
fingerprint: 'change::Clients/*/00-overview.md'
// count:3, real_success_rate:1.0 → PROMOTED to kae.db

🧒 Explain It Like I'm 10

The GHN router is a smart mail sorter. It looks at every letter for clues — where it came from and which words are inside — then picks the right specialist to read it.

1. Black Box 2. Architecture 3. GHN Routing 4. Guardians 5. Event Pipeline 6. Queue 7. Learning 8. Monitors