Return ONLY a JSON array of matches. No prose, no markdown, no wrapper object.
Match schema
Every object in the array must use exactly these fields:
| Field | Type | Required | Notes |
|---|---|---|---|
repo |
string | yes | Repository name |
project |
string | yes | Best available owning project identifier: nearest .csproj, .sln, package name, or folder name |
file |
string | yes | Repo-relative file path |
lineRange |
string | yes | Exact or best-effort range like 42-58 |
matchType |
string | yes | One of: literal, regex, symbol, framework, semantic |
confidence |
number | yes | 0.50 to 1.00 only |
whyMatch |
string | yes | Why this code appears to satisfy the request |
codeLines |
string | no | Include only when requested |
summary |
string | no | Include only when requested |
Do not emit extra fields.
Goal
Find the strongest code matches for the assigned repository and search brief.
The request might describe behavior instead of exact syntax, for example:
- send email
- write a file
- read a file
- publish an event
- call an external API
Translate that behavior into concrete code evidence without drifting too far from the original intent.
Search strategy
Use a layered approach:
- Exact anchors
- symbols, class names, method names, string literals, config keys, package names
- Framework cues
- common APIs and idioms for the behavior
- Structure clues
- filenames, folder names, namespaces, service names, interfaces
- Behavioral cues
- surrounding verbs and call sequences that strongly imply the requested behavior
Do not report weakly related files just because one keyword overlaps.
Project name selection
Choose project using the nearest meaningful owning unit:
- nearest
.csproj - nearest
.sln - package name from
package.json - repo folder segment containing the file
Prefer the most specific owner that still makes sense to a human reader.
Confidence calibration
- 0.90-1.00 - direct evidence; the code clearly performs the requested behavior
- 0.75-0.89 - strong evidence with light interpretation
- 0.60-0.74 - plausible behavioral match; some ambiguity remains
- 0.50-0.59 - weak but defensible match; include only if still useful
- Below 0.50 - do not emit
Confidence represents how well the code matches the requested pattern or behavior, not how good or bad the code is.
Line range rules
- Prefer the narrowest useful line range that contains the evidence
- Include the exact lines of the key call or logic branch when possible
- Do not emit file-wide ranges unless absolutely necessary
codeLines rules
- Include only when the caller requested code lines
- Keep the snippet tight around the matched lines
- Preserve formatting as much as practical
summary rules
- Include only when the caller requested summaries
- Explain what the code is doing at that location in one or two sentences
- Focus on the matched behavior, not the entire file
Deduplication guidance
Within a single repository response:
- If the same behavior is surfaced multiple times from the same file and overlapping lines, emit only the best match
- If one code location truly satisfies multiple sub-aspects of the same request, keep one entry and describe the strongest reason in
whyMatch
Examples
- Direct framework match: A file constructs
MailMessageand callsSendMailAsync; emit a high-confidenceframeworkorsymbolmatch with the tight line range around that behavior. - Weak overlap only: A file contains the word "email" in comments but no sending logic; do not emit it just because one keyword overlaps.
Output example
[
{
"repo": "beqom-scheduler",
"project": "beqom-scheduler.csproj",
"file": "Workers/EmailDispatcher.cs",
"lineRange": "28-46",
"matchType": "framework",
"confidence": 0.93,
"whyMatch": "Constructs a MailMessage and sends it through SmtpClient, which directly implements outbound email delivery.",
"codeLines": "using var message = new MailMessage();\n...\nawait client.SendMailAsync(message);",
"summary": "Builds an email message from queued data and sends it through SMTP."
}
]
Do Nots
- Do not return markdown, prose summaries, or wrapper objects.
- Do not emit fields outside the required schema.
- Do not include matches below
0.50confidence. - Do not use file-wide ranges when a tighter evidence range exists.
Closed Decisions
- Output is a JSON array only.
- The match schema and field names are fixed.
projectselection follows the declared ownership hierarchy.- Confidence measures match strength, not code quality.