feat(research): merge repository research and tune QMD search coverage
Research skills: - Merge repository-research into research as a Repository section, so an open repository search loads one skill fewer; move its evals and update every reference. - Tune semantic-search for QMD: one question per search, known domain terms in the query, --top-k 10 for survey questions, a small-repository exception, and a Coverage section stating what the index skips. QMD search: - Widen the index file mask to web templates and styles, .NET and WPF markup and project files, JVM build files, and more script modules, and reapply it to existing repository collections. - Add qmd-search.mjs --get to read qmd:// hits from other collections. - List the exact search command in the Claude sandbox excludedCommands, because the macOS/Linux sandbox blocks the localhost daemon and the index under the home directory. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
82d9992b3a
commit
eb7cecaaa2
18 files changed
+142
-95
No files matched your search
@@ -7,9 +7,9 @@ description: MUST apply before open repository searches - run semantic retrieval
|
||||
|
||||
Search the current Git repository, plus the user's registered QMD collections, by meaning. QMD runs locally with Qwen3-Embedding-4B, Qwen3-Reranker-4B, and QMD Query Expansion 1.7B; a background daemon keeps them loaded.
|
||||
|
||||
## Rule
|
||||
## When
|
||||
|
||||
Apply `research`, `repository-research`, and this routing rule before each open repository search. Known exact identifiers, paths, or strings use direct reads or `rg` without loading these skills. Unknown identifiers require semantic retrieval first; guessed keywords are not known identifiers. Reevaluate the route for every follow-up query. Reuse instructions already in context.
|
||||
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
|
||||
|
||||
@@ -17,14 +17,22 @@ 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>`.
|
||||
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:
|
||||
|
||||
## Use the results
|
||||
node "$HOME/.my-ai-configuration/qmd/qmd-search.mjs" --get "qmd://<collection>/<path>"
|
||||
|
||||
1. Phrase the query as a full question about behavior, not a keyword list. Batch related questions into one precise query.
|
||||
2. Open the top hits and verify them against the current files before acting; the index can lag behind uncommitted edits.
|
||||
3. If no hit is relevant, run one rephrased search before switching to `rg`.
|
||||
4. Continue with `repository-research` from the verified hits: callers, tests, and conventions.
|
||||
## 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`.
|
||||
|
||||
## Failure
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
{
|
||||
"id": 1,
|
||||
"prompt": "Somewhere in this repo we throttle outgoing emails so a user doesn't get more than a few notifications per hour. Where is that implemented?",
|
||||
"expected_output": "Unknown identifier and behavior question, so semantic retrieval comes first. Should run the qmd-search command with a full behavior question (not a keyword list) and --top-k 5. Should open the top hits and verify them against current files before answering. Should continue with repository-research from verified hits (callers, tests, conventions).",
|
||||
"expected_output": "Unknown identifier and behavior question, so semantic retrieval comes first. Should run the qmd-search command with a full behavior question (not a keyword list) and --top-k 5. Should open the top hits and verify them against current files before answering. Should continue with the repository route of research from verified hits (callers, tests, conventions).",
|
||||
"assertions": [
|
||||
"Runs node \"$HOME/.my-ai-configuration/qmd/qmd-search.mjs\" before any rg keyword search",
|
||||
"Phrases the --query as a full question about behavior rather than a keyword list",
|
||||
@@ -18,7 +18,7 @@
|
||||
{
|
||||
"id": 2,
|
||||
"prompt": "Find every usage of the exact string `X-Correlation-Id` in the repo.",
|
||||
"expected_output": "This is a known exact string. Should use rg directly without running semantic retrieval or loading research, repository-research, or semantic-search.",
|
||||
"expected_output": "This is a known exact string. Should use rg directly without running semantic retrieval or loading research or semantic-search.",
|
||||
"assertions": [
|
||||
"Uses rg or a direct exact-string search for X-Correlation-Id",
|
||||
"Does not run the qmd-search semantic retrieval command",
|
||||
@@ -38,6 +38,31 @@
|
||||
"Verifies findings against current files and cites paths"
|
||||
],
|
||||
"files": []
|
||||
},
|
||||
{
|
||||
"id": 4,
|
||||
"prompt": "Where does this script decide the output file name? (Note: semantic search returned one hit, qmd://notes/naming.md, and the repository has only three files: README.md, convert.py, and config.yml.)",
|
||||
"expected_output": "The repository is small and its file listing already shows the candidate, so convert.py can be read directly. If the qmd:// hit is relevant, it is read with the documented --get command rather than as a local path. Answers from the verified current file.",
|
||||
"assertions": [
|
||||
"Reads convert.py directly instead of relying on another semantic search",
|
||||
"Does not try to open qmd://notes/naming.md as a local file path",
|
||||
"Uses qmd-search.mjs --get if it reads the qmd:// hit",
|
||||
"Cites the verified file and line"
|
||||
],
|
||||
"files": []
|
||||
},
|
||||
{
|
||||
"id": 5,
|
||||
"prompt": "Where do we validate uploaded invoice PDFs, and separately, where do we list every place that sends tenant notification emails?",
|
||||
"expected_output": "These are two unrelated questions, so they run as two separate searches, not one combined query. The upload validation question is targeted and uses --top-k 5; the notification question is a survey question and uses --top-k 10. Known domain terms such as invoice, PDF, tenant, and notification appear in the questions. Hits are verified against current files.",
|
||||
"assertions": [
|
||||
"Runs two separate qmd-search commands instead of one combined query",
|
||||
"Uses --top-k 5 for the upload validation question",
|
||||
"Uses --top-k 10 for the survey question about notification emails",
|
||||
"Includes the known domain terms in each question",
|
||||
"Verifies hits against current files and cites paths"
|
||||
],
|
||||
"files": []
|
||||
}
|
||||
]
|
||||
}
|
||||
Reference in new issue
Block a user