Agent-first search: natural-language queries, domain-aware ranking, and JSONL output for code, legal, docs, and logs.
agrep is a deterministic query-planning retrieval engine for autonomous agent workflows. Instead of treating retrieval as an opaque vector lookup, it exposes how a natural-language query is planned, ranked, and emitted as structured JSONL that an agent harness can consume without guessing.
Vector-only RAG collapses dissimilar corpora into a single embedding space and hides ranking. agrep keeps domain-aware ranking and query plans inspectable so agents can retrieve code, legal text, documentation, and logs with a stable output contract.
The engine is designed as a tool surface for runtimes such as Lattice: the model asks a question; agrep returns ranked, structured records the harness can bound, audit, and feed back as a projection.
Natural-language query → explicit plan → domain-aware ranking → structured JSONL for the harness.
Natural-language query in; a visible query plan, domain-aware ranking, and JSONL records out — without collapsing retrieval into a black-box vector search.
The incoming natural-language question is compiled into an explicit retrieval plan before ranking, so the agent can see what will be searched and why.
Code, legal, documentation, and log corpora are ranked with domain-specific signals rather than a single generic embedding similarity score.
Results are emitted as JSON Lines with a stable schema, so harnesses can parse, bound, and trace retrieval without scraping prose.
Given the same corpus and query plan, ranking is inspectable and repeatable — a contrast to stochastic, vector-only RAG pipelines.
The agent submits a natural-language question and the target domain (code, legal, docs, or logs).
agrep compiles a retrieval plan: which indexes, filters, and ranking features will run.
Domain-aware scoring produces an ordered candidate set with visible features.
Results are written as JSONL records the harness can ingest, bound, and project back to the model.
JSONL is a closed schema, limiting the chance that retrieval dumps unbounded raw files into the model context.
Query plans and scores can be audited, so a confused or injected query is easier to detect than in opaque vector search.
Retrieval is read-oriented: the engine does not execute tools or mutate enterprise systems on the agent's behalf.
csehammad/agrep
The implementation is developed openly on GitHub — HTML. The repository is the source of truth for code, examples and documentation.