# agent: Improve initial file search quality \(\#29317\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/8b5835de171349d0d0e5aaa5f1563934b98e98c0)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: 8b5835de171349d0d0e5aaa5f1563934b98e98c0

Requested commit: 8b5835de171349d0d0e5aaa5f1563934b98e98c0

Commit: 8b5835de171349d0d0e5aaa5f1563934b98e98c0

Tree: 521adf640f2a3bf715489f287b5ac9bd8530ebab

Author: Agus Zubiaga

Committer: GitHub

## Message

```
agent: Improve initial file search quality (#29317)

This PR significantly improves the quality of the initial file search
that occurs when the model doesn't yet know the full path to a file it
needs to read/edit.

Previously, the assertions in file_search often failed on main as the
model attempted to guess full file paths. On this branch, it reliably
calls `find_path` (previously `path_search`) before reading files.

After getting the model to find paths first, I noticed it would try
using `grep` instead of `path_search`. This motivated renaming
`path_search` to `find_path` (continuing the analogy to unix commands)
and adding system prompt instructions about proper tool selection.

Note: I know the command is just called `find`, but that seemed too
general.

In my eval runs, the `file_search` example improved from 40% ± 10% to
98% ± 2%. The only assertion I'm seeing occasionally fail is "glob
starts with `**` or project". We can probably add some instructions in
that regard.

Release Notes:

- N/A
```

## Parents

- [2124b7ea998a949b2a5e4bdc1f12bb5275d636c2](https://git.cafe/gitcafe/zed/commit/2124b7ea998a949b2a5e4bdc1f12bb5275d636c2?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/8b5835de171349d0d0e5aaa5f1563934b98e98c0?format=markdown)
