Ground explicit file edits in real file contents#34
Draft
CoreyRDean wants to merge 1 commit into
Draft
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.
Non-technical summary
This fixes a reliability gap in
intent's natural-language mode for file edits. When a user names a real file and asksintentto change it, the model can no longer skip straight to an ungrounded snippet that never touches the file.intentnow forces that workflow to read the target file first or fail closed.That matters now because issue #22 is a direct break in the product promise: a request to modify a known file should yield an executable edit grounded in the file's actual contents, not pseudocode.
Technical summary
read_fileon the named target before returning a command or scriptread_filetool call; if it still does not, return a refusal instead of surfacing the ungrounded editinternal/model/prompt.goso explicit file edits requireread_file(path) FIRSTinternal/engine/engine_test.gofor both the repair path and the fail-closed path, and updatedocs/SPEC.mdto document the contractPATH="/opt/homebrew/bin:$PATH" go test ./internal/engine ./internal/model ./internal/cli,PATH="/opt/homebrew/bin:$PATH" go test ./...,PATH="/opt/homebrew/bin:$PATH" go vet ./...,PATH="/opt/homebrew/bin:$PATH" make buildAdditional notes
Trade-off: the detector is intentionally narrow and keys off explicit edit verbs plus file-like targets. It improves the real bug path without trying to infer every possible mutation request shape in one increment.
Deferred: broader grounding around implicit targets, multi-file rewrite flows, or richer path resolution heuristics remains separate work.
Remaining gap: this ensures explicit file-edit requests must read the named file before proposing a mutation, but it does not redesign the wider prompt/tooling strategy for all mutation tasks.