MCPcopy Create free account
hub / github.com/AnukarOP/claude-code-leaked / getTaskReminderAttachments

Function getTaskReminderAttachments

source code/utils/attachments.ts:3377–3434  ·  view source on GitHub ↗
(
  messages: Message[] | undefined,
  toolUseContext: ToolUseContext,
)

Source from the content-addressed store, hash-verified

3375}
3376
3377async function getTaskReminderAttachments(
3378 messages: Message[] | undefined,
3379 toolUseContext: ToolUseContext,
3380): Promise<Attachment[]> {
3381 if (!isTodoV2Enabled()) {
3382 return []
3383 }
3384
3385 // Skip for ant users
3386 if (process.env.USER_TYPE === 'ant') {
3387 return []
3388 }
3389
3390 // When SendUserMessage is in the toolkit, it's the primary communication
3391 // channel and the model is always told to use it (#20467). TaskUpdate
3392 // becomes a side channel — nudging the model about it conflicts with the
3393 // brief workflow. The tool itself stays available; this only gates the nag.
3394 if (
3395 BRIEF_TOOL_NAME &&
3396 toolUseContext.options.tools.some(t => toolMatchesName(t, BRIEF_TOOL_NAME))
3397 ) {
3398 return []
3399 }
3400
3401 // Skip if TaskUpdate tool is not available
3402 if (
3403 !toolUseContext.options.tools.some(t =>
3404 toolMatchesName(t, TASK_UPDATE_TOOL_NAME),
3405 )
3406 ) {
3407 return []
3408 }
3409
3410 // Skip if no messages provided
3411 if (!messages || messages.length === 0) {
3412 return []
3413 }
3414
3415 const { turnsSinceLastTaskManagement, turnsSinceLastReminder } =
3416 getTaskReminderTurnCounts(messages)
3417
3418 // Check if we should show a reminder
3419 if (
3420 turnsSinceLastTaskManagement >= TODO_REMINDER_CONFIG.TURNS_SINCE_WRITE &&
3421 turnsSinceLastReminder >= TODO_REMINDER_CONFIG.TURNS_BETWEEN_REMINDERS
3422 ) {
3423 const tasks = await listTasks(getTaskListId())
3424 return [
3425 {
3426 type: 'task_reminder',
3427 content: tasks,
3428 itemCount: tasks.length,
3429 },
3430 ]
3431 }
3432
3433 return []
3434}

Callers 1

getAttachmentsFunction · 0.85

Calls 5

isTodoV2EnabledFunction · 0.85
toolMatchesNameFunction · 0.85
listTasksFunction · 0.85
getTaskListIdFunction · 0.85

Tested by

no test coverage detected