claude-code - 💡(How to fix) Fix [Bug] Working directory not reset between bash command executions [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#56221Fetched 2026-05-06 06:33:56
View on GitHub
Comments
1
Participants
2
Timeline
4
Reactions
0
Author
Timeline (top)
labeled ×3commented ×1
RAW_BUFFERClick to expand / collapse

Bug Description CWD no longer resets between Bash calls. Claude is an LLM that produces semi-random Bash invocations and sometimes changes the folder. This means further bash calls, skills, and other features randomly break now. This is in the "stable" version of Claude Code with Opus 4.7.

Environment Info

  • Platform: linux
  • Terminal: konsole
  • Version: 2.1.119
  • Feedback ID: 6099542d-6cf6-42f5-9624-1b789ee2cc9f

extent analysis

TL;DR

Resetting the current working directory (CWD) manually after each Bash call may mitigate the issue.

Guidance

  • Investigate the Bash invocations generated by Claude to identify patterns or specific commands that change the folder, as this could help pinpoint the cause.
  • Consider adding a command to reset the CWD to a known state after each Bash call, such as cd /original/directory or using an absolute path for subsequent commands.
  • Review the documentation for Opus 4.7 and Claude Code version 2.1.119 to see if there are any known issues or configuration options related to CWD management.
  • Test the behavior in a controlled environment to reproduce and isolate the issue, which may help in finding a more permanent solution.

Notes

The provided information does not specify how Claude generates Bash invocations or how the CWD is managed within the application, which limits the ability to provide a definitive fix.

Recommendation

Apply workaround: Manually resetting the CWD after each Bash call is the most straightforward approach given the current information, as it directly addresses the symptom described.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING