MCPcopy
hub / github.com/codeaashu/claude-code / getPlanModeInterviewInstructions

Function getPlanModeInterviewInstructions

src/utils/messages.ts:3323–3383  ·  view source on GitHub ↗

* Iterative interview-based plan mode workflow. * Instead of forcing Explore/Plan agents, this workflow has the model: * 1. Read files and ask questions iteratively * 2. Build up the spec/plan file incrementally as understanding grows * 3. Use AskUserQuestion throughout to clarify and gather inp

(attachment: {
  planFilePath?: string
  planExists?: boolean
})

Source from the content-addressed store, hash-verified

3321 * 3. Use AskUserQuestion throughout to clarify and gather input
3322 */
3323function getPlanModeInterviewInstructions(attachment: {
3324 planFilePath?: string
3325 planExists?: boolean
3326}): UserMessage[] {
3327 const planFileInfo = attachment.planExists
3328 ? `A plan file already exists at ${attachment.planFilePath}. You can read it and make incremental edits using the ${FileEditTool.name} tool.`
3329 : `No plan file exists yet. You should create your plan at ${attachment.planFilePath} using the ${FileWriteTool.name} tool.`
3330
3331 const content = `Plan mode is active. The user indicated that they do not want you to execute yet -- you MUST NOT make any edits (with the exception of the plan file mentioned below), run any non-readonly tools (including changing configs or making commits), or otherwise make any changes to the system. This supercedes any other instructions you have received.
3332
3333## Plan File Info:
3334${planFileInfo}
3335
3336## Iterative Planning Workflow
3337
3338You are pair-planning with the user. Explore the code to build context, ask the user questions when you hit decisions you can't make alone, and write your findings into the plan file as you go. The plan file (above) is the ONLY file you may edit — it starts as a rough skeleton and gradually becomes the final plan.
3339
3340### The Loop
3341
3342Repeat this cycle until the plan is complete:
3343
33441. **Explore** — Use ${getReadOnlyToolNames()} to read code. Look for existing functions, utilities, and patterns to reuse.${areExplorePlanAgentsEnabled() ? ` You can use the ${EXPLORE_AGENT.agentType} agent type to parallelize complex searches without filling your context, though for straightforward queries direct tools are simpler.` : ''}
33452. **Update the plan file** — After each discovery, immediately capture what you learned. Don't wait until the end.
33463. **Ask the user** — When you hit an ambiguity or decision you can't resolve from code alone, use ${ASK_USER_QUESTION_TOOL_NAME}. Then go back to step 1.
3347
3348### First Turn
3349
3350Start by quickly scanning a few key files to form an initial understanding of the task scope. Then write a skeleton plan (headers and rough notes) and ask the user your first round of questions. Don't explore exhaustively before engaging the user.
3351
3352### Asking Good Questions
3353
3354- Never ask what you could find out by reading the code
3355- Batch related questions together (use multi-question ${ASK_USER_QUESTION_TOOL_NAME} calls)
3356- Focus on things only the user can answer: requirements, preferences, tradeoffs, edge case priorities
3357- Scale depth to the task — a vague feature request needs many rounds; a focused bug fix may need one or none
3358
3359### Plan File Structure
3360Your plan file should be divided into clear sections using markdown headers, based on the request. Fill out these sections as you go.
3361- Begin with a **Context** section: explain why this change is being made — the problem or need it addresses, what prompted it, and the intended outcome
3362- Include only your recommended approach, not all alternatives
3363- Ensure that the plan file is concise enough to scan quickly, but detailed enough to execute effectively
3364- Include the paths of critical files to be modified
3365- Reference existing functions and utilities you found that should be reused, with their file paths
3366- Include a verification section describing how to test the changes end-to-end (run the code, use MCP tools, run tests)
3367
3368### When to Converge
3369
3370Your plan is ready when you've addressed all ambiguities and it covers: what to change, which files to modify, what existing code to reuse (with file paths), and how to verify the changes. Call ${ExitPlanModeV2Tool.name} when the plan is ready for approval.
3371
3372### Ending Your Turn
3373
3374Your turn should only end by either:
3375- Using ${ASK_USER_QUESTION_TOOL_NAME} to gather more information
3376- Calling ${ExitPlanModeV2Tool.name} when the plan is ready for approval
3377
3378**Important:** Use ${ExitPlanModeV2Tool.name} to request plan approval. Do NOT ask about plan approval via text or AskUserQuestion.`
3379
3380 return wrapMessagesInSystemReminder([

Callers 1

Calls 4

getReadOnlyToolNamesFunction · 0.85
createUserMessageFunction · 0.85

Tested by

no test coverage detected