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

Function getDateChangeAttachments

source code/utils/attachments.ts:1417–1446  ·  view source on GitHub ↗
(
  messages: Message[] | undefined,
)

Source from the content-addressed store, hash-verified

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