Repository navigation
ADFA-6805 | Teach the local model to read files with read_file, not search - #155
Open
davidschachterADFA wants to merge 3 commits into
Open
davidschachterADFA wants to merge 3 commits into
davidschachterADFA wants to merge 3 commits into
Conversation
The local prompt's only "look at a file" example was open_file, so "Show me app/build.gradle" and "What strings are defined" went to search_project. Replace the open_file example with a read_file one (same size) and pin it in LocalSystemPromptTest. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Vh2DAaJxvRXKRYkgiDqwGQ
Its description ("Read the current build output and status") overlapped
with "show me build.gradle" for a small model. The text is shared by
every backend.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Vh2DAaJxvRXKRYkgiDqwGQ
Daniel-ADFA
approved these changes
Oct 29, 2026
4 tasks done
15 tasks done
Contributor
Author
Independent review (
|
| ID | Finding | Checked | Conclusion |
|---|---|---|---|
| F01 | The new read_file example says a bare build.gradle or strings.xml is fine, but those names are often ambiguous |
True: ReadFileHandler fails an ambiguous name with "Multiple files named 'X' — specify a path". rules.yml:20 already said bare names are accepted |
The model gets a clear error to recover from. Change only if the phone shows it going wrong |
| F02 | The only open_file example was replaced, so the prompt no longer shows how to open a file in the editor |
True. open_file is still in COMPACT_BUILT_INS, the tool list and rules.yml:20 |
No change. Whether "show" now picks the wrong tool is a model question, not settled by code |
| F03 | The read_build_output description now points at read_file in config shared by every backend |
True: PromptToolCatalog and ChatViewModel both use it. read_file is always a built-in, so the hint never names a missing tool |
About 12 more words. I did not check whether this tool ever shows in an approval dialog |
| F04 | The new test only checks that the example string is present | True. A prompt's effect on the model has no code-level test | Covered by the phone runs, not by the test |
| F05 | README says EXAMPLE_FILE_NAME is a name both read_file and open_file accept |
Not a defect: the statement is still true | None |
Not device-verified beyond the phone runs already described in the PR.
Posted by Claude Code for David Schachter.
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
ADFA-6805. A 1.5B on-device model called
search_projectinstead ofread_filefor "Show me app/build.gradle" and "What strings are defined in the app?" (ADFA-6800 saw it once; a three-run baseline on mergedmainsaw it every time). Two wording changes, one commit each so the effect can be attributed:plugins/AI-Agent-Local/.../prompts/tools.yml: theopen_fileexample is replaced by aread_fileexample ("Show or read a file (source, build.gradle, strings.xml; a bare name is fine)"). The local prompt had noread_fileexample at all, onlyopen_file. Same example count and index, so no extra prompt tokens. A newLocalSystemPromptTestcase pins the example.plugins/AI-Core/.../prompts/tool_descriptions.yml:read_build_outputnow reads "Read the log of the last build and whether it passed; to read build.gradle or any other file, use read_file" (was "Read the current build output and status", which a small model took for "show me build.gradle"). This file is shared by every backend, including the cloud ones' native tool definitions. The new text is accurate for them too; it is about 68 characters longer.Measured on a Pixel 6 Pro (Android 17)
qwen2.5-coder-1.5b-instruct-q4_k_m, "Build Apps Anywhere" test project, a fresh chat per prompt, every write declined, three cold-start runs of the 20 ADFA-6800 prompts per build. The baseline is merged
mainat 07aab78; the two builds are on 18a9c97 (a Markdown-preview change in between).search_project✗ ×3search_project✗ ×3read_file×3read_file×2,search_project(query="strings.xml")×1read_file×3read_file("…/strings.xml")×3open_file), "Show me the build output" and "Why did my last build fail?" (stillread_build_output).search_projectcall whose query namesstrings.xmlcounts as correct, which is how C1 reaches 20 in all three runs.What this does not fix (found while checking)
I ran the two edit prompts through to the approval dialog, three runs each, on C1 + C2:
edit_filethree times with the same guessedold_string(app_name = "Block Stacker", identical tonew_string), gets the same rejection ("new_string is identical to old_string…") each time, and the run endsREPEATEDafter 3 turns. It never callsread_file. The guess is rejected before the approval dialog, so nothing is written, but the edit does not happen.create_filewithcontent="", which is rejected as "Missing required argument(s): content"; on the next turn it answers "I can't assist with that request." and stops.Neither is caused by this change; both are the same on the baseline's first calls, which the 20-prompt score counts as correct. They need a different fix (handler behaviour, not wording), so I have left them out of this PR.
Review
An independent read-only review of the diff found no correctness problems: nothing pins the old text,
examples[1]and the example count are unchanged,open_filekeeps its description and its place in the compact set, and the new test fails if the example is removed. The other backends'tools.ymlfiles still carryopen_fileexamples; they are separate prompts and are not changed here.Not verified
read_build_outputwording was not tried against a cloud model on a device.prefill:figure depends on what is cached). C1 is the same size by design.Test plan
testDebugUnitTestpassaddons checkexits 0🤖 Generated with Claude Code
https://claude.ai/code/session_01Vh2DAaJxvRXKRYkgiDqwGQ