Claude Opus hallucinates about file/branch state, goes in circles
Bug Description
During a multi-step development session, Claude Opus 4.6 (1M context) repeatedly hallucinated about the state of files and branches, wasting significant time going in circles.
Specific Issues
1. Hallucinated that changes were on remote main when they weren't
After editing autocheckin_module.js locally, Claude claimed the fix was already on origin/main and that "no changes needed." When git show origin/main:file was run, it showed the old code — but Claude still insisted the fix was there. This happened multiple times in a loop.
2. Confused two separate projects sharing similar files
The workspace has two projects: checkin_bot and okr_audit, both containing app/static/autocheckin_module.js. Claude repeatedly confused which project's file it was reading/editing, launched the wrong project's server, and didn't realize the mistake until the user pointed it out.
3. Lost track of uncommitted edits
Claude made edits to a file, then ran git checkout to a new branch, which reverted the changes. Claude then read the file and claimed the edits were still there (they weren't — or were, depending on git state), creating a contradictory loop where git diff showed nothing but Read showed different content.
4. Excessive verification loops
Instead of just making the fix and committing, Claude ran 10+ rounds of git show, git diff, sed, grep on the same file trying to verify state, each time getting confused by the results. The user had to intervene with "stop and think" to break the loop.
Expected Behavior
Claude should:
- Track which branch it's on and what's committed vs uncommitted
- Not claim changes exist on remote when they don't
- Not confuse files from different projects in the same workspace
- When stuck in a verification loop, stop and reason about the contradiction
Environment
- Model: Claude Opus 4.6 (1M context)
- Tool: Claude Code CLI
- OS: macOS Darwin 25.3.0
- Session length: Long session with multiple tool calls, approaching context limits
Possible Root Cause
Long context sessions with many tool calls may degrade Claude's ability to track mutable state (branch, file contents, working directory). The model may be "averaging" over multiple contradictory snapshots of the same file seen at different points in the conversation.
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗