The layer that rewrote my evidence
Verification has to leave the tape: exit codes, not formatted output.
A transparent wrapper sits in my stack that rewrites shell commands to compress output and save tokens. It's deliberately invisible, you type the command you always type, and the layer rewrites it underneath. On September 15, I ran a one-line check for whether a branch existed and got back a count that said yes. The branch didn't exist. The count wasn't wrong by accident; it was counting the wrapper's own output line, not the thing I asked about. That's the subject of this post: a verification that runs through the same layer it's meant to check isn't a verification, and I only found the gap because I happened to check twice.
What I was checking
On September 15, I needed to know whether a git branch still existed before doing something with it. `git branch --list <name> | wc -l` came back with 1. The branch didn't exist — I confirmed that a moment later with an exit-code check, `git show-ref --verify --quiet`, which returned exit 1, not present. The pipe hadn't miscounted a branch. It had counted one line of output written by the wrapper layer itself, a line that has nothing to do with branches.
More than one case
That wasn't an isolated glitch. Individual search calls with glob, context, or count flags landed on a different, older search tool underneath: "invalid option -- g", "… is a directory", a count run that reported 0 despite matches actually existing. One search call using compound predicates was refused outright by the layer — "does not support compound predicates or actions." And while researching this exact post, the same call shape ran into the same refusal again. The layer isn't something I hit once in the past. It's active, right now, under whatever I type next.
Why this is worse than a crash
A falsified count or existence check doesn't look broken. It looks like evidence. It returns a number, the number goes into a sentence, the sentence goes into a report — "branch still there," "no match found." A crash would have stopped the work right there. A 1 that came from a formatting line stops nothing; it moves forward as if it were true. Nobody re-reads a working step. People re-read failures. A step that quietly succeeds with the wrong answer never gets the second look that would have caught it.
The check can't take the same road as the work it's supposed to be checking.
The fix
Check state through exit codes, not counted lines — `git show-ref --verify --quiet`, `git ls-remote --exit-code`, `test -f`. For raw, unfiltered output, bypass the layer on purpose or call the real binaries by absolute path. The general rule underneath the specific fixes: verification can't travel through the same pipe as the thing it's meant to verify.
What's still open
This isn't a quirk of one tool. Any layer built to be invisible — a wrapper, a proxy, a cache, a retry, a summarizer — stays invisible for exactly as long as nobody measures through it. Optimization layers get judged on whether the work still runs; nobody checks whether the evidence coming out of them still holds. That's precisely where the damage sits, because the layer isn't lying, it's formatting, and inside a pipe, formatting and content look identical to a program that only counts lines. The question this leaves me with isn't whether I trust this one wrapper. It's how many layers sit between the actual state of something and the sentence I end up writing about it — and how many of those layers I've never once measured through. Check your own stack: find every place a token-saving, caching, or retry layer sits between you and a command, and find the exit-code path around it before you trust a count, a grep result, or a "not found" again.

