-
Notifications
You must be signed in to change notification settings - Fork 2.6k
fix: strengthen codebase_search enforcement throughout conversations #5486
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- Remove conditional 'when starting a new task' language - Change to 'For ANY exploration of code you haven't examined yet in this conversation' - Add explicit statements that the requirement applies throughout the entire conversation - Update test expectations to match the new enforcement language This ensures codebase_search is used consistently throughout conversations, not just at the beginning of tasks, improving code discovery and understanding.
|
✅ No security or compliance issues detected. Reviewed everything up to 73782d9. Security Overview
Detected Code Changes
Reply to this PR with |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR strengthens the enforcement of the codebase_search tool by making it mandatory for any new code exploration throughout conversations.
- Unified prompt language to insist on
codebase_searchfirst whenever exploring unfamiliar code areas - Updated all related sections (
tool-use-guidelines,rules,objective) with continuous-enforcement wording - Adjusted corresponding unit tests to validate the new phrasing
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/core/prompts/sections/tool-use-guidelines.ts | Made codebase_search enforcement apply throughout conversations |
| src/core/prompts/sections/rules.ts | Broadened rule to require semantic search for any new code area |
| src/core/prompts/sections/objective.ts | Changed objective text to mandate continuous codebase_search use |
| src/core/prompts/sections/tests/tool-use-guidelines.spec.ts | Updated test strings to match the new guideline wording |
| src/core/prompts/sections/tests/objective.spec.ts | Modified objective tests to check for the added enforcement note |
Comments suppressed due to low confidence (1)
src/core/prompts/sections/objective.ts:14
- The objective section refers to 'entire task' while other sections mention 'entire conversation'. Consider standardizing this phrasing for consistency across all prompts.
? "First, for ANY exploration of code you haven't examined yet in this conversation, you MUST use the `codebase_search` tool to search for relevant code based on the task's intent BEFORE using any other search or file exploration tools. This applies throughout the entire task, not just at the beginning - whenever you need to explore a new area of code, codebase_search must come first. Then, "
daniel-lxs
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Problem
The
codebase_searchtool was only being enforced at the start of new tasks, not throughout entire conversations. This led to situations where the AI would use less effective search methods (likesearch_filesorlist_files) when exploring code later in a conversation, missing important context and relationships.Solution
Updated the prompt language across multiple sections to make
codebase_searchenforcement continuous throughout conversations:Changes Made
Tool Use Guidelines (
src/core/prompts/sections/tool-use-guidelines.ts):Rules Section (
src/core/prompts/sections/rules.ts):Objective Section (
src/core/prompts/sections/objective.ts):Test Updates:
objective.spec.tsandtool-use-guidelines.spec.tsto match the new enforcement languageImpact
This change ensures that
codebase_searchis used consistently throughout conversations, improving:Testing
Important
Enforces continuous use of
codebase_searchthroughout conversations for consistent code exploration, with updates to prompt language and tests.tool-use-guidelines.ts,rules.ts, andobjective.tsto enforcecodebase_searchfor any new code exploration during conversations.objective.spec.tsandtool-use-guidelines.spec.tsto align with newcodebase_searchenforcement language.codebase_search, improving code understanding and context awareness.This description was created by
for 73782d9. You can customize this summary. It will automatically update as commits are pushed.