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
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:
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:
node cli/dist/index.js status
Output:
{
"running": true,
"port": 3999,
"version": "1.0.0"
}
Agent Commands
Run Agent
Execute an agent with a goal:
node cli/dist/index.js agent run "Analyze the codebase and suggest improvements"
Run Agent with Context
Provide additional context:
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:
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:
node cli/dist/index.js workflow list
Output:
{
"workflows": [
{
"id": "expense-approval",
"name": "Expense Approval",
"status": "active"
}
]
}
Run Workflow
Execute a specific workflow:
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:
node cli/dist/index.js workflow run expense-approval \
--context '{"amount": 1000, "category": "travel"}' \
--async
System Commands
Daemon Control
Control the background daemon:
# 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:
# 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:
# 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:
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:
curl http://127.0.0.1:3999/status
GET /
Landing page:
curl http://127.0.0.1:3999/
CLI Configuration
Configuration File
The CLI uses a configuration file at ~/.synapse/config.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:
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
# 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
# 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
# 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
- Check if Arg0 Desktop is running
- Verify daemon is enabled in Settings
- Check daemon status:
node cli/dist/index.js status - Start daemon:
node cli/dist/index.js daemon start - Check port 3999 availability
Connection Refused
- Verify daemon is running
- Check host and port configuration
- Test connection:
curl http://127.0.0.1:3999/status - Check firewall settings
- Review daemon logs
Command Not Found
- Verify CLI is built:
cd cli && npm run build - Check PATH if using npm link
- Use full path:
node cli/dist/index.js - Reinstall CLI:
cd cli && npm install && npm run build - Check Node.js version
Related Documentation
- Installation - Setup guide
- Agent Implementation - Agent system
- Daemon API - Daemon API reference