MCPcopy Create free account
hub / github.com/claude-code-best/claude-code / getCompactionReminderAttachment

Function getCompactionReminderAttachment

src/utils/attachments.ts:4013–4037  ·  view source on GitHub ↗
(
  messages: Message[],
  model: string,
)

Source from the content-addressed store, hash-verified

4011}
4012
4013export function getCompactionReminderAttachment(
4014 messages: Message[],
4015 model: string,
4016): Attachment[] {
4017 if (!getFeatureValue_CACHED_MAY_BE_STALE('tengu_marble_fox', false)) {
4018 return []
4019 }
4020
4021 if (!isAutoCompactEnabled()) {
4022 return []
4023 }
4024
4025 const contextWindow = getContextWindowForModel(model, getSdkBetas())
4026 if (contextWindow < 1_000_000) {
4027 return []
4028 }
4029
4030 const effectiveWindow = getEffectiveContextWindowSize(model)
4031 const usedTokens = tokenCountWithEstimation(messages)
4032 if (usedTokens < effectiveWindow * 0.25) {
4033 return []
4034 }
4035
4036 return [{ type: 'compaction_reminder' }]
4037}
4038
4039/**
4040 * Context-efficiency nudge. Injected after every N tokens of growth without

Callers 1

getAttachmentsFunction · 0.85

Calls 6

isAutoCompactEnabledFunction · 0.85
getContextWindowForModelFunction · 0.85
getSdkBetasFunction · 0.85
tokenCountWithEstimationFunction · 0.85

Tested by

no test coverage detected