Overview
Theorcbot run command starts the OrcBot autonomous reasoning loop. It supports foreground mode, daemon mode (detached background process), and background mode (nohup-style), with built-in conflict detection to prevent multiple instances.
Usage
Options
Run in background as a daemon process. Creates PID file at
~/.orcbot/orcbot.pid and logs to ~/.orcbot/daemon.log. Process is fully detached from the terminal.Run in background using nohup-style process spawning. Logs to
~/.orcbot/foreground.log. Unlike daemon mode, this uses a different spawning strategy.Also start the web gateway server alongside the agent loop. Overrides the
gatewayAutoStart config setting to true.Disable gateway auto-start even if
gatewayAutoStart is set to true in config.Path to static files for the gateway dashboard. Default:
apps/dashboard. Only used when --with-gateway is enabled.Behavior
Instance Conflict Detection
OrcBot implements robust conflict detection to prevent multiple agent instances from running simultaneously:- Lock File Check: Before starting, checks for
~/.orcbot/orcbot.lockcontaining PID, start time, and host information - Process Validation: Verifies the process is actually running (not just a stale lock file)
- Stale Lock Cleanup: Automatically removes lock files from crashed instances
- Clear Error Messages: Provides PID, start time, and instructions when instance already exists
Foreground Mode
When run without flags:- Agent loop runs in the current terminal
- Press Ctrl+C to stop
- Logs to stdout/stderr
- Also checks for existing daemon and prevents startup if daemon is running
Daemon Mode
When run with--daemon:
- Process detaches from terminal
- Continues running after terminal closes
- PID written to
~/.orcbot/orcbot.pid - Logs redirected to
~/.orcbot/daemon.log - Manage with
orcbot daemon status/stop
Background Mode
When run with--background:
- Spawns a detached child process
- Logs to
~/.orcbot/foreground.log - Stop with
orcbot stopcommand
Gateway Auto-Start
The agent can optionally start the web gateway server when launched: Priority order:--with-gatewayflag (explicit enable)--no-gatewayflag (explicit disable)gatewayAutoStartconfig value
Examples
Basic Foreground Start
Daemon with Gateway
Background with Custom Gateway Static Files
Disable Gateway Despite Config
Process Management
Viewing Logs
Stopping the Agent
Configuration
Key config values that affectorcbot run:
Exit Codes
| Code | Meaning |
|---|---|
| 0 | Clean shutdown |
| 1 | Another instance already running |
| 1 | Daemon already running (when starting in foreground) |
Related Commands
orcbot daemon- Manage daemon processorcbot push- Queue tasks for the running agentorcbot ui- Interactive TUI dashboardorcbot gateway- Start web gateway separatelyorcbot stop- Stop all OrcBot processes
Troubleshooting
Gateway Not Starting: If
--with-gateway doesn’t start the gateway:- Check config:
orcbot config get gatewayPort - Ensure port is available:
lsof -i :3100 - Check logs for errors:
tail -f ~/.orcbot/daemon.log