LEARNING & EVOLUTION

How KAE gets smarter over time — routing patterns promoted, instructions improved automatically

GHN Learning
Evolution System
Cost Impact
ACTIVE OBSERVATION FINGERPRINTS (tap "Observe" to accumulate)
Trigger observations above to see fingerprints accumulate
GHN PATTERN STORE (patterns table, kae.db)
PROMOTION RULES
Threshold: 3+ observations (via observe()) where EVERY routed guardian has a real executed success recorded via recordOutcome() → automatic promotion. Work that only sat in the queue never counts.
Confidence update (success): pattern.confidence + 0.02 (max 0.98)
Confidence update (failure): pattern.confidence − 0.05 (min 0.10) — losing hurts more than winning helps, on purpose
Fingerprint wildcard: Client names replaced with * for generalization
Max observations: 1,000 (sliding window — oldest dropped)
Effect: Promoted patterns run AUTONOMOUSLY — no API call needed
AMENDMENT LIFECYCLE — tap each step to expand
📊
1. GUARDIAN PRODUCES OUTPUT
A guardian (e.g. AETHER) runs on a file and writes a log with its analysis, flags, and recommendations.
// File: Guardian/AETHER/Logs/aether-log-20260624-153042.md // Contains: brand analysis, ICP fit score, narrative gaps // This output is the raw material for EVOLUTION
t=0 (every guardian run)
🔬
2. EVOLUTION EXTRACTS EVIDENCE
Every hour, the EVOLUTION pipeline (outcome-extractor.js + amendment-proposer.js) scans all guardian logs and extracts outcome signals: what worked, what failed, what was flagged repeatedly. EVOLUTION is a pipeline, not a 16th guardian.
// cron: 0 * * * * (hourly) // reads: Guardian/*/Logs/*.md (rendered from emit_result JSON) // extracts: success patterns, repeated flags, quality signals // writes to: evolution_queue table in kae.db
t+1 hour (hourly cron)
📤
3. BATCH SUBMITTED TO CLAUDE
batch-submitter.js sends accumulated evidence to Claude via the Message Batch API (50% discount). Each evidence item becomes an amendment proposal request.
// API: anthropic.messages.batches.create() // model: claude-haiku-4-5 (cost-efficient) // max_tokens: 256 per proposal // discount: 50% via Message Batch API // batch ID stored for polling
t+1 hour (same batch cycle)
⏳
4. POLLER CHECKS FOR COMPLETIONS
batch-poller.js runs every 10 minutes to check if the Claude batch has completed. Batch API results are typically ready within 1-2 hours.
// cron: */10 * * * * (every 10 min) // calls: anthropic.messages.batches.retrieve(batchId) // status: processing | ended // on ended: retrieve results and process proposals
t+1h10m to t+3h (polling)
📝
5. PROPOSALS WRITTEN FOR HUMAN REVIEW
Claude's amendment suggestions are written as .md files to Systems/Guardian/GAIA/Amendments/. Each proposal includes: what to change, why, and what evidence supports it.
// File: Guardian/GAIA/Amendments/amendment-20260624.md // Contains: // Target: AETHER/instructions/AUDIT.md // Proposed change: "Add proof point requirement to audit checklist" // Evidence: "14 logs showed missing proof point flags" // Status: pending ← human reviews this
~t+2h (after batch completes)
✅
6. HUMAN APPROVES
A human reads the proposal and sets "Status: approved" in the amendment file. The amendment watcher detects this change and triggers the writer.
// Human edits the file: // Status: pending → Status: approved // // amendment-watcher.js detects the save // triggers: amendment-writer.js // no further human action needed
Human-paced (daily digest at 05:30 SAST)
🚀
7. INSTRUCTION FILE UPDATED
amendment-writer.js applies the approved change directly to the guardian's instruction .md file. The next time that guardian runs, it uses the improved instructions.
// Before: AETHER/instructions/AUDIT.md (v1) // After: AETHER/instructions/AUDIT.md (v2, +proof point rule) // // Change logged to pattern_evolution table in SQLite // Next AETHER run: improved instructions in effect // Impact visible in subsequent logs
~seconds after approval
COST IMPACT OF AUTONOMOUS PATTERNS
Without Patterns
100%
of events require API calls
Every file change triggers a Claude API call. No pattern reuse. Full Sonnet token cost for every event.
With Mature Patterns
~25%
of events require API calls
High-confidence patterns (≥0.80) are reused autonomously. No API call needed. Estimated 75% cost reduction for known patterns.
0%75% API savings from pattern reuse100%
ADDITIONAL COST OPTIMIZATIONS
Model Tiering
Haiku for extraction (APOLLO, POSEIDON, MINERVA, OYA, YEMOJA, EVOLUTION). Sonnet for judgment (AETHER, HADES, MAAT, GAIA, ELEUTHIA, ARTEMIS, HERMES, DEMETER, ESHU, HEPHAESTUS). ~5× cost difference.
Message Batch API
EVOLUTION uses Batch API for amendment proposals — 50% discount vs real-time API. Processes up to 10,000 requests per batch.
Multi-Doc Batching
Strategy C: 3 files to same guardian = 1 API call. One prompt overhead vs three. Reduces cost by up to 60% for batched events.
Token Limits
Per-guardian caps: 256 (EVOLUTION), 300 (POSEIDON, OYA), 512 (MINERVA, ARTEMIS, ELEUTHIA, HERMES, DEMETER, HEPHAESTUS, ESHU, YEMOJA), 768 (AETHER, HADES, MAAT), 1024 (GAIA only). Prevents unbounded spend.
Content Deduplication
Strategy B: same content within 1 hour is skipped entirely. Prevents re-processing unchanged files from frequent saves.
APOLLO Local-Only
APOLLO never makes API calls. All knowledge indexing is local. Every event that routes to APOLLO costs $0 in API spend.

🧒 Explain It Like I'm 10

KAE has two ways of learning: quick little habits, and slow careful improvements to its own instruction manuals.

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