Skip to content

fix(tool): say how many skill matches a query left out - #811

Merged
Ishaan Gangwani (ishaan1124) merged 2 commits into
synthetic-sciences:mainfrom
aniruddhaadak80:fix/skill-query-truncation-notice
Sep 29, 2026
Merged

Ishaan Gangwani (ishaan1124) merged 2 commits into
synthetic-sciences:mainfrom
aniruddhaadak80:fix/skill-query-truncation-notice

Conversation

@aniruddhaadak80

Copy link
Copy Markdown
Contributor

What

The query branch of the skill tool called searchSkills(params.query, candidates) and printed the result. searchSkills ends with .slice(0, limit) and limit defaults to 8, so the tool saw at most 8 matches and the output carried no total and no hint that anything was dropped.

The category-browse branch two blocks below — the same kind of bounded list — is careful about exactly this:

${candidates.length} skills available. Showing ${matched.length} from offset ${params.offset ?? 0}.
... Browse the next page with offset ${...}, or use a focused query.

Why it matters

A ranked list of 8 with no total reads as "these are the relevant skills". The 9th-best match is dropped from the end with no signal, so the model has no reason to try a narrower query or different wording.

This is the common case, not an edge case: the bundled library is ~371 skills, so any broad capability query ("RNA", "statistics", "visualization") matches far more than 8.

Verified on this machine with the existing 43-skill fixture — query: "biology" returns exactly 8 of 43 matches, with nothing in the output indicating the other 35.

Verification

Extends the existing 43-skill case in test/skill/discovery.test.ts. With the source reverted but the test kept, it fails on exactly the missing note:

Expected to contain: "of 43 matches"
Received: "## Ranked skill matches\n\nNo skill instructions have been loaded. Load an
applicable result by calling this tool with its exact name.\n\n- **biology-00** (biology): ...
- **biology-07** (biology): biology-07 analysis"

After the fix:

(pass) search respects category and browsing remains bounded with explicit pagination
 1 pass
 0 fail

The test asserts both directions: the broad query reports of 43 matches and the "narrow the query" hint, and the existing narrow RNA QC query gets no such note — so the sentence cannot appear on results that are already complete.

The change

       if (params.query && !selected) {
-        const matched = searchSkills(params.query, candidates)
+        // searchSkills caps at 8 by default, and a bare list of 8 reads as
+        // "these are the matches" rather than "the best 8 of many". Rank the
+        // whole candidate set so the note can say how many were dropped.
+        const ranked = searchSkills(params.query, candidates, candidates.length)
+        const matched = ranked.slice(0, 8)
         if (matched.length === 0) {
+        const dropped = ranked.length - matched.length
         return {
           title: `Skill matches: ${params.query}`,
-          output: `## Ranked skill matches\n\n...Load an applicable result by calling this tool with its exact name.\n\n${listing}`,
+          output: `## Ranked skill matches\n\n...Load an applicable result by calling this tool with its exact name.${dropped ? ` Showing ${matched.length} of ${ranked.length} matches; narrow the query to see the rest.` : ""}\n\n${listing}`,

The 8-result cap and the ranking are unchanged; only the reporting is. The search itself already scored every candidate before slicing, so passing a larger limit costs no extra scoring.

bun run typecheck clean; touched files are Prettier-clean (checked on LF-normalized copies — this checkout has core.autocrlf=true, which makes Prettier flag every file in the repo).

Note on pre-existing failures

test/skill/discovery.test.ts has other pre-existing failures in this Windows checkout, and they vary run to run (1 pass / 5 fail to 5 pass / 1 fail on unmodified main). They are path-separator and timing assertions unrelated to this change; the targeted case above is green and fails without the fix.

Fixes #810

@vercel

vercel Bot commented Sep 28, 2026

Copy link
Copy Markdown

ANIRUDDHA ADAK (@aniruddhaadak80) is attempting to deploy a commit to the InkVell Team on Vercel.

A member of the Team first needs to authorize it.

searchSkills caps at 8 by default and the query branch emitted those 8 with no total, so a broad query read as the full result set. The category branch two blocks down already reports its count; rank the whole candidate set so the same note can be given here.
@ishaan1124
Ishaan Gangwani (ishaan1124) merged commit 7df6ca1 into synthetic-sciences:main Sep 29, 2026
8 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

A broad skill search silently drops matches past the eighth

2 participants