Watching Claude execute commands is painful, and a little worrying, not least because it never knows what directory it is in.
It constantly tries commands (include rm -f commands, though not yet rm -rf) that fail because it is in the wrong directory. It can be kind of comical, but it wears thin quickly, and clearly carries risks. For example, just searching for the phrase “wrong directory” since I started exporting logs from Claude sessions:
$ grep 'wrong directory' *.txt
2025-10-10T15-50-00-tags-discussion.txt: 533 + - Commands fail with cryptic errors if in wrong directory
2025-10-17T06-39-29-styles.txt:• I'm in the wrong directory. Let me move up:
2025-10-23T14-07-56-settings.txt: The entire /static/ Alias is pointing to the wrong directory.
2025-10-23T14-07-56-settings.txt: shouldn't cause Apache to serve from the wrong directory.
2025-10-23T16-09-32-settings.txt:• I'm in the wrong directory! Let me check from the correct location:
2025-10-25T08-23-55-checkup.txt:⏺ Ah, I'm in the wrong directory! Let me check:
2025-10-26T09-21-30-checkup.txt:⏺ I'm in the wrong directory. The test users "check" and "eagle" don't exist in the database - we only
2025-10-26T09-21-30-checkup.txt:⏺ I'm in the wrong directory. Let me check where I am and navigate properly:
2025-10-29T17-25-06-dates.txt:⏺ Ah! It's in ./web/static/common-icons.css but I'm in the wrong directory!
2025-11-05T08-46-48-rh-matter-align.txt: - Safari reading static files from wrong directory
2025-11-09T12-31-29-smart-punctuation-and-continuations.txt:⏺ Ah, I'm in the wrong directory. Let me go back to checkeagle/:
Most sessions include multiple examples, not always including this exact phrase.
Before I learned how to export logs, I wondered whether part of the problem was that I use a very short shell prompt that doesn’t include anything like the current working directory. (Just the exit code from the last command, the machine name, and $). I wondered whether that was why.