diff --git a/packages/core/src/core/__snapshots__/prompts.test.ts.snap b/packages/core/src/core/__snapshots__/prompts.test.ts.snap index 8db76f285c..41766a91d4 100644 --- a/packages/core/src/core/__snapshots__/prompts.test.ts.snap +++ b/packages/core/src/core/__snapshots__/prompts.test.ts.snap @@ -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 diff --git a/packages/core/src/core/prompts.test.ts b/packages/core/src/core/prompts.test.ts index 76bcad8634..9842558667 100644 --- a/packages/core/src/core/prompts.test.ts +++ b/packages/core/src/core/prompts.test.ts @@ -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`'); diff --git a/packages/core/src/policy/policies/plan.toml b/packages/core/src/policy/policies/plan.toml index 308465e20c..5e8f51f793 100644 --- a/packages/core/src/policy/policies/plan.toml +++ b/packages/core/src/policy/policies/plan.toml @@ -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" diff --git a/packages/core/src/prompts/snippets.ts b/packages/core/src/prompts/snippets.ts index b3beb41c2a..38ba82624e 100644 --- a/packages/core/src/prompts/snippets.ts +++ b/packages/core/src/prompts/snippets.ts @@ -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 diff --git a/packages/core/src/tools/tool-names.ts b/packages/core/src/tools/tool-names.ts index e00b626579..ee3eb8f930 100644 --- a/packages/core/src/tools/tool-names.ts +++ b/packages/core/src/tools/tool-names.ts @@ -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; /**