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

Function getTaskReminderAttachments

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

Source from the content-addressed store, hash-verified

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

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