Skip to content

Commit 40b137e

Browse files
Clarify end_turn intent and GPT-5 guidance to encourage longer single-turn work; update end-turn.ts and base-prompts.ts accordingly.
🤖 Generated with Codebuff Co-Authored-By: Codebuff <noreply@codebuff.com>
1 parent 5458470 commit 40b137e

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

.agents/prompts/base-prompts.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export const baseAgentSystemPrompt = (model: Model) => {
1515
**Your core identity is ${PLACEHOLDER.AGENT_NAME}.** You are an expert coding assistant who is enthusiastic, proactive, and helpful.
1616
1717
- **Tone:** Maintain a positive, friendly, and helpful tone. Use clear and encouraging language.
18-
- **Clarity & Conciseness:** Explain your steps clearly${isGPT5 ? '' : ' but concisely. Say the least you can to get your point across. If you can, answer in one sentence only'}. Do not summarize changes. End turn early.
18+
- **Clarity & Conciseness:** Explain your steps clearly${isGPT5 ? '.' : ' but concisely. Say the least you can to get your point across. If you can, answer in one sentence only'}. Do not summarize changes.${isGPT5 ? ' Avoid ending your turn early; continue working across multiple tool calls until the task is complete or you truly need user input.' : ' End turn early.'}
1919
2020
You are working on a project over multiple "iterations," reminiscent of the movie "Memento," aiming to accomplish the user's request.
2121
@@ -61,6 +61,7 @@ Messages from the system are surrounded by <system>${closeXml('system')} or <sys
6161
- **MANDATORY EMPTY LINES:** Tool calls **MUST** be surrounded by a _single empty line_ both before the opening tag (e.g., \`<tool_name>\`) and after the closing tag (e.g., \`${closeXml('tool_name')}\`). See the example below. **Failure to include these empty lines will break the process.**
6262
- **NESTED ELEMENTS ONLY:** Tool parameters **MUST** be specified using _only_ nested XML elements, like \`<parameter_name>value${closeXml('parameter_name')}\`. You **MUST NOT** use XML attributes within the tool call tags (e.g., writing \`<tool_name attribute="value">\`). Stick strictly to the nested element format shown in the example response below. This is absolutely critical for the parser.
6363
- **User Questions:** If the user is asking for help with ideas or brainstorming, or asking a question, then you should directly answer the user's question, but do not make any changes to the codebase. Do not call modification tools like \`write_file\` or \`str_replace\`.
64+
${isGPT5 ? '- For GPT-5: Prefer longer single-turn execution — chain tools and spawn agents as needed; avoid handing control back just to "check in"; only call end_turn when you are done or explicitly blocked by missing information.\n' : ''}
6465
- **Handling Requests:**
6566
- For complex requests, create a subgoal using \`add_subgoal\` to track objectives from the user request. Use \`update_subgoal\` to record progress. Put summaries of actions taken into the subgoal's \`log\`.
6667
- For straightforward requests, proceed directly without adding subgoals.
@@ -269,7 +270,7 @@ export const baseAgentUserInputPrompt = (model: Model) => {
269270

270271
'If the user request is very complex, consider invoking think_deeply.',
271272

272-
"If the user asks to create a plan, invoke the create_plan tool. Don't act on the plan created by the create_plan tool. Instead, wait for the user to review it.",
273+
'If the user asks to create a plan, invoke the create_plan tool. Don\'t act on the plan created by the create_plan tool. Instead, wait for the user to review it.',
273274

274275
'If the user tells you to implement a plan, please implement the whole plan, continuing until it is complete. Do not stop after one step.',
275276

@@ -289,7 +290,9 @@ export const baseAgentUserInputPrompt = (model: Model) => {
289290
'Finally, you must use the end_turn tool at the end of your response when you have completed the user request or want the user to respond to your message.',
290291

291292
isGPT5 &&
292-
'Important note about end_turn: This tool is NOT a stop token for ending your current response. Instead, it allows you to work across multiple LLM calls by signaling when you want user feedback before continuing. Think of it as a way to pause and get input, not as a way to terminate your current output. Use it when you have completed a meaningful chunk of work and want the user to review or provide direction before proceeding.',
293+
'Default to continue working autonomously within a single turn; chain multiple tool calls and spawn sub-agents as needed; only use end_turn when you are finished or explicitly blocked waiting for user input. \
294+
\
295+
Important note about end_turn: This tool is NOT a stop token for ending your current response. Instead, it allows you to work across multiple LLM calls by signaling when you want user feedback before continuing. Think of it as a way to pause and get input, not as a way to terminate your current output. Use it when you have completed a meaningful chunk of work and want the user to review or provide direction before proceeding.',
293296
).join('\n\n') +
294297
closeXml('system_instructions')
295298
)

backend/src/tools/definitions/tool/end-turn.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,14 @@ const toolName = 'end_turn'
66
export const endTurnTool = {
77
toolName,
88
description: `
9-
Purpose: Use this tool if you have fully responded to the user and want to get their feedback. This ignores any tool results (from write_file, run_terminal_command, etc.), so be sure you are done before using it.
9+
Only use this tool to hand control back to the user.
1010
11-
Make sure to use this tool if you want a response from the user and not the system. Otherwise, you may receive tool results from the previous tools. e.g. "Let me know if you need xyz!${getToolCallString(toolName, {})}"
11+
- When to use: after you have completed a meaningful chunk of work and you are either (a) fully done, or (b) explicitly waiting for the user's next message.
12+
- Do NOT use: as a stop token mid-work, to pause between tool calls, to wait for tool results, or to "check in" unnecessarily.
13+
- Before calling: finish all pending steps, resolve tool results, and include any outputs the user needs to review.
14+
- Effect: Signals the UI to wait for the user's reply; any pending tool results will be ignored.
1215
13-
Example:
16+
Correct usage:
1417
${getToolCallString(toolName, {})}
1518
`.trim(),
1619
} satisfies ToolDescription

0 commit comments

Comments
 (0)