claude-code - 💡(How to fix) Fix [BUG] System prompt guidance on not using 'cd' in Bash leads to repeated failures [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#54624Fetched 2026-04-30 06:40:32
View on GitHub
Comments
1
Participants
2
Timeline
5
Reactions
1
Timeline (top)
labeled ×4commented ×1

Error Message

Error Messages/Logs

Root Cause

I use Claude Code with Opus 4.7 in a scenario where deployment takes place on a remote machine and Claude has to execute commands over ssh. On the remote machine it needs to use cd to change directory. This used to work but now it often results in the agent failing to correctly preprend the 'cd' to its chain of commands. It will fail over and over again. The model at one point said that it could see its 'cd' was not appended and it was 'forgetting' to do it because of instructions in my CLAUDE.md. When I asked it instead clarified that it meant the system prompt, and showed me a chunk of text from the instructions on the Bash tool that instruct Claude not to use 'cd' unless given explicit permission by the user.

RAW_BUFFERClick to expand / collapse

Preflight Checklist

  • I have searched existing issues and this hasn't been reported yet
  • This is a single bug report (please file separate reports for different bugs)
  • I am using the latest version of Claude Code

What's Wrong?

I use Claude Code with Opus 4.7 in a scenario where deployment takes place on a remote machine and Claude has to execute commands over ssh. On the remote machine it needs to use cd to change directory. This used to work but now it often results in the agent failing to correctly preprend the 'cd' to its chain of commands. It will fail over and over again. The model at one point said that it could see its 'cd' was not appended and it was 'forgetting' to do it because of instructions in my CLAUDE.md. When I asked it instead clarified that it meant the system prompt, and showed me a chunk of text from the instructions on the Bash tool that instruct Claude not to use 'cd' unless given explicit permission by the user.

What Should Happen?

Claude should use the appropriate tools necessary to solve the problem. In this case, 'cd'.

Error Messages/Logs

Steps to Reproduce

Have claude need to edit / deploy a system on a remote host whereby the commands piped to ssh would require a 'cd' before them to succeed.

Claude Model

Opus

Is this a regression?

Yes, this worked in a previous version

Last Working Version

No response

Claude Code Version

2.1.23

Platform

AWS Bedrock

Operating System

Other Linux

Terminal/Shell

Other

Additional Information

No response

extent analysis

TL;DR

Review the CLAUDE.md file for instructions that may be preventing Claude from prepending 'cd' to its chain of commands.

Guidance

  • Check the CLAUDE.md file for any instructions related to the Bash tool that may be causing Claude to avoid using 'cd' unless explicitly permitted.
  • Verify that the remote machine's SSH configuration allows Claude to execute 'cd' commands.
  • Test Claude with a simplified scenario to isolate the issue and determine if it's specific to the current setup or a more general problem.
  • Consider updating the CLAUDE.md file to provide explicit permission for Claude to use 'cd' when necessary.

Example

No code snippet is provided as the issue is related to configuration and permissions rather than code.

Notes

The issue seems to be related to a change in behavior between versions, and the exact cause is unclear without more information about the CLAUDE.md file and the SSH configuration.

Recommendation

Apply workaround: Review and update the CLAUDE.md file to ensure that Claude has the necessary permissions to use 'cd' when required, as this is the most likely cause of the issue based on the provided information.

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