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.
- package/README.md +335 -62
- package/dist/agents/agents/mcp-agent.d.ts +82 -0
- package/dist/agents/agents/mcp-agent.d.ts.map +1 -0
- package/dist/agents/agents/mcp-agent.js +241 -0
- package/dist/agents/agents/mcp-agent.js.map +1 -0
- package/dist/agents/agents/planner.js +1 -1
- package/dist/agents/agents/planner.js.map +1 -1
- package/dist/agents/agents/skill-runner.d.ts +39 -0
- package/dist/agents/agents/skill-runner.d.ts.map +1 -0
- package/dist/agents/agents/skill-runner.js +154 -0
- package/dist/agents/agents/skill-runner.js.map +1 -0
- package/dist/agents/agents/writer.d.ts.map +1 -1
- package/dist/agents/agents/writer.js +35 -1
- package/dist/agents/agents/writer.js.map +1 -1
- package/dist/agents/orchestrator.d.ts +47 -0
- package/dist/agents/orchestrator.d.ts.map +1 -1
- package/dist/agents/orchestrator.js +139 -1
- package/dist/agents/orchestrator.js.map +1 -1
- package/dist/cli/chat.d.ts.map +1 -1
- package/dist/cli/chat.js +137 -19
- package/dist/cli/chat.js.map +1 -1
- package/dist/cli/ci.d.ts +99 -0
- package/dist/cli/ci.d.ts.map +1 -0
- package/dist/cli/ci.js +415 -0
- package/dist/cli/ci.js.map +1 -0
- package/dist/cli/config.d.ts.map +1 -1
- package/dist/cli/config.js +128 -2
- package/dist/cli/config.js.map +1 -1
- package/dist/cli/edit.d.ts.map +1 -1
- package/dist/cli/edit.js +25 -1
- package/dist/cli/edit.js.map +1 -1
- package/dist/cli/execute.d.ts +2 -0
- package/dist/cli/execute.d.ts.map +1 -1
- package/dist/cli/execute.js +33 -5
- package/dist/cli/execute.js.map +1 -1
- package/dist/cli/federation.d.ts +8 -0
- package/dist/cli/federation.d.ts.map +1 -1
- package/dist/cli/federation.js +186 -0
- package/dist/cli/federation.js.map +1 -1
- package/dist/cli/feedback.d.ts +22 -0
- package/dist/cli/feedback.d.ts.map +1 -0
- package/dist/cli/feedback.js +203 -0
- package/dist/cli/feedback.js.map +1 -0
- package/dist/cli/history.d.ts +8 -6
- package/dist/cli/history.d.ts.map +1 -1
- package/dist/cli/history.js +52 -14
- package/dist/cli/history.js.map +1 -1
- package/dist/cli/init.js +1 -1
- package/dist/cli/init.js.map +1 -1
- package/dist/cli/marketplace.d.ts +24 -0
- package/dist/cli/marketplace.d.ts.map +1 -0
- package/dist/cli/marketplace.js +273 -0
- package/dist/cli/marketplace.js.map +1 -0
- package/dist/cli/mcp.d.ts +25 -0
- package/dist/cli/mcp.d.ts.map +1 -0
- package/dist/cli/mcp.js +315 -0
- package/dist/cli/mcp.js.map +1 -0
- package/dist/cli/model-picker.d.ts.map +1 -1
- package/dist/cli/model-picker.js +11 -1
- package/dist/cli/model-picker.js.map +1 -1
- package/dist/cli/model.d.ts +74 -0
- package/dist/cli/model.d.ts.map +1 -0
- package/dist/cli/model.js +564 -0
- package/dist/cli/model.js.map +1 -0
- package/dist/cli/models.d.ts.map +1 -1
- package/dist/cli/models.js +7 -1
- package/dist/cli/models.js.map +1 -1
- package/dist/cli/provider.d.ts +22 -0
- package/dist/cli/provider.d.ts.map +1 -0
- package/dist/cli/provider.js +317 -0
- package/dist/cli/provider.js.map +1 -0
- package/dist/cli/router.d.ts.map +1 -1
- package/dist/cli/router.js +32 -0
- package/dist/cli/router.js.map +1 -1
- package/dist/cli/security.d.ts +26 -0
- package/dist/cli/security.d.ts.map +1 -0
- package/dist/cli/security.js +175 -0
- package/dist/cli/security.js.map +1 -0
- package/dist/cli/skill.d.ts +29 -0
- package/dist/cli/skill.d.ts.map +1 -0
- package/dist/cli/skill.js +341 -0
- package/dist/cli/skill.js.map +1 -0
- package/dist/config/manager.d.ts +4 -4
- package/dist/config/manager.d.ts.map +1 -1
- package/dist/config/manager.js +35 -4
- package/dist/config/manager.js.map +1 -1
- package/dist/config/types.d.ts +39 -3
- package/dist/config/types.d.ts.map +1 -1
- package/dist/context/history.d.ts +55 -1
- package/dist/context/history.d.ts.map +1 -1
- package/dist/context/history.js +144 -2
- package/dist/context/history.js.map +1 -1
- package/dist/editing/ast.d.ts +40 -0
- package/dist/editing/ast.d.ts.map +1 -0
- package/dist/editing/ast.js +669 -0
- package/dist/editing/ast.js.map +1 -0
- package/dist/editing/diff.d.ts +22 -0
- package/dist/editing/diff.d.ts.map +1 -0
- package/dist/editing/diff.js +316 -0
- package/dist/editing/diff.js.map +1 -0
- package/dist/editing/edit.d.ts +55 -0
- package/dist/editing/edit.d.ts.map +1 -0
- package/dist/editing/edit.js +243 -0
- package/dist/editing/edit.js.map +1 -0
- package/dist/editing/types.d.ts +124 -0
- package/dist/editing/types.d.ts.map +1 -0
- package/dist/editing/types.js +141 -0
- package/dist/editing/types.js.map +1 -0
- package/dist/federation/a2a-client.d.ts +47 -0
- package/dist/federation/a2a-client.d.ts.map +1 -0
- package/dist/federation/a2a-client.js +200 -0
- package/dist/federation/a2a-client.js.map +1 -0
- package/dist/federation/a2a-server.d.ts +34 -0
- package/dist/federation/a2a-server.d.ts.map +1 -0
- package/dist/federation/a2a-server.js +294 -0
- package/dist/federation/a2a-server.js.map +1 -0
- package/dist/federation/a2a-types.d.ts +233 -0
- package/dist/federation/a2a-types.d.ts.map +1 -0
- package/dist/federation/a2a-types.js +145 -0
- package/dist/federation/a2a-types.js.map +1 -0
- package/dist/index.d.ts +37 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +71 -0
- package/dist/index.js.map +1 -1
- package/dist/learning/context-pruner.d.ts +159 -0
- package/dist/learning/context-pruner.d.ts.map +1 -0
- package/dist/learning/context-pruner.js +273 -0
- package/dist/learning/context-pruner.js.map +1 -0
- package/dist/learning/error-repair.d.ts +152 -0
- package/dist/learning/error-repair.d.ts.map +1 -0
- package/dist/learning/error-repair.js +409 -0
- package/dist/learning/error-repair.js.map +1 -0
- package/dist/learning/hybrid-router.d.ts +22 -2
- package/dist/learning/hybrid-router.d.ts.map +1 -1
- package/dist/learning/hybrid-router.js +110 -23
- package/dist/learning/hybrid-router.js.map +1 -1
- package/dist/learning/provider-fallback.d.ts +149 -0
- package/dist/learning/provider-fallback.d.ts.map +1 -0
- package/dist/learning/provider-fallback.js +358 -0
- package/dist/learning/provider-fallback.js.map +1 -0
- package/dist/learning/self-improver.d.ts +16 -4
- package/dist/learning/self-improver.d.ts.map +1 -1
- package/dist/learning/self-improver.js +74 -4
- package/dist/learning/self-improver.js.map +1 -1
- package/dist/learning/skill-compiler.d.ts +57 -0
- package/dist/learning/skill-compiler.d.ts.map +1 -0
- package/dist/learning/skill-compiler.js +344 -0
- package/dist/learning/skill-compiler.js.map +1 -0
- package/dist/learning/skill-store.d.ts +90 -0
- package/dist/learning/skill-store.d.ts.map +1 -0
- package/dist/learning/skill-store.js +372 -0
- package/dist/learning/skill-store.js.map +1 -0
- package/dist/learning/skill-types.d.ts +114 -0
- package/dist/learning/skill-types.d.ts.map +1 -0
- package/dist/learning/skill-types.js +29 -0
- package/dist/learning/skill-types.js.map +1 -0
- package/dist/mcp/client.d.ts +118 -0
- package/dist/mcp/client.d.ts.map +1 -0
- package/dist/mcp/client.js +379 -0
- package/dist/mcp/client.js.map +1 -0
- package/dist/mcp/manager.d.ts +67 -0
- package/dist/mcp/manager.d.ts.map +1 -0
- package/dist/mcp/manager.js +215 -0
- package/dist/mcp/manager.js.map +1 -0
- package/dist/mcp/types.d.ts +172 -0
- package/dist/mcp/types.d.ts.map +1 -0
- package/dist/mcp/types.js +16 -0
- package/dist/mcp/types.js.map +1 -0
- package/dist/team/review.d.ts.map +1 -1
- package/dist/team/review.js +1 -2
- package/dist/team/review.js.map +1 -1
- 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**
|
|
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]
|
|
72
|
-
edit [options] <file>
|
|
73
|
-
models [options]
|
|
74
|
-
plan [options] [target]
|
|
75
|
-
execute [options] <goal>
|
|
76
|
-
|
|
77
|
-
|
|
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
|
-
│
|
|
552
|
-
│
|
|
553
|
-
│ │
|
|
554
|
-
│ │ ├─ Planner
|
|
555
|
-
│ │ ├─ ContextGather
|
|
556
|
-
│ │ ├─ Writer
|
|
557
|
-
│ │ ├─ Reviewer
|
|
558
|
-
│ │ ├─ Tester
|
|
559
|
-
│ │ ├─ Runner
|
|
560
|
-
│ │ ├─ Debugger
|
|
561
|
-
│ │
|
|
562
|
-
│
|
|
563
|
-
│
|
|
564
|
-
│
|
|
565
|
-
│
|
|
566
|
-
│ │
|
|
567
|
-
│ │ ├─
|
|
568
|
-
│ │
|
|
569
|
-
│
|
|
570
|
-
│
|
|
571
|
-
│
|
|
572
|
-
│
|
|
573
|
-
│ │
|
|
574
|
-
│ │ ├─
|
|
575
|
-
│ │
|
|
576
|
-
│
|
|
577
|
-
│
|
|
578
|
-
│
|
|
579
|
-
│
|
|
580
|
-
│
|
|
581
|
-
│ │
|
|
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
|
-
| **
|
|
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:**
|
|
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
|
|
1052
|
+
│ ├── planner.ts # PlannerAgent
|
|
814
1053
|
│ ├── context-gatherer.ts
|
|
815
|
-
│ ├── writer.ts
|
|
816
|
-
│ ├── reviewer.ts
|
|
817
|
-
│ ├── runner.ts
|
|
818
|
-
│ ├── tester.ts
|
|
819
|
-
│ ├── debugger.ts
|
|
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
|
-
│
|
|
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 (
|
|
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
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
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"}
|