Skip to content

Commit afad3df

Browse files
agents: name mgrep/rg/fd in the searching guidance (#303)
Folds concrete search-tool selection into the shared `searching` fragment so consumers (including ix) inherit it: semantic/natural-language questions go through `mgrep search -c "<query>" <path>`, exact strings and symbols use `rg`, and known file-path patterns use `fd` or a glob tool. Documents the flags an agent actually reaches for (`-r`, `-m N`, `-a`, `-w`, `--agentic`, `-s`/`mgrep watch`) based on the real `mgrep search` CLI surface. This generalizes the ix-only "ix search invariants" note; ix keeps only its repo-specific invariant (run mgrep from the main checkout) once it picks this up via `nix flake update index`. Regenerated `AGENTS.md` and `CLAUDE.md` via `nix run .#agents-md -- --write`.
1 parent 1bfba76 commit afad3df

3 files changed

Lines changed: 30 additions & 0 deletions

File tree

AGENTS.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -854,6 +854,16 @@ Use exact text search for exact questions and semantic search for fuzzy
854854
questions. Prefer machine-readable output when available, then inspect the narrow
855855
source files that own the behavior.
856856

857+
Reach for semantic search first on conceptual or natural-language questions:
858+
`mgrep search -c "<query>" <path>` returns ranked files with the matched
859+
snippets. Add `-r` to recurse into subdirectories, `-m N` to raise the
860+
ten-result cap, `-a` to synthesize an answer from the hits, `-w` to fold in web
861+
results, and `--agentic` to let mgrep refine the query across several searches.
862+
Pass `-s` to sync local edits into the store before searching when files changed
863+
since the last index, or run `mgrep watch` to keep the store live. Use `rg` for
864+
exact strings and known symbols, and `fd` or a glob tool for known file-path
865+
patterns.
866+
857867
Avoid broad agent delegation for simple search. The codebase is usually small
858868
enough that direct search plus a focused read gives better signal.
859869

CLAUDE.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -854,6 +854,16 @@ Use exact text search for exact questions and semantic search for fuzzy
854854
questions. Prefer machine-readable output when available, then inspect the narrow
855855
source files that own the behavior.
856856

857+
Reach for semantic search first on conceptual or natural-language questions:
858+
`mgrep search -c "<query>" <path>` returns ranked files with the matched
859+
snippets. Add `-r` to recurse into subdirectories, `-m N` to raise the
860+
ten-result cap, `-a` to synthesize an answer from the hits, `-w` to fold in web
861+
results, and `--agentic` to let mgrep refine the query across several searches.
862+
Pass `-s` to sync local edits into the store before searching when files changed
863+
since the last index, or run `mgrep watch` to keep the store live. Use `rg` for
864+
exact strings and known symbols, and `fd` or a glob tool for known file-path
865+
patterns.
866+
857867
Avoid broad agent delegation for simple search. The codebase is usually small
858868
enough that direct search plus a focused read gives better signal.
859869

agents-md/sections/18-searching.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,16 @@ Use exact text search for exact questions and semantic search for fuzzy
44
questions. Prefer machine-readable output when available, then inspect the narrow
55
source files that own the behavior.
66

7+
Reach for semantic search first on conceptual or natural-language questions:
8+
`mgrep search -c "<query>" <path>` returns ranked files with the matched
9+
snippets. Add `-r` to recurse into subdirectories, `-m N` to raise the
10+
ten-result cap, `-a` to synthesize an answer from the hits, `-w` to fold in web
11+
results, and `--agentic` to let mgrep refine the query across several searches.
12+
Pass `-s` to sync local edits into the store before searching when files changed
13+
since the last index, or run `mgrep watch` to keep the store live. Use `rg` for
14+
exact strings and known symbols, and `fd` or a glob tool for known file-path
15+
patterns.
16+
717
Avoid broad agent delegation for simple search. The codebase is usually small
818
enough that direct search plus a focused read gives better signal.
919

0 commit comments

Comments
 (0)