Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/core/prompts/sections/__tests__/objective.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,13 @@ describe("getObjectiveSection", () => {
}
})

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

// Check that thinking tags guidance is included in both cases
// Check that analysis guidance is included in both cases
for (const objective of [objectiveEnabled, objectiveDisabled]) {
expect(objective).toContain("<thinking></thinking> tags")
expect(objective).toContain("Before calling a tool, do some analysis")
expect(objective).toContain("analyze the file structure provided in environment_details")
expect(objective).toContain("think about which of the provided tools is the most relevant")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ describe("getToolUseGuidelinesSection", () => {
const guidelines = getToolUseGuidelinesSection(mockCodeIndexManagerEnabled)

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

// Check that all numbered items are present with correct numbering
expect(guidelines).toContain("1. In <thinking> tags")
expect(guidelines).toContain("1. Assess what information")
expect(guidelines).toContain("2. Choose the most appropriate tool")
expect(guidelines).toContain("3. If multiple actions are needed")
expect(guidelines).toContain("4. Formulate your tool use")
Expand Down
2 changes: 1 addition & 1 deletion src/core/prompts/sections/objective.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ You accomplish a given task iteratively, breaking it down into clear steps and w

1. Analyze the user's task and set clear, achievable goals to accomplish it. Prioritize these goals in a logical order.
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.
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.
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.
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.
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.`
}
2 changes: 1 addition & 1 deletion src/core/prompts/sections/tool-use-guidelines.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export function getToolUseGuidelinesSection(codeIndexManager?: CodeIndexManager)

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

// Conditional codebase search guideline
Expand Down
2 changes: 1 addition & 1 deletion src/core/prompts/tools/attempt-completion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { ToolArgs } from "./types"
export function getAttemptCompletionDescription(args?: ToolArgs): string {
return `## 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.
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.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P3] Clarity tweak: explicitly require "explicit confirmation" and block usage if any tool result is missing/unclear. This mirrors current behavior but reduces ambiguity for some models.

Parameters:
- 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.
Usage:
Expand Down
Loading