mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-03-10 22:21:22 -07:00
Make codebase investigator less prone to be triggered for simple searches (#10655)
This commit is contained in:
@@ -44,10 +44,9 @@ export const CodebaseInvestigatorAgent: AgentDefinition<
|
||||
> = {
|
||||
name: 'codebase_investigator',
|
||||
displayName: 'Codebase Investigator Agent',
|
||||
description: `Your primary tool for multifile search tasks and codebase exploration.
|
||||
Invoke this tool to delegate search tasks to an autonomous subagent.
|
||||
Use this to find features, understand context, or locate specific files, functions, or symbols.
|
||||
Returns a structured Json report with key file paths, symbols, architectural map and insights to solve a task or answer questions`,
|
||||
description: `The specialized tool for codebase analysis, architectural mapping, and understanding system-wide dependencies.
|
||||
Invoke this tool for tasks like vague requests, bug root-cause analysis, system refactoring, comprehensive feature implementation or to answer questions about the codebase that require investigation.
|
||||
It returns a structured report with key file paths, symbols, and actionable architectural insights.`,
|
||||
inputConfig: {
|
||||
inputs: {
|
||||
objective: {
|
||||
|
||||
@@ -153,7 +153,7 @@ describe('Core System Prompt (prompts.ts)', () => {
|
||||
`your **first and primary tool** must be '${CodebaseInvestigatorAgent.name}'`,
|
||||
);
|
||||
expect(prompt).toContain(
|
||||
`Do not ignore the output of '${CodebaseInvestigatorAgent.name}'`,
|
||||
`do not ignore the output of '${CodebaseInvestigatorAgent.name}'`,
|
||||
);
|
||||
expect(prompt).not.toContain(
|
||||
"Use 'search_file_content' and 'glob' search tools extensively",
|
||||
|
||||
@@ -129,8 +129,8 @@ When requested to perform tasks like fixing bugs, adding features, refactoring,
|
||||
${(function () {
|
||||
if (enableCodebaseInvestigator) {
|
||||
return `
|
||||
1. **Understand & Strategize:** for any request that requires searching terms or explore the codebase, your **first and primary tool** must be '${CodebaseInvestigatorAgent.name}'. You must use it to build a comprehensive understanding of the relevant code, its structure, and dependencies. The output from '${CodebaseInvestigatorAgent.name}' will be the foundation of your plan. YOU MUST not use '${GrepTool.Name}' or '${GlobTool.Name}' as your initial exploration tool; they should only be used for secondary, targeted searches after the investigator has provided you with context.
|
||||
2. **Plan:** Build a coherent and grounded (based on the understanding in step 1) plan for how you intend to resolve the user's task. Do not ignore the output of '${CodebaseInvestigatorAgent.name}', you must use it as the foundation of your plan. Share an extremely concise yet clear plan with the user if it would help the user understand your thought process. As part of the plan, you should use an iterative development process that includes writing unit tests to verify your changes. Use output logs or debug statements as part of this process to arrive at a solution.`;
|
||||
1. **Understand & Strategize:** Think about the user's request and the relevant codebase context. When the task involves **complex refactoring, codebase exploration or system-wide analysis**, your **first and primary tool** must be '${CodebaseInvestigatorAgent.name}'. Use it to build a comprehensive understanding of the code, its structure, and dependencies. For **simple, targeted searches** (like finding a specific function name, file path, or variable declaration), you should use '${GrepTool.Name}' or '${GlobTool.Name}' directly.
|
||||
2. **Plan:** Build a coherent and grounded (based on the understanding in step 1) plan for how you intend to resolve the user's task. If '${CodebaseInvestigatorAgent.name}' was used, do not ignore the output of '${CodebaseInvestigatorAgent.name}', you must use it as the foundation of your plan. Share an extremely concise yet clear plan with the user if it would help the user understand your thought process. As part of the plan, you should use an iterative development process that includes writing unit tests to verify your changes. Use output logs or debug statements as part of this process to arrive at a solution.`;
|
||||
}
|
||||
return `
|
||||
1. **Understand:** Think about the user's request and the relevant codebase context. Use '${GrepTool.Name}' and '${GlobTool.Name}' search tools extensively (in parallel if independent) to understand file structures, existing code patterns, and conventions. Use '${ReadFileTool.Name}' and '${ReadManyFilesTool.Name}' to understand context and validate any assumptions you may have.
|
||||
|
||||
Reference in New Issue
Block a user