shell_bulk
Execute many shell commands in one ordered call with conditions, retries, and output capture to cut token usage and stop on failure.
Instructions
Run MANY commands in one call, in order — the token-efficient way to work. Each step supports: delay_before_ms/delay_after_ms, when (condition), expect_exit, retry, on_failure, assign (capture output into a variable) and capture (how much output to return). Conditions and ${...} interpolation can read earlier steps: prev.ok, prev.exit, prev.stdout, step..ok, steps[0].exit, vars., failed_count. Prefer capture="on_failure" for long pipelines: silent on success, full output where it broke.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| cwd | No | Working directory. Relative paths resolve against the server cwd. Default: server cwd. | |
| env | No | Extra environment variables. | |
| vars | No | Extra variables for this run, layered over the persistent store. Everything already in the store is readable as vars.<name> without repeating it here. | |
| shell | No | Override shell for this call: auto|bash|gitbash|zsh|fish|sh|cmd|powershell|pwsh|wsl, a configured name, or an absolute path. | |
| steps | Yes | Steps executed sequentially. A plain string is shorthand for {command: "..."}. | |
| capture | No | Default capture mode for every step. Default full. | |
| timeout_ms | No | Kill the command (whole process tree) after this many ms. 0 = no limit. | |
| max_total_bytes | No | Total output budget for the whole run; later steps get suppressed once spent. Default 40000. | |
| stop_on_failure | No | Abort the run at the first failing step. Default true. | |
| max_output_bytes | No | Byte cap on returned output before middle-truncation. Lower it to save tokens. |