--- name: bash-tool-shell-gotchas description: Bash-tool zsh has noclobber ON; pi --mode json hangs on stdin (fix: existing_file` fails with `file exists: ` and writes 0 bytes. Two recurring consequences and fixes: 1. **`pi --mode json` HANGS waiting on stdin in the Bash tool** (exit 124 on timeout, 0 bytes, even on a fast valid model; text mode works fine). The earlier "writes to tty" diagnosis was wrong. Real fix: redirect ` --no-tools --no-skills -nc --system-prompt "$SYS" -p "$P" --mode json ` onto existing files.** Use `>|` to force-overwrite, or `rm -f` first, or have the program write the file itself (Python `Path.write_text`, `tee` both work; `>` redirect does not). **Why:** wasted ~an hour chasing 0-byte panel output that looked like an auth/model problem but was noclobber + pi-tty. **How to apply:** when a `>` redirect or a piped CLI returns 0 bytes, suspect these two before debugging the tool itself. Also: batching many Bash calls in one message causes cascade-cancellation — if the first errors (e.g. the noclobber test exits 2), the rest are all cancelled. Run diagnostics sequentially. See [[projected-grpo-rebuild-from-pseudocode]].