Skip to content

Commit af5f350

Browse files
committed
Prompt codebuff to end earlier
1 parent 262d686 commit af5f350

File tree

2 files changed

+6
-18
lines changed

2 files changed

+6
-18
lines changed

backend/src/main-prompt.ts

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -149,21 +149,18 @@ export const mainPrompt = async (
149149
const geminiThinkingEnabled = costMode === 'max'
150150
const isLiteMode = costMode === 'lite'
151151
const isGeminiPro = model === models.gemini2_5_pro_preview
152-
const isGPT4_1 = model === models.gpt4_1
153152
const isFlash =
154153
model === 'gemini-2.5-flash-preview-04-17:thinking' ||
155154
(model as any) === 'gemini-2.5-flash-preview-04-17'
156155
const toolsInstructions = getFilteredToolsInstructions(costMode)
157156
const userInstructions = buildArray(
158157
isAskMode &&
159158
'You are a coding agent in "ASK" mode so the user can ask questions, which means you do not have access to tools that can modify files or run terminal commands. You should instead answer the user\'s questions and come up with brilliant plans which can later be implemented.',
160-
isLiteMode
161-
? 'Please proceed toward the user request and any subgoals. Please complete the entire user request. You must finally use the end_turn tool at the end of your response.'
162-
: 'Proceed toward the user request and any subgoals. Please complete the entire user request, then verify changes by running the type checker/linter (only if knowledge files specify a command to run with with the <run_terminal_command> tool). You must finally use the end_turn tool at the end of your response.',
159+
'Proceed toward the user request and any subgoals. Please either 1. clarify the request or 2. complete the entire user request. You must finally use the end_turn tool at the end of your response.',
163160

164161
'If the user asks a question, simply answer the question rather than making changes to the code.',
165162

166-
'If you have already completed the user request, write nothing at all and end your response. Err on the side of ending your reponse early, do not keep making further refinements to code you just wrote. Write it once and stop.',
163+
'If you have already completed the user request, write nothing at all and end your response. If you have already made 1 attempt at fixing an error, you should stop and end_turn to wait for user feedback. Err on the side of ending your response early!',
167164

168165
"If there are multiple ways the user's request could be interpreted that would lead to very different outcomes, ask at least one clarifying question that will help you understand what they are really asking for, and then use the end_turn tool. If the user specifies that you don't ask questions, make your best assumption and skip this step.",
169166

@@ -175,7 +172,7 @@ export const mainPrompt = async (
175172
? toolsInstructions
176173
: `Any tool calls will be run from the project root (${agentState.fileContext.currentWorkingDirectory}) unless otherwise specified`,
177174

178-
'You must read additional files with the read_files tool whenever it could possibly improve your response. Before you use write_file to edit an existing file, make sure to read it.',
175+
'You must read additional files with the read_files tool whenever it could possibly improve your response. Before you use write_file to edit an existing file, make sure to read it if you have not already!',
179176

180177
(isFlash || isGeminiPro) &&
181178
'Important: When mentioning a file path, for example for <write_file> or <read_files>, make sure to include all the directories in the path to the file from the project root. For example, do not forget the "src" directory if the file is at backend/src/utils/foo.ts! Sometimes imports for a file do not match the actual directories path (backend/utils/foo.ts for example).',
@@ -190,7 +187,7 @@ export const mainPrompt = async (
190187
!isLiteMode &&
191188
`To confirm complex changes to a web app, you should use the browser_logs tool to check for console logs or errors.`,
192189

193-
isFlash &&
190+
(isFlash || isGeminiPro) &&
194191
"Don't forget to close your your tags, e.g. <think_deeply> <thought> </thought> </think_deeply> or <write_file> <path> </path> <content> </content> </write_file>!",
195192

196193
(isFlash || isGeminiPro) &&
@@ -216,14 +213,6 @@ export const mainPrompt = async (
216213

217214
'Important: When editing an existing file with the write_file tool, do not rewrite the entire file, write just the parts of the file that have changed. Do not start writing the first line of the file. Instead, use comments surrounding your edits like "// ... existing code ..." (or "# ... existing code ..." or "/* ... existing code ... */" or "<!-- ... existing code ... -->", whichever is appropriate for the language) plus a few lines of context from the original file, to show just the sections that have changed.',
218215

219-
// Disable for now. You can use codebuff.json triggers to ensure this.
220-
// !isLiteMode &&
221-
// `Before finishing your response, you should check that you left the project in a good state using any tools you have available, make sure all relevant tests are passing and there are no type or lint errors (if applicable) or errors in the browser_logs tool (if applicable). You must do these checks every time you make a change to the project.`,
222-
!isLiteMode &&
223-
"If you are still working on the user's request, do not stop. If the user's request requires multiple steps, please complete ALL the steps before ending turn.",
224-
isGPT4_1 &&
225-
`**Do NOT end your response if you have not *completely* finished the user's entire request—continue until every part is 100% done, no early hand-off, no matter what.**`,
226-
227216
'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.'
228217
).join('\n\n')
229218

npm-app/src/cli-definitions.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,8 @@ export const cliOptions: CliParam[] = [
5656
},
5757
{
5858
flags: '--ask',
59-
description:
60-
'Start in ask mode (questions & planning only, no code changes)',
61-
menuDescription: 'Start in ask mode (questions & planning only)',
59+
description: "Start in ask mode (won't change code)",
60+
menuDescription: "Start in ask mode (won't change code)",
6261
hidden: false,
6362
},
6463
{

0 commit comments

Comments
 (0)