Prompt budget stays within +10% of baseline (instruction 1485 -> 1331, skill metadata 3163 -> 3017, rule catalog claude 28818 -> 30517); baseline files unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
32 lines
1.5 KiB
Markdown
32 lines
1.5 KiB
Markdown
---
|
|
name: semantic-search
|
|
description: MUST use before reading or grepping code whenever the exact symbol, file, or string is not already known - concept questions, unfamiliar areas, "where/how is X done", and bug reports that describe behavior. Use rg only for known identifiers, paths, or exact strings.
|
|
---
|
|
|
|
# Semantic Search
|
|
|
|
Search the current Git repository, plus the user's registered QMD collections, by meaning. QMD runs locally with Qwen3-Embedding-0.6B, Qwen3-Reranker-0.6B, and QMD Query Expansion 1.7B; a background daemon keeps them loaded.
|
|
|
|
## Rule
|
|
|
|
Run this search first whenever you do not already know the exact identifier, path, or string. Do not start with `rg` guesses for a concept. `rg` comes after the search, for callers and tests of verified hits.
|
|
|
|
## Run
|
|
|
|
The same command works in Bash and PowerShell:
|
|
|
|
node "$HOME/.my-ai-configuration/qmd/qmd-search.mjs" --query "<full question about behavior>" --top-k 5
|
|
|
|
Output: JSON list of `{path, line, score, snippet}`, best first. Repository paths are relative to the repository root; hits from other collections are `qmd://<collection>/<path>`.
|
|
|
|
## Use the results
|
|
|
|
1. Phrase the query as a full question about behavior, not a keyword list.
|
|
2. Open the top hits and verify them against the current files before acting.
|
|
3. Follow verified hits with `rg` for their symbols to find callers and tests.
|
|
4. If no hit is relevant, run one rephrased search before switching to `rg`.
|
|
|
|
## Failure
|
|
|
|
If the command exits non-zero, continue with `rg` and state the limitation in one sentence.
|