MCPcopy Index your code
hub / github.com/codeaashu/claude-code / getPlanModeExitAttachment

Function getPlanModeExitAttachment

src/utils/attachments.ts:1248–1273  ·  view source on GitHub ↗

* Returns a plan_mode_exit attachment if we just exited plan mode. * This is a one-time notification to tell the model it's no longer in plan mode.

(
  toolUseContext: ToolUseContext,
)

Source from the content-addressed store, hash-verified

1246 * This is a one-time notification to tell the model it's no longer in plan mode.
1247 */
1248async function getPlanModeExitAttachment(
1249 toolUseContext: ToolUseContext,
1250): Promise<Attachment[]> {
1251 // Only trigger if the flag is set (we just exited plan mode)
1252 if (!needsPlanModeExitAttachment()) {
1253 return []
1254 }
1255
1256 const appState = toolUseContext.getAppState()
1257 if (appState.toolPermissionContext.mode === 'plan') {
1258 setNeedsPlanModeExitAttachment(false)
1259 return []
1260 }
1261
1262 // Clear the flag - this is a one-time notification
1263 setNeedsPlanModeExitAttachment(false)
1264
1265 const planFilePath = getPlanFilePath(toolUseContext.agentId)
1266 const planExists = getPlan(toolUseContext.agentId) !== null
1267
1268 // Note: skill discovery does NOT fire on plan exit. By the time the plan is
1269 // written, it's too late — the model should have had relevant skills WHILE
1270 // planning. The user_message signal already fires on the request that
1271 // triggers planning ("plan how to deploy this"), which is the right moment.
1272 return [{ type: 'plan_mode_exit', planFilePath, planExists }]
1273}
1274
1275function getAutoModeAttachmentTurnCount(messages: Message[]): {
1276 turnCount: number

Callers 1

getAttachmentsFunction · 0.85

Calls 4

getPlanFilePathFunction · 0.85
getPlanFunction · 0.85

Tested by

no test coverage detected