f-0002 · must · score 1 · effort xs - Stop loop aborts under set -euo pipefail when .lock directory is missing, and parse_error on malformed JSON falls through into Stop and wipes active backups
hooks/simplify-ignore.sh enables set -euo pipefail at line 17, but calls rmdir “$CACHE/${fid}.lock” 2>/dev/null without || true at lines 326, 332, 339, and 392 (unlike line 373 which uses || true). If a lock directory is missing when Stop iterates over multiple .bak files, rmdir returns exit code 1 on the first file and aborts the script before restoring remaining files. In addition, when jq fails to parse malformed hook input at lines 37-47, parse_error is logged with TOOL_NAME=”” but execution does not exit, falling straight into if [ -z “$TOOL_NAME” ] at line 287 (the Stop handler) and wiping active session backups mid-session.
Evidence: hooks/simplify-ignore.sh:17, hooks/simplify-ignore.sh:36-47, hooks/simplify-ignore.sh:287-340, hooks/simplify-ignore.sh:392
Do: Exit 0 after logging parse_error at hooks/simplify-ignore.sh:47, append || true to rmdir calls at lines 326, 332, 339, and 392, and add regression coverage in hooks/simplify-ignore-test.sh.
f-0001 · must · score 1 · effort s - expand_file bakes original leading indentation into placeholder and omits :* in fuzzy matching, corrupting files and .bak when /code-simplify re-indents or edits reason text
In hooks/simplify-ignore.sh:84 and 170-196, filter_file stores the full line prefix before simplify-ignore-start (including leading whitespace) in .prefix.. When /code-simplify flattens a nested block (e.g. unindenting a placeholder from 4 spaces to 2 spaces), neither esc_placeholder nor esc_fuzzy matches because both require the original 4-space prefix. expand_file falls through to line=${line//BLOCK_${h}/$block_content} (line 193), replacing only the bare BLOCK_ token and leaving the comment opener before the expanded block and : */ after simplify-ignore-end. During PostToolUse Edit\|Write (line 424), this corrupted syntax overwrites $CACHE/${ID}.bak. The same fallback failure hits any /* ... */ or block whose reason text was modified by the model, because esc_fuzzy (${bp}BLOCK_${h}${bs}) omits :* between BLOCK_${h} and ${bs}, and in // or # comments ${bp}BLOCK_${h} matches only the prefix+hash and leaves : appended to simplify-ignore-end.
Evidence: `hooks/simplify-ignore.sh:84`, `hooks/simplify-ignore.sh:170-196`, `hooks/simplify-ignore.sh:418-432`
Do: In hooks/simplify-ignore.sh:170-196, match re-indented placeholders by stripping leading whitespace from bp (${bp#"${bp%%[![:space:]]*}"}) and pairing with the current line indentation, update the fuzzy fallback to match ${esc_bp}BLOCK_${h}:*${esc_bs} (or ${esc_bp}BLOCK_${h}:* when bs is empty) before ${esc_bp}BLOCK_${h}${esc_bs}, and add regression Tests 19-21 in hooks/simplify-ignore-test.sh.
Shape of the work
1 module · 2 findings · effort 1×xs, 1×s
Generated by Ponder - AI that knows when to speak, and when to shut up.