Self-Evolving Multi-Agent AI Orchestration System
A production orchestration framework where AI agents coordinate, compete, evolve, and self-improve. Genetic algorithm prompt evolution, swarm immune system, trust contagion networks, constitutional evolution, and 50+ MCP tools.
14,000+ lines of JavaScript. 47 source files. 99 tests. Built solo. Source is private.
Note: This is a showcase repository. The source code is private. This README documents the architecture, capabilities, and design decisions.
Throne is a multi-agent orchestration system where specialized AI agents work together — and sometimes against each other — to solve complex problems. Unlike simple "chain-of-thought" agent systems, Throne implements real coordination primitives: shared memory, trust scoring, democratic voting, adversarial quality loops, and genetic evolution of prompts.
The system learns from every interaction and self-improves over time.
┌───────────────────────────────────────────────────────┐
│ MCP SERVER LAYER │
│ 50+ tools exposed via MCP protocol │
└───────────────────────┬───────────────────────────────┘
│
┌──────────────┼──────────────┐
▼ ▼ ▼
┌──────────────┐ ┌────────────┐ ┌──────────────┐
│ EVOLUTION │ │ IMMUNE │ │ TRUST │
│ ENGINE │ │ SYSTEM │ │ NETWORK │
│ │ │ │ │ │
│ Prompt DNA │ │ 5-rule │ │ Social graph │
│ Crossover │ │ anomaly │ │ Propagation │
│ Mutation │ │ detection │ │ Toxic pair │
│ Fitness │ │ Quarantine │ │ detection │
│ Selection │ │ Auto-heal │ │ Decay curves │
└──────┬───────┘ └─────┬──────┘ └──────┬───────┘
│ │ │
└───────────────┼───────────────┘
▼
┌───────────────────────────────┐
│ COORDINATION LAYER │
│ │
│ TAQL quality assessment │
│ Democratic voting │
│ Arena competitions │
│ Hierarchical delegation │
│ Consensus protocols │
└───────────────┬───────────────┘
▼
┌───────────────────────────────┐
│ MEMORY LAYER │
│ │
│ 7 SQLite tables │
│ HNSW vector search │
│ Knowledge compiler │
│ Graph ingester │
│ Temporal supersession │
└───────────────────────────────┘
Prompts are treated as DNA. The system runs genetic algorithms — crossover, mutation, selection — to evolve prompts that produce higher-quality outputs over time. Fitness is scored by TAQL (Throne Adversarial Quality Loop), where specialized critic agents evaluate outputs against quality criteria.
Every agent output goes through an adversarial quality assessment. Critic agents score outputs on correctness, completeness, clarity, and safety. Outputs that fail quality thresholds get rejected and re-generated. This prevents the "garbage in, garbage out" problem that plagues naive agent chains.
5-rule anomaly detection system inspired by biological immune systems. Detects agents that are producing bad outputs, hallucinating, or consuming excessive resources. Flagged agents get quarantined automatically. The system self-heals by replacing quarantined agents with fresh instances.
Agents exist in a social graph where trust propagates through connections. High-trust agents influence their neighbors positively. When an agent produces bad work, trust decays — and that decay spreads to agents that relied on the bad output. Toxic pair detection identifies agent combinations that consistently produce poor results together.
Agents can vote on decisions using configurable quorum rules. For competitive tasks, the Arena module runs multiple agents in parallel and selects the best output. This combines the wisdom-of-crowds approach with head-to-head competition.
The system builds a knowledge graph from everything it learns — 1,639 nodes, 3,219 edges, 94 clusters, 140 flows in the current production instance. The graph is searchable via HNSW vector search (pure JavaScript, no external dependencies).
Throne uses intelligent model routing to minimize costs:
| Model | Repos Analyzed | Cost/Repo | Cost/Learning | Use Case |
|---|---|---|---|---|
| Haiku | 22 | $0.016 | $0.0002 | Bulk analysis, classification |
| Opus | 4 | $1.32 | $0.073 | Deep reasoning, architecture |
Haiku is 365x more cost-efficient per learning extracted. The system routes tasks to the cheapest model that can handle them, escalating to expensive models only when necessary.
Throne exposes its full capability set as MCP (Model Context Protocol) tools, making it composable with any MCP-compatible system:
Agent Management — spawn, terminate, list, status, health check Memory — store, retrieve, search (HNSW vector), list, delete Evolution — evolve prompts, score fitness, crossover, mutate Quality — TAQL assess, critic score, threshold check Trust — score agents, propagate trust, detect toxic pairs Democracy — propose, vote, tally, quorum check Arena — compete agents, select winner, rank outputs Knowledge — compile, query graph, search nodes, traverse edges
| Metric | Value |
|---|---|
| Lines of Code | 14,000+ |
| Source Files | 47 |
| Tests | 99 (53 passing) |
| SQLite Tables | 7 |
| MCP Tools | 50+ |
| Knowledge Nodes | 1,639 |
| Knowledge Edges | 3,219 |
| Clusters | 94 |
| Local LLM Support | Ollama (qwen2.5:14b, gemma3:12b) |
In a recent autonomous session, Throne analyzed 26 open-source repositories and self-audited its own codebase:
- 1,918 commands executed autonomously
- $8.37 total cost for the entire session
- 1.5M tokens processed
- HNSW search improved ~100x
- Dashboard response improved ~16x
- 10 critical findings identified and patched
- 34 new error catches added
- +25% module connectivity improvement
All without human intervention.
Throne contains:
- Novel agent coordination algorithms
- Proprietary quality assessment heuristics
- Trust propagation formulas
- Genetic evolution parameters tuned through extensive experimentation
- Production knowledge graph data
The architecture and design philosophy are shared here. The implementation stays private.
Karim Lukita — One-person product studio. SaaS platforms, trading bots, AI orchestration, games. Design to deployment, shipped fast.