Expand description
gw guard — Claude Code PreToolUse(Bash) hook helper.
Input format: a JSON object with at least tool_name and tool_input.
Policy: when tool_name == "Bash" and the call’s cwd is unhealthy
(missing path or not a directory), block the tool call with a strong
abort instruction in stderr — regardless of which command is being run.
Rationale: the guard exists for sessions whose worktree was removed out
from under them (e.g. gw rm while Claude was paused). In that state
every shell command runs in a stale environment, so the safe default is
to refuse all of them and ask the user before continuing. Sessions with
a healthy cwd pass through transparently.