CI / CI configuration security checks (push) Successful in 3s
CI / Capabilities and shell quality (push) Successful in 14s
CI / Python tests and compilation (push) Successful in 26s
CI / QMD unit tests (push) Successful in 5s
CI / Build and inspect generated packages (push) Successful in 14s
CI / PowerShell tests on Ubuntu (push) Successful in 1m4s
CI / Installed client configuration smoke tests (push) Successful in 33s
CI / Bash integration and installation guards (push) Successful in 1m1s
40 lines
2.4 KiB
Markdown
40 lines
2.4 KiB
Markdown
---
|
|
name: semantic-search
|
|
description: Use from the repository route of `research` to run semantic retrieval first for unknown identifiers and behavior questions. Not needed for known paths, symbols, or exact strings, which use direct reads or rg.
|
|
---
|
|
|
|
# Semantic Search
|
|
|
|
Search the current Git repository, plus the user's registered QMD collections, by meaning. QMD runs its embedding, reranking, and query expansion models locally; a background daemon keeps them loaded.
|
|
|
|
## When
|
|
|
|
Use it for unknown identifiers and behavior questions; the routing itself comes from `research`. Skip it when a file listing of a small repository already shows the candidate files: read those directly.
|
|
|
|
## 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>`. Read such a hit with:
|
|
|
|
node "$HOME/.my-ai-configuration/qmd/qmd-search.mjs" --get "qmd://<collection>/<path>"
|
|
|
|
## Query and results
|
|
|
|
1. Phrase the query as a full question about behavior, not a keyword list. Ask one question per search: QMD ranks every hit against the whole query, so mixed questions dilute the ranking. Run separate questions as separate searches.
|
|
2. Include domain terms you already know from the task or code, such as "tenant" or "throttle"; QMD also matches keywords. Do not present guessed identifiers as facts.
|
|
3. Use `--top-k 5` for a targeted question and `--top-k 10` for survey questions such as "where is X done".
|
|
4. Open the top hits and verify them against the current files before acting. The index refreshes from `git status` before each search.
|
|
5. If no hit is relevant, run one rephrased search before switching to `rg`.
|
|
6. Continue with the repository route of `research` from the verified hits: callers, tests, and conventions.
|
|
|
|
## Coverage
|
|
|
|
The index skips git-ignored files, npm and pnpm lockfiles, minified `*.min.js` bundles, and file types outside its mask (for example images, binaries, and `.txt`). An empty or irrelevant result is not proof of absence. Confirm absence with `rg -uu` (or `rg --no-ignore`): default `rg` also skips ignored files, so it misses the same files as the index.
|
|
|
|
## Failure
|
|
|
|
If the command exits non-zero, continue with `rg` and state the limitation in one sentence.
|