feat(grokbuild): hashline anchor editing; fuzzy file search - #244
Merged
Conversation
Two final adoptions from grok-build's tool implementations.
Hashline anchor-based editing (internal/tool/hashline.go):
- Every line carries a content-derived SHA-256 hash anchor; ReadAnchored
outputs L{line}:{hash}|{content} for the agent to reference.
- ApplyEdits validates ALL anchors against current content before
applying anything: a bad hash rejects the entire batch atomically with
no partial writes. Shifted-anchor recovery finds drifted content within
a bounded window so insertion/deletion above the edit point does not
force the agent to re-read the file. Bottom-up application prevents
earlier edits from shifting later line numbers.
Fuzzy file search (internal/fuzzyfind + FuzzyFind tool):
- Scored path matching: exact basename > basename prefix > basename
contains > multi-word segments > path contains > camelCase/abbrev,
with path-length tiebreak. Gitignore-aware walk.
- FuzzyFind tool registered in chat_tools.go with safety capabilities +
permission aliases. Complements Glob/Grep for approximate lookups.
Verification: new suites green (hashline 8, fuzzyfind 7, FuzzyFindTool 3);
tool, cmd, safety, testaudit suites pass; golangci-lint 0 issues;
gofmt clean; go build ./... clean.
The previous commit missed internal/fuzzyfind/ (the package implementing scored path matching) and the chat_tools/capabilities/permission registrations for both CodeMatch and FuzzyFind, because the initial git add failed on the missing test file and the retry only staged internal/tool/.
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.
Summary
Two final adoptions from grok-build's tool implementations.
Hashline anchor-based editing —
internal/tool/hashline.goReadAnchoredoutputsL{line}:{hash}|{content}for agent referenceApplyEditsvalidates ALL anchors against current content before applying anything: a bad hash rejects the entire batch atomically (no partial writes)Fuzzy file search —
internal/fuzzyfind+FuzzyFindtoolFuzzyFindtool registered in chat_tools.go + safety capabilitiesTesting