code_search
Retrieve relevant code snippets from the local index with file:start-end references, using hybrid keyword/embedding ranking and graceful fallback to keyword-only.
Instructions
Search the local project index built by code_index and get the most relevant windows back with file:start-end references — cheaper and more targeted than grepping or reading whole files. Ranking is hybrid: SQLite FTS5 keyword (BM25) plus embeddings when an embed host answers, fused by reciprocal rank. When no host answers it degrades to keyword-only with a degraded note instead of failing. Optional rerank=true reorders the top hits with a small chat model (ASK_FABLE_EMBED_RERANK_MODEL); skipped with a note when unset or unreachable. Returns not_indexed until code_index has run.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| k | No | Maximum hits to return (default 8, max 50). | |
| query | Yes | Natural-language or code search query. | |
| rerank | No | Reorder the top hits with the chat model in `ASK_FABLE_EMBED_RERANK_MODEL` (opt-in; skipped with a note when unset or unreachable). |