Add optional mode suggestions to follow-up questions (#5200)

This commit is contained in:
Matt Rubens 2025-06-27 16:26:17 -04:00 committed by GitHub
parent 3a8ba27615
commit 719d661478
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
17 changed files with 398 additions and 32 deletions

View file

@ -277,6 +277,8 @@ Parameters:
1. Be provided in its own <suggest> tag
2. Be specific, actionable, and directly related to the completed task
3. Be a complete answer to the question - the user should not need to provide additional information or fill in any missing details. DO NOT include placeholders with brackets or parentheses.
4. Optionally include a mode attribute to switch to a specific mode when the suggestion is selected: <suggest mode="mode-slug">suggestion text</suggest>
- When using the mode attribute, focus the suggestion text on the action to be taken rather than mentioning the mode switch, as the mode change is handled automatically and indicated by a visual badge
Usage:
<ask_followup_question>
<question>Your question here</question>
@ -284,6 +286,9 @@ Usage:
<suggest>
Your suggested answer here
</suggest>
<suggest mode="code">
Implement the solution
</suggest>
</follow_up>
</ask_followup_question>
@ -297,6 +302,16 @@ Example: Requesting to ask the user for the path to the frontend-config.json fil
</follow_up>
</ask_followup_question>
Example: Asking a question with mode switching options
<ask_followup_question>
<question>How would you like to proceed with this task?</question>
<follow_up>
<suggest mode="code">Start implementing the solution</suggest>
<suggest mode="architect">Plan the architecture first</suggest>
<suggest>Continue with more details</suggest>
</follow_up>
</ask_followup_question>
## attempt_completion
Description: After each tool use, the user will respond with the result of that tool use, i.e. if it succeeded or failed, along with any reasons for failure. Once you've received the results of tool uses and can confirm that the task is complete, use this tool to present the result of your work to the user. The user may respond with feedback if they are not satisfied with the result, which you can use to make improvements and try again.
IMPORTANT NOTE: This tool CANNOT be used until you've confirmed from the user that any previous tool uses were successful. Failure to do so will result in code corruption and system failure. Before using this tool, you must ask yourself in <thinking></thinking> tags if you've confirmed from the user that any previous tool uses were successful. If not, then DO NOT use this tool.

View file

@ -174,6 +174,8 @@ Parameters:
1. Be provided in its own <suggest> tag
2. Be specific, actionable, and directly related to the completed task
3. Be a complete answer to the question - the user should not need to provide additional information or fill in any missing details. DO NOT include placeholders with brackets or parentheses.
4. Optionally include a mode attribute to switch to a specific mode when the suggestion is selected: <suggest mode="mode-slug">suggestion text</suggest>
- When using the mode attribute, focus the suggestion text on the action to be taken rather than mentioning the mode switch, as the mode change is handled automatically and indicated by a visual badge
Usage:
<ask_followup_question>
<question>Your question here</question>
@ -181,6 +183,9 @@ Usage:
<suggest>
Your suggested answer here
</suggest>
<suggest mode="code">
Implement the solution
</suggest>
</follow_up>
</ask_followup_question>
@ -194,6 +199,16 @@ Example: Requesting to ask the user for the path to the frontend-config.json fil
</follow_up>
</ask_followup_question>
Example: Asking a question with mode switching options
<ask_followup_question>
<question>How would you like to proceed with this task?</question>
<follow_up>
<suggest mode="code">Start implementing the solution</suggest>
<suggest mode="architect">Plan the architecture first</suggest>
<suggest>Continue with more details</suggest>
</follow_up>
</ask_followup_question>
## attempt_completion
Description: After each tool use, the user will respond with the result of that tool use, i.e. if it succeeded or failed, along with any reasons for failure. Once you've received the results of tool uses and can confirm that the task is complete, use this tool to present the result of your work to the user. The user may respond with feedback if they are not satisfied with the result, which you can use to make improvements and try again.
IMPORTANT NOTE: This tool CANNOT be used until you've confirmed from the user that any previous tool uses were successful. Failure to do so will result in code corruption and system failure. Before using this tool, you must ask yourself in <thinking></thinking> tags if you've confirmed from the user that any previous tool uses were successful. If not, then DO NOT use this tool.

View file

@ -348,6 +348,8 @@ Parameters:
1. Be provided in its own <suggest> tag
2. Be specific, actionable, and directly related to the completed task
3. Be a complete answer to the question - the user should not need to provide additional information or fill in any missing details. DO NOT include placeholders with brackets or parentheses.
4. Optionally include a mode attribute to switch to a specific mode when the suggestion is selected: <suggest mode="mode-slug">suggestion text</suggest>
- When using the mode attribute, focus the suggestion text on the action to be taken rather than mentioning the mode switch, as the mode change is handled automatically and indicated by a visual badge
Usage:
<ask_followup_question>
<question>Your question here</question>
@ -355,6 +357,9 @@ Usage:
<suggest>
Your suggested answer here
</suggest>
<suggest mode="code">
Implement the solution
</suggest>
</follow_up>
</ask_followup_question>
@ -368,6 +373,16 @@ Example: Requesting to ask the user for the path to the frontend-config.json fil
</follow_up>
</ask_followup_question>
Example: Asking a question with mode switching options
<ask_followup_question>
<question>How would you like to proceed with this task?</question>
<follow_up>
<suggest mode="code">Start implementing the solution</suggest>
<suggest mode="architect">Plan the architecture first</suggest>
<suggest>Continue with more details</suggest>
</follow_up>
</ask_followup_question>
## attempt_completion
Description: After each tool use, the user will respond with the result of that tool use, i.e. if it succeeded or failed, along with any reasons for failure. Once you've received the results of tool uses and can confirm that the task is complete, use this tool to present the result of your work to the user. The user may respond with feedback if they are not satisfied with the result, which you can use to make improvements and try again.
IMPORTANT NOTE: This tool CANNOT be used until you've confirmed from the user that any previous tool uses were successful. Failure to do so will result in code corruption and system failure. Before using this tool, you must ask yourself in <thinking></thinking> tags if you've confirmed from the user that any previous tool uses were successful. If not, then DO NOT use this tool.

View file

@ -348,6 +348,8 @@ Parameters:
1. Be provided in its own <suggest> tag
2. Be specific, actionable, and directly related to the completed task
3. Be a complete answer to the question - the user should not need to provide additional information or fill in any missing details. DO NOT include placeholders with brackets or parentheses.
4. Optionally include a mode attribute to switch to a specific mode when the suggestion is selected: <suggest mode="mode-slug">suggestion text</suggest>
- When using the mode attribute, focus the suggestion text on the action to be taken rather than mentioning the mode switch, as the mode change is handled automatically and indicated by a visual badge
Usage:
<ask_followup_question>
<question>Your question here</question>
@ -355,6 +357,9 @@ Usage:
<suggest>
Your suggested answer here
</suggest>
<suggest mode="code">
Implement the solution
</suggest>
</follow_up>
</ask_followup_question>
@ -368,6 +373,16 @@ Example: Requesting to ask the user for the path to the frontend-config.json fil
</follow_up>
</ask_followup_question>
Example: Asking a question with mode switching options
<ask_followup_question>
<question>How would you like to proceed with this task?</question>
<follow_up>
<suggest mode="code">Start implementing the solution</suggest>
<suggest mode="architect">Plan the architecture first</suggest>
<suggest>Continue with more details</suggest>
</follow_up>
</ask_followup_question>
## attempt_completion
Description: After each tool use, the user will respond with the result of that tool use, i.e. if it succeeded or failed, along with any reasons for failure. Once you've received the results of tool uses and can confirm that the task is complete, use this tool to present the result of your work to the user. The user may respond with feedback if they are not satisfied with the result, which you can use to make improvements and try again.
IMPORTANT NOTE: This tool CANNOT be used until you've confirmed from the user that any previous tool uses were successful. Failure to do so will result in code corruption and system failure. Before using this tool, you must ask yourself in <thinking></thinking> tags if you've confirmed from the user that any previous tool uses were successful. If not, then DO NOT use this tool.

View file

@ -304,6 +304,8 @@ Parameters:
1. Be provided in its own <suggest> tag
2. Be specific, actionable, and directly related to the completed task
3. Be a complete answer to the question - the user should not need to provide additional information or fill in any missing details. DO NOT include placeholders with brackets or parentheses.
4. Optionally include a mode attribute to switch to a specific mode when the suggestion is selected: <suggest mode="mode-slug">suggestion text</suggest>
- When using the mode attribute, focus the suggestion text on the action to be taken rather than mentioning the mode switch, as the mode change is handled automatically and indicated by a visual badge
Usage:
<ask_followup_question>
<question>Your question here</question>
@ -311,6 +313,9 @@ Usage:
<suggest>
Your suggested answer here
</suggest>
<suggest mode="code">
Implement the solution
</suggest>
</follow_up>
</ask_followup_question>
@ -324,6 +329,16 @@ Example: Requesting to ask the user for the path to the frontend-config.json fil
</follow_up>
</ask_followup_question>
Example: Asking a question with mode switching options
<ask_followup_question>
<question>How would you like to proceed with this task?</question>
<follow_up>
<suggest mode="code">Start implementing the solution</suggest>
<suggest mode="architect">Plan the architecture first</suggest>
<suggest>Continue with more details</suggest>
</follow_up>
</ask_followup_question>
## attempt_completion
Description: After each tool use, the user will respond with the result of that tool use, i.e. if it succeeded or failed, along with any reasons for failure. Once you've received the results of tool uses and can confirm that the task is complete, use this tool to present the result of your work to the user. The user may respond with feedback if they are not satisfied with the result, which you can use to make improvements and try again.
IMPORTANT NOTE: This tool CANNOT be used until you've confirmed from the user that any previous tool uses were successful. Failure to do so will result in code corruption and system failure. Before using this tool, you must ask yourself in <thinking></thinking> tags if you've confirmed from the user that any previous tool uses were successful. If not, then DO NOT use this tool.

View file

@ -299,6 +299,8 @@ Parameters:
1. Be provided in its own <suggest> tag
2. Be specific, actionable, and directly related to the completed task
3. Be a complete answer to the question - the user should not need to provide additional information or fill in any missing details. DO NOT include placeholders with brackets or parentheses.
4. Optionally include a mode attribute to switch to a specific mode when the suggestion is selected: <suggest mode="mode-slug">suggestion text</suggest>
- When using the mode attribute, focus the suggestion text on the action to be taken rather than mentioning the mode switch, as the mode change is handled automatically and indicated by a visual badge
Usage:
<ask_followup_question>
<question>Your question here</question>
@ -306,6 +308,9 @@ Usage:
<suggest>
Your suggested answer here
</suggest>
<suggest mode="code">
Implement the solution
</suggest>
</follow_up>
</ask_followup_question>
@ -319,6 +324,16 @@ Example: Requesting to ask the user for the path to the frontend-config.json fil
</follow_up>
</ask_followup_question>
Example: Asking a question with mode switching options
<ask_followup_question>
<question>How would you like to proceed with this task?</question>
<follow_up>
<suggest mode="code">Start implementing the solution</suggest>
<suggest mode="architect">Plan the architecture first</suggest>
<suggest>Continue with more details</suggest>
</follow_up>
</ask_followup_question>
## attempt_completion
Description: After each tool use, the user will respond with the result of that tool use, i.e. if it succeeded or failed, along with any reasons for failure. Once you've received the results of tool uses and can confirm that the task is complete, use this tool to present the result of your work to the user. The user may respond with feedback if they are not satisfied with the result, which you can use to make improvements and try again.
IMPORTANT NOTE: This tool CANNOT be used until you've confirmed from the user that any previous tool uses were successful. Failure to do so will result in code corruption and system failure. Before using this tool, you must ask yourself in <thinking></thinking> tags if you've confirmed from the user that any previous tool uses were successful. If not, then DO NOT use this tool.

View file

@ -352,6 +352,8 @@ Parameters:
1. Be provided in its own <suggest> tag
2. Be specific, actionable, and directly related to the completed task
3. Be a complete answer to the question - the user should not need to provide additional information or fill in any missing details. DO NOT include placeholders with brackets or parentheses.
4. Optionally include a mode attribute to switch to a specific mode when the suggestion is selected: <suggest mode="mode-slug">suggestion text</suggest>
- When using the mode attribute, focus the suggestion text on the action to be taken rather than mentioning the mode switch, as the mode change is handled automatically and indicated by a visual badge
Usage:
<ask_followup_question>
<question>Your question here</question>
@ -359,6 +361,9 @@ Usage:
<suggest>
Your suggested answer here
</suggest>
<suggest mode="code">
Implement the solution
</suggest>
</follow_up>
</ask_followup_question>
@ -372,6 +377,16 @@ Example: Requesting to ask the user for the path to the frontend-config.json fil
</follow_up>
</ask_followup_question>
Example: Asking a question with mode switching options
<ask_followup_question>
<question>How would you like to proceed with this task?</question>
<follow_up>
<suggest mode="code">Start implementing the solution</suggest>
<suggest mode="architect">Plan the architecture first</suggest>
<suggest>Continue with more details</suggest>
</follow_up>
</ask_followup_question>
## attempt_completion
Description: After each tool use, the user will respond with the result of that tool use, i.e. if it succeeded or failed, along with any reasons for failure. Once you've received the results of tool uses and can confirm that the task is complete, use this tool to present the result of your work to the user. The user may respond with feedback if they are not satisfied with the result, which you can use to make improvements and try again.
IMPORTANT NOTE: This tool CANNOT be used until you've confirmed from the user that any previous tool uses were successful. Failure to do so will result in code corruption and system failure. Before using this tool, you must ask yourself in <thinking></thinking> tags if you've confirmed from the user that any previous tool uses were successful. If not, then DO NOT use this tool.

View file

@ -299,6 +299,8 @@ Parameters:
1. Be provided in its own <suggest> tag
2. Be specific, actionable, and directly related to the completed task
3. Be a complete answer to the question - the user should not need to provide additional information or fill in any missing details. DO NOT include placeholders with brackets or parentheses.
4. Optionally include a mode attribute to switch to a specific mode when the suggestion is selected: <suggest mode="mode-slug">suggestion text</suggest>
- When using the mode attribute, focus the suggestion text on the action to be taken rather than mentioning the mode switch, as the mode change is handled automatically and indicated by a visual badge
Usage:
<ask_followup_question>
<question>Your question here</question>
@ -306,6 +308,9 @@ Usage:
<suggest>
Your suggested answer here
</suggest>
<suggest mode="code">
Implement the solution
</suggest>
</follow_up>
</ask_followup_question>
@ -319,6 +324,16 @@ Example: Requesting to ask the user for the path to the frontend-config.json fil
</follow_up>
</ask_followup_question>
Example: Asking a question with mode switching options
<ask_followup_question>
<question>How would you like to proceed with this task?</question>
<follow_up>
<suggest mode="code">Start implementing the solution</suggest>
<suggest mode="architect">Plan the architecture first</suggest>
<suggest>Continue with more details</suggest>
</follow_up>
</ask_followup_question>
## attempt_completion
Description: After each tool use, the user will respond with the result of that tool use, i.e. if it succeeded or failed, along with any reasons for failure. Once you've received the results of tool uses and can confirm that the task is complete, use this tool to present the result of your work to the user. The user may respond with feedback if they are not satisfied with the result, which you can use to make improvements and try again.
IMPORTANT NOTE: This tool CANNOT be used until you've confirmed from the user that any previous tool uses were successful. Failure to do so will result in code corruption and system failure. Before using this tool, you must ask yourself in <thinking></thinking> tags if you've confirmed from the user that any previous tool uses were successful. If not, then DO NOT use this tool.

View file

@ -387,6 +387,8 @@ Parameters:
1. Be provided in its own <suggest> tag
2. Be specific, actionable, and directly related to the completed task
3. Be a complete answer to the question - the user should not need to provide additional information or fill in any missing details. DO NOT include placeholders with brackets or parentheses.
4. Optionally include a mode attribute to switch to a specific mode when the suggestion is selected: <suggest mode="mode-slug">suggestion text</suggest>
- When using the mode attribute, focus the suggestion text on the action to be taken rather than mentioning the mode switch, as the mode change is handled automatically and indicated by a visual badge
Usage:
<ask_followup_question>
<question>Your question here</question>
@ -394,6 +396,9 @@ Usage:
<suggest>
Your suggested answer here
</suggest>
<suggest mode="code">
Implement the solution
</suggest>
</follow_up>
</ask_followup_question>
@ -407,6 +412,16 @@ Example: Requesting to ask the user for the path to the frontend-config.json fil
</follow_up>
</ask_followup_question>
Example: Asking a question with mode switching options
<ask_followup_question>
<question>How would you like to proceed with this task?</question>
<follow_up>
<suggest mode="code">Start implementing the solution</suggest>
<suggest mode="architect">Plan the architecture first</suggest>
<suggest>Continue with more details</suggest>
</follow_up>
</ask_followup_question>
## attempt_completion
Description: After each tool use, the user will respond with the result of that tool use, i.e. if it succeeded or failed, along with any reasons for failure. Once you've received the results of tool uses and can confirm that the task is complete, use this tool to present the result of your work to the user. The user may respond with feedback if they are not satisfied with the result, which you can use to make improvements and try again.
IMPORTANT NOTE: This tool CANNOT be used until you've confirmed from the user that any previous tool uses were successful. Failure to do so will result in code corruption and system failure. Before using this tool, you must ask yourself in <thinking></thinking> tags if you've confirmed from the user that any previous tool uses were successful. If not, then DO NOT use this tool.

View file

@ -299,6 +299,8 @@ Parameters:
1. Be provided in its own <suggest> tag
2. Be specific, actionable, and directly related to the completed task
3. Be a complete answer to the question - the user should not need to provide additional information or fill in any missing details. DO NOT include placeholders with brackets or parentheses.
4. Optionally include a mode attribute to switch to a specific mode when the suggestion is selected: <suggest mode="mode-slug">suggestion text</suggest>
- When using the mode attribute, focus the suggestion text on the action to be taken rather than mentioning the mode switch, as the mode change is handled automatically and indicated by a visual badge
Usage:
<ask_followup_question>
<question>Your question here</question>
@ -306,6 +308,9 @@ Usage:
<suggest>
Your suggested answer here
</suggest>
<suggest mode="code">
Implement the solution
</suggest>
</follow_up>
</ask_followup_question>
@ -319,6 +324,16 @@ Example: Requesting to ask the user for the path to the frontend-config.json fil
</follow_up>
</ask_followup_question>
Example: Asking a question with mode switching options
<ask_followup_question>
<question>How would you like to proceed with this task?</question>
<follow_up>
<suggest mode="code">Start implementing the solution</suggest>
<suggest mode="architect">Plan the architecture first</suggest>
<suggest>Continue with more details</suggest>
</follow_up>
</ask_followup_question>
## attempt_completion
Description: After each tool use, the user will respond with the result of that tool use, i.e. if it succeeded or failed, along with any reasons for failure. Once you've received the results of tool uses and can confirm that the task is complete, use this tool to present the result of your work to the user. The user may respond with feedback if they are not satisfied with the result, which you can use to make improvements and try again.
IMPORTANT NOTE: This tool CANNOT be used until you've confirmed from the user that any previous tool uses were successful. Failure to do so will result in code corruption and system failure. Before using this tool, you must ask yourself in <thinking></thinking> tags if you've confirmed from the user that any previous tool uses were successful. If not, then DO NOT use this tool.

View file

@ -352,6 +352,8 @@ Parameters:
1. Be provided in its own <suggest> tag
2. Be specific, actionable, and directly related to the completed task
3. Be a complete answer to the question - the user should not need to provide additional information or fill in any missing details. DO NOT include placeholders with brackets or parentheses.
4. Optionally include a mode attribute to switch to a specific mode when the suggestion is selected: <suggest mode="mode-slug">suggestion text</suggest>
- When using the mode attribute, focus the suggestion text on the action to be taken rather than mentioning the mode switch, as the mode change is handled automatically and indicated by a visual badge
Usage:
<ask_followup_question>
<question>Your question here</question>
@ -359,6 +361,9 @@ Usage:
<suggest>
Your suggested answer here
</suggest>
<suggest mode="code">
Implement the solution
</suggest>
</follow_up>
</ask_followup_question>
@ -372,6 +377,16 @@ Example: Requesting to ask the user for the path to the frontend-config.json fil
</follow_up>
</ask_followup_question>
Example: Asking a question with mode switching options
<ask_followup_question>
<question>How would you like to proceed with this task?</question>
<follow_up>
<suggest mode="code">Start implementing the solution</suggest>
<suggest mode="architect">Plan the architecture first</suggest>
<suggest>Continue with more details</suggest>
</follow_up>
</ask_followup_question>
## attempt_completion
Description: After each tool use, the user will respond with the result of that tool use, i.e. if it succeeded or failed, along with any reasons for failure. Once you've received the results of tool uses and can confirm that the task is complete, use this tool to present the result of your work to the user. The user may respond with feedback if they are not satisfied with the result, which you can use to make improvements and try again.
IMPORTANT NOTE: This tool CANNOT be used until you've confirmed from the user that any previous tool uses were successful. Failure to do so will result in code corruption and system failure. Before using this tool, you must ask yourself in <thinking></thinking> tags if you've confirmed from the user that any previous tool uses were successful. If not, then DO NOT use this tool.

View file

@ -348,6 +348,8 @@ Parameters:
1. Be provided in its own <suggest> tag
2. Be specific, actionable, and directly related to the completed task
3. Be a complete answer to the question - the user should not need to provide additional information or fill in any missing details. DO NOT include placeholders with brackets or parentheses.
4. Optionally include a mode attribute to switch to a specific mode when the suggestion is selected: <suggest mode="mode-slug">suggestion text</suggest>
- When using the mode attribute, focus the suggestion text on the action to be taken rather than mentioning the mode switch, as the mode change is handled automatically and indicated by a visual badge
Usage:
<ask_followup_question>
<question>Your question here</question>
@ -355,6 +357,9 @@ Usage:
<suggest>
Your suggested answer here
</suggest>
<suggest mode="code">
Implement the solution
</suggest>
</follow_up>
</ask_followup_question>
@ -368,6 +373,16 @@ Example: Requesting to ask the user for the path to the frontend-config.json fil
</follow_up>
</ask_followup_question>
Example: Asking a question with mode switching options
<ask_followup_question>
<question>How would you like to proceed with this task?</question>
<follow_up>
<suggest mode="code">Start implementing the solution</suggest>
<suggest mode="architect">Plan the architecture first</suggest>
<suggest>Continue with more details</suggest>
</follow_up>
</ask_followup_question>
## attempt_completion
Description: After each tool use, the user will respond with the result of that tool use, i.e. if it succeeded or failed, along with any reasons for failure. Once you've received the results of tool uses and can confirm that the task is complete, use this tool to present the result of your work to the user. The user may respond with feedback if they are not satisfied with the result, which you can use to make improvements and try again.
IMPORTANT NOTE: This tool CANNOT be used until you've confirmed from the user that any previous tool uses were successful. Failure to do so will result in code corruption and system failure. Before using this tool, you must ask yourself in <thinking></thinking> tags if you've confirmed from the user that any previous tool uses were successful. If not, then DO NOT use this tool.

View file

@ -299,6 +299,8 @@ Parameters:
1. Be provided in its own <suggest> tag
2. Be specific, actionable, and directly related to the completed task
3. Be a complete answer to the question - the user should not need to provide additional information or fill in any missing details. DO NOT include placeholders with brackets or parentheses.
4. Optionally include a mode attribute to switch to a specific mode when the suggestion is selected: <suggest mode="mode-slug">suggestion text</suggest>
- When using the mode attribute, focus the suggestion text on the action to be taken rather than mentioning the mode switch, as the mode change is handled automatically and indicated by a visual badge
Usage:
<ask_followup_question>
<question>Your question here</question>
@ -306,6 +308,9 @@ Usage:
<suggest>
Your suggested answer here
</suggest>
<suggest mode="code">
Implement the solution
</suggest>
</follow_up>
</ask_followup_question>
@ -319,6 +324,16 @@ Example: Requesting to ask the user for the path to the frontend-config.json fil
</follow_up>
</ask_followup_question>
Example: Asking a question with mode switching options
<ask_followup_question>
<question>How would you like to proceed with this task?</question>
<follow_up>
<suggest mode="code">Start implementing the solution</suggest>
<suggest mode="architect">Plan the architecture first</suggest>
<suggest>Continue with more details</suggest>
</follow_up>
</ask_followup_question>
## attempt_completion
Description: After each tool use, the user will respond with the result of that tool use, i.e. if it succeeded or failed, along with any reasons for failure. Once you've received the results of tool uses and can confirm that the task is complete, use this tool to present the result of your work to the user. The user may respond with feedback if they are not satisfied with the result, which you can use to make improvements and try again.
IMPORTANT NOTE: This tool CANNOT be used until you've confirmed from the user that any previous tool uses were successful. Failure to do so will result in code corruption and system failure. Before using this tool, you must ask yourself in <thinking></thinking> tags if you've confirmed from the user that any previous tool uses were successful. If not, then DO NOT use this tool.

View file

@ -7,6 +7,8 @@ Parameters:
1. Be provided in its own <suggest> tag
2. Be specific, actionable, and directly related to the completed task
3. Be a complete answer to the question - the user should not need to provide additional information or fill in any missing details. DO NOT include placeholders with brackets or parentheses.
4. Optionally include a mode attribute to switch to a specific mode when the suggestion is selected: <suggest mode="mode-slug">suggestion text</suggest>
- When using the mode attribute, focus the suggestion text on the action to be taken rather than mentioning the mode switch, as the mode change is handled automatically and indicated by a visual badge
Usage:
<ask_followup_question>
<question>Your question here</question>
@ -14,6 +16,9 @@ Usage:
<suggest>
Your suggested answer here
</suggest>
<suggest mode="code">
Implement the solution
</suggest>
</follow_up>
</ask_followup_question>
@ -25,5 +30,15 @@ Example: Requesting to ask the user for the path to the frontend-config.json fil
<suggest>./config/frontend-config.json</suggest>
<suggest>./frontend-config.json</suggest>
</follow_up>
</ask_followup_question>
Example: Asking a question with mode switching options
<ask_followup_question>
<question>How would you like to proceed with this task?</question>
<follow_up>
<suggest mode="code">Start implementing the solution</suggest>
<suggest mode="architect">Plan the architecture first</suggest>
<suggest>Continue with more details</suggest>
</follow_up>
</ask_followup_question>`
}

View file

@ -0,0 +1,108 @@
import { describe, it, expect, vi } from "vitest"
import { askFollowupQuestionTool } from "../askFollowupQuestionTool"
import { ToolUse } from "../../../shared/tools"
describe("askFollowupQuestionTool", () => {
let mockCline: any
let mockPushToolResult: any
let toolResult: any
beforeEach(() => {
vi.clearAllMocks()
mockCline = {
ask: vi.fn().mockResolvedValue({ text: "Test response" }),
say: vi.fn().mockResolvedValue(undefined),
consecutiveMistakeCount: 0,
}
mockPushToolResult = vi.fn((result) => {
toolResult = result
})
})
it("should parse suggestions without mode attributes", async () => {
const block: ToolUse = {
type: "tool_use",
name: "ask_followup_question",
params: {
question: "What would you like to do?",
follow_up: "<suggest>Option 1</suggest><suggest>Option 2</suggest>",
},
partial: false,
}
await askFollowupQuestionTool(
mockCline,
block,
vi.fn(),
vi.fn(),
mockPushToolResult,
vi.fn((tag, content) => content),
)
expect(mockCline.ask).toHaveBeenCalledWith(
"followup",
expect.stringContaining('"suggest":[{"answer":"Option 1"},{"answer":"Option 2"}]'),
false,
)
})
it("should parse suggestions with mode attributes", async () => {
const block: ToolUse = {
type: "tool_use",
name: "ask_followup_question",
params: {
question: "What would you like to do?",
follow_up: '<suggest mode="code">Write code</suggest><suggest mode="debug">Debug issue</suggest>',
},
partial: false,
}
await askFollowupQuestionTool(
mockCline,
block,
vi.fn(),
vi.fn(),
mockPushToolResult,
vi.fn((tag, content) => content),
)
expect(mockCline.ask).toHaveBeenCalledWith(
"followup",
expect.stringContaining(
'"suggest":[{"answer":"Write code","mode":"code"},{"answer":"Debug issue","mode":"debug"}]',
),
false,
)
})
it("should handle mixed suggestions with and without mode attributes", async () => {
const block: ToolUse = {
type: "tool_use",
name: "ask_followup_question",
params: {
question: "What would you like to do?",
follow_up: '<suggest>Regular option</suggest><suggest mode="architect">Plan architecture</suggest>',
},
partial: false,
}
await askFollowupQuestionTool(
mockCline,
block,
vi.fn(),
vi.fn(),
mockPushToolResult,
vi.fn((tag, content) => content),
)
expect(mockCline.ask).toHaveBeenCalledWith(
"followup",
expect.stringContaining(
'"suggest":[{"answer":"Regular option"},{"answer":"Plan architecture","mode":"architect"}]',
),
false,
)
})
})

View file

@ -26,7 +26,7 @@ export async function askFollowupQuestionTool(
return
}
type Suggest = { answer: string }
type Suggest = { answer: string; mode?: string }
let follow_up_json = {
question,
@ -34,12 +34,17 @@ export async function askFollowupQuestionTool(
}
if (follow_up) {
// Define the actual structure returned by the XML parser
type ParsedSuggestion = string | { "#text": string; "@_mode"?: string }
let parsedSuggest: {
suggest: Suggest[] | Suggest
suggest: ParsedSuggestion[] | ParsedSuggestion
}
try {
parsedSuggest = parseXml(follow_up, ["suggest"]) as { suggest: Suggest[] | Suggest }
parsedSuggest = parseXml(follow_up, ["suggest"]) as {
suggest: ParsedSuggestion[] | ParsedSuggestion
}
} catch (error) {
cline.consecutiveMistakeCount++
cline.recordToolError("ask_followup_question")
@ -48,9 +53,24 @@ export async function askFollowupQuestionTool(
return
}
const normalizedSuggest = Array.isArray(parsedSuggest?.suggest)
const rawSuggestions = Array.isArray(parsedSuggest?.suggest)
? parsedSuggest.suggest
: [parsedSuggest?.suggest].filter((sug): sug is Suggest => sug !== undefined)
: [parsedSuggest?.suggest].filter((sug): sug is ParsedSuggestion => sug !== undefined)
// Transform parsed XML to our Suggest format
const normalizedSuggest: Suggest[] = rawSuggestions.map((sug) => {
if (typeof sug === "string") {
// Simple string suggestion (no mode attribute)
return { answer: sug }
} else {
// XML object with text content and optional mode attribute
const result: Suggest = { answer: sug["#text"] }
if (sug["@_mode"]) {
result.mode = sug["@_mode"]
}
return result
}
})
follow_up_json.suggest = normalizedSuggest
}

View file

@ -2,11 +2,17 @@ import { useCallback } from "react"
import { Edit } from "lucide-react"
import { Button, StandardTooltip } from "@/components/ui"
import { vscode } from "@/utils/vscode"
import { useAppTranslation } from "@src/i18n/TranslationContext"
interface SuggestionItem {
answer: string
mode?: string
}
interface FollowUpSuggestProps {
suggestions?: string[]
suggestions?: (string | SuggestionItem)[]
onSuggestionClick?: (answer: string, event?: React.MouseEvent) => void
ts: number
}
@ -14,8 +20,19 @@ interface FollowUpSuggestProps {
export const FollowUpSuggest = ({ suggestions = [], onSuggestionClick, ts = 1 }: FollowUpSuggestProps) => {
const { t } = useAppTranslation()
const handleSuggestionClick = useCallback(
(suggestion: string, event: React.MouseEvent) => {
onSuggestionClick?.(suggestion, event)
(suggestion: string | SuggestionItem, event: React.MouseEvent) => {
const suggestionText = typeof suggestion === "string" ? suggestion : suggestion.answer
const mode = typeof suggestion === "object" ? suggestion.mode : undefined
// If there's a mode switch and it's not a shift-click (which just copies to input), switch modes first
if (mode && !event.shiftKey) {
vscode.postMessage({
type: "mode",
text: mode,
})
}
onSuggestionClick?.(suggestionText, event)
},
[onSuggestionClick],
)
@ -27,30 +44,41 @@ export const FollowUpSuggest = ({ suggestions = [], onSuggestionClick, ts = 1 }:
return (
<div className="flex mb-2 flex-col h-full gap-2">
{suggestions.map((suggestion) => (
<div key={`${suggestion}-${ts}`} className="w-full relative group">
<Button
variant="outline"
className="text-left whitespace-normal break-words w-full h-auto py-3 justify-start pr-8"
onClick={(event) => handleSuggestionClick(suggestion, event)}
aria-label={suggestion}>
<div>{suggestion}</div>
</Button>
<StandardTooltip content={t("chat:followUpSuggest.copyToInput")}>
<div
className="absolute top-1 right-1 opacity-0 group-hover:opacity-100 transition-opacity"
onClick={(e) => {
e.stopPropagation()
// Simulate shift-click by directly calling the handler with shiftKey=true.
onSuggestionClick?.(suggestion, { ...e, shiftKey: true })
}}>
<Button variant="ghost" size="icon">
<Edit />
</Button>
</div>
</StandardTooltip>
</div>
))}
{suggestions.map((suggestion) => {
const suggestionText = typeof suggestion === "string" ? suggestion : suggestion.answer
const mode = typeof suggestion === "object" ? suggestion.mode : undefined
return (
<div key={`${suggestionText}-${ts}`} className="w-full relative group">
<Button
variant="outline"
className="text-left whitespace-normal break-words w-full h-auto py-3 justify-start pr-8"
onClick={(event) => handleSuggestionClick(suggestion, event)}
aria-label={suggestionText}>
{suggestionText}
</Button>
{mode && (
<div className="absolute bottom-0 right-0 text-[10px] bg-vscode-badge-background text-vscode-badge-foreground px-1 py-0.5 border border-vscode-badge-background flex items-center gap-0.5">
<span className="codicon codicon-arrow-right" style={{ fontSize: "8px" }} />
{mode}
</div>
)}
<StandardTooltip content={t("chat:followUpSuggest.copyToInput")}>
<div
className="absolute top-0 right-0 opacity-0 group-hover:opacity-100 transition-opacity"
onClick={(e) => {
e.stopPropagation()
// Simulate shift-click by directly calling the handler with shiftKey=true.
onSuggestionClick?.(suggestionText, { ...e, shiftKey: true })
}}>
<Button variant="ghost" size="icon">
<Edit />
</Button>
</div>
</StandardTooltip>
</div>
)
})}
</div>
)
}