Skip to content

fix(indexing): improvements to semantic_search tool description - #12227

Merged
marius-kilocode merged 1 commit into
Kilo-Org:mainfrom
shssoichiro:fix/issue-10271
Jul 31, 2026
Merged

fix(indexing): improvements to semantic_search tool description#12227
marius-kilocode merged 1 commit into
Kilo-Org:mainfrom
shssoichiro:fix/issue-10271

Conversation

@shssoichiro

Copy link
Copy Markdown
Contributor

Issue

Fixes #10271 (hopefully for good this time)

Context

The semantic search tool continues to not be invoked reliably. We want to help agents understand how and when to use this tool appropriately.

Implementation

  • Add a statement instructing the agent to "proactively" use the tool in the appropriate scenario. The word "proactively" has been shown to improve agent tool utilization.
  • Refactor the location and wording of directory and path parameter limitations, as I've seen agents sometimes failing to understand these limitations.

Screenshots / Video

N/A

How to Test

  • Do some task that involves finding code snippets without knowing the specific name. Don't explicitly tell the agent to use the tool.
  • Codebase search should be used early in the agent's exploratory process to narrow down search scope for more exact file reads and greps.

Checklist

  • Issue linked above, or exception explained
  • Tests/verification described
  • Screenshots/video included for visual changes, or marked N/A
  • Changeset considered for user-facing changes
  • I personally reviewed the diff and can explain the changes, including any AI-assisted work.

Get in Touch

ExpedientFalcon on Discord

Comment thread packages/opencode/src/kilocode/tool/semantic-search.txt Outdated
@kilo-code-bot

kilo-code-bot Bot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: 1 Issue Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 0
SUGGESTION 1
Issue Details (click to expand)

SUGGESTION

File Line Issue
packages/opencode/src/kilocode/tool/semantic-search.txt 7 New prose references Grep/Read without backticks while the rest of the description code-formats tool names
Files Reviewed (1 file)
  • packages/opencode/src/kilocode/tool/semantic-search.txt - 1 issue

Notes: the reworded "When to use" prose matches the wording agreed in the existing review discussion, and the earlier duplicate-bullet finding no longer applies. The PR description still says the change adds a "proactively" instruction, which the current text no longer contains — worth updating the description before merge.

Fix these issues in Kilo Cloud

Previous Review Summaries (2 snapshots, latest commit 1a55007)

Current summary above is authoritative. Previous snapshots are kept for context only.

Previous review (commit 1a55007)

Status: No Issues Found | Recommendation: Merge

Files Reviewed (1 file)
  • packages/opencode/src/kilocode/tool/semantic-search.txt - previously flagged duplicate bullet removed; no remaining issues

Previous review (commit 5aeb043)

Status: 1 Issue Found | Recommendation: Merge

Overview

Severity Count
CRITICAL 0
WARNING 0
SUGGESTION 1
Issue Details (click to expand)

SUGGESTION

File Line Issue
packages/opencode/src/kilocode/tool/semantic-search.txt 5 New intro line duplicates an existing "When to use" bullet, making the guidance redundant
Files Reviewed (1 file)
  • packages/opencode/src/kilocode/tool/semantic-search.txt - 1 issue

Fix these issues in Kilo Cloud


Reviewed by claude-opus-5 · Input: 28 · Output: 5.2K · Cached: 755.4K

Review guidance: REVIEW.md from base branch main


## When to use

Use proactively before following up with other, more targeted, tools such as `Read` or `Grep`, to:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should make it clearer when semantic search is superior to indexed based search. "Use proactively before" will inevitably lead to more token consumption.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm unsure what you mean. This is the indexing-based semantic search tool. Are you thinking about how it interacts with the warpgrep semantic search tool? That is a good question. I've been generally running on the assumption that a user won't have both enabled at the same time, because that seems like the most likely scenario, but also because my assumption is that right now, if a user does have both enabled, the LLM will pick one pseudo-randomly.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right that semantic_search is itself index-backed. I was conflating indexing with lexical search. The distinction I meant is semantic retrieval versus exact keyword/regex search.

I do not think we should instruct agents to use semantic search proactively before all targeted tools. It is superior when the agent can describe the desired behavior but does not yet know the repository’s identifiers or terminology. Grep is superior when there is already a concrete symbol, string, config key, error, or regex.

Can we try something like:

“Use early for open-ended exploration when you know the intent but not the exact identifiers or the semantics. Once likely files or symbols are found, follow up with Grep and Read. Prefer Grep directly when exact terms are already known.”

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good to me!

- Limit semantic search to one subdirectory with `path`
Use early for open-ended exploration when you know the intent
but not the exact identifiers or the semantics. Once likely files or symbols are found,
follow up with Grep and Read. Prefer Grep directly when exact terms are already known.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SUGGESTION: Keep tool names in backticks for consistency

Every other tool reference in this description is code-formatted (Grep, Glob, Read, path), but the new prose mentions Grep and Read as plain words. Since this text goes straight into the model-facing tool description, consistent formatting makes it clearer these are literal tool names rather than prose.

Suggested change
follow up with Grep and Read. Prefer Grep directly when exact terms are already known.
follow up with `Grep` and `Read`. Prefer `Grep` directly when exact terms are already known.

Reply with @kilocode-bot fix it to have Kilo Code address this issue.

@marius-kilocode
marius-kilocode merged commit 3af9c50 into Kilo-Org:main Jul 31, 2026
29 checks passed
@marius-kilocode

Copy link
Copy Markdown
Collaborator

Thanks @shssoichiro

unixcrh pushed a commit to unixcrh/kilocode that referenced this pull request Aug 1, 2026
t7tran pushed a commit to t7tran/kilocode that referenced this pull request Aug 14, 2026
fix(indexing): improvements to semantic_search tool description
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.

semantic_search tool barely used by Kilo Code while local codebase indexing is enabled

2 participants