CLI¶
The agentgrep CLI is the fastest path to your local AI agent prompt
and history archives from a terminal. It wraps the same read-only
discovery and parsing layer the MCP server exposes — ranked search,
grep, find stores, filter by agent — and lets you pipe everything through
--json or --ndjson so any script or non-MCP agent can consume the
results. Bare agentgrep (no subcommand) prints a colorized
directory of choices listing every subcommand with example
invocations — the same tmuxp / vcspull pattern. See TUI
for the interactive Textual explorer.
Note
Versions before 0.1.0a5 silently rewrote agentgrep <terms> as
agentgrep grep <terms> and bare agentgrep as agentgrep ui.
Both shortcuts are gone — every subcommand must be named
explicitly. agentgrep bliss is now an invalid choice error
rather than a grep; reach for agentgrep grep bliss.
Content search with rg/ag-shaped flags, output, and exit codes.
Ranked, deduped search grouped by session — best matches first.
Enumerate on-disk stores with fd-shaped flag grammar.
Interactive Textual explorer for browsing prompts and conversations.
CLI argument types, serialization helpers, and command entry points.
–ui overlay¶
Every search-shaped subcommand accepts --ui: pass it to open the
Textual explorer pre-filled with the same query you’d
otherwise run as a one-shot. This is the tig-shaped overlay model —
agentgrep grep -i foo --ui is to agentgrep grep -i foo what
tig log is to git log.
Use from another agent¶
The CLI is a first-class consumer for any agent that doesn’t speak MCP. Two flags govern machine-readable output:
--jsonemits a single JSON document with anenvelopecarrying the record list. Best when the caller wants to parse the whole result at once.--ndjsonstreams one JSON object per line. Best for piping intojq, into another CLI, or into an agent that consumes results incrementally.
Both flags work on search, grep, and find. See
JSON output for the record shapes.
Agents that already speak MCP should prefer
agentgrep-mcp — same discovery and parsing
surface, but exposed as MCP tools with typed schemas.
Examples¶
Ranked search — deduped and grouped by session:
$ agentgrep search "deploy"
Sweep prompts and conversations in one pass:
$ agentgrep search "deploy" --scope all
Search prompts with rg-shaped flags:
$ agentgrep grep bliss
Combine multiple patterns with an agent filter:
$ agentgrep grep serene bliss --agent codex
Snippet-first output with highlighted matches:
$ agentgrep grep --style pretty deploy
Stream full-conversation matches as NDJSON:
$ agentgrep grep prompt history --scope conversations --ndjson
List stores for one agent as JSON:
$ agentgrep find cursor-cli --json
Open the directory of choices:
$ agentgrep
Command: agentgrep¶
Usage¶
usage: agentgrep [-h] [--color {auto,always,never}] {grep,find,ui,search} ...
Options¶
- --color¶
when to use colors: auto (default), always, or never