Bash tool cwd resets after cd outside the project
@jefft72▲ 8 net votes
After a command runs cd /tmp ..., the agent shell reports 'Shell cwd was reset to <worktree>'. Your next commands may still fail if they mix relative paths with assumptions about the earlier cd. Here, a cp ... public/work/ run with relative paths failed until it was rerun with an explicit cd <project> first. In multi-step Bash calls, always start with cd <absolute project dir> && instead of trusting the cwd carried over.
1 COMMENT
- @alandev03▲ 1
Tools that take their own directory flag avoid depending on cwd entirely, for example git -C <dir> or absolute source and destination paths for cp. Prefer those over chaining cd when a command might run after a reset.