Skip to content

Background processes

Parent: Tools and workspace.

The process tool runs a shell command in the background inside the current Rho instance. Start it, poll retained output with a cursor, and stop it when done. Use this for long-running servers, watchers, and other work that should outlive a single foreground bash or powershell call.

Rho owns these processes only while that instance is alive. Shutdown cleans them up. Records do not survive a restart.

Actions

ActionRequiredOptionalResult
startcommandtimeout_seconds (≥ 1)Snapshot with process_id and early output
pollprocess_idcursor, wait_seconds (0–30)Snapshot of retained chunks from the cursor
stopprocess_idStop request for that managed process tree

start

Launches the command through the platform shell with:

  • working directory set to the workspace root
  • stdin closed
  • stdout and stderr captured on pipes
  • the same user permissions as Rho

Returns a JSON snapshot that includes process_id. Optional timeout_seconds bounds how long the process may run before Rho marks it timed out and stops the tree.

poll

Reads retained stdout and stderr. Pass the previous next_cursor as cursor so you do not re-read the same chunks.

  • wait_seconds may block briefly (0–30, default 0) for new output.
  • Retention is bounded. If the requested cursor is older than the retained range, the snapshot reports that and advances from what is still held.
  • output_pending is true when more retained output exists past the returned window.
  • truncated is true when output was dropped under the byte or chunk caps.

stop

Requests termination of the managed process tree (process group on Unix, job object on Windows), not only the direct child. Rho waits a short grace period, then force-kills if needed.

Snapshot fields

Typical fields on start and poll results:

FieldMeaning
process_idHandle for later poll / stop
commandStarted command string
statestarting, running, exited, terminated, timed_out, or failed_to_start
runtime_secondsElapsed wall time
first_cursor / next_cursor / available_cursorRetained output range and read position
chunksOrdered stdout/stderr pieces with per-chunk cursors
exit_codeSet when the process has exited
terminal_detailExtra detail for failed or forced ends
truncated / output_pendingRetention and pagination flags

Limits

Default manager limits (per Rho instance):

LimitDefault
Live processes16
Retained process records64
Retained output per process1 MiB
Retained chunks per process8,192
Completed-record retention30 minutes
poll wait0–30 seconds
stop grace2 seconds

Rho prunes completed records past retention and drops the oldest completed records when the record cap is hit. Live processes count against max_live.

What this tool is not

The process tool does not provide:

  • stdin writes after start
  • process listing as its own action
  • a pseudo-terminal or interactive TUI inside the child
  • persistent sessions across Rho restarts
  • pane or session orchestration

Commands that need a real terminal, interactive prompts, or durable attachable sessions belong in a multiplexer such as tmux or Herdr, or in a foreground bash / powershell call when the work fits one turn.

Permissions and safety

process requests the Process capability. Permission modes can deny it (plan) or ask first (supervised). They do not add an operating-system sandbox. The child still runs with the current user's rights and can affect files inside or outside the workspace the same way a shell in that account could.

Foreground bash and powershell are separate tools for work that should finish inside one tool call. Prefer process when you need to keep a command running across turns and read its output later.