agent-nuvira 1.14.6 → 1.15.0

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.
Files changed (172) hide show
  1. package/README.md +335 -62
  2. package/dist/agents/agents/mcp-agent.d.ts +82 -0
  3. package/dist/agents/agents/mcp-agent.d.ts.map +1 -0
  4. package/dist/agents/agents/mcp-agent.js +241 -0
  5. package/dist/agents/agents/mcp-agent.js.map +1 -0
  6. package/dist/agents/agents/planner.js +1 -1
  7. package/dist/agents/agents/planner.js.map +1 -1
  8. package/dist/agents/agents/skill-runner.d.ts +39 -0
  9. package/dist/agents/agents/skill-runner.d.ts.map +1 -0
  10. package/dist/agents/agents/skill-runner.js +154 -0
  11. package/dist/agents/agents/skill-runner.js.map +1 -0
  12. package/dist/agents/agents/writer.d.ts.map +1 -1
  13. package/dist/agents/agents/writer.js +35 -1
  14. package/dist/agents/agents/writer.js.map +1 -1
  15. package/dist/agents/orchestrator.d.ts +47 -0
  16. package/dist/agents/orchestrator.d.ts.map +1 -1
  17. package/dist/agents/orchestrator.js +139 -1
  18. package/dist/agents/orchestrator.js.map +1 -1
  19. package/dist/cli/chat.d.ts.map +1 -1
  20. package/dist/cli/chat.js +137 -19
  21. package/dist/cli/chat.js.map +1 -1
  22. package/dist/cli/ci.d.ts +99 -0
  23. package/dist/cli/ci.d.ts.map +1 -0
  24. package/dist/cli/ci.js +415 -0
  25. package/dist/cli/ci.js.map +1 -0
  26. package/dist/cli/config.d.ts.map +1 -1
  27. package/dist/cli/config.js +128 -2
  28. package/dist/cli/config.js.map +1 -1
  29. package/dist/cli/edit.d.ts.map +1 -1
  30. package/dist/cli/edit.js +25 -1
  31. package/dist/cli/edit.js.map +1 -1
  32. package/dist/cli/execute.d.ts +2 -0
  33. package/dist/cli/execute.d.ts.map +1 -1
  34. package/dist/cli/execute.js +33 -5
  35. package/dist/cli/execute.js.map +1 -1
  36. package/dist/cli/federation.d.ts +8 -0
  37. package/dist/cli/federation.d.ts.map +1 -1
  38. package/dist/cli/federation.js +186 -0
  39. package/dist/cli/federation.js.map +1 -1
  40. package/dist/cli/feedback.d.ts +22 -0
  41. package/dist/cli/feedback.d.ts.map +1 -0
  42. package/dist/cli/feedback.js +203 -0
  43. package/dist/cli/feedback.js.map +1 -0
  44. package/dist/cli/history.d.ts +8 -6
  45. package/dist/cli/history.d.ts.map +1 -1
  46. package/dist/cli/history.js +52 -14
  47. package/dist/cli/history.js.map +1 -1
  48. package/dist/cli/init.js +1 -1
  49. package/dist/cli/init.js.map +1 -1
  50. package/dist/cli/marketplace.d.ts +24 -0
  51. package/dist/cli/marketplace.d.ts.map +1 -0
  52. package/dist/cli/marketplace.js +273 -0
  53. package/dist/cli/marketplace.js.map +1 -0
  54. package/dist/cli/mcp.d.ts +25 -0
  55. package/dist/cli/mcp.d.ts.map +1 -0
  56. package/dist/cli/mcp.js +315 -0
  57. package/dist/cli/mcp.js.map +1 -0
  58. package/dist/cli/model-picker.d.ts.map +1 -1
  59. package/dist/cli/model-picker.js +11 -1
  60. package/dist/cli/model-picker.js.map +1 -1
  61. package/dist/cli/model.d.ts +74 -0
  62. package/dist/cli/model.d.ts.map +1 -0
  63. package/dist/cli/model.js +564 -0
  64. package/dist/cli/model.js.map +1 -0
  65. package/dist/cli/models.d.ts.map +1 -1
  66. package/dist/cli/models.js +7 -1
  67. package/dist/cli/models.js.map +1 -1
  68. package/dist/cli/provider.d.ts +22 -0
  69. package/dist/cli/provider.d.ts.map +1 -0
  70. package/dist/cli/provider.js +317 -0
  71. package/dist/cli/provider.js.map +1 -0
  72. package/dist/cli/router.d.ts.map +1 -1
  73. package/dist/cli/router.js +32 -0
  74. package/dist/cli/router.js.map +1 -1
  75. package/dist/cli/security.d.ts +26 -0
  76. package/dist/cli/security.d.ts.map +1 -0
  77. package/dist/cli/security.js +175 -0
  78. package/dist/cli/security.js.map +1 -0
  79. package/dist/cli/skill.d.ts +29 -0
  80. package/dist/cli/skill.d.ts.map +1 -0
  81. package/dist/cli/skill.js +341 -0
  82. package/dist/cli/skill.js.map +1 -0
  83. package/dist/config/manager.d.ts +4 -4
  84. package/dist/config/manager.d.ts.map +1 -1
  85. package/dist/config/manager.js +35 -4
  86. package/dist/config/manager.js.map +1 -1
  87. package/dist/config/types.d.ts +39 -3
  88. package/dist/config/types.d.ts.map +1 -1
  89. package/dist/context/history.d.ts +55 -1
  90. package/dist/context/history.d.ts.map +1 -1
  91. package/dist/context/history.js +144 -2
  92. package/dist/context/history.js.map +1 -1
  93. package/dist/editing/ast.d.ts +40 -0
  94. package/dist/editing/ast.d.ts.map +1 -0
  95. package/dist/editing/ast.js +669 -0
  96. package/dist/editing/ast.js.map +1 -0
  97. package/dist/editing/diff.d.ts +22 -0
  98. package/dist/editing/diff.d.ts.map +1 -0
  99. package/dist/editing/diff.js +316 -0
  100. package/dist/editing/diff.js.map +1 -0
  101. package/dist/editing/edit.d.ts +55 -0
  102. package/dist/editing/edit.d.ts.map +1 -0
  103. package/dist/editing/edit.js +243 -0
  104. package/dist/editing/edit.js.map +1 -0
  105. package/dist/editing/types.d.ts +124 -0
  106. package/dist/editing/types.d.ts.map +1 -0
  107. package/dist/editing/types.js +141 -0
  108. package/dist/editing/types.js.map +1 -0
  109. package/dist/federation/a2a-client.d.ts +47 -0
  110. package/dist/federation/a2a-client.d.ts.map +1 -0
  111. package/dist/federation/a2a-client.js +200 -0
  112. package/dist/federation/a2a-client.js.map +1 -0
  113. package/dist/federation/a2a-server.d.ts +34 -0
  114. package/dist/federation/a2a-server.d.ts.map +1 -0
  115. package/dist/federation/a2a-server.js +294 -0
  116. package/dist/federation/a2a-server.js.map +1 -0
  117. package/dist/federation/a2a-types.d.ts +233 -0
  118. package/dist/federation/a2a-types.d.ts.map +1 -0
  119. package/dist/federation/a2a-types.js +145 -0
  120. package/dist/federation/a2a-types.js.map +1 -0
  121. package/dist/index.d.ts +37 -1
  122. package/dist/index.d.ts.map +1 -1
  123. package/dist/index.js +71 -0
  124. package/dist/index.js.map +1 -1
  125. package/dist/learning/context-pruner.d.ts +159 -0
  126. package/dist/learning/context-pruner.d.ts.map +1 -0
  127. package/dist/learning/context-pruner.js +273 -0
  128. package/dist/learning/context-pruner.js.map +1 -0
  129. package/dist/learning/error-repair.d.ts +152 -0
  130. package/dist/learning/error-repair.d.ts.map +1 -0
  131. package/dist/learning/error-repair.js +409 -0
  132. package/dist/learning/error-repair.js.map +1 -0
  133. package/dist/learning/hybrid-router.d.ts +22 -2
  134. package/dist/learning/hybrid-router.d.ts.map +1 -1
  135. package/dist/learning/hybrid-router.js +110 -23
  136. package/dist/learning/hybrid-router.js.map +1 -1
  137. package/dist/learning/provider-fallback.d.ts +149 -0
  138. package/dist/learning/provider-fallback.d.ts.map +1 -0
  139. package/dist/learning/provider-fallback.js +358 -0
  140. package/dist/learning/provider-fallback.js.map +1 -0
  141. package/dist/learning/self-improver.d.ts +16 -4
  142. package/dist/learning/self-improver.d.ts.map +1 -1
  143. package/dist/learning/self-improver.js +74 -4
  144. package/dist/learning/self-improver.js.map +1 -1
  145. package/dist/learning/skill-compiler.d.ts +57 -0
  146. package/dist/learning/skill-compiler.d.ts.map +1 -0
  147. package/dist/learning/skill-compiler.js +344 -0
  148. package/dist/learning/skill-compiler.js.map +1 -0
  149. package/dist/learning/skill-store.d.ts +90 -0
  150. package/dist/learning/skill-store.d.ts.map +1 -0
  151. package/dist/learning/skill-store.js +372 -0
  152. package/dist/learning/skill-store.js.map +1 -0
  153. package/dist/learning/skill-types.d.ts +114 -0
  154. package/dist/learning/skill-types.d.ts.map +1 -0
  155. package/dist/learning/skill-types.js +29 -0
  156. package/dist/learning/skill-types.js.map +1 -0
  157. package/dist/mcp/client.d.ts +118 -0
  158. package/dist/mcp/client.d.ts.map +1 -0
  159. package/dist/mcp/client.js +379 -0
  160. package/dist/mcp/client.js.map +1 -0
  161. package/dist/mcp/manager.d.ts +67 -0
  162. package/dist/mcp/manager.d.ts.map +1 -0
  163. package/dist/mcp/manager.js +215 -0
  164. package/dist/mcp/manager.js.map +1 -0
  165. package/dist/mcp/types.d.ts +172 -0
  166. package/dist/mcp/types.d.ts.map +1 -0
  167. package/dist/mcp/types.js +16 -0
  168. package/dist/mcp/types.js.map +1 -0
  169. package/dist/team/review.d.ts.map +1 -1
  170. package/dist/team/review.js +1 -2
  171. package/dist/team/review.js.map +1 -1
  172. package/package.json +23 -7
package/README.md CHANGED
@@ -22,7 +22,33 @@ agent-nuvira config list
22
22
  - **Codebase planning** that analyzes directory structure and generates implementation plans
23
23
  - **Multi-agent orchestration** — `agent-nuvira execute "goal"` runs a pipeline of planner, gatherer, writer, reviewer, tester, and more
24
24
  - **Response caching** via SQLite to reduce costs and latency
25
- - **Plugin system** for adding custom inference providers
25
+ - **Plugin system** with auto-discovery — drop `.js` files into `~/.buff/plugins/` for automatic loading
26
+ - **Project scaffolding** — `agent-nuvira init` generates starter projects with interactive template + provider selection
27
+ - **Context-preserving model switching** — `agent-nuvira model switch` changes providers mid-session without losing agent state
28
+ - **Skill compiler** — automatically extracts reusable patterns from successful agent runs into executable skills (`agent-nuvira skill run`)
29
+ - **Context-window memory pruner** — prevents long multi-agent chains from exceeding model token limits
30
+ - **Complete streaming support** — all 5 providers support real-time token-by-token output
31
+ - **Cost tracking** — per-provider/session/monthly costs with `agent-nuvira stats cost`
32
+ - **Prompt history search** — keyword and semantic search across past conversations (`/search`, `buff history`)
33
+ - **Native embedding support** — 3-tier embedder with `@huggingface/transformers` for 10x faster semantic search
34
+ - **Workflow template marketplace** — 10 built-in templates + GitHub registry with install/publish lifecycle
35
+ - **Model benchmarking** — 21 standardized coding tasks with scoring and A/B comparison
36
+ - **Docker sandbox isolation** — resource-limited, network-isolated container execution with 8 base images
37
+ - **Provider health dashboard** — `agent-nuvira doctor` with color-coded status, watch mode, and auto-fix
38
+ - **Memory compression & pruning** — automatic trajectory summarization with configurable retention policies
39
+ - **VS Code extension** — 9 commands, inline code suggestions, diff viewer, agent progress panel
40
+ - **Remote agent federation** — multi-machine collaboration with protocol, server, and client
41
+ - **Web UI dashboard** — React dashboard with DAG visualization, model health, cost charts, and history browser
42
+ - **Hybrid model routing** — intelligent model selection based on task complexity, cost, and availability
43
+ - **Team collaboration** — Git-synced shared config, memory, and review pipelines
44
+ - **Agent SDK** — `@agent-nuvira/sdk` npm package for building custom agents with scaffolding CLI
45
+ - **Provider CLI** — `buff provider list` with color-coded status table, `buff provider health` with per-provider diagnostics
46
+ - **Provider fallback routing** — automatic failover between providers with circuit breaker and configurable chain
47
+ - **Security scan CLI** — `buff security scan` detects PII, prompt injections, and dangerous code patterns
48
+ - **Feedback & rating system** — `buff feedback record/list/stats/clear` drives self-improvement scoring
49
+ - **Marketplace unified CLI** — `buff marketplace browse/search/install/info` for workflow templates + plugins
50
+ - **MCP (Model Context Protocol) integration** — connect to databases, APIs, and file systems via MCP servers
51
+ - **AST-aware code editing** — structural analysis engine understands functions, classes, methods across JS/TS/Python/Go/Rust
26
52
  - **Configuration** via JSON config file + environment variables
27
53
  - **No server dependency** — no telemetry, no subscriptions, no outbound calls to a hosted backend
28
54
 
@@ -68,13 +94,32 @@ Options:
68
94
  -h, --help display help for command
69
95
 
70
96
  Commands:
71
- chat [options] [prompt] Start an interactive chat session with AI
72
- edit [options] <file> Edit a file using AI assistance
73
- models [options] List available models from inference providers
74
- plan [options] [target] Generate an implementation plan for a codebase task
75
- execute [options] <goal> Execute a multi-agent pipeline for a goal
76
- config Manage Buff configuration
77
- cache Manage inference cache
97
+ chat [options] [prompt] Start an interactive chat session with AI
98
+ edit [options] <file> Edit a file using AI assistance
99
+ models [options] List available models from inference providers
100
+ plan [options] [target] Generate an implementation plan for a codebase task
101
+ execute [options] <goal> Execute a multi-agent pipeline for a goal
102
+ model Switch providers and manage active models
103
+ skill List, compile, and run reusable skill scripts
104
+ init [name] Scaffold a new project from a template
105
+ history Search and manage chat history
106
+ doctor Provider health dashboard
107
+ benchmark Run model benchmarks
108
+ workflow Workflow template marketplace
109
+ federation Remote agent federation
110
+ team Team collaboration
111
+ dashboard Launch web UI dashboard
112
+ memory Memory compression and stats
113
+ provider Provider list and health diagnostics
114
+ security Security scan for PII, injections, and dangerous code
115
+ feedback Feedback and rating system
116
+ marketplace Browse, search, and install plugins and workflows
117
+ mcp Model Context Protocol — connect to MCP servers
118
+ plugins Manage auto-discovered plugins
119
+ sandbox Docker sandbox management
120
+ sdk Agent SDK scaffolding
121
+ config Manage Buff configuration
122
+ cache Manage inference cache
78
123
  ```
79
124
 
80
125
  ---
@@ -384,6 +429,157 @@ agent-nuvira cache clear
384
429
 
385
430
  ---
386
431
 
432
+ ### `agent-nuvira model` — Context-Preserving Model Switching
433
+
434
+ Switch inference providers and models on the fly without losing conversation history, agent state, or session continuity. The active model persists across CLI restarts.
435
+
436
+ ```bash
437
+ # Show current active model + prompt to switch
438
+ agent-nuvira model
439
+
440
+ # List all providers with their status
441
+ agent-nuvira model list
442
+
443
+ # Interactive categorized model picker
444
+ agent-nuvira model switch
445
+
446
+ # Switch to a provider with its default model
447
+ agent-nuvira model switch groq
448
+
449
+ # Switch to a specific provider/model pair
450
+ agent-nuvira model switch groq/llama-3.3-70b-versatile
451
+
452
+ # Show detailed active configuration
453
+ agent-nuvira model info
454
+
455
+ # Get model routing recommendations
456
+ agent-nuvira model recommend
457
+
458
+ # Quick health check for the active provider
459
+ agent-nuvira model health
460
+ ```
461
+
462
+ **Priority chain:** CLI `--provider`/`--model` flags → `buff model switch` active state → default config file — the most specific wins.
463
+
464
+ ---
465
+
466
+ ### `agent-nuvira skill` — Skill Compiler System
467
+
468
+ Automatically convert successful agent execution trajectories into reusable, parameterized skill scripts. Skills are extracted by an LLM from high-scoring runs, saved to `~/.buff/skills/`, and invoked directly via the orchestrator.
469
+
470
+ ```bash
471
+ # List all compiled skills
472
+ agent-nuvira skill list
473
+
474
+ # Show a skill's definition and steps
475
+ agent-nuvira skill show "Add CLI Command"
476
+
477
+ # Run a skill with parameters (invokes the orchestrator)
478
+ agent-nuvira skill run "Add CLI Command" --params commandName=deploy --params description="Deploy to production"
479
+
480
+ # Manually trigger skill compilation from recent trajectories
481
+ agent-nuvira skill compile
482
+
483
+ # Search skills by keyword
484
+ agent-nuvira skill search "cli"
485
+
486
+ # Show skill quality scores
487
+ agent-nuvira skill quality
488
+
489
+ # Garbage-collect old/low-quality skills
490
+ agent-nuvira skill gc
491
+ ```
492
+
493
+ **How it works:** Every 8 successful orchestration runs, the Self-Improver automatically feeds the top-5 trajectories to the Skill Compiler. The LLM identifies reusable patterns and parameterizes them with `{{paramName}}` placeholders. Skills act as pre-built task plans that the orchestrator can execute on demand.
494
+
495
+ ---
496
+
497
+ ### `agent-nuvira init` — Project Scaffolding
498
+
499
+ Scaffold new projects from built-in templates with interactive prompts and provider selection. Supports custom template directories.
500
+
501
+ ```bash
502
+ # Interactive: name, template, and provider prompts
503
+ agent-nuvira init
504
+
505
+ # Name from CLI, interactive for template and provider
506
+ agent-nuvira init my-app
507
+
508
+ # Fully non-interactive
509
+ agent-nuvira init my-app --template node-api
510
+
511
+ # List all available templates
512
+ agent-nuvira init --list
513
+
514
+ # Use a custom template from a local directory
515
+ agent-nuvira init my-app --template custom --template-dir ~/my-templates
516
+ ```
517
+
518
+ **Built-in templates:**
519
+
520
+ | Template | Description |
521
+ |---|---|
522
+ | `node-cli` | Node.js CLI app with Commander + TypeScript |
523
+ | `ts-library` | TypeScript library with Vitest |
524
+ | `node-api` | Express REST API with TypeScript |
525
+ | `python-cli` | Python CLI app with Click + Poetry |
526
+ | `minimal` | Minimal TypeScript project (1 file) |
527
+
528
+ The command also generates a `.buffconfig.json` with your chosen provider and model, ready to use immediately.
529
+
530
+ ---
531
+
532
+ ## Docker Compose (5-Minute Onboarding)
533
+
534
+ Get the full Agent-Nuvira dashboard and CLI running with a single command — no Node.js or TypeScript setup required.
535
+
536
+ ```bash
537
+ # Clone and go
538
+ cp .env.example .env # Fill in your API keys
539
+ docker compose up # Build & launch at http://localhost:3030
540
+ ```
541
+
542
+ ### What you get
543
+
544
+ - **Dashboard UI** at `http://localhost:3030` — provider health, cost tracking, model benchmarks, memory browser
545
+ - **CLI** accessible via `docker compose run --rm agent-nuvira <command>`
546
+ - **Persistent data** — config, memory, cache, and history stored in a named volume
547
+ - **Health checks** — automatic dashboard status verification
548
+
549
+ ### Examples
550
+
551
+ ```bash
552
+ # Quick one-shot commands via Docker
553
+ docker compose run --rm agent-nuvira chat "explain recursion in Rust"
554
+ docker compose run --rm agent-nuvira models --provider groq
555
+ docker compose run --rm agent-nuvira execute "add a health check endpoint"
556
+
557
+ # With local inference (requires Ollama on host)
558
+ docker compose --profile ollama up
559
+ ```
560
+
561
+ ### Docker Compose Structure
562
+
563
+ | Feature | Details |
564
+ |---|---|
565
+ | **Base image** | `node:22-alpine` — slim, secure |
566
+ | **Stages** | 3-stage build: TypeScript compile → Vite dashboard → runtime |
567
+ | **Layer caching** | Dependency manifests copied before source for cache reuse |
568
+ | **Ollama profile** | `--profile ollama` adds an Ollama container; defaults to `host.docker.internal` |
569
+ | **Volume** | `agent-nuvira-data` at `/root/.buff` preserves all data |
570
+ | **Port** | `3030` mapped to dashboard server |
571
+ | **Health** | Node `fetch()` verifies dashboard API every 30s |
572
+
573
+ ### Configuration via Docker
574
+
575
+ Set API keys in `.env` (see `.env.example`) or pass them as environment variables:
576
+
577
+ ```bash
578
+ docker compose run --rm -e GROQ_API_KEY=gsk_xxx agent-nuvira chat "hello"
579
+ ```
580
+
581
+ ---
582
+
387
583
  ## Provider Details
388
584
 
389
585
  ### Local (Ollama)
@@ -513,8 +709,25 @@ agent-nuvira execute "add tests" --agent-model planner=gemini --agent-model writ
513
709
 
514
710
  # Use persistent memory across sessions
515
711
  agent-nuvira execute "fix the login bug" --memory
712
+
713
+ # Set a custom context window limit (default: 128,000 tokens)
714
+ agent-nuvira execute "refactor large codebase" --context-limit 256000
715
+
716
+ # Adjust pruning aggressiveness for long chains
717
+ agent-nuvira execute "build entire microservice" --context-prune medium
718
+ agent-nuvira execute "migrate database schema" --context-prune aggressive
516
719
  ```
517
720
 
721
+ **Context pruning flags:**
722
+
723
+ | Flag | Purpose | Default |
724
+ |---|---|---|
725
+ | `--context-limit <tokens>` | Max tokens before automatic pruning activates | 128000 |
726
+ | `--context-prune <mode>` | Prune aggressiveness: `soft` \| `medium` \| `aggressive` | `soft` |
727
+
728
+ The pruner automatically compresses the shared agent context between pipeline steps using 5 strategies: metadata stripping, file change collapsing, conversation truncation, artifact summarization, and aggressive fallback.
729
+
730
+
518
731
  The pipeline runs these agents in sequence (with parallelization where possible):
519
732
  1. **Planner** — Analyzes the goal, creates a task plan
520
733
  2. **Context Gatherer** — Scans the codebase for relevant files
@@ -547,40 +760,56 @@ Adapter Adapter Adapter Adapter Adapter
547
760
  Groq NVIDIA Google OpenRouter Ollama / HF /
548
761
  LPU NIM Gemini (free) APIs GGML Models
549
762
 
550
- ┌──────────────────────────┐
551
- │ Multi-Agent System │
552
- │ ┌────────────────────┐ │
553
- │ │ Orchestrator │ │
554
- │ │ ├─ Planner │ │
555
- │ │ ├─ ContextGather │ │
556
- │ │ ├─ Writer │ │
557
- │ │ ├─ Reviewer │ │
558
- │ │ ├─ Tester │ │
559
- │ │ ├─ Runner │ │
560
- │ │ ├─ Debugger │ │
561
- │ │ └─ GitAgent │ │
562
- │ └────────────────────┘ │
563
- │ │
564
- │ ┌────────────────────┐ │
565
- │ │ Memory System │ │
566
- │ │ ├─ Vector Store │ │
567
- │ │ ├─ Trajectory │ │
568
- │ │ └─ Embedder │ │
569
- │ └────────────────────┘ │
570
- │ │
571
- │ ┌────────────────────┐ │
572
- │ │ Self-Learning │ │
573
- │ │ ├─ Model Router │ │
574
- │ │ ├─ Pattern Extr. │ │
575
- │ │ └─ Scorer │ │
576
- │ └────────────────────┘ │
577
- │ │
578
- │ ┌────────────────────┐ │
579
- │ │ SQLite Cache │ │
580
- │ │ Multi-file Parser │ │
581
- │ │ Token Chunking │ │
582
- │ └────────────────────┘ │
583
- └──────────────────────────┘
763
+ ┌──────────────────────────────┐
764
+ │ Core Pipeline │
765
+ │ ┌────────────────────────┐ │
766
+ │ │ Orchestrator │ │
767
+ │ │ ├─ Planner │ │
768
+ │ │ ├─ ContextGather │ │
769
+ │ │ ├─ Writer │ │
770
+ │ │ ├─ Reviewer │ │
771
+ │ │ ├─ Tester │ │
772
+ │ │ ├─ Runner │ │
773
+ │ │ ├─ Debugger │ │
774
+ │ │ ├─ GitAgent │ │
775
+ │ │ └─ SkillRunner │ │
776
+ │ └────────────────────────┘ │
777
+ │ │
778
+ │ ┌────────────────────────┐ │
779
+ │ │ Memory System │ │
780
+ │ │ ├─ Vector Store │ │
781
+ │ │ ├─ Trajectory/Store │ │
782
+ │ │ └─ Embedder │ │
783
+ │ └────────────────────────┘ │
784
+ │ │
785
+ │ ┌────────────────────────┐ │
786
+ │ │ Self-Learning │ │
787
+ │ │ ├─ Model Router │ │
788
+ │ │ ├─ Pattern Extractor │ │
789
+ │ │ ├─ Scorer │ │
790
+ │ │ └─ Skill Compiler │ │
791
+ │ └────────────────────────┘ │
792
+ │ │
793
+ │ ┌────────────────────────┐ │
794
+ │ │ Context Mgmt │ │
795
+ │ │ ├─ ContextPruner │ │
796
+ │ │ ├─ SQLite Cache │ │
797
+ │ │ ├─ Multi-file Parser │ │
798
+ │ │ └─ Token Chunking │ │
799
+ │ └────────────────────────┘ │
800
+ │ │
801
+ │ ┌────────────────────────┐ │
802
+ │ │ CLI Layer │ │
803
+ │ │ ├─ buff init │ │
804
+ │ │ ├─ buff model │ │
805
+ │ │ └─ buff skill │ │
806
+ │ └────────────────────────┘ │
807
+ │ │
808
+ │ ┌────────────────────────┐ │
809
+ │ │ Docker Deployment │ │
810
+ │ │ └─ docker-compose.yml │ │
811
+ │ └────────────────────────┘ │
812
+ └──────────────────────────────┘
584
813
  ```
585
814
 
586
815
  ### Key Modules
@@ -593,9 +822,16 @@ Adapter Adapter Adapter Adapter Adapter
593
822
  | **Provider Factory** | `src/inference/factory.ts` | Instantiates the right adapter |
594
823
  | **Adapters** | `src/inference/*-adapter.ts` | One per provider (Groq, NIM, Gemini, OpenRouter, Local) |
595
824
  | **Model Discovery** | `src/cli/models.ts` | Lists and searches models from all providers |
596
- | **Orchestrator** | `src/agents/orchestrator.ts` | Multi-agent pipeline coordinator |
825
+ | **Model Switch** | `src/cli/model.ts` | Context-preserving provider/model switching |
826
+ | **Project Scaffold** | `src/cli/init.ts` | Interactive project scaffolding with templates |
827
+ | **Skill Commands** | `src/cli/skill.ts` | List, compile, search, and run skill scripts |
828
+ | **Orchestrator** | `src/agents/orchestrator.ts` | Multi-agent pipeline coordinator (with context pruning) |
597
829
  | **Context Cache** | `src/context/cache.ts` | SQLite-backed response caching |
598
830
  | **Context Parser** | `src/context/parser.ts` | Multi-file reading, chunking, prioritization |
831
+ | **Context Pruner** | `src/learning/context-pruner.ts` | Token-aware context compression for long agent chains |
832
+ | **Skill Compiler** | `src/learning/skill-compiler.ts` | LLM-powered extraction of reusable patterns from trajectories |
833
+ | **Skill Store** | `src/learning/skill-store.ts` | Persistent skill storage with decay scoring |
834
+ | **Skill Runner Agent** | `src/agents/agents/skill-runner.ts` | Injects skill steps into the execution plan |
599
835
  | **Plugin Registry** | `src/plugins/registry.ts` | Pluggable third-party provider system |
600
836
  | **Logger** | `src/utils/logger.ts` | Colored, level-based logging |
601
837
 
@@ -769,7 +1005,7 @@ Then use it:
769
1005
  agent-nuvira chat --provider anthropic
770
1006
  ```
771
1007
 
772
- > **Note:** The plugin system is a *programmatic* API. To make plugins load automatically from a directory (discovery), you would add a plugin loader script that scans a `~/.buff/plugins/` directory and registers any plugins found.
1008
+ > **Note:** Plugins placed in `~/.buff/plugins/` are **auto-discovered** at CLI startup — no manual registration required. Programmatic registration via the Plugin Registry API is also supported for advanced use cases.
773
1009
 
774
1010
  ---
775
1011
 
@@ -794,29 +1030,33 @@ npm run dev # Build and run with tsx (fast)
794
1030
 
795
1031
  ```
796
1032
  src/
797
- ├── index.ts # Entry point
1033
+ ├── index.ts # Entry point & public exports
798
1034
  ├── cli/
799
1035
  │ ├── router.ts # Command registration & provider resolution
800
1036
  │ ├── commands.ts # Base command class
801
1037
  │ ├── chat.ts # Interactive chat
802
1038
  │ ├── edit.ts # File editing
803
1039
  │ ├── models.ts # Model discovery (list/search models)
1040
+ │ ├── model.ts # Context-preserving model switching
1041
+ │ ├── skill.ts # Skill compilation & execution
1042
+ │ ├── init.ts # Project scaffolding
804
1043
  │ ├── plan.ts # Implementation plans
805
1044
  │ ├── config.ts # Configuration management
806
- │ ├── execute.ts # Multi-agent orchestration
1045
+ │ ├── execute.ts # Multi-agent orchestration (with context pruning)
807
1046
  │ └── cache.ts # Cache management
808
1047
  ├── agents/
809
1048
  │ ├── agent.ts # Abstract Agent + types
810
1049
  │ ├── orchestrator.ts # Multi-agent pipeline coordinator
811
1050
  │ ├── context-vault.ts # Shared context bus
812
1051
  │ └── agents/
813
- │ ├── planner.ts # PlannerAgent
1052
+ │ ├── planner.ts # PlannerAgent
814
1053
  │ ├── context-gatherer.ts
815
- │ ├── writer.ts # WriterAgent
816
- │ ├── reviewer.ts # ReviewerAgent
817
- │ ├── runner.ts # RunnerAgent
818
- │ ├── tester.ts # TesterAgent
819
- │ ├── debugger.ts # DebuggerAgent
1054
+ │ ├── writer.ts # WriterAgent
1055
+ │ ├── reviewer.ts # ReviewerAgent
1056
+ │ ├── runner.ts # RunnerAgent
1057
+ │ ├── tester.ts # TesterAgent
1058
+ │ ├── debugger.ts # DebuggerAgent
1059
+ │ ├── skill-runner.ts # SkillRunnerAgent (injects skill steps)
820
1060
  │ ├── git-agent.ts
821
1061
  │ ├── package-agent.ts
822
1062
  │ ├── github-release-agent.ts
@@ -827,6 +1067,7 @@ src/
827
1067
  ├── inference/
828
1068
  │ ├── interface.ts # InferenceProvider contract
829
1069
  │ ├── factory.ts # Provider instantiation
1070
+ │ ├── sse.ts # Server-sent events streaming
830
1071
  │ ├── groq-adapter.ts # Groq LPU
831
1072
  │ ├── nim-adapter.ts # NVIDIA NIM
832
1073
  │ ├── gemini-adapter.ts # Google Gemini
@@ -834,10 +1075,15 @@ src/
834
1075
  │ └── local-adapter.ts # Ollama / HuggingFace / GGML
835
1076
  ├── context/
836
1077
  │ ├── cache.ts # SQLite response cache
837
- │ └── parser.ts # Multi-file context parsing
1078
+ │ ├── parser.ts # Multi-file context parsing
1079
+ │ └── history.ts # Chat history persistence
838
1080
  ├── plugins/
839
1081
  │ └── registry.ts # Plugin registration system
840
1082
  ├── learning/
1083
+ │ ├── skill-compiler.ts # LLM-powered skill extraction from trajectories
1084
+ │ ├── skill-store.ts # Persistent skill storage with decay scoring
1085
+ │ ├── skill-types.ts # Skill type definitions
1086
+ │ ├── context-pruner.ts # Token-aware context compression
841
1087
  │ ├── model-router.ts # Adaptive model routing
842
1088
  │ ├── scorer.ts # Trajectory scoring
843
1089
  │ ├── pattern-extractor.ts
@@ -858,7 +1104,7 @@ src/
858
1104
  ### Testing
859
1105
 
860
1106
  ```bash
861
- # Run all tests (115+ tests)
1107
+ # Run all tests (1150+ tests)
862
1108
  npm test
863
1109
 
864
1110
  # Watch mode
@@ -875,14 +1121,41 @@ npx tsc --noEmit
875
1121
 
876
1122
  ## Roadmap
877
1123
 
878
- - [x] **Groq integration** — fast LPU inference for open-source models
879
- - [x] **Multi-agent orchestration** — plan, write, review, test, and publish
880
- - [x] **Model discovery** — search and filter across all providers
881
- - [ ] **Streaming support** — real-time token-by-token output in chat mode
882
- - [ ] **Auto-discovery plugin loader** — scan `~/.buff/plugins/` for `.js` plugin files
883
- - [ ] **Hybrid routing** — automatically route small prompts to local models and complex ones to cloud
884
- - [ ] **Local telemetry** — usage logs stored locally (no server upload)
885
- - [ ] **Provider health checks** — `agent-nuvira doctor` to verify all configured providers
1124
+ **Phases 1–3 (25 phases) are complete.** Phase 4 (Industry Standards & Autonomous Polish) is in progress. See [UPGRADE_ROADMAP.md](./UPGRADE_ROADMAP.md) for the full implementation journey.
1125
+
1126
+ | Phase | Feature | Status |
1127
+ |---|---|---|
1128
+ | **Phase 1: Quick Wins** | | |
1129
+ | 1.1 | Auto-discovery plugin loader — drop `.js` into `~/.buff/plugins/` | ✅ Complete |
1130
+ | 1.2 | Complete streaming support — all 5 providers | ✅ Complete |
1131
+ | 1.3 | Cost tracking — per-provider/session/monthly | ✅ Complete |
1132
+ | 1.4 | `buff init` — interactive project scaffolding | ✅ Complete |
1133
+ | 1.5 | Prompt history search — keyword + semantic | ✅ Complete |
1134
+ | 1.6 | Skill compiler — auto-extract reusable patterns from trajectories | ✅ Complete |
1135
+ | 1.7 | Context-window memory pruner — prevent OOM in long chains | ✅ Complete |
1136
+ | 1.8 | Context-preserving model switching — mid-session provider changes | ✅ Complete |
1137
+ | **Phase 2: Structural Changes** | | |
1138
+ | 2.1 | Native embedding support — 3-tier embedder (Xenova/Python/LLM) | ✅ Complete |
1139
+ | 2.2 | Workflow template marketplace — 10 templates + registry | ✅ Complete |
1140
+ | 2.3 | Model benchmarking — 21 tasks, scoring, A/B comparison | ✅ Complete |
1141
+ | 2.4 | Docker sandbox isolation — resource limits, network isolation, 8 images | ✅ Complete |
1142
+ | 2.5 | Provider health dashboard — `buff doctor` | ✅ Complete |
1143
+ | 2.6 | Memory compression & pruning — trajectory summarization | ✅ Complete |
1144
+ | **Phase 3: Major Upgrades** | | |
1145
+ | 3.1 | VS Code extension — 9 commands, inline suggestions, diff viewer | ✅ Complete |
1146
+ | 3.2 | Remote agent federation — multi-machine collaboration | ✅ Complete |
1147
+ | 3.3 | Web UI dashboard — React + Recharts + DAG visualization | ✅ Complete |
1148
+ | 3.4 | Hybrid model routing — complexity-based model selection | ✅ Complete |
1149
+ | 3.5 | Team collaboration — shared config, memory, and review pipelines | ✅ Complete |
1150
+ | 3.6 | Agent SDK — `@agent-nuvira/sdk` npm package + scaffolding | ✅ Complete |
1151
+ | 3.7 | Provider CLI (`buff provider list/health`) | ✅ Complete |
1152
+ | 3.8 | Provider fallback routing — auto-failover with circuit breaker | ✅ Complete |
1153
+ | 3.9 | Security scan CLI (`buff security scan`) | ✅ Complete |
1154
+ | 3.10 | Feedback & rating system (`buff feedback`) | ✅ Complete |
1155
+ | 3.11 | Marketplace unified CLI (`buff marketplace browse/search/install`) | ✅ Complete |
1156
+ | **Phase 4: Industry Standards** | *(in progress)* | |
1157
+ | 4.1 | MCP (Model Context Protocol) integration — MCP client/manager/CLI | ✅ Complete |
1158
+ | 4.2 | AST-aware code editing — structural analysis engine (JS/TS/Python/Go/Rust) | ✅ Complete |
886
1159
 
887
1160
  ---
888
1161
 
@@ -0,0 +1,82 @@
1
+ /**
2
+ * MCPAgent — Invokes MCP (Model Context Protocol) tools during orchestration.
3
+ *
4
+ * This agent reads a tool-call request from context.metadata.mcpRequest,
5
+ * calls the MCP Manager's connected servers to execute the tool, and
6
+ * stores the result in context.metadata.mcpResult.
7
+ *
8
+ * The PlannerAgent can schedule mcp-agent steps when it knows MCP tools
9
+ * are available. The orchestrator injects available MCP tool descriptions
10
+ * into context.metadata.mcpTools before any agent runs.
11
+ *
12
+ * Usage in task plans:
13
+ * ```json
14
+ * {
15
+ * "id": "mcp-read-files",
16
+ * "description": "Use MCP filesystem tool to read project files: callTool('read_file', { path: '/path/to/project/package.json' })",
17
+ * "agentType": "mcp",
18
+ * "dependsOn": []
19
+ * }
20
+ * ```
21
+ *
22
+ * The tool name and arguments can be specified in:
23
+ * 1. context.metadata.mcpRequest — { tool: string, args?: Record<string, unknown> }
24
+ * 2. Parsed from the task description (e.g., "callTool('read_file', ...)")
25
+ * 3. Interactive selection if multiple MCP tools are available
26
+ */
27
+ import { Agent, type AgentContext, type AgentResult } from '../agent.js';
28
+ import type { LLMCallFn } from '../agent.js';
29
+ export declare class MCPAgent extends Agent {
30
+ readonly name = "MCP";
31
+ readonly description = "Invokes MCP (Model Context Protocol) tools from connected servers";
32
+ execute(context: AgentContext, _callLLM: LLMCallFn): Promise<AgentResult>;
33
+ /**
34
+ * Determine which MCP tool to call and with what arguments.
35
+ *
36
+ * Priority:
37
+ * 1. context.metadata.mcpRequest — explicit programmatic request
38
+ * 2. Parsed from the task description (callTool(...) pattern)
39
+ * 3. null — just list available tools
40
+ */
41
+ private determineToolRequest;
42
+ /**
43
+ * Parse a tool call from the task description.
44
+ * Supports formats:
45
+ * - "callTool('read_file', { path: '/tmp/test.txt' })"
46
+ * - "Use MCP filesystem tool: callTool read_file with path=/tmp/test.txt"
47
+ * - Simply the tool name as the first word of the description
48
+ */
49
+ private parseToolCallFromDescription;
50
+ }
51
+ /** A discovered MCP tool with its server context */
52
+ export interface McpToolEntry {
53
+ server: string;
54
+ tool: {
55
+ name: string;
56
+ description?: string;
57
+ inputSchema?: Record<string, unknown>;
58
+ };
59
+ }
60
+ /** The result of an MCP tool call */
61
+ export interface McpToolResult {
62
+ server: string;
63
+ tool: string;
64
+ args?: Record<string, unknown>;
65
+ result: {
66
+ content: Array<{
67
+ type: string;
68
+ text?: string;
69
+ data?: string;
70
+ mimeType?: string;
71
+ }>;
72
+ isError?: boolean;
73
+ };
74
+ }
75
+ /**
76
+ * Format a list of MCP tool entries into a human-readable string
77
+ * suitable for injection into LLM prompts.
78
+ *
79
+ * Truncated to MAX_MCP_FORMATTED_CHARS to avoid token bloat.
80
+ */
81
+ export declare function formatMcpToolsForPrompt(tools: McpToolEntry[]): string;
82
+ //# sourceMappingURL=mcp-agent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mcp-agent.d.ts","sourceRoot":"","sources":["../../../src/agents/agents/mcp-agent.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,EAAE,KAAK,EAAE,KAAK,YAAY,EAAE,KAAK,WAAW,EAAE,MAAM,aAAa,CAAC;AACzE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAM7C,qBAAa,QAAS,SAAQ,KAAK;IACjC,QAAQ,CAAC,IAAI,SAAS;IACtB,QAAQ,CAAC,WAAW,uEAAuE;IAErF,OAAO,CAAC,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,SAAS,GAAG,OAAO,CAAC,WAAW,CAAC;IAoF/E;;;;;;;OAOG;IACH,OAAO,CAAC,oBAAoB;IAwB5B;;;;;;OAMG;IACH,OAAO,CAAC,4BAA4B;CAmCrC;AAID,oDAAoD;AACpD,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE;QACJ,IAAI,EAAE,MAAM,CAAC;QACb,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KACvC,CAAC;CACH;AAED,qCAAqC;AACrC,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/B,MAAM,EAAE;QACN,OAAO,EAAE,KAAK,CAAC;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,IAAI,CAAC,EAAE,MAAM,CAAC;YAAC,IAAI,CAAC,EAAE,MAAM,CAAC;YAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;SAAE,CAAC,CAAC;QAClF,OAAO,CAAC,EAAE,OAAO,CAAC;KACnB,CAAC;CACH;AAKD;;;;;GAKG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,YAAY,EAAE,GAAG,MAAM,CA4ErE"}