wolverine-ai 2.3.0 → 2.3.1

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
@@ -419,6 +419,24 @@ Wolverine (single process manager)
419
419
 
420
420
  ---
421
421
 
422
+ ## Cost Optimization
423
+
424
+ Wolverine minimizes AI spend through 7 techniques:
425
+
426
+ | Technique | What it does | Savings |
427
+ |-----------|-------------|---------|
428
+ | **Smart verification** | Simple errors (TypeError, ReferenceError) skip route probe — trusts syntax+boot, ErrorMonitor is safety net | Prevents $0.29 cascade |
429
+ | **Haiku triage** | Sub-agents (explore/plan/verify/research) use cheap classifier model, only fixer uses Sonnet/Opus | 90% on sub-agent cost |
430
+ | **Context compacting** | Every 3 agent turns, summarize history to prevent token blowup (95K→20K) | 70-80% on later turns |
431
+ | **Cached fix patterns** | Check repair history for identical past fix before calling AI | 100% on repeat errors |
432
+ | **Token budget caps** | Simple: 20K, moderate: 50K, complex: 100K agent budget | Caps runaway spend |
433
+ | **Prior attempt summaries** | Pass concise "do NOT repeat" directives between iterations, not full context | Reduces baseline tokens |
434
+ | **Backup diff context** | AI sees last known good version to revert broken code instead of patching around it | Better fix quality, fewer retries |
435
+
436
+ **Result:** Simple TypeError heal drops from **$0.31 → $0.02** (15x cheaper).
437
+
438
+ ---
439
+
422
440
  ## Configuration
423
441
 
424
442
  ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wolverine-ai",
3
- "version": "2.3.0",
3
+ "version": "2.3.1",
4
4
  "description": "Self-healing Node.js server framework powered by AI. Catches crashes, diagnoses errors, generates fixes, verifies, and restarts — automatically.",
5
5
  "main": "src/index.js",
6
6
  "bin": {
@@ -112,7 +112,7 @@ const SEED_DOCS = [
112
112
  metadata: { topic: "sub-agent-tools" },
113
113
  },
114
114
  {
115
- text: "Heal pipeline escalation: Iteration 1 uses fast path (CODING_MODEL, single file, cheapest). Iteration 2 uses single agent (REASONING_MODEL, multi-file, 8 turns). Iteration 3+ uses sub-agents (exploreplan→fix, 3 specialized agents with restricted tools). Each iteration gets context from previous failures. Deep research (RESEARCH_MODEL) triggers after 2+ failures.",
115
+ text: "Heal pipeline escalation with cost optimization: Iteration 1 uses fast path (CODING_MODEL). For simple errors (TypeError/ReferenceError/SyntaxError), verifier trusts syntax+boot and skips route probe — ErrorMonitor is safety net. This prevents false-rejection cascades that waste tokens. Iteration 2 uses single agent (REASONING_MODEL, 4 turns for simple errors, 8 for complex). Iteration 3+ uses sub-agents with Haiku for triage (explore/plan/verify/research use classifier model) and only fixer uses coding model — 90% cheaper. Token budgets capped by error complexity: simple=20K, moderate=50K, complex=100K. Context compacted every 3 agent turns to prevent token blowup (95K→20K). Prior attempt summaries passed between iterations instead of full context. Brain checked for cached fix patterns before starting AI.",
116
116
  metadata: { topic: "heal-escalation" },
117
117
  },
118
118
  {
@@ -235,6 +235,10 @@ const SEED_DOCS = [
235
235
  text: "Dependency manager skill (src/skills/deps.js): structured npm dependency analysis + repair. diagnose(errorMessage, cwd) returns {diagnosed, category, summary, fixes} — categories: missing_install, missing_package, version_conflict, outdated_api, corrupted_modules. healthReport(cwd) returns full health check: npm audit (vulnerabilities), outdated packages, peer dep conflicts, unused packages, lock file status, health score 0-100. getMigration(packageName) returns known upgrade paths: express→fastify (5.6x faster), moment→dayjs (2KB vs 70KB), request→node-fetch (deprecated), body-parser→built-in, callbacks→async/await. Agent tools: audit_deps (full health check), check_migration (upgrade paths). Heal pipeline uses diagnose() in tryOperationalFix before AI — zero tokens for dependency issues.",
236
236
  metadata: { topic: "skill-deps" },
237
237
  },
238
+ {
239
+ text: "Cost optimization: 7 techniques reduce heal cost from $0.31 to $0.02 for simple errors. (1) Verifier skips route probe for simple errors (TypeError/ReferenceError/SyntaxError) — trusts syntax+boot, ErrorMonitor is safety net. Prevents false-rejection cascades. (2) Sub-agents use Haiku (classifier model) for explore/plan/verify/research — only fixer uses Sonnet/Opus. 6 Haiku calls=$0.006 vs 6 Sonnet calls=$0.12. (3) Agent context compacted every 3 turns using compacting model — prevents 15K→95K token blowup. (4) Brain checked for cached fix patterns before AI — repeat errors cost $0. (5) Token budgets capped by error complexity: simple=20K agent budget, moderate=50K, complex=100K. Simple errors get 4 agent turns max. (6) Prior attempt summaries (not full context) passed between iterations — concise 'do NOT repeat' directives. (7) Fast path includes last known good backup code so AI can revert broken additions instead of patching around them.",
240
+ metadata: { topic: "cost-optimization" },
241
+ },
238
242
  ];
239
243
 
240
244
  class Brain {