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

Function getTaskReminderAttachments

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

Source from the content-addressed store, hash-verified

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

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