Skip to content

Auto-detect external file changes between turns #30427

Closed as duplicate
Closed as duplicate

Description

@owengong

Preflight Checklist

  • I have searched existing requests and this feature hasn't been requested yet
  • This is a single feature request (not multiple features)

Problem Statement

When I'm collaborating with Claude on a file — Claude makes an edit, then I manually tweak a few lines
before continuing — Claude doesn't detect my changes. It continues working from its stale mental model and
either overwrites my edits or gets confused by the mismatch.

The current workflow requires me to manually tell Claude "I edited that file, re-read it before
continuing" every time. This adds friction to the most natural collaborative editing pattern: Claude
writes, I adjust, we continue.

Proposed Solution

After Claude edits a file, store its hash or mtime. Before Claude's next turn, check if the file changed
externally. If it did, automatically re-read only that file and surface the user's changes as context
(e.g., "Note: user modified lines 12-15 of plan.md since your last edit").

This should be cheap — stat() for mtime is basically free, and you only re-read the 1-2 files that
actually changed. Claude already knows what it wrote (conversation history), and the filesystem knows
current state. The delta is necessarily the user's changes.

Alternative Solutions

Currently I work around this by explicitly telling Claude "I edited the file, re-read it" before
continuing. This works but adds friction every time. A prompt-submit hook could theoretically detect
changes, but this feels like it should be built in since the data is already available.

Priority

High - Significant impact on productivity

Feature Category

CLI commands and flags

Use Case Example

  1. I ask Claude to write an implementation plan to plan.md
  2. Claude writes the plan
  3. I read it and manually adjust a few sections — reword a step, remove something unnecessary
  4. I prompt Claude to "continue implementing"
  5. Claude works from the version it wrote, not my updated version — it may overwrite my changes or produce
    code that doesn't match the plan I actually want
  6. With this feature, Claude would automatically detect that plan.md changed, re-read it, and work from my
    version

Additional Context

This is especially common in plan mode where Claude writes a plan file and the user wants to tweak it
before execution. But it applies to any collaborative editing — code files, configs, etc. The pattern of
"AI writes, human adjusts, AI continues" should just work without manual re-read prompts.

Activity

  1. github-actions commented on Mar 3, 2026

    @github-actions

    Found 3 possible duplicate issues:

    1. [BUG] Config file (.claude.json) silently reverts user changes — stale write detection logs telemetry but does not prevent overwrite #27941
    2. [BUG] Plan file edits ignored when approving with "Yes, clear context": cached plan content injected instead of re-reading from disk #24302
    3. [BUG] Edit/Write/Read tools use mtime for change detection — false positives from IDE autosave #25623

    This issue will be automatically closed as a duplicate in 3 days.

    • If your issue is a duplicate, please close it and 👍 the existing issue instead
    • To prevent auto-closure, add a comment or 👎 this comment

    🤖 Generated with Claude Code

  2. github-actions commented on Mar 7, 2026

    @github-actions

    This issue has been automatically closed as a duplicate of #27941.

    If this is incorrect, please re-open this issue or create a new one.

    🤖 Generated with Claude Code

  3. added
    duplicateThis issue or pull request already exists
    and removed
    enhancementNew feature or request
    on Mar 7, 2026
  4. github-actions commented on Mar 14, 2026

    @github-actions

    This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.

  5. locked as resolved and limited conversation to collaborators on Mar 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    duplicateThis issue or pull request already exists

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions