MCPcopy
hub / github.com/claude-code-best/claude-code / getDateChangeAttachments

Function getDateChangeAttachments

src/utils/attachments.ts:1469–1498  ·  view source on GitHub ↗
(
  messages: Message[] | undefined,
)

Source from the content-addressed store, hash-verified

1467 * Exported for testing — regression guard for the cache-clear removal.
1468 */
1469export function getDateChangeAttachments(
1470 messages: Message[] | undefined,
1471): Attachment[] {
1472 const currentDate = getLocalISODate()
1473 const lastDate = getLastEmittedDate()
1474
1475 if (lastDate === null) {
1476 // First turn — just record, no attachment needed
1477 setLastEmittedDate(currentDate)
1478 return []
1479 }
1480
1481 if (currentDate === lastDate) {
1482 return []
1483 }
1484
1485 setLastEmittedDate(currentDate)
1486
1487 // Assistant mode: flush yesterday's transcript to the per-day file so
1488 // the /dream skill (1–5am local) finds it even if no compaction fires
1489 // today. Fire-and-forget; writeSessionTranscriptSegment buckets by
1490 // message timestamp so a multi-day gap flushes each day correctly.
1491 if (feature('KAIROS')) {
1492 if (getKairosActive() && messages !== undefined) {
1493 sessionTranscriptModule?.flushOnDateChange(messages, currentDate)
1494 }
1495 }
1496
1497 return [{ type: 'date_change', newDate: currentDate }]
1498}
1499
1500function getUltrathinkEffortAttachment(input: string | null): Attachment[] {
1501 if (!isUltrathinkEnabled() || !input || !hasUltrathinkKeyword(input)) {

Callers 1

getAttachmentsFunction · 0.85

Calls 4

getLocalISODateFunction · 0.85
getLastEmittedDateFunction · 0.85
setLastEmittedDateFunction · 0.85
getKairosActiveFunction · 0.85

Tested by

no test coverage detected