# Background Exec and Process Tool

## Overview

OpenClaw provides two complementary tools for managing shell commands and long-running tasks:

**exec tool** handles command execution with automatic backgrounding capabilities, while the **process tool** manages those background sessions.

## exec Tool Features

Key parameters include command (required), `yieldMs` (10000ms default for auto-backgrounding), `background` flag for immediate backgrounding, and configurable timeout (1800 seconds default).

The tool supports TTY allocation via `pty: true`, working directory specification, environment variable overrides, and elevated mode execution when permitted.

### Execution Behavior

Foreground commands return output immediately. When backgrounded, the tool responds with `status: "running"`, a session ID, and recent output tail. Output remains in memory until polled or cleared.

## process Tool Actions

Available operations include:

- `list`: display running and finished sessions
- `poll`: retrieve new output and exit status
- `log`: read aggregated output with offset/limit support
- `write`: send stdin data
- `kill`: terminate a session
- `clear`: remove finished sessions
- `remove`: terminate or clear sessions

## Key Limitations

Sessions exist only in memory and are lost upon process restart. The tool is scoped per agent and only tracks that agent's sessions. Session logs enter chat history only when explicitly polled and recorded.
