Because Claude Code loses track of where it is. After one cd, it often forgets it moved, and the next command uses a path relative to the folder it thinks it is in. The folder it names doesn't exist from where it actually stands, so the command fails or runs in the wrong place.
It's a known, long-standing problem. Claude will frequently cd and then forget its working directory (GitHub issue #7442), and Claude Code loses track of working directory after creating subdirectory (#14122). A typical case from those reports: it is already inside external_data/ and runs cd external_data/LSLB, a path that only existed from the parent folder.
cd.(cd dir && command), so the change doesn't leak into later commands.Before the command runs, Check asks your machine whether the folder cd would go to exists. If it doesn't, the command is stopped and the agent is told so in your shell's own words, before anything runs in the wrong place.
After a leading cd folder &&, Check checks the rest of the command in that folder: the scripts it would run and the files it would read. One honest limit: anything after a cd that isn't the first thing in the command is let through, because Check doesn't guess.
100 free blocks, then A$0.10 for each action Check stops, from a prepaid balance. Allowed actions are always free. No subscription. Windows and Linux; macOS isn't supported yet. Get your key at the console, then run this in your own terminal:
npx @golproductions/check@latest --install
Or add Check as a plugin for Claude Code, Gemini CLI, Copilot CLI or Codex: the guide. Everything Check checks, and what it lets through: What Check does.
100 free blocks. Get your GOL API Key at the console.