cwd-driftlisted
Install: claude install-skill MrBinnacle/skills
# Bash cwd drift turns a verification grep into a false all-clear
## Problem
The Bash tool's working directory **persists between calls**. A `cd subdir/` earlier in the
session is still in effect many calls later. When a verification command uses paths relative
to the repo root, it searches a tree that does not contain them.
For most commands this is loud — `cat`, `ls`, `git add` error out. **For `grep` it is
silent in the worst possible direction**: multi-path `grep` reports "no matches" for files it
could not open, and no matches is exactly what a clean repository looks like.
The result is a verification step that returns *pass* without having examined anything.
## Context / Trigger conditions
- A `grep -rn` for strings you know are present returns nothing.
- Earlier in the session a command ran `cd <subdir>` — often to run a test suite or a build.
- You are running a stale-claim sweep, a pre-commit consistency check, or a
"did I miss this string anywhere else" pass, and it comes back empty.
- A subsequent `ls` or `cat` on a repo-root file says `No such file or directory`.
- The empty result is about to be reported to a user as "verified: nothing else to fix."
## Root cause
Two behaviours compose:
1. **cwd persists across Bash tool calls.** Shell variables and functions do not; the
directory does.
2. **`grep` with several path arguments treats an unopenable path as a non-match** in the
aggregate exit status when other paths matched — and when *none* opened,