File cache conflicts when running multiple Claude Code instances with git worktrees

Resolved 💬 2 comments Opened Jan 11, 2026 by scabana Closed Jan 11, 2026

Problem

When running multiple Claude Code instances in the same root repository but working in different git worktrees, the file cache appears to be shared at the project/folder level. This causes conflicts where:

  1. Instance A reads a file in worktree A
  2. Instance B reads a different file in worktree B
  3. Instance A tries to write/edit its file → "File has been unexpectedly modified" or "File has not been read yet"

Steps to Reproduce

  1. Create a git worktree: git worktree add .worktree/issue-123 -b feature/issue-123
  2. Open Claude Code in the main folder, reference a file in .worktree/issue-123
  3. Open another Claude Code instance in the main folder (or another worktree)
  4. Have both instances read files
  5. Try to edit a file in either instance → cache invalidation errors

Expected Behavior

Each Claude Code instance should maintain its own file cache, or the cache should be scoped per-worktree when working with git worktrees.

Current Workaround

  • Pause other instances when editing files
  • Launch Claude Code directly from within each worktree folder instead of from the parent
  • Manually paste file content

Environment

  • Windows (MINGW64)
  • Multiple Claude Code instances running concurrently
  • Using git worktrees for parallel development on different issues

Suggested Solution

Consider one of:

  1. Per-instance file cache (using session/process ID)
  2. Per-worktree cache isolation when files are in different worktrees
  3. A configuration option like CLAUDE_CACHE_SCOPE=instance or similar

View original on GitHub ↗

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