From 863ca97ab26dac16c2768ae2216308e4aae620ee Mon Sep 17 00:00:00 2001 From: Josh Holmer Date: Fri, 15 May 2026 07:48:11 -0400 Subject: [PATCH] fix(indexing): clarifications and improvements to semantic search tool description --- .../src/kilocode/tool/semantic-search.txt | 37 +++++++++++++------ 1 file changed, 26 insertions(+), 11 deletions(-) diff --git a/packages/opencode/src/kilocode/tool/semantic-search.txt b/packages/opencode/src/kilocode/tool/semantic-search.txt index f4cd41664e0..b5245c16e99 100644 --- a/packages/opencode/src/kilocode/tool/semantic-search.txt +++ b/packages/opencode/src/kilocode/tool/semantic-search.txt @@ -1,13 +1,28 @@ -- 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. +Find code snippets by semantic meaning and return ranked matches with file paths and line ranges. -Usage Notes: -- Use this tool any time you start exploring a new area of the codebase. This tool will help discover all areas of the codebase related to the query, even if they do not match an exact symbol name. -- Queries MUST be in English (translate if needed). -- Prefer the Grep tool if you know the exact symbol name to search for and do not need semantic context. +## When to use -Example Queries: -- "User login and password hashing" -- "database connection pooling" +- Explore an unfamiliar code area before you know exact identifiers +- Find related implementations of a concept or behavior across the workspace +- Search by intent such as authentication, caching, or session resume logic +- Narrow a large codebase before following up with `Read` or `Grep` +- Limit semantic search to one subdirectory with `path` + +## When NOT to use + +- Search for an exact symbol or regex pattern — use `Grep` +- Find files by filename or extension — use `Glob` +- Read the contents of a known file — use `Read` +- Explore files outside the current workspace - use `Grep`, `Glob`, and `Read` + +## Examples + +- "User login and password hashing" → search for auth-related code by meaning +- "Database connection pooling" → find conceptually similar implementations +- "Session resume flow" → retrieve snippets involved in restoring session state +- "Tool approval UI" with `path: "packages/opencode/src"` → combine a natural-language query with `path` + +## Constraints + +- Write the query in English. +- Use `path` only for subdirectories inside the current workspace.