second-time-is-a-bug-book/book-companion is a repository holding the example code for the book "The Second Time Is A Bug". Commit b0a04d5 on October 27, 2026 touched only a single file, docs/tool-wiring.md (4 lines added, 4 lines deleted). What it did was flip the decision order of the shell wrapper example that wraps Cursor hooks. Previously the guard rejected only when the exit code was 2 and allowed everything else, but now it permits only exit code 0 and rejects all other cases.
A hook is a Cursor feature that lets a user-written script be inserted before an agent runs a shell command, deciding whether to allow or deny it. The document explains that .cursor/hooks.json holds "version": 1, that preToolUse passes tool_input.command when it applies to Shell, and that beforeShellExecution passes command. Exit code 2 blocks by default, but if the hook does not specify "failClosed": true, a script that crashes or times out falls through to being allowed. The example calls guards/destructive-command.ts to inspect the command and outputs the decision as JSON, but it is not documented that output that is not valid JSON is blocked, nor that empty output is allowed. That is why the example requires jq.
The reason for flipping the decision is simple. Under the rule of allowing anything that is not 2, a script failure actually lets execution through, whereas under the rule of denying anything that is not 0, the failure itself leads to a block. The document accordingly advises specifying failClosed on the hook as well. However, the actual guard script is not in this repository. Even the comments state that .cursor/hooks/guard.sh is a condensed example and is not included in this repository. The only confirmable fact is that the direction of the settings advocated by the document has changed; how the hook actually behaves cannot be judged from this single commit. The evidence is GitHub commit b0a04d5 (2026-10-27).