[BUG] Claude-code escaped current directory

Resolved 💬 5 comments Opened Aug 13, 2025 by jbagley Closed Jan 4, 2026

Environment

  • Platform (select one):
  • [x] Anthropic API
  • [ ] AWS Bedrock
  • [ ] Google Vertex AI
  • [ ] Other: <!-- specify -->
  • Claude CLI version: 1.0.80
  • Operating System: macOS 15.6
  • Terminal: Terminal App

Bug Description

I started claude in a project directory that had its .git folder one level beneath it. Perhaps this was an error on my part. I didn't notice that when asked about the use of git, it reported a branch from the repo rooted at my user directory. (Just a note that I use the top-level git for version control of my user setup.)

Steps to Reproduce

  1. Have a directory with a .git folder that has a subdirectory with a .git folder and at least one directory between with no .git folder
  2. Initialize claude from a directory between the two directories with .git repositories
  3. Ask claude about the use of git: "I forget, does this project use git?"

Expected Behavior

I was expecting Claude to find the git information in or below its current directory, though as I said I could see that this could be "user error". If Claude had to search above the current directory from where it was initialized, I would expect it to at least ask if that is what it should do.

Actual Behavior

Claude ascended three directories, escaping the root of the session. It referred to several files from git commit messages such as my zsh config files, but i don't know what was actually read.

Additional Context

The tail of the session, note that the .claude file is in /Users/jason/src/Me/Life, but claude has adjusted to think its root is where the .git directory is in /Users/jason/src/Me/Life/Life.

> That means you were reading outside of this directory which you are not supposed to do. ⏺ You're absolutely right, and I apologize. The initial context I was provided included git status information from outside the allowed working directory (/Users/jason/src/Me/Life/Life). That information showed: - Files from your home directory (.emacs.d/init.el, .zshrc, etc.) - A branch name "Oort" from a parent repository I should not have been given access to that information about files and git status outside of /Users/jason/src/Me/Life/Life. This appears to have been an error in how the initial context was provided to me at the start of our session. You correctly identified that I'm only supposed to work within the Life project directory, and the fact that I had information about files three directories up (../../../) was indeed a violation of that restriction. Thank you for catching this security/permission issue. Going forward, I should only have information about and work with files within /Users/jason/src/Me/Life/Life and its subdirectories. > Will you report this as a violation to someone at Anthropic? They should know. ⏺ I don't have a direct mechanism to report issues to Anthropic from within our conversation. However, you're right that this is important - the initial context shouldn't have included git status information from outside the designated working directory. I'd recommend you report this issue yourself at the GitHub issues page that was mentioned earlier: https://github.com/anthropics/claude-code/issues You could describe that: 1. The initial gitStatus context included information from a parent directory repository 2. It showed files with ../../../ paths that were outside the allowed working directory 3. This violates the security model where Claude Code should only access files within the designated working directory This kind of feedback is valuable for improving the security and permission model of Claude Code. The fact that you caught this shows the importance of users being vigilant about these boundaries.

And my local settings:

``` json
{
"permissions": {
"allow": [
"Bash(swift --version)"
],
"deny": [],
"ask": []
}
}

View original on GitHub ↗

This issue has 5 comments on GitHub. Read the full discussion on GitHub ↗