Skip to content

Add recent_changes tool to surface unsaved buffer diffs as agent context#50430

Open
BitStrider wants to merge 6 commits intozed-industries:mainfrom
BitStrider:add-recent-changes-tool
Open

Add recent_changes tool to surface unsaved buffer diffs as agent context#50430
BitStrider wants to merge 6 commits intozed-industries:mainfrom
BitStrider:add-recent-changes-tool

Conversation

@BitStrider
Copy link

The agent currently has no way to know what files the user is actively
editing unless they explicitly @-mention them. This means the agent can
easily clobber unsaved work or miss important in-progress changes when
making edits.

This PR adds a recent_changes tool that lets the agent call a single
tool and immediately see every dirty buffer in the project as a unified
diff — what changed, in which file, since the last save.

The tool is read-only, always-on, and follows the exact same pattern as
the existing diagnostics and grep tools. No new architecture, no
feature flag needed.

Internally it snapshots dirty buffers synchronously via BufferStore,
then loads the saved-on-disk version asynchronously via Fs and runs
diffy::create_patch to produce the diff. Three cases are handled:
files modified since last save, files never saved yet, and files whose
saved version can't be read from disk.

Also promotes diffy to a workspace dependency since it was already
pinned inline in the language crate.

Release Notes:

  • Added: recent_changes tool for the agent to discover unsaved edits
    across the project without requiring explicit file mentions

@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Mar 1, 2026
@zed-community-bot zed-community-bot bot added the first contribution the author's first pull request to Zed. NOTE: the label application is automated via github actions label Mar 1, 2026
@SomeoneToIgnore SomeoneToIgnore added the area:ai Improvement related to Agent Panel, Edit Prediction, Copilot, or other AI features label Mar 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:ai Improvement related to Agent Panel, Edit Prediction, Copilot, or other AI features cla-signed The user has signed the Contributor License Agreement first contribution the author's first pull request to Zed. NOTE: the label application is automated via github actions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants