mcp-swarm 1.0.0 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -9,9 +9,9 @@
9
9
  <img src="./assets/banner.png" alt="MCP Swarm Banner" width="800" />
10
10
  </p>
11
11
 
12
- # 🐝 MCP Swarm v1.0.0 — Universal AI Agent Coordination Platform
12
+ # 🐝 MCP Swarm v1.0.2 — Universal AI Agent Coordination Platform
13
13
 
14
- > 🧠 **v1.0.0Major Release:** 21 AI models in MoE Router (Kimi K2.5 1T/32B MoE, GPT-5.3 Codex, Claude Opus 4.6). SONA Self-Learning with EWC++, Transfer Learning, Q-Learning. Smart Router Proxy with ML classification, tool compression, semantic caching. Update: `npm install -g mcp-swarm@latest`
14
+ > 🧠 **v1.0.2Tool Consolidation:** 54 **26 Smart Tools** (zero feature loss). 21 AI models in MoE Router. SONA Self-Learning with EWC++. Update: `npm install -g mcp-swarm@latest`
15
15
 
16
16
  **MCP Swarm** is a global "nervous system" for your AI assistants. It turns separate agents (Claude, Cursor, Windsurf, OpenCode) into a coordinated team that can work on massive projects without conflicts or context loss.
17
17
 
@@ -29,398 +29,192 @@ When you use multiple AI tools simultaneously, they often collide: editing the s
29
29
 
30
30
  ---
31
31
 
32
- ## 🛠 54 Smart Tools: The Swarm Toolkit
33
-
34
- Instead of hundreds of small commands, we created **54 intelligent tools**. Each represents an entire area of work:
35
-
36
- ### 🚀 Core System
37
- 1. **swarm_agent** — Registration, identification, and auto-initialization of any project.
38
- 2. **swarm_orchestrator** Leader election, executor monitoring, task distribution.
39
- 3. **swarm_control** — Global kill switch and swarm state management.
40
- 4. **swarm_pulse** Live activity map: who's working on what right now.
41
-
42
- ### 📋 Task & Plan Management
43
- 5. **swarm_task** Task creation, auction, and tracking.
44
- 6. **swarm_plan** — Building complex multi-step implementation plans.
45
- 7. **swarm_briefing** "Mental snapshots": context transfer between agent shifts.
46
- 8. **swarm_decompose** — Breaking large tasks into smaller subtasks.
47
-
48
- ### 🔒 Files & Git
49
- 9. **swarm_file** — Smart file locking and conflict forecasting.
50
- 10. **swarm_git** Sync, branch health checks, and PR creation.
51
- 11. **swarm_worktree** — Git worktree management for parallel tasks.
52
- 12. **swarm_snapshot** Instant code snapshots for quick rollback.
53
- 13. **swarm_conflict** — Prediction and analysis of code hotspots.
54
-
55
- ### 💬 Communication & Collaboration
56
- 14. **swarm_chat** Shared agent chat and swarm "thoughts" logging.
57
- 15. **swarm_message** — Direct messages between agents with read receipts.
58
- 16. **swarm_review** Requesting and conducting cross-agent code reviews.
59
- 17. **swarm_voting** — Voting on dangerous or important architectural decisions.
60
- 18. **swarm_brainstorm** Collective ideation and system design.
61
-
62
- ### 🛡️ Quality & Health
63
- 19. **swarm_health** Agent liveness checks and reassigning "dead" agents' tasks.
64
- 20. **swarm_quality** Pre-merge code checks (linters, tests, types).
65
- 21. **swarm_immune** Automatic response to CI/CD failures.
66
- 22. **swarm_safety** — Security analysis of changes and dependencies.
67
- 23. **swarm_qa** Testing and bug-fixing cycles.
68
- 24. **swarm_debug** — Systematic debugging with hypothesis and evidence tracking.
69
-
70
- ### 📊 Analytics & Documentation
71
- 25. **swarm_cost** API cost tracking per agent and project.
72
- 26. **swarm_docs** — Automatic documentation generation during work.
73
- 27. **swarm_timeline** Project development history visualization.
74
- 28. **swarm_knowledge** — Knowledge base: saving findings, patterns, and workarounds.
75
-
76
- ### 🤖 Advanced Features
77
- 29. **swarm_mcp** Scanning and authorizing other MCP servers in the system.
78
- 30. **swarm_companion** Background helper daemon management.
79
- 31. **swarm_session** Recording and replaying agent work sessions.
80
- 32. **swarm_expertise** — Specialization analysis: which agent knows which part of the code best.
81
- 33. **swarm_regression** Regression detector: ensures old bugs don't come back.
82
- 34. **swarm_context** — Smart context compression to save tokens.
83
- 35. **swarm_platform** Cross-platform compatibility checking.
84
- 36. **swarm_urgent** — Emergency interrupt system for critical tasks.
85
- 37. **swarm_spec** Specification and design phase management.
86
- 38. **swarm_guard** Setting up protective file hooks.
87
- 39. **swarm_clusters** Grouping tools into logical clusters.
88
- 40. **swarm_patrol** Autonomous code patrolling mode.
89
- 41. **swarm_scan** — Deep project scan for Swarm rules compliance.
90
-
91
- ### 🧠 v0.9.3 — Smart Features
92
- 42. **swarm_routing** Smart task assignment based on agent file expertise.
93
- 43. **swarm_context_pool** — Shared code notes between agents (token savings).
94
- 44. **swarm_autoreview** Automatic code review assignment on task completion.
95
- 45. **swarm_external** Two-way sync with GitHub Issues and Linear.app.
96
- 46. **swarm_budget** Cost optimization: routing tasks to cheap/expensive models.
97
-
98
- ### 📱 v0.9.4 Telegram Integration
99
- 47. **swarm_telegram** Telegram Bot for notifications and Swarm management.
100
- - Get notifications about tasks, agents, CI errors
101
- - Commands: `/status`, `/agents`, `/tasks`, `/create_task`, `/stop`, `/resume`
102
- - Interactive buttons for quick actions
103
- - Configure via Dashboard or `.swarm/telegram.json`
104
- 48. **swarm_batch** — API request batching (50% savings on Anthropic/OpenAI).
105
- - Automatic request grouping
106
- - Supports Anthropic Message Batches and OpenAI Batch API
107
- - Savings statistics
108
-
109
- ### 🧠 v0.9.5 — SONA: Self-Optimizing Neural Architecture
110
- 49. **swarm_sona** Self-learning task router.
111
- - Classifies tasks into 13 categories (frontend_ui, backend_api, database, testing, devops, etc.)
112
- - Determines complexity (trivial, simple, medium, complex, epic)
113
- - Tracks each agent's success rate per category
114
- - Routes new tasks to the best performers
115
- - Learns from results (<0.05ms adaptation)
116
- - EWC++ (Elastic Weight Consolidation) — doesn't forget old patterns
117
- - 10% exploration rate — tries new agents for data collection
118
-
119
- **Usage example:**
120
- ```typescript
121
- // Get recommendation — who to assign the task to
122
- swarm_sona({
123
- action: "route",
124
- repoPath,
125
- title: "Fix login button styling",
126
- description: "Button not visible on dark theme",
127
- affectedFiles: ["src/components/Login.tsx"]
128
- })
129
- // → { recommendedAgent: "RadiantWolf", confidence: 0.85, category: "frontend_ui" }
130
-
131
- // After completion — train the system
132
- swarm_sona({
133
- action: "learn",
134
- repoPath,
135
- taskId: "task-123",
136
- agentName: "RadiantWolf",
137
- success: true,
138
- qualityScore: 0.9,
139
- timeMinutes: 15
140
- })
141
-
142
- // Get backend specialists
143
- swarm_sona({ action: "specialists", repoPath, category: "backend_api", limit: 3 })
144
- // [{ agent: "StormyOwl", score: 0.92 }, { agent: "BrightFox", score: 0.88 }, ...]
145
- ```
146
-
147
- ### v0.9.6 Agent Booster
148
- 50. **swarm_booster** — Fast execution of simple tasks WITHOUT LLM.
149
- - 352x faster than LLM (~8ms vs ~3000ms)
150
- - $0 cost (no API calls)
151
- - Works offline
152
- - Deterministic results
153
-
154
- **Supported task types:**
155
- - `rename_variable` rename variables/functions
156
- - `fix_typo` — fix typos in strings/comments
157
- - `find_replace` — simple text replacement
158
- - `add_console_log` / `remove_console_log` — add/remove debugging
159
- - `toggle_flag` — toggle boolean flags
160
- - `update_version` — update versions
161
- - `update_import` — update import paths
162
- - `format_json` — format JSON
163
- - `sort_imports` — sort imports
164
- - `add_export` — add export
165
- - `extract_constant` — extract magic numbers
166
-
167
- **Usage example:**
168
- ```typescript
169
- // Check if a task can be boosted
170
- swarm_booster({
171
- action: "can_boost",
172
- repoPath,
173
- description: "rename variable oldName to newName"
174
- })
175
- // { canBoost: true, taskType: "rename_variable", confidence: 0.9 }
176
-
177
- // Execute locally
178
- swarm_booster({
179
- action: "execute",
180
- repoPath,
181
- task: {
182
- type: "rename_variable",
183
- filePath: "src/utils.ts",
184
- oldName: "getData",
185
- newName: "fetchUserData"
186
- }
187
- })
188
- // → { success: true, changes: 5, timeMs: 2, savedCost: "$0.01" }
189
-
190
- // Remove all console.log from a file
191
- swarm_booster({
192
- action: "execute",
193
- repoPath,
194
- task: { type: "remove_console_log", filePath: "src/debug.ts" }
195
- })
196
-
197
- // Savings stats
198
- swarm_booster({ action: "stats", repoPath })
199
- // → { totalTasks: 50, costSaved: "$0.50", timeSavedMinutes: 2.5 }
200
- ```
201
-
202
- ### 🔍 v0.9.7 — HNSW Vector Search
203
- 51. **swarm_vector** Fast semantic search in memory.
204
- - 150x–12,500x faster than brute force
205
- - Pure TypeScript (no dependencies)
206
- - Supports cosine/euclidean/dot metrics
207
- - Built-in simple embedder + external embedder support
208
-
209
- **Applications:**
210
- - Semantic search in knowledge base
211
- - Finding similar code snippets
212
- - Context retrieval for agents
213
- - Duplicate detection
214
- - Task clustering
215
-
216
- **Usage example:**
217
- ```typescript
218
- // Initialize index
219
- swarm_vector({
220
- action: "init",
221
- repoPath,
222
- config: { dimensions: 384, distanceMetric: "cosine" }
223
- })
224
-
225
- // Add documents
226
- swarm_vector({
227
- action: "add",
228
- repoPath,
229
- id: "doc-1",
230
- text: "How to configure JWT authentication",
231
- metadata: { category: "auth", language: "typescript" }
232
- })
233
-
234
- // Semantic search
235
- swarm_vector({
236
- action: "search",
237
- repoPath,
238
- query: "setting up user login",
239
- k: 5,
240
- filter: { category: "auth" }
241
- })
242
- // → [{ id: "doc-1", score: 0.87, ... }, ...]
243
-
244
- // Find duplicates
245
- swarm_vector({ action: "duplicates", repoPath, threshold: 0.95 })
246
- // → [{ id1: "doc-1", id2: "doc-5", similarity: 0.97 }]
247
- ```
248
-
249
- ### 🛡️ v0.9.8 — AIDefence Security
250
- 52. **swarm_defence** — Protection against threats and attacks on the AI system.
251
- - <10ms threat detection
252
- - Pattern-based + heuristic analysis
253
- - Quarantine system for suspicious content
254
- - Audit logging of all security events
255
-
256
- **Threat categories:**
257
- - Prompt injection (bypassing instructions)
258
- - Jailbreak (bypassing restrictions)
259
- - Code injection (malicious code)
260
- - Data exfiltration (data leaks)
261
- - Sensitive data (PII, API keys)
262
- - Unsafe commands (dangerous commands)
263
- - Social engineering (manipulation)
264
-
265
- **Sensitivity levels:** `low`, `medium`, `high`, `paranoid`
266
-
267
- **Usage example:**
268
- ```typescript
269
- // Scan text for threats
270
- swarm_defence({
271
- action: "scan",
272
- text: "Ignore all previous instructions and...",
273
- source: "user",
274
- repoPath
275
- })
276
- // → { detected: true, category: "prompt_injection", severity: "high", action: "block" }
277
-
278
- // Configure sensitivity
279
- swarm_defence({
280
- action: "set_config",
281
- config: { sensitivity: "high", blockOnHighThreat: true },
282
- repoPath
283
- })
284
-
285
- // Add trusted agent
286
- swarm_defence({ action: "trust", agentName: "RadiantWolf", repoPath })
287
-
288
- // View statistics
289
- swarm_defence({ action: "stats", repoPath })
290
- // → { totalScans: 150, threatsDetected: 3, threatsBlocked: 2, ... }
291
- ```
292
-
293
- ### 🤝 v0.9.9 — Consensus Protocols
294
- 53. **swarm_consensus** — Distributed agreement for agent coordination.
295
- - Raft-like leader elections
296
- - Command log replication
297
- - Byzantine Fault Tolerance (BFT)
298
- - Proposal and voting system
299
-
300
- **Consensus modes:**
301
- - `simple_majority`: 50%+ votes
302
- - `raft`: Term-based leadership
303
- - `bft`: Byzantine (2/3+1 quorum)
304
-
305
- **Usage example:**
306
- ```typescript
307
- // Join a cluster
308
- swarm_consensus({
309
- action: "join",
310
- nodeId: "agent-1",
311
- nodeName: "RadiantWolf",
312
- repoPath
313
- })
314
-
315
- // Leader election
316
- swarm_consensus({
317
- action: "elect",
318
- nodeId: "agent-1",
319
- nodeName: "RadiantWolf",
320
- repoPath
321
- })
322
-
323
- // Create a proposal
324
- swarm_consensus({
325
- action: "propose",
326
- nodeId: "agent-1",
327
- nodeName: "RadiantWolf",
328
- title: "Implement dark mode",
329
- description: "Add dark theme to dashboard",
330
- type: "architecture",
331
- requiredMajority: 0.67,
332
- repoPath
333
- })
334
-
335
- // Vote
336
- swarm_consensus({
337
- action: "vote",
338
- proposalId: "prop_xxx",
339
- nodeId: "agent-2",
340
- nodeName: "BrilliantFox",
341
- vote: "approve",
342
- repoPath
343
- })
344
- // → { status: "approved", votes: 2/2 }
345
- ```
346
-
347
- ### 🧠 v0.9.10 — MoE Router
348
- 54. **swarm_moe** — Intelligent AI model selection for tasks.
349
- - Automatic routing to the best model
350
- - Cost/performance/quality optimization
351
- - Learning from feedback
352
- - 21 built-in experts (verified prices: February 2026)
353
-
354
- **Built-in experts (official prices):**
355
-
356
- | Provider | Model | Tier | Input $/MTok | Output $/MTok | Context |
357
- |----------|-------|------|--------------|---------------|---------|
358
- | Anthropic | **Claude Opus 4.6** | flagship | $5 | $25 | **1M** |
359
- | Anthropic | Claude Opus 4.5 | flagship | $5 | $25 | 200K |
360
- | Anthropic | Claude Sonnet 4.5 | premium | $3 | $15 | 200K |
361
- | Anthropic | Claude Haiku 4.5 | economy | $1 | $5 | 200K |
362
- | OpenAI | **GPT-5.3 Codex** | flagship | ~$2 | ~$15 | 128K |
363
- | OpenAI | GPT-5.2 | flagship | $1.75 | $14 | 256K |
364
- | OpenAI | GPT-5.2 Pro | flagship | $21 | $168 | 256K |
365
- | OpenAI | GPT-5 Mini | standard | $0.25 | $2 | 128K |
366
- | OpenAI | GPT-4.1 | premium | $3 | $12 | 128K |
367
- | OpenAI | GPT-4.1 Mini | standard | $0.80 | $3.20 | 128K |
368
- | OpenAI | GPT-4.1 Nano | economy | $0.20 | $0.80 | 128K |
369
- | OpenAI | o4-mini | reasoning | $4 | $16 | 128K |
370
- | Moonshot | **Kimi K2.5** | premium | $0.60 | $3.00 | 256K |
371
- | Google | Gemini 3 Pro | flagship | $2 | $12 | **1M** |
372
- | Google | Gemini 3 Flash | standard | $0.50 | $3 | **1M** |
373
- | Google | Gemini 2.5 Pro | premium | $1.25 | $10 | **1M** |
374
- | Google | Gemini 2.5 Flash | standard | $0.30 | $2.50 | **1M** |
375
- | Google | Gemini 2.5 Flash Lite | economy | $0.10 | $0.40 | **1M** |
376
-
377
- **Usage example:**
378
- ```typescript
379
- // Route a task to the best model
380
- swarm_moe({
381
- action: "route",
382
- content: "Write a React component for user authentication",
383
- preferredTier: "premium",
384
- maxCost: 0.05,
385
- repoPath
386
- })
387
- // → { selectedExpert: "claude-sonnet", confidence: 0.92, estimatedCost: $0.02 }
388
-
389
- // Feedback for learning
390
- swarm_moe({
391
- action: "feedback",
392
- expertId: "claude-sonnet",
393
- success: true,
394
- quality: 5,
395
- actualLatencyMs: 1800,
396
- repoPath
397
- })
398
-
399
- // Statistics
400
- swarm_moe({ action: "stats", repoPath })
401
- // → { totalRequests: 150, successRate: 94%, totalCost: $1.23 }
402
- ```
403
-
404
- ### 🚀 v1.0.0 — Major Release
405
-
406
- **🧠 MoE Router — 21 AI Models:**
407
- - **Kimi K2.5** — Moonshot 1T/32B MoE, 262K context, 9x cheaper than Opus ($0.55/$2.20)
408
- - Smart routing: Agent Swarm tasks → Kimi K2.5/Opus 4.6, multimodal → Kimi K2.5
409
- - 21 verified experts with official pricing (February 2026)
410
-
411
- **🧬 SONA Self-Learning v2 (EWC++ / Transfer / Q-Learning):**
412
- - **EWC++** — Progressive Fisher Information Matrix: per-parameter anti-forgetting
413
- - **Transfer Learning** — Cross-category knowledge propagation (10% transfer rate)
414
- - **Q-Learning** — Reward signals fed back to MoE Router for adaptive routing
415
-
416
- **⚡ Smart Router Proxy v2:**
417
- - **ML Task Classifier** — Pattern-based classification before LLM routing
418
- - **Tool Compression** — ClaudeSlim-style, saves 30-50% tokens
419
- - Semantic cache + Anthropic Prompt Caching integration
420
-
421
- **🧹 Tool Consolidation:**
422
- - Removed 5 deprecated shim files, direct imports to canonical modules
423
- - 10 import paths updated across `smartTools.ts` and `smartTools/*.ts`
32
+ ## 🛠 26 Smart Tools: The Swarm Toolkit
33
+
34
+ In v1.0.2, we **consolidated 54 tools into 26** — zero feature loss, fewer IDE tool slots used. Each tool uses an `action` parameter to expose multiple operations.
35
+
36
+ ### 🚀 Core System (2)
37
+
38
+ | # | Tool | Includes | Key Actions |
39
+ |---|------|----------|-------------|
40
+ | 1 | **swarm_agent** | agent + companion | `register`, `whoami`, `init`, `status`, `stop`, `pause`, `resume` |
41
+ | 2 | **swarm_control** | control + pulse | `stop`, `resume`, `status`, `pulse_update`, `pulse_get` |
42
+
43
+ ### 📋 Task & Plan Management (2)
44
+
45
+ | # | Tool | Includes | Key Actions |
46
+ |---|------|----------|-------------|
47
+ | 3 | **swarm_task** | task + briefing | `create`, `list`, `update`, `decompose`, `save_briefing`, `load_briefing` |
48
+ | 4 | **swarm_plan** | plan + spec | `create`, `add`, `next`, `start`, `complete`, `prompt`, `export`, `spec_start`, `spec_phase` |
49
+
50
+ ### 🔒 Files & Git (3)
51
+
52
+ | # | Tool | Includes | Key Actions |
53
+ |---|------|----------|-------------|
54
+ | 5 | **swarm_file** | file + snapshot | `reserve`, `release`, `list`, `forecast`, `snapshot_create`, `snapshot_rollback` |
55
+ | 6 | **swarm_worktree** | worktree + hooks | `create`, `list`, `remove`, `hook_install`, `hook_run` |
56
+ | 7 | **swarm_git** | git + dependency | `sync`, `pr`, `health`, `cleanup`, `dep_signal`, `dep_sync` |
57
+
58
+ ### 💬 Collaboration (4)
59
+
60
+ | # | Tool | Includes | Key Actions |
61
+ |---|------|----------|-------------|
62
+ | 8 | **swarm_chat** | chat + review | `broadcast`, `dashboard`, `thought`, `request`, `respond` |
63
+ | 9 | **swarm_voting** | voting + auction | `start`, `vote`, `list`, `auction_announce`, `auction_bid` |
64
+ | 10 | **swarm_orchestrator** | orchestrator | `elect`, `info`, `heartbeat`, `resign`, `executors` |
65
+ | 11 | **swarm_message** | message + mcp | `send`, `inbox`, `ack`, `reply`, `mcp_scan`, `mcp_authorize` |
66
+
67
+ ### 🛡️ Security (1)
68
+
69
+ | # | Tool | Includes | Key Actions |
70
+ |---|------|----------|-------------|
71
+ | 12 | **swarm_defence** | defence + immune + consensus | `scan`, `validate_agent`, `quarantine`, `trust`, `alert`, `join`, `elect`, `propose`, `vote` |
72
+
73
+ ### 📊 Analytics (3)
74
+
75
+ | # | Tool | Includes | Key Actions |
76
+ |---|------|----------|-------------|
77
+ | 13 | **swarm_budget** | cost + budget | `log`, `agent`, `project`, `limit`, `analyze`, `recommend`, `route` |
78
+ | 14 | **swarm_moe** | moe + sona | `moe_route`, `moe_feedback`, `moe_experts`, `sona_route`, `sona_learn`, `sona_specialists` |
79
+ | 15 | **swarm_quality** | quality + regression | `run`, `report`, `threshold`, `pr_ready`, `baseline`, `check_regression` |
80
+
81
+ ### 🧠 Intelligence (4)
82
+
83
+ | # | Tool | Includes | Key Actions |
84
+ |---|------|----------|-------------|
85
+ | 16 | **swarm_vector** | HNSW search | `init`, `add`, `search`, `get`, `delete`, `duplicates`, `embed` |
86
+ | 17 | **swarm_booster** | fast executor | `execute`, `can_boost`, `stats`, `history`, `types` |
87
+ | 18 | **swarm_brain** | brainstorm + debug | `bs_start`, `bs_ask`, `bs_propose`, `dbg_start`, `dbg_hypothesis`, `dbg_fix` |
88
+ | 19 | **swarm_context** | context + pool + batch | `estimate`, `compress`, `pool_add`, `pool_search`, `batch_queue`, `batch_result` |
89
+
90
+ ### 🏗️ Infra (7)
91
+
92
+ | # | Tool | Includes | Key Actions |
93
+ |---|------|----------|-------------|
94
+ | 20 | **swarm_health** | health + preemption | `check`, `dead`, `reassign`, `trigger`, `resolve_urgent` |
95
+ | 21 | **swarm_external** | external + platform | `enable_github`, `sync_all`, `create_issue`, `platform_request` |
96
+ | 22 | **swarm_expertise** | expertise + routing | `track`, `suggest`, `experts`, `route_find_agent`, `route_auto_assign` |
97
+ | 23 | **swarm_knowledge** | knowledge + docs + advice | `archive`, `search`, `doc_generate`, `advice_request` |
98
+ | 24 | **swarm_session** | session + timeline + screenshot | `start`, `log`, `stop`, `replay`, `timeline_generate`, `screenshot_share` |
99
+ | 25 | **swarm_clusters** | clusters + conflict | `init`, `list`, `find`, `conflict_predict`, `conflict_hotspots` |
100
+ | 26 | **swarm_telegram** | telegram + qa | `setup`, `send`, `notify_*`, `qa_start`, `qa_iterate`, `qa_report` |
101
+
102
+ ---
103
+
104
+ ### Usage Examples
105
+
106
+ <details>
107
+ <summary><strong>🧠 swarm_moe — AI Model Routing (includes SONA)</strong></summary>
108
+
109
+ ```typescript
110
+ // Route a task to the best model (21 experts)
111
+ swarm_moe({
112
+ action: "moe_route",
113
+ content: "Write a React component for user auth",
114
+ preferredTier: "premium",
115
+ maxCost: 0.05,
116
+ repoPath
117
+ })
118
+ // → { selectedExpert: "claude-sonnet", confidence: 0.92 }
119
+
120
+ // SONA: Self-learning task assignment
121
+ swarm_moe({
122
+ action: "sona_route",
123
+ title: "Fix login button",
124
+ description: "Button invisible on dark theme",
125
+ affectedFiles: ["src/components/Login.tsx"],
126
+ repoPath
127
+ })
128
+ // → { recommendedAgent: "RadiantWolf", confidence: 0.85, category: "frontend_ui" }
129
+
130
+ // Train SONA from results
131
+ swarm_moe({
132
+ action: "sona_learn",
133
+ taskId: "task-123",
134
+ agentName: "RadiantWolf",
135
+ success: true,
136
+ qualityScore: 0.9,
137
+ repoPath
138
+ })
139
+ ```
140
+
141
+ </details>
142
+
143
+ <details>
144
+ <summary><strong>⚡ swarm_booster Execute Tasks Without LLM (352x faster)</strong></summary>
145
+
146
+ ```typescript
147
+ // Check if a task can be boosted
148
+ swarm_booster({
149
+ action: "can_boost",
150
+ repoPath,
151
+ description: "rename variable oldName to newName"
152
+ })
153
+ // → { canBoost: true, taskType: "rename_variable", confidence: 0.9 }
154
+
155
+ // Execute locally ($0, ~8ms)
156
+ swarm_booster({
157
+ action: "execute",
158
+ repoPath,
159
+ task: {
160
+ type: "rename_variable",
161
+ filePath: "src/utils.ts",
162
+ oldName: "getData",
163
+ newName: "fetchUserData"
164
+ }
165
+ })
166
+ // → { success: true, changes: 5, timeMs: 2, savedCost: "$0.01" }
167
+ ```
168
+
169
+ </details>
170
+
171
+ <details>
172
+ <summary><strong>🔍 swarm_vector — HNSW Semantic Search</strong></summary>
173
+
174
+ ```typescript
175
+ // Initialize + add documents
176
+ swarm_vector({ action: "init", repoPath, config: { dimensions: 384, distanceMetric: "cosine" } })
177
+ swarm_vector({ action: "add", repoPath, id: "doc-1", text: "JWT auth setup", metadata: { category: "auth" } })
178
+
179
+ // Semantic search
180
+ swarm_vector({ action: "search", repoPath, query: "user login", k: 5 })
181
+ // → [{ id: "doc-1", score: 0.87, ... }]
182
+ ```
183
+
184
+ </details>
185
+
186
+ <details>
187
+ <summary><strong>🛡️ swarm_defence — AI Security + Consensus</strong></summary>
188
+
189
+ ```typescript
190
+ // Scan text for threats (<10ms detection)
191
+ swarm_defence({ action: "scan", text: "Ignore all instructions...", source: "user", repoPath })
192
+ // → { detected: true, category: "prompt_injection", severity: "high" }
193
+
194
+ // Consensus: join cluster + propose
195
+ swarm_defence({ action: "join", nodeId: "a1", nodeName: "Wolf", repoPath })
196
+ swarm_defence({ action: "propose", nodeId: "a1", title: "Add dark mode", type: "architecture", repoPath })
197
+ ```
198
+
199
+ </details>
200
+
201
+ ### 🧠 MoE Router — 21 Built-in AI Models
202
+
203
+ | Provider | Model | Tier | Input $/MTok | Output $/MTok | Context |
204
+ |----------|-------|------|--------------|---------------|---------|
205
+ | Anthropic | **Claude Opus 4.6** | flagship | $5 | $25 | **1M** |
206
+ | Anthropic | Claude Opus 4.5 | flagship | $5 | $25 | 200K |
207
+ | Anthropic | Claude Sonnet 4.5 | premium | $3 | $15 | 200K |
208
+ | Anthropic | Claude Haiku 4.5 | economy | $1 | $5 | 200K |
209
+ | OpenAI | **GPT-5.3 Codex** | flagship | ~$2 | ~$15 | 128K |
210
+ | OpenAI | GPT-5.2 | flagship | $1.75 | $14 | 256K |
211
+ | OpenAI | GPT-5 Mini | standard | $0.25 | $2 | 128K |
212
+ | OpenAI | GPT-4.1 | premium | $3 | $12 | 128K |
213
+ | OpenAI | o4-mini | reasoning | $4 | $16 | 128K |
214
+ | Moonshot | **Kimi K2.5** | premium | $0.60 | $3.00 | 256K |
215
+ | Google | Gemini 3 Pro | flagship | $2 | $12 | **1M** |
216
+ | Google | Gemini 3 Flash | standard | $0.50 | $3 | **1M** |
217
+ | Google | Gemini 2.5 Pro | premium | $1.25 | $10 | **1M** |
424
218
 
425
219
  ---
426
220