ohara query
For interactive use, prefer the MCP server.
ohara queryis a one-off CLI entry point: each invocation re-loads the embedder and reranker (~3s warm, ~25s cold first download). The MCP server (ohara-mcp) loads those models once per session, so an MCP client (Claude Code, Cursor, Codex, OpenCode) is the right surface for repeated or interactive querying. Seefind_patternfor the MCP equivalent.If you need warm-model CLI queries (no MCP client), run
ohara servein the background — it keeps the embedder + reranker loaded acrossohara queryinvocations. The CLI itself is intended for one-off scripted use — CI glue, ad-hocjqpipelines, debugging an index. See issue #60 for context.
Run a find_pattern query from the command line. Useful for
sanity-checking an index without going through an MCP client, and for
piping ranked hits into jq for ad-hoc analysis.
Returns the same JSON envelope as the MCP tool — see
find_pattern for the response shape.
Usage
ohara query [PATH] --query <STRING> [--k N] [--language LANG] [--no-rerank]
| Flag | Default | Description |
|---|---|---|
PATH (positional) | . | Path to the repo. |
-q, --query | required | Natural-language query string. |
-k, --k | 5 | Number of results to return. |
--language | null | Filter results to a single language (rust, python, java, kotlin). |
--no-rerank | off | Skip the cross-encoder rerank stage. Faster, deterministic, slightly less precise on the top result. Skips the rerank model download too. |
Examples
Top-5 retry-with-backoff matches in the current repo:
ohara query --query "retry with backoff"
Top-3 Rust-only matches, piped through jq:
ohara query --query "exponential retry" --k 3 --language rust | jq '.hits[].commit_message'
Skip the cross-encoder for a faster, deterministic ranking:
ohara query --query "auth middleware" --no-rerank
Notes
- The
--sincefilter exposed by the MCP tool (since: "30d",since: "2024-01-01") is not currently surfaced on the CLI. ohara queryprints the full{ "hits": [...], "meta": {...} }document. Themetablock carriesindex_status, an optionalhint, and — when the index is incompatible — acompatibilityobject. The MCPfind_patterntool returns the same hits under a_metaenvelope.- Experimental (issue #55): set
OHARA_RERANKER=int8to load the INT8 quantizedbge-reranker-base(~280 MB vs the 1.1 GB full-precision model) instead of the default cross-encoder. Applies to every path that reranks (ohara query, theohara servedaemon, andohara-mcp). The default is unchanged — flipping it is gated on a recall eval. Unset or any other value keeps full precision.