Add recent_changes tool to surface unsaved buffer diffs as agent context#50430
Open
BitStrider wants to merge 6 commits intozed-industries:mainfrom
Open
Add recent_changes tool to surface unsaved buffer diffs as agent context#50430BitStrider wants to merge 6 commits intozed-industries:mainfrom
recent_changes tool to surface unsaved buffer diffs as agent context#50430BitStrider wants to merge 6 commits intozed-industries:mainfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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_changestool that lets the agent call a singletool 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
diagnosticsandgreptools. No new architecture, nofeature flag needed.
Internally it snapshots dirty buffers synchronously via
BufferStore,then loads the saved-on-disk version asynchronously via
Fsand runsdiffy::create_patchto 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
diffyto a workspace dependency since it was alreadypinned inline in the
languagecrate.Release Notes:
recent_changestool for the agent to discover unsaved editsacross the project without requiring explicit file mentions