mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-05-13 05:12:55 -07:00
feat(plan): enable AskUser tool in Plan mode for clarifying questions (#17694)
This commit is contained in:
@@ -185,7 +185,8 @@ The following read-only tools are available in Plan Mode:
|
|||||||
|
|
||||||
### Phase 1: Requirements Understanding
|
### Phase 1: Requirements Understanding
|
||||||
- Analyze the user's request to identify core requirements and constraints
|
- Analyze the user's request to identify core requirements and constraints
|
||||||
- If critical information is missing or ambiguous, ask ONE clarifying question at a time
|
- If critical information is missing or ambiguous, ask clarifying questions using the \`ask_user\` tool
|
||||||
|
- When using \`ask_user\`, prefer providing multiple-choice options for the user to select from when possible
|
||||||
- Do NOT explore the project or create a plan yet
|
- Do NOT explore the project or create a plan yet
|
||||||
|
|
||||||
### Phase 2: Project Exploration
|
### Phase 2: Project Exploration
|
||||||
|
|||||||
@@ -274,10 +274,11 @@ describe('Core System Prompt (prompts.ts)', () => {
|
|||||||
|
|
||||||
it('should only list available tools in PLAN mode', () => {
|
it('should only list available tools in PLAN mode', () => {
|
||||||
vi.mocked(mockConfig.getApprovalMode).mockReturnValue(ApprovalMode.PLAN);
|
vi.mocked(mockConfig.getApprovalMode).mockReturnValue(ApprovalMode.PLAN);
|
||||||
// Only enable glob and read_file, disable others (like web search)
|
// Only enable a subset of tools, including ask_user
|
||||||
vi.mocked(mockConfig.getToolRegistry().getAllToolNames).mockReturnValue([
|
vi.mocked(mockConfig.getToolRegistry().getAllToolNames).mockReturnValue([
|
||||||
'glob',
|
'glob',
|
||||||
'read_file',
|
'read_file',
|
||||||
|
'ask_user',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const prompt = getCoreSystemPrompt(mockConfig);
|
const prompt = getCoreSystemPrompt(mockConfig);
|
||||||
@@ -285,6 +286,7 @@ describe('Core System Prompt (prompts.ts)', () => {
|
|||||||
// Should include enabled tools
|
// Should include enabled tools
|
||||||
expect(prompt).toContain('`glob`');
|
expect(prompt).toContain('`glob`');
|
||||||
expect(prompt).toContain('`read_file`');
|
expect(prompt).toContain('`read_file`');
|
||||||
|
expect(prompt).toContain('`ask_user`');
|
||||||
|
|
||||||
// Should NOT include disabled tools
|
// Should NOT include disabled tools
|
||||||
expect(prompt).not.toContain('`google_web_search`');
|
expect(prompt).not.toContain('`google_web_search`');
|
||||||
|
|||||||
@@ -64,6 +64,12 @@ decision = "allow"
|
|||||||
priority = 50
|
priority = 50
|
||||||
modes = ["plan"]
|
modes = ["plan"]
|
||||||
|
|
||||||
|
[[rule]]
|
||||||
|
toolName = "ask_user"
|
||||||
|
decision = "allow"
|
||||||
|
priority = 50
|
||||||
|
modes = ["plan"]
|
||||||
|
|
||||||
# Allow write_file for .md files in plans directory
|
# Allow write_file for .md files in plans directory
|
||||||
[[rule]]
|
[[rule]]
|
||||||
toolName = "write_file"
|
toolName = "write_file"
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
import {
|
import {
|
||||||
ACTIVATE_SKILL_TOOL_NAME,
|
ACTIVATE_SKILL_TOOL_NAME,
|
||||||
|
ASK_USER_TOOL_NAME,
|
||||||
EDIT_TOOL_NAME,
|
EDIT_TOOL_NAME,
|
||||||
GLOB_TOOL_NAME,
|
GLOB_TOOL_NAME,
|
||||||
GREP_TOOL_NAME,
|
GREP_TOOL_NAME,
|
||||||
@@ -312,7 +313,8 @@ ${options.planModeToolsList}
|
|||||||
|
|
||||||
### Phase 1: Requirements Understanding
|
### Phase 1: Requirements Understanding
|
||||||
- Analyze the user's request to identify core requirements and constraints
|
- Analyze the user's request to identify core requirements and constraints
|
||||||
- If critical information is missing or ambiguous, ask ONE clarifying question at a time
|
- If critical information is missing or ambiguous, ask clarifying questions using the \`${ASK_USER_TOOL_NAME}\` tool
|
||||||
|
- When using \`${ASK_USER_TOOL_NAME}\`, prefer providing multiple-choice options for the user to select from when possible
|
||||||
- Do NOT explore the project or create a plan yet
|
- Do NOT explore the project or create a plan yet
|
||||||
|
|
||||||
### Phase 2: Project Exploration
|
### Phase 2: Project Exploration
|
||||||
|
|||||||
@@ -60,6 +60,7 @@ export const PLAN_MODE_TOOLS = [
|
|||||||
READ_FILE_TOOL_NAME,
|
READ_FILE_TOOL_NAME,
|
||||||
LS_TOOL_NAME,
|
LS_TOOL_NAME,
|
||||||
WEB_SEARCH_TOOL_NAME,
|
WEB_SEARCH_TOOL_NAME,
|
||||||
|
ASK_USER_TOOL_NAME,
|
||||||
] as const;
|
] as const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user