Skip to main content

Overview

The orcbot 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

boolean
default:"false"
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.
boolean
default:"false"
Run in background using nohup-style process spawning. Logs to ~/.orcbot/foreground.log. Unlike daemon mode, this uses a different spawning strategy.
boolean
default:"false"
Also start the web gateway server alongside the agent loop. Overrides the gatewayAutoStart config setting to true.
boolean
default:"false"
Disable gateway auto-start even if gatewayAutoStart is set to true in config.
string
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:
  1. Lock File Check: Before starting, checks for ~/.orcbot/orcbot.lock containing PID, start time, and host information
  2. Process Validation: Verifies the process is actually running (not just a stale lock file)
  3. Stale Lock Cleanup: Automatically removes lock files from crashed instances
  4. Clear Error Messages: Provides PID, start time, and instructions when instance already exists
If an instance is already running:

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 stop command

Gateway Auto-Start

The agent can optionally start the web gateway server when launched: Priority order:
  1. --with-gateway flag (explicit enable)
  2. --no-gateway flag (explicit disable)
  3. gatewayAutoStart config value
Configuration:
Example with gateway:

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 affect orcbot run:

Exit Codes

Troubleshooting

Multiple Instance Error: If you see “OrcBot is already running” but believe it’s a false positive:
Gateway Not Starting: If --with-gateway doesn’t start the gateway:
  1. Check config: orcbot config get gatewayPort
  2. Ensure port is available: lsof -i :3100
  3. Check logs for errors: tail -f ~/.orcbot/daemon.log