[BUG] Claude ignores working directory from <env> and uses hardcoded absolute paths to wrong directories

Resolved 💬 4 comments Opened Oct 2, 2025 by mstroeve Closed Jan 7, 2026

Preflight Checklist

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

What's Wrong?

Claude consistently ignores the working directory provided in <env> and instead uses hardcoded absolute paths to directories outside the current project, despite:

  1. Clear working directory in <env>
  2. Explicit project CLAUDE.md instructions stating "ALWAYS use working directory from <env> as base"
  3. Multiple user corrections during the session

What Should Happen?

Expected Behavior (worked in previous versions):

  • Claude respects <env> working directory
  • Uses relative paths from working directory
  • Only works in the specified project directory

Error Messages/Logs

Actual Behavior (regression in current version):
  - Claude uses hardcoded absolute paths like /home/user/projects/system_a/...
  - Edits files in WRONG directory (system_b) instead of current working directory (system_a)
  - Continues this pattern even after corrections
  - Ignores project-specific CLAUDE.md instructions

Steps to Reproduce

  1. Session starts in: /home/user/projects/system_a/templates
  2. <env> clearly shows: Working directory: /home/user/projects/system_a/templates
  3. Project CLAUDE.md contains:

## Repository Locations
ALWAYS use the working directory from <env> as base:

  • Module/feature: module/feature/ (relative from working dir)
  • Templates: templates/ (relative from working dir)

NEVER use hardcoded paths

  1. User requests: "fix sorting in grid"
  2. Claude edits files in BOTH:
  • /home/user/projects/system_a/... (correct)
  • /home/user/projects/system_b/... (WRONG - different project!)

Claude Model

None

Is this a regression?

Yes, this worked in a previous version

Last Working Version

<2.0.1

Claude Code Version

2.0.1

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Terminal.app (macOS)

Additional Information

Concrete Examples from Session:

User repeatedly had to correct:

  • "wrong directory again! it's system_a"
  • "you edited system_b again! check this"
  • "this should be in system_a only!"
  • "why do you keep editing both dirs!"

Each time Claude acknowledged but continued the same pattern.

Impact:

  • Files edited in wrong project directories
  • Wasted time reverting incorrect changes
  • User frustration
  • Loss of trust in Claude respecting project boundaries

Previous Behavior:
User confirms this never happened in previous Claude versions - this is a regression.

Root Cause (suspected):
Claude appears to be using pattern matching from earlier in conversation instead of actively checking <env> working directory for each operation. It creates a mental model of "these two directories need to be kept in sync" and applies it incorrectly.

View original on GitHub ↗

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