agentgrep

The top-level package contains the CLI parser, search pipeline, terminal progress renderer, and serializer helpers used by the command-line interface and MCP server.

Core data

class agentgrep.PrivatePath
class
class
class agentgrep.PrivatePath

Bases: PosixPath

Path subclass that hides the user’s home directory in textual output.

agentgrep.format_display_path(path, *, directory=False)
function
function
agentgrep.format_display_path(path, *, directory=False)

Return a privacy-safe display path.

Parameters:
Return type:

str

class agentgrep.BackendSelection
class
class
class agentgrep.BackendSelection

Bases: object

Selected optional subprocess backends.

class agentgrep.SearchArgs
class
class
class agentgrep.SearchArgs

Bases: object

Typed arguments for agentgrep search.

class agentgrep.FindArgs
class
class
class agentgrep.FindArgs

Bases: object

Typed arguments for agentgrep find.

class agentgrep.SearchQuery
class
class
class agentgrep.SearchQuery

Bases: object

Compiled search configuration.

class agentgrep.SourceHandle
class
class
class agentgrep.SourceHandle

Bases: object

A discovered, parseable source file or SQLite database.

class agentgrep.SearchRecord
class
class
class agentgrep.SearchRecord

Bases: object

Normalized prompt/history record.

class agentgrep.FindRecord
class
class
class agentgrep.FindRecord

Bases: object

Normalized discovery record for agentgrep find.

Search control and progress

class agentgrep.SearchControl
class
class
class agentgrep.SearchControl

Bases: object

Thread-safe cooperative controls for an active search.

class agentgrep.SearchProgress
class
class
class agentgrep.SearchProgress

Bases: Protocol

Progress reporter used by search internals.

class agentgrep.NoopSearchProgress
class
class
class agentgrep.NoopSearchProgress

Bases: object

Silent search progress reporter.

class agentgrep.ConsoleSearchProgress
class
class
class agentgrep.ConsoleSearchProgress

Bases: object

Human progress reporter for potentially long searches.

Serialization and CLI

agentgrep.serialize_search_record(record)
function
function
agentgrep.serialize_search_record(record)

Serialize a search record to a JSON-compatible mapping.

Parameters:

record (SearchRecord)

Return type:

SearchRecordPayload

agentgrep.serialize_find_record(record)
function
function
agentgrep.serialize_find_record(record)

Serialize a find record to a JSON-compatible mapping.

Parameters:

record (FindRecord)

Return type:

FindRecordPayload

agentgrep.serialize_source_handle(source)
function
function
agentgrep.serialize_source_handle(source)

Serialize a source handle to a JSON-compatible mapping.

Parameters:

source (SourceHandle)

Return type:

SourceHandlePayload

agentgrep.build_envelope(command, query_data, results)
function
function
agentgrep.build_envelope(command, query_data, results)

Build a JSON envelope.

Parameters:
Return type:

EnvelopePayload

agentgrep.run_search_command(args)
function
function
agentgrep.run_search_command(args)

Execute agentgrep search.

Parameters:

args (SearchArgs)

Return type:

int

agentgrep.run_find_command(args)
function
function
agentgrep.run_find_command(args)

Execute agentgrep find.

Parameters:

args (FindArgs)

Return type:

int

agentgrep.main(argv=None)
function
function
agentgrep.main(argv=None)

Run the CLI.

Parameters:

argv (Sequence[str] | None)

Return type:

int