[Bug] Excessive context re-sending in tool round-trips due to CLAUDE.md file inclusion
Status Open
Reported on v2.1.259
Maintainer reply None cached
Workaround ✓ Mentioned in thread ↓
Activity 3 comments · opened Sep 3, 2026
Bug Description
- This repo's CLAUDE.md is ~900 lines and re-sends on every tool round-trip. - Twice, editing files via python/sed instead of the Edit tool triggered a "file changed on disk" reminder that re-printed 150+ lines of the file back into context. That's self-inflicted and avoidable.
Environment Info
- Platform: win32
- Terminal: xterm-256color
- Version: 2.1.259
- Feedback ID: 74e41bc2-cf4c-41d2-841c-6af2346e51df
Errors
[{"error":"TelemetrySafeError: VirtualMessageList: itemKeys/messages length desync (keys=67 messages=66 range=[21,67))\n at nHt (B:/~BUN/root/chunk-9891yaqw.js:36:25132)\n at Due (B:/~BUN/root/chunk-9891yaqw.js:36:17978)\n at Oa (B:/~BUN/root/chunk-89zm4j0p.js:18:20034)\n at Au (B:/~BUN/root/chunk-89zm4j0p.js:18:38200)\n at zh (B:/~BUN/root/chunk-89zm4j0p.js:18:84275)\n at bg (B:/~BUN/root/chunk-89zm4j0p.js:18:83275)\n at qu (B:/~BUN/root/chunk-89zm4j0p.js:18:83104)\n at _h (B:/~BUN/root/chunk-89zm4j0p.js:18:79629)\n at je (B:/~BUN/root/chunk-89zm4j0p.js:18:6260)\n at Fe (B:/~BUN/root/chunk-89zm4j0p.js:18:4791)","timestamp":"2026-09-03T17:39:56.525Z"}]
3 Comments
~~ConfigChanged hook might enable you to prevent the instruction~~
Proposed solution for Antrhopic: allow decision control on InstructionsLoaded and/or include InstructionsLoaded in ConfigChanged.
Currently there is no straightforward method to prevent this issue.
Current workarounds
claudeMdExcludesin the settings for sessions or teammates that are going to be subjected to CLAUDE.md and other instruction files-
Claude can we gaslight writers that they're writing to the files?
Yes — that's an overlayfs upper layer inside a private mount namespace. Writes land in a scratch dir, the real file is untouched, nothing outside the namespace sees the change, and the upper dir is your reviewable diff.
bubblewrap (simplest)
Requires bubblewrap ≥ 0.9 (
bwrap --version). Inside, the agent writes CLAUDE.md normally and gets a success. Outside, your file is unchanged.Throwaway variant — writes vanish on exit:
Plain unshare, if bwrap is too old
Reviewing and applying
Everything the agent touched is in the upper dir, whole-file:
Apply selectively:
Or all of it:
Discard:
rm -rf /tmp/cc-upper /tmp/cc-work.Caveats
upperdirandworkdirmust be on the same filesystem, and it needstrusted.*xattr support — ext4/xfs/btrfs are fine, and your NVMe setup is fine. Don't put them on tmpfs on older kernels..wh.NAMEwhiteouts or char-dev 0:0 nodes in the upper dir, hence the rsync exclude.$PWDis already on an overlay (inside a container), stacking fails — usefuse-overlayfsinstead..claude/subdir only, and leave the rest bind-mounted normally.This is strictly better than the chattr/permissions route for your case: the agent gets a plausible success instead of an EPERM it will try to route around with
sed -i.Hold on this only protects other processes
Cooking
That's a little much. Have you explored path scoped
rules.mdfiles yet?Sounds like you're getting bullied three times?
Typical Tuesday I'd say