feat(plan): enable AskUser tool in Plan mode for clarifying questions (#17694)

This commit is contained in:
Jerop Kipruto
2026-01-27 15:23:49 -05:00
committed by GitHub
parent 771ece03c9
commit 0774f60e08
5 changed files with 15 additions and 3 deletions

View File

@@ -185,7 +185,8 @@ The following read-only tools are available in Plan Mode:
### Phase 1: Requirements Understanding
- 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
### Phase 2: Project Exploration

View File

@@ -274,10 +274,11 @@ describe('Core System Prompt (prompts.ts)', () => {
it('should only list available tools in PLAN mode', () => {
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([
'glob',
'read_file',
'ask_user',
]);
const prompt = getCoreSystemPrompt(mockConfig);
@@ -285,6 +286,7 @@ describe('Core System Prompt (prompts.ts)', () => {
// Should include enabled tools
expect(prompt).toContain('`glob`');
expect(prompt).toContain('`read_file`');
expect(prompt).toContain('`ask_user`');
// Should NOT include disabled tools
expect(prompt).not.toContain('`google_web_search`');

View File

@@ -64,6 +64,12 @@ decision = "allow"
priority = 50
modes = ["plan"]
[[rule]]
toolName = "ask_user"
decision = "allow"
priority = 50
modes = ["plan"]
# Allow write_file for .md files in plans directory
[[rule]]
toolName = "write_file"

View File

@@ -6,6 +6,7 @@
import {
ACTIVATE_SKILL_TOOL_NAME,
ASK_USER_TOOL_NAME,
EDIT_TOOL_NAME,
GLOB_TOOL_NAME,
GREP_TOOL_NAME,
@@ -312,7 +313,8 @@ ${options.planModeToolsList}
### Phase 1: Requirements Understanding
- 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
### Phase 2: Project Exploration

View File

@@ -60,6 +60,7 @@ export const PLAN_MODE_TOOLS = [
READ_FILE_TOOL_NAME,
LS_TOOL_NAME,
WEB_SEARCH_TOOL_NAME,
ASK_USER_TOOL_NAME,
] as const;
/**