Skip to content

Commit 1410658

Browse files
committed
feat: remove <thinking> tags from prompts for cleaner output and fewer tokens
- Remove <thinking></thinking> tags from tool-use-guidelines.ts - Remove <thinking></thinking> tags from objective.ts - Remove <thinking></thinking> tags from attempt-completion.ts - Update test expectations to match new prompt format - Keep the behavioral rule (confirm tool success) in plain language Fixes #8318
1 parent ab0644d commit 1410658

File tree

5 files changed

+8
-8
lines changed

5 files changed

+8
-8
lines changed

src/core/prompts/sections/__tests__/objective.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,13 @@ describe("getObjectiveSection", () => {
5353
}
5454
})
5555

56-
it("should include thinking tags guidance regardless of codebase_search availability", () => {
56+
it("should include analysis guidance regardless of codebase_search availability", () => {
5757
const objectiveEnabled = getObjectiveSection(mockCodeIndexManagerEnabled)
5858
const objectiveDisabled = getObjectiveSection(mockCodeIndexManagerDisabled)
5959

60-
// Check that thinking tags guidance is included in both cases
60+
// Check that analysis guidance is included in both cases
6161
for (const objective of [objectiveEnabled, objectiveDisabled]) {
62-
expect(objective).toContain("<thinking></thinking> tags")
62+
expect(objective).toContain("Before calling a tool, do some analysis")
6363
expect(objective).toContain("analyze the file structure provided in environment_details")
6464
expect(objective).toContain("think about which of the provided tools is the most relevant")
6565
}

src/core/prompts/sections/__tests__/tool-use-guidelines.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ describe("getToolUseGuidelinesSection", () => {
3434
const guidelines = getToolUseGuidelinesSection(mockCodeIndexManagerEnabled)
3535

3636
// Check that all numbered items are present
37-
expect(guidelines).toContain("1. In <thinking> tags")
37+
expect(guidelines).toContain("1. Assess what information")
3838
expect(guidelines).toContain("2. **CRITICAL:")
3939
expect(guidelines).toContain("3. Choose the most appropriate tool")
4040
expect(guidelines).toContain("4. If multiple actions are needed")
@@ -59,7 +59,7 @@ describe("getToolUseGuidelinesSection", () => {
5959
const guidelines = getToolUseGuidelinesSection(mockCodeIndexManagerDisabled)
6060

6161
// Check that all numbered items are present with correct numbering
62-
expect(guidelines).toContain("1. In <thinking> tags")
62+
expect(guidelines).toContain("1. Assess what information")
6363
expect(guidelines).toContain("2. Choose the most appropriate tool")
6464
expect(guidelines).toContain("3. If multiple actions are needed")
6565
expect(guidelines).toContain("4. Formulate your tool use")

src/core/prompts/sections/objective.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ You accomplish a given task iteratively, breaking it down into clear steps and w
2222
2323
1. Analyze the user's task and set clear, achievable goals to accomplish it. Prioritize these goals in a logical order.
2424
2. Work through these goals sequentially, utilizing available tools one at a time as necessary. Each goal should correspond to a distinct step in your problem-solving process. You will be informed on the work completed and what's remaining as you go.
25-
3. Remember, you have extensive capabilities with access to a wide range of tools that can be used in powerful and clever ways as necessary to accomplish each goal. Before calling a tool, do some analysis within <thinking></thinking> tags. ${codebaseSearchInstruction}analyze the file structure provided in environment_details to gain context and insights for proceeding effectively. Next, think about which of the provided tools is the most relevant tool to accomplish the user's task. Go through each of the required parameters of the relevant tool and determine if the user has directly provided or given enough information to infer a value. When deciding if the parameter can be inferred, carefully consider all the context to see if it supports a specific value. If all of the required parameters are present or can be reasonably inferred, close the thinking tag and proceed with the tool use. BUT, if one of the values for a required parameter is missing, DO NOT invoke the tool (not even with fillers for the missing params) and instead, ask the user to provide the missing parameters using the ask_followup_question tool. DO NOT ask for more information on optional parameters if it is not provided.
25+
3. Remember, you have extensive capabilities with access to a wide range of tools that can be used in powerful and clever ways as necessary to accomplish each goal. Before calling a tool, do some analysis. ${codebaseSearchInstruction}analyze the file structure provided in environment_details to gain context and insights for proceeding effectively. Next, think about which of the provided tools is the most relevant tool to accomplish the user's task. Go through each of the required parameters of the relevant tool and determine if the user has directly provided or given enough information to infer a value. When deciding if the parameter can be inferred, carefully consider all the context to see if it supports a specific value. If all of the required parameters are present or can be reasonably inferred, proceed with the tool use. BUT, if one of the values for a required parameter is missing, DO NOT invoke the tool (not even with fillers for the missing params) and instead, ask the user to provide the missing parameters using the ask_followup_question tool. DO NOT ask for more information on optional parameters if it is not provided.
2626
4. Once you've completed the user's task, you must use the attempt_completion tool to present the result of the task to the user.
2727
5. The user may provide feedback, which you can use to make improvements and try again. But DO NOT continue in pointless back and forth conversations, i.e. don't end your responses with questions or offers for further assistance.`
2828
}

src/core/prompts/sections/tool-use-guidelines.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export function getToolUseGuidelinesSection(codeIndexManager?: CodeIndexManager)
1313

1414
// First guideline is always the same
1515
guidelinesList.push(
16-
`${itemNumber++}. In <thinking> tags, assess what information you already have and what information you need to proceed with the task.`,
16+
`${itemNumber++}. Assess what information you already have and what information you need to proceed with the task.`,
1717
)
1818

1919
// Conditional codebase search guideline

src/core/prompts/tools/attempt-completion.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { ToolArgs } from "./types"
33
export function getAttemptCompletionDescription(args?: ToolArgs): string {
44
return `## attempt_completion
55
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.
6-
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.
6+
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 confirm that you've received successful results from the user for any previous tool uses. If not, then DO NOT use this tool.
77
Parameters:
88
- result: (required) The result of the task. Formulate this result in a way that is final and does not require further input from the user. Don't end your result with questions or offers for further assistance.
99
Usage:

0 commit comments

Comments
 (0)