Files
openclaw-skill/openclaw-knowhow-skill/docs/infrastructure/gateway/background-process.md
Selig 4c966a3ad2 Initial commit: OpenClaw Skill Collection
6 custom skills (assign-task, dispatch-webhook, daily-briefing,
task-capture, qmd-brain, tts-voice) with technical documentation.
Compatible with Claude Code, OpenClaw, Codex CLI, and OpenCode.
2026-03-13 10:58:30 +08:00

34 lines
1.4 KiB
Markdown

# 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.