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

Function getDateChangeAttachments

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

Source from the content-addressed store, hash-verified

1413 * Exported for testing — regression guard for the cache-clear removal.
1414 */
1415export function getDateChangeAttachments(
1416 messages: Message[] | undefined,
1417): Attachment[] {
1418 const currentDate = getLocalISODate()
1419 const lastDate = getLastEmittedDate()
1420
1421 if (lastDate === null) {
1422 // First turn — just record, no attachment needed
1423 setLastEmittedDate(currentDate)
1424 return []
1425 }
1426
1427 if (currentDate === lastDate) {
1428 return []
1429 }
1430
1431 setLastEmittedDate(currentDate)
1432
1433 // Assistant mode: flush yesterday's transcript to the per-day file so
1434 // the /dream skill (1–5am local) finds it even if no compaction fires
1435 // today. Fire-and-forget; writeSessionTranscriptSegment buckets by
1436 // message timestamp so a multi-day gap flushes each day correctly.
1437 if (feature('KAIROS')) {
1438 if (getKairosActive() && messages !== undefined) {
1439 sessionTranscriptModule?.flushOnDateChange(messages, currentDate)
1440 }
1441 }
1442
1443 return [{ type: 'date_change', newDate: currentDate }]
1444}
1445
1446function getUltrathinkEffortAttachment(input: string | null): Attachment[] {
1447 if (!isUltrathinkEnabled() || !input || !hasUltrathinkKeyword(input)) {

Callers 1

getAttachmentsFunction · 0.85

Calls 5

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

Tested by

no test coverage detected