From 00313bfcd4326cf24ffda674da3befe493633b20 Mon Sep 17 00:00:00 2001 From: Truffle Date: Mon, 11 May 2026 07:15:41 -0700 Subject: [PATCH] fix(tool): clarify semantic_search returns snippets not file paths (#10142) * fix(tool): clarify semantic_search returns snippets not file paths The first description bullet read "Find files most relevant to the search query using semantic search.", which led an AI agent to tell a user that the tool returns file paths only. The tool actually returns matching content with file paths, line ranges, and relevance scores. Updates the first two description bullets to name the output shape directly. No runtime change. Closes #9767. * test(cli): cover semantic_search description --------- Co-authored-by: marius-kilocode --- .changeset/semantic-search-snippets.md | 5 +++++ packages/opencode/src/kilocode/tool/semantic-search.txt | 3 ++- packages/opencode/test/kilocode/semantic-search.test.ts | 8 ++++++++ 3 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 .changeset/semantic-search-snippets.md diff --git a/.changeset/semantic-search-snippets.md b/.changeset/semantic-search-snippets.md new file mode 100644 index 00000000000..8b45d0e7f44 --- /dev/null +++ b/.changeset/semantic-search-snippets.md @@ -0,0 +1,5 @@ +--- +"@kilocode/cli": patch +--- + +Clarify that semantic search returns matching code snippets with paths, line ranges, and relevance scores. diff --git a/packages/opencode/src/kilocode/tool/semantic-search.txt b/packages/opencode/src/kilocode/tool/semantic-search.txt index f7b1f36718c..f4cd41664e0 100644 --- a/packages/opencode/src/kilocode/tool/semantic-search.txt +++ b/packages/opencode/src/kilocode/tool/semantic-search.txt @@ -1,4 +1,5 @@ -- Find files most relevant to the search query using semantic search. +- Find code snippets most relevant to the search query using semantic search. +- Returns matching content with file paths, line ranges, and relevance scores. - Searches based on meaning rather than exact text matches. - By default searches entire workspace, with capability to filter by path. diff --git a/packages/opencode/test/kilocode/semantic-search.test.ts b/packages/opencode/test/kilocode/semantic-search.test.ts index 300e965660f..171eee74737 100644 --- a/packages/opencode/test/kilocode/semantic-search.test.ts +++ b/packages/opencode/test/kilocode/semantic-search.test.ts @@ -34,6 +34,14 @@ const baseCtx = { } satisfies Tool.Context describe("tool.semantic_search", () => { + test("describes code snippet results", async () => { + const tool = await initTool() + + expect(tool.description).toContain("Find code snippets most relevant") + expect(tool.description).toContain("Returns matching content with file paths, line ranges, and relevance scores") + expect(tool.description).not.toContain("Find files most relevant") + }) + test("throws when query is empty", async () => { const tool = await initTool() expect(rt.runPromise(tool.execute({ query: "" }, baseCtx))).rejects.toThrow("query is required")