MCPcopy
hub / github.com/CodebuffAI/codebuff / baseAgentUserInputPrompt

Function baseAgentUserInputPrompt

agents-graveyard/base/base-prompts.ts:210–315  ·  view source on GitHub ↗
(
  model: Model,
  mode: 'lite' | 'normal' | 'max' | 'experimental',
)

Source from the content-addressed store, hash-verified

208}
209
210export const baseAgentUserInputPrompt = (
211 model: Model,
212 mode: 'lite' | 'normal' | 'max' | 'experimental',
213) => {
214 const isFlash = model === models.openrouter_gemini2_5_flash
215 const isGeminiPro = model === models.openrouter_gemini2_5_pro_preview
216 const isGPT5 =
217 model === models.openrouter_gpt5 || model === models.openrouter_gpt5_chat
218 const isLite = mode === 'lite'
219 const isMax = mode === 'max'
220
221 return (
222 PLACEHOLDER.KNOWLEDGE_FILES_CONTENTS +
223 '\n\n<system_instructions>' +
224 buildArray(
225 `Proceed toward the user request and any subgoals. Please either 1. clarify the request or 2. complete the entire user request. ${isLite ? '' : 'If you made any changes to the codebase, you must spawn the reviewer agent to review your changes. '}${isGPT5 ? '' : 'Then, finally you must use the end_turn tool at the end of your response. '}If you have already completed the user request, write nothing at all and end your response.`,
226
227 `If there are multiple ways the user's request could be interpreted that would lead to very different outcomes (not just minor differences), ask at least one clarifying question that will help you understand what they are really asking for${isGPT5 ? '.' : ', and then use the end_turn tool.'}`,
228
229 'Use the spawn_agents tool (and not spawn_agent_inline!) to spawn agents to help you complete the user request. You can spawn as many agents as you want.',
230
231 `It is a good idea to spawn a file explorer agent first to explore the codebase from different perspectives. Use the researcher agent to help you get up-to-date information from docs and web results too. After that, for complex requests, you should spawn the thinker agent to do deep thinking on a problem, but do not spawn it at the same time as the file picker, only spawn it *after* you have the file picker results. ${isLite ? '' : 'Finally, you must spawn the reviewer agent to review your code changes.'}`,
232 isGPT5 &&
233 'Important: You must spawn a file-explorer agent first to explore the codebase from different perspectives for non-trivial requests. This is an inexpensive way to get a lot of context on the codebase.',
234 `Important: you *must* read as many files with the read_files tool as possible from the results of the file picker agents. Don't be afraid to read ${isLite ? '8' : '20'} files. The more files you read, the better context you have on the codebase and the better your response will be.`,
235
236 isMax &&
237 `IMPORTANT: You must spawn the decomposing-planner agent for all non-trivial coding tasks. It will help you come up with the best possible code changes. This is non-negotiable. The user needs you to spawn this agent to get the best possible code changes. Use your judgment to deviate from the plan whereever you see fit.`,
238
239 'If the users uses "@agent-id" or "@AgentName" in their message, you must spawn that agent. If you don\'t know what input parameters that agent expects, use the lookup_agent_info tool to get the agent metadata. Spawn all the agents that the user mentions.',
240
241 !isGPT5 &&
242 'Be extremely concise in your replies. Example: If asked what 2+2 equals, respond simply: "4". No need to even write a full sentence.',
243
244 'Important: When using write_file, do NOT rewrite the entire file. Only show the parts of the file that have changed and write "// ... existing code ..." comments (or "# ... existing code ..." or "/* ... existing code ... */", whichever is appropriate for the language) around the changed area.',
245
246 isGeminiPro &&
247 `Any tool calls will be run from the project root (${PLACEHOLDER.PROJECT_ROOT}) unless otherwise specified`,
248
249 'You must read additional files with the read_files tool whenever it could possibly improve your response.',
250
251 (isFlash || isGeminiPro) &&
252 'Before you use write_file or str_replace to edit an existing file, make sure to read it if you have not already!',
253
254 (isFlash || isGeminiPro) &&
255 '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).',
256
257 !isFlash &&
258 !isLite &&
259 'You must use the "add_subgoal" and "update_subgoal" tools to record your progress and any new information you learned as you go. If the change is very minimal, you may not need to use these tools.',
260
261 'Preserve as much of the existing code, its comments, and its behavior as possible. Make minimal edits to accomplish only the core of what is requested. Pay attention to any comments in the file you are editing and keep original user comments exactly as they were, line for line.',
262
263 'Never write out a tool_result yourself: e.g. {\n "type": "tool_result", "toolCallId": "...",\n // ...\n}. These are generated automatically by the system in response to the tool calls that you make.',
264
265 !isLite &&
266 'If you are trying to kill background processes, make sure to kill the entire process GROUP (or tree in Windows), and always prefer SIGTERM signals. If you restart the process, make sure to do so with process_type=BACKGROUND',
267

Callers 2

baseFunction · 0.90
thinkingBaseFunction · 0.90

Calls 3

buildArrayFunction · 0.90
getToolCallStringFunction · 0.90
closeXmlFunction · 0.90

Tested by

no test coverage detected