diff --git a/.changeset/proud-horses-hope.md b/.changeset/proud-horses-hope.md new file mode 100644 index 00000000..a5d4ce86 --- /dev/null +++ b/.changeset/proud-horses-hope.md @@ -0,0 +1,5 @@ +--- +"claude-dev": patch +--- + +Removed new_task from system prompts, updated slash command prompt, added helper function for native tool calling checks diff --git a/src/core/prompts/commands.ts b/src/core/prompts/commands.ts index b18292a1..dfb36d0e 100644 --- a/src/core/prompts/commands.ts +++ b/src/core/prompts/commands.ts @@ -1,8 +1,40 @@ import type { ApiProviderInfo } from "@/core/api" import { getDeepPlanningPrompt } from "./commands/deep-planning" -export const newTaskToolResponse = () => - ` +export const newTaskToolResponse = (enableNativeToolCalls?: boolean) => { + const xmlExample = enableNativeToolCalls + ? "" + : ` +Example: + +1. Current Work: + [Detailed description] + +2. Key Technical Concepts: + - [Concept 1] + - [Concept 2] + - [...] + +3. Relevant Files and Code: + - [File Name 1] + - [Summary of why this file is important] + - [Summary of the changes made to this file, if any] + - [Important Code Snippet] + - [File Name 2] + - [Important Code Snippet] + - [...] + +4. Problem Solving: + [Detailed description] + +5. Pending Tasks and Next Steps: + - [Task 1 details & next steps] + - [Task 2 details & next steps] + - [...] + +` + + return ` The user has explicitly asked you to help them create a new task with preloaded context, which you will generate. The user may have provided instructions or additional information for you to consider when summarizing existing work and creating the context for the new task. Irrespective of whether additional information or instructions are given, you are ONLY allowed to respond to this message by calling the new_task tool. @@ -19,15 +51,11 @@ Parameters: 3. Relevant Files and Code: If applicable, enumerate specific files and code sections examined, modified, or created for the task continuation. Pay special attention to the most recent messages and changes. 4. Problem Solving: Document problems solved thus far and any ongoing troubleshooting efforts. 5. Pending Tasks and Next Steps: Outline all pending tasks that you have explicitly been asked to work on, as well as list the next steps you will take for all outstanding work, if applicable. Include code snippets where they add clarity. For any next steps, include direct quotes from the most recent conversation showing exactly what task you were working on and where you left off. This should be verbatim to ensure there's no information loss in context between tasks. - -Usage: - -context to preload new task with - - +${xmlExample} Below is the the user's input when they indicated that they wanted to create a new task. \n ` +} export const condenseToolResponse = (focusChainSettings?: { enabled: boolean }) => ` diff --git a/src/core/prompts/system-prompt/__tests__/__snapshots__/anthropic_claude_sonnet_4-basic.snap b/src/core/prompts/system-prompt/__tests__/__snapshots__/anthropic_claude_sonnet_4-basic.snap index 2961e87b..59cfe657 100644 --- a/src/core/prompts/system-prompt/__tests__/__snapshots__/anthropic_claude_sonnet_4-basic.snap +++ b/src/core/prompts/system-prompt/__tests__/__snapshots__/anthropic_claude_sonnet_4-basic.snap @@ -250,21 +250,6 @@ Usage: Checklist here (required if you used task_progress in previous tool uses) -## new_task -Description: Request to create a new task with preloaded context covering the conversation with the user up to this point and key information for continuing with the new task. With this tool, you will create a detailed summary of the conversation so far, paying close attention to the user's explicit requests and your previous actions, with a focus on the most relevant information required for the new task. -Among other important areas of focus, this summary should be thorough in capturing technical details, code patterns, and architectural decisions that would be essential for continuing with the new task. The user will be presented with a preview of your generated context and can choose to create a new task or keep chatting in the current conversation. The user may choose to start a new task at any point. -Parameters: -- context: (required) The context to preload the new task with. If applicable based on the current task, this should include: - 1. Current Work: Describe in detail what was being worked on prior to this request to create a new task. Pay special attention to the more recent messages / conversation. - 2. Key Technical Concepts: List all important technical concepts, technologies, coding conventions, and frameworks discussed, which might be relevant for the new task. - 3. Relevant Files and Code: If applicable, enumerate specific files and code sections examined, modified, or created for the task continuation. Pay special attention to the most recent messages and changes. - 4. Problem Solving: Document problems solved thus far and any ongoing troubleshooting efforts. - 5. Pending Tasks and Next Steps: Outline all pending tasks that you have explicitly been asked to work on, as well as list the next steps you will take for all outstanding work, if applicable. Include code snippets where they add clarity. For any next steps, include direct quotes from the most recent conversation showing exactly what task you were working on and where you left off. This should be verbatim to ensure there's no information loss in context between tasks. It's important to be detailed here. -Usage: - -context to preload new task with - - ## plan_mode_respond Description: Respond to the user's inquiry in an effort to plan a solution to the user's task. This tool should ONLY be used when you have already explored the relevant files and are ready to present a concrete plan. DO NOT use this tool to announce what files you're going to read - just read them first. This tool is only available in PLAN MODE. The environment_details will specify the current mode; if it is not PLAN_MODE then you should not use this tool. However, if while writing your response you realize you actually need to do more exploration before providing a complete plan, you can add the optional needs_more_exploration parameter to indicate this. This allows you to acknowledge that you should have done more exploration first, and signals that your next message will use exploration tools instead. diff --git a/src/core/prompts/system-prompt/__tests__/__snapshots__/anthropic_claude_sonnet_4-no-browser.snap b/src/core/prompts/system-prompt/__tests__/__snapshots__/anthropic_claude_sonnet_4-no-browser.snap index 23d427e2..0f05522e 100644 --- a/src/core/prompts/system-prompt/__tests__/__snapshots__/anthropic_claude_sonnet_4-no-browser.snap +++ b/src/core/prompts/system-prompt/__tests__/__snapshots__/anthropic_claude_sonnet_4-no-browser.snap @@ -216,21 +216,6 @@ Usage: Checklist here (required if you used task_progress in previous tool uses) -## new_task -Description: Request to create a new task with preloaded context covering the conversation with the user up to this point and key information for continuing with the new task. With this tool, you will create a detailed summary of the conversation so far, paying close attention to the user's explicit requests and your previous actions, with a focus on the most relevant information required for the new task. -Among other important areas of focus, this summary should be thorough in capturing technical details, code patterns, and architectural decisions that would be essential for continuing with the new task. The user will be presented with a preview of your generated context and can choose to create a new task or keep chatting in the current conversation. The user may choose to start a new task at any point. -Parameters: -- context: (required) The context to preload the new task with. If applicable based on the current task, this should include: - 1. Current Work: Describe in detail what was being worked on prior to this request to create a new task. Pay special attention to the more recent messages / conversation. - 2. Key Technical Concepts: List all important technical concepts, technologies, coding conventions, and frameworks discussed, which might be relevant for the new task. - 3. Relevant Files and Code: If applicable, enumerate specific files and code sections examined, modified, or created for the task continuation. Pay special attention to the most recent messages and changes. - 4. Problem Solving: Document problems solved thus far and any ongoing troubleshooting efforts. - 5. Pending Tasks and Next Steps: Outline all pending tasks that you have explicitly been asked to work on, as well as list the next steps you will take for all outstanding work, if applicable. Include code snippets where they add clarity. For any next steps, include direct quotes from the most recent conversation showing exactly what task you were working on and where you left off. This should be verbatim to ensure there's no information loss in context between tasks. It's important to be detailed here. -Usage: - -context to preload new task with - - ## plan_mode_respond Description: Respond to the user's inquiry in an effort to plan a solution to the user's task. This tool should ONLY be used when you have already explored the relevant files and are ready to present a concrete plan. DO NOT use this tool to announce what files you're going to read - just read them first. This tool is only available in PLAN MODE. The environment_details will specify the current mode; if it is not PLAN_MODE then you should not use this tool. However, if while writing your response you realize you actually need to do more exploration before providing a complete plan, you can add the optional needs_more_exploration parameter to indicate this. This allows you to acknowledge that you should have done more exploration first, and signals that your next message will use exploration tools instead. diff --git a/src/core/prompts/system-prompt/__tests__/__snapshots__/anthropic_claude_sonnet_4-no-focus-chain.snap b/src/core/prompts/system-prompt/__tests__/__snapshots__/anthropic_claude_sonnet_4-no-focus-chain.snap index f76c213f..5a485130 100644 --- a/src/core/prompts/system-prompt/__tests__/__snapshots__/anthropic_claude_sonnet_4-no-focus-chain.snap +++ b/src/core/prompts/system-prompt/__tests__/__snapshots__/anthropic_claude_sonnet_4-no-focus-chain.snap @@ -224,21 +224,6 @@ Usage: Your command here (optional) -## new_task -Description: Request to create a new task with preloaded context covering the conversation with the user up to this point and key information for continuing with the new task. With this tool, you will create a detailed summary of the conversation so far, paying close attention to the user's explicit requests and your previous actions, with a focus on the most relevant information required for the new task. -Among other important areas of focus, this summary should be thorough in capturing technical details, code patterns, and architectural decisions that would be essential for continuing with the new task. The user will be presented with a preview of your generated context and can choose to create a new task or keep chatting in the current conversation. The user may choose to start a new task at any point. -Parameters: -- context: (required) The context to preload the new task with. If applicable based on the current task, this should include: - 1. Current Work: Describe in detail what was being worked on prior to this request to create a new task. Pay special attention to the more recent messages / conversation. - 2. Key Technical Concepts: List all important technical concepts, technologies, coding conventions, and frameworks discussed, which might be relevant for the new task. - 3. Relevant Files and Code: If applicable, enumerate specific files and code sections examined, modified, or created for the task continuation. Pay special attention to the most recent messages and changes. - 4. Problem Solving: Document problems solved thus far and any ongoing troubleshooting efforts. - 5. Pending Tasks and Next Steps: Outline all pending tasks that you have explicitly been asked to work on, as well as list the next steps you will take for all outstanding work, if applicable. Include code snippets where they add clarity. For any next steps, include direct quotes from the most recent conversation showing exactly what task you were working on and where you left off. This should be verbatim to ensure there's no information loss in context between tasks. It's important to be detailed here. -Usage: - -context to preload new task with - - ## plan_mode_respond Description: Respond to the user's inquiry in an effort to plan a solution to the user's task. This tool should ONLY be used when you have already explored the relevant files and are ready to present a concrete plan. DO NOT use this tool to announce what files you're going to read - just read them first. This tool is only available in PLAN MODE. The environment_details will specify the current mode; if it is not PLAN_MODE then you should not use this tool. However, if while writing your response you realize you actually need to do more exploration before providing a complete plan, you can add the optional needs_more_exploration parameter to indicate this. This allows you to acknowledge that you should have done more exploration first, and signals that your next message will use exploration tools instead. diff --git a/src/core/prompts/system-prompt/__tests__/__snapshots__/anthropic_claude_sonnet_4-no-mcp.snap b/src/core/prompts/system-prompt/__tests__/__snapshots__/anthropic_claude_sonnet_4-no-mcp.snap index 2da117b4..e7142ef7 100644 --- a/src/core/prompts/system-prompt/__tests__/__snapshots__/anthropic_claude_sonnet_4-no-mcp.snap +++ b/src/core/prompts/system-prompt/__tests__/__snapshots__/anthropic_claude_sonnet_4-no-mcp.snap @@ -250,21 +250,6 @@ Usage: Checklist here (required if you used task_progress in previous tool uses) -## new_task -Description: Request to create a new task with preloaded context covering the conversation with the user up to this point and key information for continuing with the new task. With this tool, you will create a detailed summary of the conversation so far, paying close attention to the user's explicit requests and your previous actions, with a focus on the most relevant information required for the new task. -Among other important areas of focus, this summary should be thorough in capturing technical details, code patterns, and architectural decisions that would be essential for continuing with the new task. The user will be presented with a preview of your generated context and can choose to create a new task or keep chatting in the current conversation. The user may choose to start a new task at any point. -Parameters: -- context: (required) The context to preload the new task with. If applicable based on the current task, this should include: - 1. Current Work: Describe in detail what was being worked on prior to this request to create a new task. Pay special attention to the more recent messages / conversation. - 2. Key Technical Concepts: List all important technical concepts, technologies, coding conventions, and frameworks discussed, which might be relevant for the new task. - 3. Relevant Files and Code: If applicable, enumerate specific files and code sections examined, modified, or created for the task continuation. Pay special attention to the most recent messages and changes. - 4. Problem Solving: Document problems solved thus far and any ongoing troubleshooting efforts. - 5. Pending Tasks and Next Steps: Outline all pending tasks that you have explicitly been asked to work on, as well as list the next steps you will take for all outstanding work, if applicable. Include code snippets where they add clarity. For any next steps, include direct quotes from the most recent conversation showing exactly what task you were working on and where you left off. This should be verbatim to ensure there's no information loss in context between tasks. It's important to be detailed here. -Usage: - -context to preload new task with - - ## plan_mode_respond Description: Respond to the user's inquiry in an effort to plan a solution to the user's task. This tool should ONLY be used when you have already explored the relevant files and are ready to present a concrete plan. DO NOT use this tool to announce what files you're going to read - just read them first. This tool is only available in PLAN MODE. The environment_details will specify the current mode; if it is not PLAN_MODE then you should not use this tool. However, if while writing your response you realize you actually need to do more exploration before providing a complete plan, you can add the optional needs_more_exploration parameter to indicate this. This allows you to acknowledge that you should have done more exploration first, and signals that your next message will use exploration tools instead. diff --git a/src/core/prompts/system-prompt/__tests__/__snapshots__/openai_gpt_3-basic.snap b/src/core/prompts/system-prompt/__tests__/__snapshots__/openai_gpt_3-basic.snap index 0364e10c..cb8c3500 100644 --- a/src/core/prompts/system-prompt/__tests__/__snapshots__/openai_gpt_3-basic.snap +++ b/src/core/prompts/system-prompt/__tests__/__snapshots__/openai_gpt_3-basic.snap @@ -232,21 +232,6 @@ Usage: Checklist here (required if you used task_progress in previous tool uses) -## new_task -Description: Request to create a new task with preloaded context covering the conversation with the user up to this point and key information for continuing with the new task. With this tool, you will create a detailed summary of the conversation so far, paying close attention to the user's explicit requests and your previous actions, with a focus on the most relevant information required for the new task. -Among other important areas of focus, this summary should be thorough in capturing technical details, code patterns, and architectural decisions that would be essential for continuing with the new task. The user will be presented with a preview of your generated context and can choose to create a new task or keep chatting in the current conversation. The user may choose to start a new task at any point. -Parameters: -- context: (required) The context to preload the new task with. If applicable based on the current task, this should include: - 1. Current Work: Describe in detail what was being worked on prior to this request to create a new task. Pay special attention to the more recent messages / conversation. - 2. Key Technical Concepts: List all important technical concepts, technologies, coding conventions, and frameworks discussed, which might be relevant for the new task. - 3. Relevant Files and Code: If applicable, enumerate specific files and code sections examined, modified, or created for the task continuation. Pay special attention to the most recent messages and changes. - 4. Problem Solving: Document problems solved thus far and any ongoing troubleshooting efforts. - 5. Pending Tasks and Next Steps: Outline all pending tasks that you have explicitly been asked to work on, as well as list the next steps you will take for all outstanding work, if applicable. Include code snippets where they add clarity. For any next steps, include direct quotes from the most recent conversation showing exactly what task you were working on and where you left off. This should be verbatim to ensure there's no information loss in context between tasks. It's important to be detailed here. -Usage: - -context to preload new task with - - ## plan_mode_respond Description: Respond to the user's inquiry in an effort to plan a solution to the user's task. This tool should ONLY be used when you have already explored the relevant files and are ready to present a concrete plan. DO NOT use this tool to announce what files you're going to read - just read them first. This tool is only available in PLAN MODE. The environment_details will specify the current mode; if it is not PLAN_MODE then you should not use this tool. However, if while writing your response you realize you actually need to do more exploration before providing a complete plan, you can add the optional needs_more_exploration parameter to indicate this. This allows you to acknowledge that you should have done more exploration first, and signals that your next message will use exploration tools instead. diff --git a/src/core/prompts/system-prompt/__tests__/__snapshots__/openai_gpt_3-no-browser.snap b/src/core/prompts/system-prompt/__tests__/__snapshots__/openai_gpt_3-no-browser.snap index 98d8d193..09191b72 100644 --- a/src/core/prompts/system-prompt/__tests__/__snapshots__/openai_gpt_3-no-browser.snap +++ b/src/core/prompts/system-prompt/__tests__/__snapshots__/openai_gpt_3-no-browser.snap @@ -198,21 +198,6 @@ Usage: Checklist here (required if you used task_progress in previous tool uses) -## new_task -Description: Request to create a new task with preloaded context covering the conversation with the user up to this point and key information for continuing with the new task. With this tool, you will create a detailed summary of the conversation so far, paying close attention to the user's explicit requests and your previous actions, with a focus on the most relevant information required for the new task. -Among other important areas of focus, this summary should be thorough in capturing technical details, code patterns, and architectural decisions that would be essential for continuing with the new task. The user will be presented with a preview of your generated context and can choose to create a new task or keep chatting in the current conversation. The user may choose to start a new task at any point. -Parameters: -- context: (required) The context to preload the new task with. If applicable based on the current task, this should include: - 1. Current Work: Describe in detail what was being worked on prior to this request to create a new task. Pay special attention to the more recent messages / conversation. - 2. Key Technical Concepts: List all important technical concepts, technologies, coding conventions, and frameworks discussed, which might be relevant for the new task. - 3. Relevant Files and Code: If applicable, enumerate specific files and code sections examined, modified, or created for the task continuation. Pay special attention to the most recent messages and changes. - 4. Problem Solving: Document problems solved thus far and any ongoing troubleshooting efforts. - 5. Pending Tasks and Next Steps: Outline all pending tasks that you have explicitly been asked to work on, as well as list the next steps you will take for all outstanding work, if applicable. Include code snippets where they add clarity. For any next steps, include direct quotes from the most recent conversation showing exactly what task you were working on and where you left off. This should be verbatim to ensure there's no information loss in context between tasks. It's important to be detailed here. -Usage: - -context to preload new task with - - ## plan_mode_respond Description: Respond to the user's inquiry in an effort to plan a solution to the user's task. This tool should ONLY be used when you have already explored the relevant files and are ready to present a concrete plan. DO NOT use this tool to announce what files you're going to read - just read them first. This tool is only available in PLAN MODE. The environment_details will specify the current mode; if it is not PLAN_MODE then you should not use this tool. However, if while writing your response you realize you actually need to do more exploration before providing a complete plan, you can add the optional needs_more_exploration parameter to indicate this. This allows you to acknowledge that you should have done more exploration first, and signals that your next message will use exploration tools instead. diff --git a/src/core/prompts/system-prompt/__tests__/__snapshots__/openai_gpt_3-no-focus-chain.snap b/src/core/prompts/system-prompt/__tests__/__snapshots__/openai_gpt_3-no-focus-chain.snap index 3cbe55d2..7e48e30a 100644 --- a/src/core/prompts/system-prompt/__tests__/__snapshots__/openai_gpt_3-no-focus-chain.snap +++ b/src/core/prompts/system-prompt/__tests__/__snapshots__/openai_gpt_3-no-focus-chain.snap @@ -208,21 +208,6 @@ Usage: Your command here (optional) -## new_task -Description: Request to create a new task with preloaded context covering the conversation with the user up to this point and key information for continuing with the new task. With this tool, you will create a detailed summary of the conversation so far, paying close attention to the user's explicit requests and your previous actions, with a focus on the most relevant information required for the new task. -Among other important areas of focus, this summary should be thorough in capturing technical details, code patterns, and architectural decisions that would be essential for continuing with the new task. The user will be presented with a preview of your generated context and can choose to create a new task or keep chatting in the current conversation. The user may choose to start a new task at any point. -Parameters: -- context: (required) The context to preload the new task with. If applicable based on the current task, this should include: - 1. Current Work: Describe in detail what was being worked on prior to this request to create a new task. Pay special attention to the more recent messages / conversation. - 2. Key Technical Concepts: List all important technical concepts, technologies, coding conventions, and frameworks discussed, which might be relevant for the new task. - 3. Relevant Files and Code: If applicable, enumerate specific files and code sections examined, modified, or created for the task continuation. Pay special attention to the most recent messages and changes. - 4. Problem Solving: Document problems solved thus far and any ongoing troubleshooting efforts. - 5. Pending Tasks and Next Steps: Outline all pending tasks that you have explicitly been asked to work on, as well as list the next steps you will take for all outstanding work, if applicable. Include code snippets where they add clarity. For any next steps, include direct quotes from the most recent conversation showing exactly what task you were working on and where you left off. This should be verbatim to ensure there's no information loss in context between tasks. It's important to be detailed here. -Usage: - -context to preload new task with - - ## plan_mode_respond Description: Respond to the user's inquiry in an effort to plan a solution to the user's task. This tool should ONLY be used when you have already explored the relevant files and are ready to present a concrete plan. DO NOT use this tool to announce what files you're going to read - just read them first. This tool is only available in PLAN MODE. The environment_details will specify the current mode; if it is not PLAN_MODE then you should not use this tool. However, if while writing your response you realize you actually need to do more exploration before providing a complete plan, you can add the optional needs_more_exploration parameter to indicate this. This allows you to acknowledge that you should have done more exploration first, and signals that your next message will use exploration tools instead. diff --git a/src/core/prompts/system-prompt/__tests__/__snapshots__/openai_gpt_3-no-mcp.snap b/src/core/prompts/system-prompt/__tests__/__snapshots__/openai_gpt_3-no-mcp.snap index aebed4e3..47db2abc 100644 --- a/src/core/prompts/system-prompt/__tests__/__snapshots__/openai_gpt_3-no-mcp.snap +++ b/src/core/prompts/system-prompt/__tests__/__snapshots__/openai_gpt_3-no-mcp.snap @@ -232,21 +232,6 @@ Usage: Checklist here (required if you used task_progress in previous tool uses) -## new_task -Description: Request to create a new task with preloaded context covering the conversation with the user up to this point and key information for continuing with the new task. With this tool, you will create a detailed summary of the conversation so far, paying close attention to the user's explicit requests and your previous actions, with a focus on the most relevant information required for the new task. -Among other important areas of focus, this summary should be thorough in capturing technical details, code patterns, and architectural decisions that would be essential for continuing with the new task. The user will be presented with a preview of your generated context and can choose to create a new task or keep chatting in the current conversation. The user may choose to start a new task at any point. -Parameters: -- context: (required) The context to preload the new task with. If applicable based on the current task, this should include: - 1. Current Work: Describe in detail what was being worked on prior to this request to create a new task. Pay special attention to the more recent messages / conversation. - 2. Key Technical Concepts: List all important technical concepts, technologies, coding conventions, and frameworks discussed, which might be relevant for the new task. - 3. Relevant Files and Code: If applicable, enumerate specific files and code sections examined, modified, or created for the task continuation. Pay special attention to the most recent messages and changes. - 4. Problem Solving: Document problems solved thus far and any ongoing troubleshooting efforts. - 5. Pending Tasks and Next Steps: Outline all pending tasks that you have explicitly been asked to work on, as well as list the next steps you will take for all outstanding work, if applicable. Include code snippets where they add clarity. For any next steps, include direct quotes from the most recent conversation showing exactly what task you were working on and where you left off. This should be verbatim to ensure there's no information loss in context between tasks. It's important to be detailed here. -Usage: - -context to preload new task with - - ## plan_mode_respond Description: Respond to the user's inquiry in an effort to plan a solution to the user's task. This tool should ONLY be used when you have already explored the relevant files and are ready to present a concrete plan. DO NOT use this tool to announce what files you're going to read - just read them first. This tool is only available in PLAN MODE. The environment_details will specify the current mode; if it is not PLAN_MODE then you should not use this tool. However, if while writing your response you realize you actually need to do more exploration before providing a complete plan, you can add the optional needs_more_exploration parameter to indicate this. This allows you to acknowledge that you should have done more exploration first, and signals that your next message will use exploration tools instead. diff --git a/src/core/prompts/system-prompt/__tests__/__snapshots__/openai_gpt_5-basic.snap b/src/core/prompts/system-prompt/__tests__/__snapshots__/openai_gpt_5-basic.snap index 808b33fc..9d9f26d5 100644 --- a/src/core/prompts/system-prompt/__tests__/__snapshots__/openai_gpt_5-basic.snap +++ b/src/core/prompts/system-prompt/__tests__/__snapshots__/openai_gpt_5-basic.snap @@ -250,21 +250,6 @@ Usage: Checklist here (required if you used task_progress in previous tool uses) -## new_task -Description: Request to create a new task with preloaded context covering the conversation with the user up to this point and key information for continuing with the new task. With this tool, you will create a detailed summary of the conversation so far, paying close attention to the user's explicit requests and your previous actions, with a focus on the most relevant information required for the new task. -Among other important areas of focus, this summary should be thorough in capturing technical details, code patterns, and architectural decisions that would be essential for continuing with the new task. The user will be presented with a preview of your generated context and can choose to create a new task or keep chatting in the current conversation. The user may choose to start a new task at any point. -Parameters: -- context: (required) The context to preload the new task with. If applicable based on the current task, this should include: - 1. Current Work: Describe in detail what was being worked on prior to this request to create a new task. Pay special attention to the more recent messages / conversation. - 2. Key Technical Concepts: List all important technical concepts, technologies, coding conventions, and frameworks discussed, which might be relevant for the new task. - 3. Relevant Files and Code: If applicable, enumerate specific files and code sections examined, modified, or created for the task continuation. Pay special attention to the most recent messages and changes. - 4. Problem Solving: Document problems solved thus far and any ongoing troubleshooting efforts. - 5. Pending Tasks and Next Steps: Outline all pending tasks that you have explicitly been asked to work on, as well as list the next steps you will take for all outstanding work, if applicable. Include code snippets where they add clarity. For any next steps, include direct quotes from the most recent conversation showing exactly what task you were working on and where you left off. This should be verbatim to ensure there's no information loss in context between tasks. It's important to be detailed here. -Usage: - -context to preload new task with - - ## plan_mode_respond Description: Respond to the user's inquiry in an effort to plan a solution to the user's task. This tool should ONLY be used when you have already explored the relevant files and are ready to present a concrete plan. DO NOT use this tool to announce what files you're going to read - just read them first. This tool is only available in PLAN MODE. The environment_details will specify the current mode; if it is not PLAN_MODE then you should not use this tool. However, if while writing your response you realize you actually need to do more exploration before providing a complete plan, you can add the optional needs_more_exploration parameter to indicate this. This allows you to acknowledge that you should have done more exploration first, and signals that your next message will use exploration tools instead. diff --git a/src/core/prompts/system-prompt/__tests__/__snapshots__/openai_gpt_5-no-browser.snap b/src/core/prompts/system-prompt/__tests__/__snapshots__/openai_gpt_5-no-browser.snap index fdf2bb49..89635998 100644 --- a/src/core/prompts/system-prompt/__tests__/__snapshots__/openai_gpt_5-no-browser.snap +++ b/src/core/prompts/system-prompt/__tests__/__snapshots__/openai_gpt_5-no-browser.snap @@ -216,21 +216,6 @@ Usage: Checklist here (required if you used task_progress in previous tool uses) -## new_task -Description: Request to create a new task with preloaded context covering the conversation with the user up to this point and key information for continuing with the new task. With this tool, you will create a detailed summary of the conversation so far, paying close attention to the user's explicit requests and your previous actions, with a focus on the most relevant information required for the new task. -Among other important areas of focus, this summary should be thorough in capturing technical details, code patterns, and architectural decisions that would be essential for continuing with the new task. The user will be presented with a preview of your generated context and can choose to create a new task or keep chatting in the current conversation. The user may choose to start a new task at any point. -Parameters: -- context: (required) The context to preload the new task with. If applicable based on the current task, this should include: - 1. Current Work: Describe in detail what was being worked on prior to this request to create a new task. Pay special attention to the more recent messages / conversation. - 2. Key Technical Concepts: List all important technical concepts, technologies, coding conventions, and frameworks discussed, which might be relevant for the new task. - 3. Relevant Files and Code: If applicable, enumerate specific files and code sections examined, modified, or created for the task continuation. Pay special attention to the most recent messages and changes. - 4. Problem Solving: Document problems solved thus far and any ongoing troubleshooting efforts. - 5. Pending Tasks and Next Steps: Outline all pending tasks that you have explicitly been asked to work on, as well as list the next steps you will take for all outstanding work, if applicable. Include code snippets where they add clarity. For any next steps, include direct quotes from the most recent conversation showing exactly what task you were working on and where you left off. This should be verbatim to ensure there's no information loss in context between tasks. It's important to be detailed here. -Usage: - -context to preload new task with - - ## plan_mode_respond Description: Respond to the user's inquiry in an effort to plan a solution to the user's task. This tool should ONLY be used when you have already explored the relevant files and are ready to present a concrete plan. DO NOT use this tool to announce what files you're going to read - just read them first. This tool is only available in PLAN MODE. The environment_details will specify the current mode; if it is not PLAN_MODE then you should not use this tool. However, if while writing your response you realize you actually need to do more exploration before providing a complete plan, you can add the optional needs_more_exploration parameter to indicate this. This allows you to acknowledge that you should have done more exploration first, and signals that your next message will use exploration tools instead. diff --git a/src/core/prompts/system-prompt/__tests__/__snapshots__/openai_gpt_5-no-focus-chain.snap b/src/core/prompts/system-prompt/__tests__/__snapshots__/openai_gpt_5-no-focus-chain.snap index 9c77a32d..cdfff682 100644 --- a/src/core/prompts/system-prompt/__tests__/__snapshots__/openai_gpt_5-no-focus-chain.snap +++ b/src/core/prompts/system-prompt/__tests__/__snapshots__/openai_gpt_5-no-focus-chain.snap @@ -224,21 +224,6 @@ Usage: Your command here (optional) -## new_task -Description: Request to create a new task with preloaded context covering the conversation with the user up to this point and key information for continuing with the new task. With this tool, you will create a detailed summary of the conversation so far, paying close attention to the user's explicit requests and your previous actions, with a focus on the most relevant information required for the new task. -Among other important areas of focus, this summary should be thorough in capturing technical details, code patterns, and architectural decisions that would be essential for continuing with the new task. The user will be presented with a preview of your generated context and can choose to create a new task or keep chatting in the current conversation. The user may choose to start a new task at any point. -Parameters: -- context: (required) The context to preload the new task with. If applicable based on the current task, this should include: - 1. Current Work: Describe in detail what was being worked on prior to this request to create a new task. Pay special attention to the more recent messages / conversation. - 2. Key Technical Concepts: List all important technical concepts, technologies, coding conventions, and frameworks discussed, which might be relevant for the new task. - 3. Relevant Files and Code: If applicable, enumerate specific files and code sections examined, modified, or created for the task continuation. Pay special attention to the most recent messages and changes. - 4. Problem Solving: Document problems solved thus far and any ongoing troubleshooting efforts. - 5. Pending Tasks and Next Steps: Outline all pending tasks that you have explicitly been asked to work on, as well as list the next steps you will take for all outstanding work, if applicable. Include code snippets where they add clarity. For any next steps, include direct quotes from the most recent conversation showing exactly what task you were working on and where you left off. This should be verbatim to ensure there's no information loss in context between tasks. It's important to be detailed here. -Usage: - -context to preload new task with - - ## plan_mode_respond Description: Respond to the user's inquiry in an effort to plan a solution to the user's task. This tool should ONLY be used when you have already explored the relevant files and are ready to present a concrete plan. DO NOT use this tool to announce what files you're going to read - just read them first. This tool is only available in PLAN MODE. The environment_details will specify the current mode; if it is not PLAN_MODE then you should not use this tool. However, if while writing your response you realize you actually need to do more exploration before providing a complete plan, you can add the optional needs_more_exploration parameter to indicate this. This allows you to acknowledge that you should have done more exploration first, and signals that your next message will use exploration tools instead. diff --git a/src/core/prompts/system-prompt/__tests__/__snapshots__/openai_gpt_5-no-mcp.snap b/src/core/prompts/system-prompt/__tests__/__snapshots__/openai_gpt_5-no-mcp.snap index ecbab3e6..936b4a60 100644 --- a/src/core/prompts/system-prompt/__tests__/__snapshots__/openai_gpt_5-no-mcp.snap +++ b/src/core/prompts/system-prompt/__tests__/__snapshots__/openai_gpt_5-no-mcp.snap @@ -250,21 +250,6 @@ Usage: Checklist here (required if you used task_progress in previous tool uses) -## new_task -Description: Request to create a new task with preloaded context covering the conversation with the user up to this point and key information for continuing with the new task. With this tool, you will create a detailed summary of the conversation so far, paying close attention to the user's explicit requests and your previous actions, with a focus on the most relevant information required for the new task. -Among other important areas of focus, this summary should be thorough in capturing technical details, code patterns, and architectural decisions that would be essential for continuing with the new task. The user will be presented with a preview of your generated context and can choose to create a new task or keep chatting in the current conversation. The user may choose to start a new task at any point. -Parameters: -- context: (required) The context to preload the new task with. If applicable based on the current task, this should include: - 1. Current Work: Describe in detail what was being worked on prior to this request to create a new task. Pay special attention to the more recent messages / conversation. - 2. Key Technical Concepts: List all important technical concepts, technologies, coding conventions, and frameworks discussed, which might be relevant for the new task. - 3. Relevant Files and Code: If applicable, enumerate specific files and code sections examined, modified, or created for the task continuation. Pay special attention to the most recent messages and changes. - 4. Problem Solving: Document problems solved thus far and any ongoing troubleshooting efforts. - 5. Pending Tasks and Next Steps: Outline all pending tasks that you have explicitly been asked to work on, as well as list the next steps you will take for all outstanding work, if applicable. Include code snippets where they add clarity. For any next steps, include direct quotes from the most recent conversation showing exactly what task you were working on and where you left off. This should be verbatim to ensure there's no information loss in context between tasks. It's important to be detailed here. -Usage: - -context to preload new task with - - ## plan_mode_respond Description: Respond to the user's inquiry in an effort to plan a solution to the user's task. This tool should ONLY be used when you have already explored the relevant files and are ready to present a concrete plan. DO NOT use this tool to announce what files you're going to read - just read them first. This tool is only available in PLAN MODE. The environment_details will specify the current mode; if it is not PLAN_MODE then you should not use this tool. However, if while writing your response you realize you actually need to do more exploration before providing a complete plan, you can add the optional needs_more_exploration parameter to indicate this. This allows you to acknowledge that you should have done more exploration first, and signals that your next message will use exploration tools instead. diff --git a/src/core/prompts/system-prompt/variants/generic/config.ts b/src/core/prompts/system-prompt/variants/generic/config.ts index a872dc80..e760c8f6 100644 --- a/src/core/prompts/system-prompt/variants/generic/config.ts +++ b/src/core/prompts/system-prompt/variants/generic/config.ts @@ -59,7 +59,6 @@ export const config = createVariant(ModelFamily.GENERIC) ClineDefaultTool.MCP_ACCESS, ClineDefaultTool.ASK, ClineDefaultTool.ATTEMPT, - ClineDefaultTool.NEW_TASK, ClineDefaultTool.PLAN_MODE, ClineDefaultTool.MCP_DOCS, ClineDefaultTool.TODO, diff --git a/src/core/prompts/system-prompt/variants/glm/config.ts b/src/core/prompts/system-prompt/variants/glm/config.ts index 2b5a9adf..51701047 100644 --- a/src/core/prompts/system-prompt/variants/glm/config.ts +++ b/src/core/prompts/system-prompt/variants/glm/config.ts @@ -47,7 +47,6 @@ export const config = createVariant(ModelFamily.GLM) ClineDefaultTool.MCP_ACCESS, ClineDefaultTool.ASK, ClineDefaultTool.ATTEMPT, - ClineDefaultTool.NEW_TASK, ClineDefaultTool.PLAN_MODE, ClineDefaultTool.MCP_DOCS, ClineDefaultTool.TODO, diff --git a/src/core/prompts/system-prompt/variants/gpt-5/config.ts b/src/core/prompts/system-prompt/variants/gpt-5/config.ts index da871a8f..b13b2446 100644 --- a/src/core/prompts/system-prompt/variants/gpt-5/config.ts +++ b/src/core/prompts/system-prompt/variants/gpt-5/config.ts @@ -57,7 +57,6 @@ export const config = createVariant(ModelFamily.GPT_5) ClineDefaultTool.MCP_ACCESS, ClineDefaultTool.ASK, ClineDefaultTool.ATTEMPT, - ClineDefaultTool.NEW_TASK, ClineDefaultTool.PLAN_MODE, ClineDefaultTool.MCP_DOCS, ClineDefaultTool.TODO, diff --git a/src/core/prompts/system-prompt/variants/native-gpt-5/config.ts b/src/core/prompts/system-prompt/variants/native-gpt-5/config.ts index dda144f8..0ce0b9be 100644 --- a/src/core/prompts/system-prompt/variants/native-gpt-5/config.ts +++ b/src/core/prompts/system-prompt/variants/native-gpt-5/config.ts @@ -62,7 +62,6 @@ export const config = createVariant(ModelFamily.NATIVE_GPT_5) ClineDefaultTool.MCP_ACCESS, ClineDefaultTool.ASK, ClineDefaultTool.ATTEMPT, - ClineDefaultTool.NEW_TASK, ClineDefaultTool.PLAN_MODE, ClineDefaultTool.MCP_DOCS, ClineDefaultTool.TODO, diff --git a/src/core/prompts/system-prompt/variants/native-next-gen/config.ts b/src/core/prompts/system-prompt/variants/native-next-gen/config.ts index 63415bc4..de5ab18a 100644 --- a/src/core/prompts/system-prompt/variants/native-next-gen/config.ts +++ b/src/core/prompts/system-prompt/variants/native-next-gen/config.ts @@ -55,7 +55,6 @@ export const config = createVariant(ModelFamily.NATIVE_NEXT_GEN) ClineDefaultTool.WEB_FETCH, ClineDefaultTool.MCP_ACCESS, ClineDefaultTool.ATTEMPT, - ClineDefaultTool.NEW_TASK, ClineDefaultTool.PLAN_MODE, ClineDefaultTool.MCP_DOCS, ClineDefaultTool.TODO, diff --git a/src/core/prompts/system-prompt/variants/next-gen/config.ts b/src/core/prompts/system-prompt/variants/next-gen/config.ts index b9828cca..f6e4b537 100644 --- a/src/core/prompts/system-prompt/variants/next-gen/config.ts +++ b/src/core/prompts/system-prompt/variants/next-gen/config.ts @@ -60,7 +60,6 @@ export const config = createVariant(ModelFamily.NEXT_GEN) ClineDefaultTool.MCP_ACCESS, ClineDefaultTool.ASK, ClineDefaultTool.ATTEMPT, - ClineDefaultTool.NEW_TASK, ClineDefaultTool.PLAN_MODE, ClineDefaultTool.MCP_DOCS, ClineDefaultTool.TODO, diff --git a/src/core/slash-commands/index.ts b/src/core/slash-commands/index.ts index 46153f98..e92450db 100644 --- a/src/core/slash-commands/index.ts +++ b/src/core/slash-commands/index.ts @@ -2,6 +2,7 @@ import type { ApiProviderInfo } from "@core/api" import { ClineRulesToggles } from "@shared/cline-rules" import fs from "fs/promises" import { telemetryService } from "@/services/telemetry" +import { isNativeToolCallingConfig } from "@/utils/model-utils" import { condenseToolResponse, deepPlanningToolResponse, @@ -37,12 +38,16 @@ export async function parseSlashCommands( globalWorkflowToggles: ClineRulesToggles, ulid: string, focusChainSettings?: { enabled: boolean }, + enableNativeToolCalls?: boolean, providerInfo?: ApiProviderInfo, ): Promise<{ processedText: string; needsClinerulesFileCheck: boolean }> { const SUPPORTED_DEFAULT_COMMANDS = ["newtask", "smol", "compact", "newrule", "reportbug", "deep-planning", "subagent"] + // Determine if the current provider/model/setting actually uses native tool calling + const willUseNativeTools = isNativeToolCallingConfig(providerInfo!, enableNativeToolCalls || false) + const commandReplacements: Record = { - newtask: newTaskToolResponse(), + newtask: newTaskToolResponse(willUseNativeTools), smol: condenseToolResponse(focusChainSettings), compact: condenseToolResponse(focusChainSettings), newrule: newRuleToolResponse(), diff --git a/src/core/task/index.ts b/src/core/task/index.ts index 2f1900cc..1107f961 100644 --- a/src/core/task/index.ts +++ b/src/core/task/index.ts @@ -3242,7 +3242,7 @@ export class Task { globalWorkflowToggles, this.ulid, this.stateManager.getGlobalSettingsKey("focusChainSettings"), - this.getCurrentProviderInfo(), + this.useNativeToolCalls ) if (needsCheck) { diff --git a/src/utils/model-utils.ts b/src/utils/model-utils.ts index 1499b3f5..eda10b9c 100644 --- a/src/utils/model-utils.ts +++ b/src/utils/model-utils.ts @@ -128,6 +128,24 @@ export function parsePrice(priceString: string | undefined): number { return parsed * 1_000_000 } +/** + * Determines if the given provider and model combination will use native tool calling. + * Helpful if we need to quickly check this for prompts or other logic. + * @param providerInfo The provider and model information + * @param enableNativeToolCalls Whether the native tool calls setting is enabled + * @returns true if the model will use native tool calling, false otherwise + */ +export function isNativeToolCallingConfig(providerInfo: ApiProviderInfo, enableNativeToolCalls: boolean): boolean { + if (!enableNativeToolCalls) { + return false + } + if (!isNextGenModelProvider(providerInfo)) { + return false + } + const modelId = providerInfo.model.id.toLowerCase() + return isNextGenModelFamily(modelId) +} + function normalize(text: string): string { return text.trim().toLowerCase() }