Add compact search_file tool with local and remote filesystem support - #1
Draft
ADD-SP wants to merge 6 commits into
Draft
Add compact search_file tool with local and remote filesystem support#1ADD-SP wants to merge 6 commits into
ADD-SP wants to merge 6 commits into
Conversation
# Conflicts: # codex-rs/core/src/environment_selection.rs
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
search_filetool for grouped, compact filesystem search results.Historical replay indicates that search_file can replace approximately 73% of independent file searches while reducing their model-visible output by 26% on average.
Historical impact analysis
To estimate the impact of
search_file, local Codex rollout history was replayed against the compact formatter. The analysis usedceil(UTF-8 bytes / 4)as the token approximation and excluded the current development session.Corpus and replaceability
search_fileAn independent file search is a tool call containing one search operation without build/test/Git commands, dynamic shell control flow, command substitution, or result-processing pipelines such as
awk,cut,xargs, orwc.Model-visible output reduction
search_fileSavings by operation
Path-prefix grouping and removal of shell wrapper output accounted for approximately 86.6% of the savings. The 300-character excerpt limit accounted for the remaining 13.4%.
No measured call depended on the 1,000-result limit or the 10K-token output limit to produce these savings; the measured reduction came from the compact representation itself rather than lossy truncation.
The remaining independent searches primarily used context flags such as
-A/-B/-C, dynamic paths or shell globs, filename/count-only output modes, or traversal semantics not represented by the initial tool. Including straightforwardgrep,find, andfdtranslations gives an estimated coverage ceiling of approximately 84%, while 72.9% is the conservative directly confirmed result.Because tool outputs remain in conversation history until compaction, their reduction also lowers repeated input context. Historical replay estimated 157.5M fewer repeated input tokens before tool-schema overhead, or approximately 60.2M–69.1M net tokens when the tool is enabled only in relevant sessions.
These figures measure model context size rather than billing impact: approximately 98.2% of historical input tokens were cached.