跳到主要内容

Viben CLI

Viben CLI (viben) is the command-line interface for Agent Swarm x Code Evolution - an intelligent system that orchestrates multiple AI agents to continuously evolve and optimize your codebase.

What is Viben CLI?

Viben CLI enables a new paradigm of software development where AI agent swarms collaborate to iteratively improve code quality, generate ideas, and manage complex development tasks autonomously.

Core Capabilities

FeatureDescription
FileEvoFile-based self-evolution for code optimization - agents iteratively improve code through multi-dimensional evaluation
Agent SwarmOrchestrate multiple specialized agents working in parallel on different aspects of your codebase
Task SystemXState-powered task management with state machines for complex development workflows
Idea GenerationAI-driven ideation for features, refactoring opportunities, and architectural improvements

Key Features

FeatureDescription
Task ManagementCreate, queue, and track development tasks with state machine workflows
Swarm OrchestrationCoordinate multiple agents with different specializations
Agent ManagementCreate, configure, and manage AI agent instances
Provider ConfigurationSet up API providers (OpenAI, Anthropic, Google, Azure, etc.)
Model ManagementConfigure model aliases, fallback chains, and model-level settings
Executor DiscoveryDiscover locally installed executors (Claude Code, Cursor, etc.)
MCP Server ManagementInstall, enable, and configure MCP servers
Skill ManagementInstall and manage agent skills
Gateway RuntimeStart the core runtime connecting channels to agent loops
Channel ManagementConfigure chat channels (Telegram, Discord, Feishu, etc.)
Cron SchedulingManage scheduled tasks for agents
Queue SystemBackground command execution with concurrency control
Scope AwarenessAuto-detect workspace, support global/workspace configuration

Design Principles

Agent Swarm x Code Evolution

The CLI is designed around the core philosophy of continuous code improvement through AI collaboration:

  • FileEvo: Agents learn from code change outcomes to make better decisions
  • Swarm Intelligence: Multiple specialized agents work in parallel
  • Task-Driven: XState state machines manage complex development workflows
  • Idea Generation: AI proactively suggests improvements and features

Human-Machine Friendly

  • Human Mode: Colored, formatted terminal output (default)
  • Machine Mode: Use --json flag for structured JSON output, easy for AI agents to parse

Scope Awareness

CLI automatically detects your workspace context:

  • If current directory contains .viben/, use workspace configuration
  • Otherwise use global configuration (~/.viben/)
  • Override with --global or --workspace flags

Tech Stack

ComponentChoiceReason
RuntimeNode.jsReuse existing TypeScript code and packages
FrameworkCommander.jsMature, stable, rich ecosystem
State MachineXStateRobust task workflow management
ConfigurationYAMLHuman-readable, supports comments
OutputChalk + JSONColored terminal + structured output

Command Overview

viben <command> [subcommand] [options]

Core Commands (Agent Swarm x Code Evolution):
task XState-powered task management with state machine workflows
swarm Orchestrate multiple agents working in parallel
idea AI-driven ideation for features and improvements
queue Background command execution with concurrency control

Agent & Configuration:
agent Manage agent instances and templates
provider Manage API providers (OpenAI, Anthropic, etc.)
model Manage models, aliases, and fallback chains
executor Discover and view executors (Claude Code, Cursor, etc.)
mcp Manage MCP servers
skill Manage skills

Workspace & Service:
init Initialize workspace in current directory
config Configuration management (git-style)
service Manage background services
gateway Start Gateway (message bus + agent loop)
channel Manage chat channels (Telegram, Discord, Feishu, etc.)
cron Manage scheduled tasks
team Team collaboration workspace management
workspace Workspace operations
version Show version information
help Show help

Global Options

All commands support these global options:

OptionDescription
--jsonOutput JSON (for agent parsing)
--global, -gUse global configuration
--workspaceUse workspace configuration (current directory)
-n, --name <id>Specify agent name/ID (default: current or 'main')
--verbose, -vVerbose output
--quiet, -qSuppress non-essential output
--help, -hShow help

Architecture Overview

~/.viben/ # State directory
├── config.yaml # Global configuration
├── queue/ # Command queue (background execution)
├── agents/ # Agent instances
│ └── <agent-id>/ # Individual agent
│ ├── config.yaml # Agent configuration
│ ├── mcp_servers.json # MCP server configuration
│ ├── skills/ # Agent-specific skills
│ ├── memory/ # Agent memory
│ │ ├── MEMORY.md # Main memory file
│ │ └── YYYY-MM-DD.md # Daily logs
│ ├── .agentrc # Startup configuration
│ ├── .agent_history # Command history
│ └── .agent_sessions/ # Session storage
├── providers.yaml # API provider configuration
├── models.yaml # Model configuration
├── channels.yaml # Channel configuration
├── cron.yaml # Scheduled task configuration
├── mcp/ # Shared MCP servers
└── skills/ # Shared skills

<project>/.viben/ # Workspace configuration (optional)
├── config.yaml # Workspace-specific overrides
└── tasks/ # Task storage (XState workflows)
└── <task-id>/
├── task.json # Task state and metadata
└── context.md # Task context and notes

Configuration File Format

Viben CLI uses YAML for human-readable configuration:

# ~/.viben/config.yaml
version: 1

# Global settings
settings:
editor: code
pager: less
color: auto

# Default MCP servers
mcp:
enabled:
- filesystem
- git

# Default skills
skills:
enabled:
- code-review
- commit

# Swarm configuration
swarm:
default_roles:
- architect
- implementer
- reviewer
max_parallel_agents: 4

Environment Variables

VariableDescriptionDefault
VIBEN_STATE_DIRState directory~/.viben
VIBEN_CONFIG_PATHConfiguration file path~/.viben/config.yaml
VIBEN_AGENTCurrent agent IDmain
VIBEN_SCOPEConfiguration scopeAuto-detect

Agent Integration

AI agents can use Viben CLI through Bash tool calls. The --json flag ensures structured output for agent parsing:

# Task management workflow
viben task create "implement-auth" --json
viben task enqueue implement-auth --json
viben task status implement-auth --json

# Swarm orchestration
viben swarm start --task implement-auth --json

# Idea generation
viben idea generate --context "auth system" --json

# Configuration
viben config list --json
viben agent config my-agent set model gpt-4 --json

JSON Response Format

All commands with --json flag return structured responses:

{
"success": true,
"data": {
"task": {
"id": "implement-auth",
"state": "in_progress",
"agents": ["architect", "implementer"]
}
}
}

Error responses include error codes for programmatic handling:

{
"success": false,
"error": {
"code": "TASK_NOT_FOUND",
"message": "Task 'unknown-task' not found in workspace"
}
}

Next Steps