Arg0/Docs

CLI Usage

Control Arg0 from the command line - Powerful CLI for agent execution, workflow management, and system control from your terminal.

Command-line interface for Arg0 Desktop.

Overview

Arg0 Desktop includes a command-line interface (CLI) for controlling agents and workflows from the terminal. The CLI provides programmatic access to agent execution, workflow management, and system status.

Installation

Installing the CLI

bash
cd cli
npm install
npm run build
npm link  # Optional: makes 'synapse' command available globally

After running npm link, you can use the CLI directly:

bash
synapse status
synapse agent run "Analyze the codebase"

Requirements

  • Arg0 Desktop must be running with the daemon enabled
  • The daemon runs on port 3999 by default
  • Start the daemon from Settings in Synapse Desktop UI

Available Commands

Status

Check daemon status:

bash
node cli/dist/index.js status

Output:

json
{
  "running": true,
  "port": 3999,
  "version": "1.0.0"
}

Agent Commands

Run Agent

Execute an agent with a goal:

bash
node cli/dist/index.js agent run "Analyze the codebase and suggest improvements"

Run Agent with Context

Provide additional context:

bash
node cli/dist/index.js agent run "Fix the bug in login flow" --context "Users report timeout after 30 seconds"

Agent Options

  • --context: Additional context for the agent
  • --provider: AI provider to use (openai, anthropic, gemini, ollama)
  • --model: Specific model to use
  • --timeout: Execution timeout in seconds
  • --output: Output file path for results

Example:

bash
node cli/dist/index.js agent run "Review the code" \
  --context "Focus on security issues" \
  --provider openai \
  --model gpt-4 \
  --timeout 300 \
  --output results.json

Workflow Commands

List Workflows

List all available workflows:

bash
node cli/dist/index.js workflow list

Output:

json
{
  "workflows": [
    {
      "id": "expense-approval",
      "name": "Expense Approval",
      "status": "active"
    }
  ]
}

Run Workflow

Execute a specific workflow:

bash
node cli/dist/index.js workflow run expense-approval

Workflow Options

  • --context: Additional context variables
  • --async: Run workflow asynchronously
  • --webhook: Trigger via webhook
  • --input: Input file for workflow

Example:

bash
node cli/dist/index.js workflow run expense-approval \
  --context '{"amount": 1000, "category": "travel"}' \
  --async

System Commands

Daemon Control

Control the background daemon:

bash
# Start daemon
node cli/dist/index.js daemon start

# Stop daemon
node cli/dist/index.js daemon stop

# Restart daemon
node cli/dist/index.js daemon restart

Logs

View system logs:

bash
# View recent logs
node cli/dist/index.js logs

# Follow logs
node cli/dist/index.js logs --follow

# Filter logs
node cli/dist/index.js logs --filter error

Configuration

View and edit configuration:

bash
# View configuration
node cli/dist/index.js config

# Set configuration value
node cli/dist/index.js config set key value

# Get configuration value
node cli/dist/index.js config get key

Daemon API

Endpoints

The daemon provides HTTP endpoints for external integration:

POST /task

Queue an agent goal:

bash
curl -X POST http://127.0.0.1:3999/task \
  -H "Content-Type: application/json" \
  -d '{
    "goal": "Analyze the codebase",
    "context": "Focus on performance"
  }'

GET /status

Health check:

bash
curl http://127.0.0.1:3999/status

GET /

Landing page:

bash
curl http://127.0.0.1:3999/

CLI Configuration

Configuration File

The CLI uses a configuration file at ~/.synapse/config.json:

json
{
  "daemon": {
    "host": "127.0.0.1",
    "port": 3999
  },
  "agent": {
    "defaultProvider": "openai",
    "defaultModel": "gpt-4",
    "timeout": 300
  },
  "output": {
    "format": "json",
    "directory": "./synapse-output"
  }
}

Environment Variables

Configure via environment variables:

bash
export SYNAPSE_DAEMON_HOST=127.0.0.1
export SYNAPSE_DAEMON_PORT=3999
export SYNAPSE_DEFAULT_PROVIDER=openai
export SYNAPSE_DEFAULT_MODEL=gpt-4

Examples

Basic Agent Execution

bash
# Simple agent run
node cli/dist/index.js agent run "Hello world"

# With context
node cli/dist/index.js agent run "Fix the bug" --context "Bug in login page"

# With provider
node cli/dist/index.js agent run "Generate code" --provider anthropic

Workflow Automation

bash
# List workflows
node cli/dist/index.js workflow list

# Run workflow
node cli/dist/index.js workflow run daily-report

# Run with context
node cli/dist/index.js workflow run backup --context '{"target": "production"}'

System Management

bash
# Check status
node cli/dist/index.js status

# View logs
node cli/dist/index.js logs --follow

# Restart daemon
node cli/dist/index.js daemon restart

Best Practices

CLI Usage

  • Use quotes for goals with spaces
  • Provide context for better results
  • Set appropriate timeouts
  • Use output files for long-running tasks
  • Monitor logs for debugging

Automation

  • Use CLI in scripts for automation
  • Schedule workflows with cron
  • Integrate with CI/CD pipelines
  • Use async mode for long tasks
  • Monitor daemon health

Configuration

  • Use configuration files for reproducibility
  • Set environment variables for secrets
  • Use appropriate timeouts
  • Configure output directories
  • Regularly update CLI

Troubleshooting

Daemon Not Running

  1. Check if Arg0 Desktop is running
  2. Verify daemon is enabled in Settings
  3. Check daemon status: node cli/dist/index.js status
  4. Start daemon: node cli/dist/index.js daemon start
  5. Check port 3999 availability

Connection Refused

  1. Verify daemon is running
  2. Check host and port configuration
  3. Test connection: curl http://127.0.0.1:3999/status
  4. Check firewall settings
  5. Review daemon logs

Command Not Found

  1. Verify CLI is built: cd cli && npm run build
  2. Check PATH if using npm link
  3. Use full path: node cli/dist/index.js
  4. Reinstall CLI: cd cli && npm install && npm run build
  5. Check Node.js version