Files
evil_MoE/.claude/memory/bash-tool-shell-gotchas.md
T
2026-06-03 23:56:50 +00:00

1.6 KiB

name, description, metadata
name description metadata
bash-tool-shell-gotchas Bash-tool zsh has noclobber ON and pi --mode json gives 0 bytes (non-tty); workarounds
node_type type originSessionId
memory feedback ba4a4349-3947-4bfe-87fc-2d6e99001352

The Bash tool runs a zsh where noclobber is ON, and it is NOT set in any user rc file (~/.zshrc, ~/.zshenv, etc. — grep finds nothing). So the harness/wrapper sets it; editing ~/.zshrc does NOT turn it off. Symptom: cmd > existing_file fails with file exists: <path> and writes 0 bytes.

Two recurring consequences and fixes:

  1. pi --mode json writes to the tty, not stdout. In this non-tty shell, pi ... | extractor or pi ... > file yields 0 bytes (silently). Fix: skip pi, hit OpenRouter HTTP directly — see ~/.claude/skills/external-review/panel_direct.py (stdlib-only, reads key from /root/.env). This is the robust path for the external-review comprehension panel and external-panel Q&A.

  2. noclobber refuses > 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.