agentgrep fuzzy¶
The agentgrep fuzzy command is a non-interactive fuzzy filter
shaped like fzf --filter. It reads candidate lines from stdin,
scores them against your query, and emits the matches in descending
score order. Use it as the narrowing stage at the tail of a pipeline.
Defaults follow fzf: fuzzy matching with the v2 algorithm, smart-case
(case-insensitive unless the query has uppercase), extended-search
syntax (foo !bar, ^foo, bar$, 'foo), and score-descending
sort.
Examples¶
Narrow grep output to lines that fuzzy-match a phrase:
$ agentgrep grep -F . | agentgrep fuzzy 'config bliss'
Exact substring matching instead of fuzzy:
$ agentgrep fuzzy --exact -i 'design notes' < transcript.txt
Match in a specific tab-separated column (1-indexed):
$ agentgrep find -l | agentgrep fuzzy --delimiter $'\t' --nth 4 jsonl
Print the query as the first output line (fzf’s --print-query):
$ agentgrep fuzzy --print-query design < transcript.txt
Open the Textual explorer pre-filled with the fuzzy query:
$ agentgrep fuzzy design --ui
No-input behavior¶
When agentgrep fuzzy is invoked with no QUERY positional, no -f
filter, AND no piped stdin (i.e. you typed agentgrep fuzzy into an
interactive shell), the subcommand prints its usage and exits with
status 2. There is no interactive fzf-style TUI fallback — for
interactive browsing reach for agentgrep ui or the --ui overlay
on any other subcommand.
Command¶
Usage¶
usage: agentgrep fuzzy [-h] [--agent {codex,claude,cursor,gemini,all}] [-f QUERY] [-i | --no-ignore-case | --smart-case] [-e] [--no-extended] [--algo {v1,v2}] [--tiebreak {length,begin,end,index,chunk}] [--no-sort] [-d DELIM] [-n N] [--with-nth N] [--print-query] [--read0] [--print0] [--json | --ndjson | --ui] [query]
Positional Arguments¶
- query¶
Fuzzy query (also accepted via -f/--filter)
Options¶
- --agent¶
Limit results to a specific agent; repeatable
- -f, --filter QUERY¶
Explicit filter query (overrides the positional)
- -e, --exact¶
Use exact substring matching instead of fuzzy
- --no-extended¶
Disable extended-search tokens (``foo !bar`` etc.)
- --algo¶
Fuzzy match algorithm (default: v2)
- --tiebreak¶
Score tiebreak rule (default: length)
- --no-sort¶
Preserve input order instead of sorting by score (fzf's ``+s``)
- -d, --delimiter DELIM¶
Field delimiter (default: whitespace)
- -n, --nth N¶
Limit matching to the Nth field (1-indexed)
- --with-nth N¶
Display only the Nth field
- --print-query¶
Prepend the query as the first line of output
- --read0¶
Treat stdin as NUL-delimited
- --print0¶
Separate output records with NUL instead of newline
- -i, --ignore-case¶
Force case-insensitive matching
- --no-ignore-case¶
Force case-sensitive matching (fzf's ``+i``)
- --smart-case¶
Smart-case (default): case-sensitive only when query has uppercase
- --json¶
Emit one JSON document
- --ndjson¶
Emit one JSON object per line
- --ui¶
Launch a read-only UI
Exit codes¶
0— at least one input line matched the filter1— no lines matched2— invalid usage (no QUERY and no piped stdin)
Extended-search syntax¶
The default --no-extended flag toggles fzf’s extended-search
grammar:
A bare token must appear in the line (substring match)
!tokenexcludes lines containingtoken^tokenanchors to the line prefixtoken$anchors to the line suffix'tokenforces an exact substring match (no fuzzy fallback)
Tokens are whitespace-separated. A line matches when every positive
token’s predicate is satisfied and no negative token’s predicate is.
Pass --no-extended to treat the query as a single literal pattern.
Field selection¶
--delimiter, --nth, and --with-nth mirror fzf’s field-selection
model. With --delimiter $'\t' and --nth 2, only the second
tab-separated field is scored. With --with-nth 3, only the third
field is displayed even though scoring happens against the full line.
Together they let you fuzzy-narrow tabular pipelines (e.g. agentgrep
find --list-details) by column.
NUL-delimited I/O¶
Pass --read0 to treat stdin as NUL-delimited (for input from
agentgrep find --print0, xargs -0, etc.). Pass --print0 to
separate output records with NUL — useful when piping back into
another xargs -0 consumer or any tool that needs paths with
embedded spaces.
Interactive UI¶
Pass --ui to open the Textual explorer pre-filled
with the fuzzy query.