Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

ohara query

For interactive use, prefer the MCP server. ohara query is 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. See find_pattern for the MCP equivalent.

If you need warm-model CLI queries (no MCP client), run ohara serve in the background — it keeps the embedder + reranker loaded across ohara query invocations. The CLI itself is intended for one-off scripted use — CI glue, ad-hoc jq pipelines, 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]
FlagDefaultDescription
PATH (positional).Path to the repo.
-q, --queryrequiredNatural-language query string.
-k, --k5Number of results to return.
--languagenullFilter results to a single language (rust, python, java, kotlin).
--no-rerankoffSkip 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 --since filter exposed by the MCP tool (since: "30d", since: "2024-01-01") is not currently surfaced on the CLI.
  • ohara query prints the full { "hits": [...], "meta": {...} } document. The meta block carries index_status, an optional hint, and — when the index is incompatible — a compatibility object. The MCP find_pattern tool returns the same hits under a _meta envelope.
  • Experimental (issue #55): set OHARA_RERANKER=int8 to load the INT8 quantized bge-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, the ohara serve daemon, and ohara-mcp). The default is unchanged — flipping it is gated on a recall eval. Unset or any other value keeps full precision.