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

Function getCompactionReminderAttachment

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

Source from the content-addressed store, hash-verified

3930}
3931
3932export function getCompactionReminderAttachment(
3933 messages: Message[],
3934 model: string,
3935): Attachment[] {
3936 if (!getFeatureValue_CACHED_MAY_BE_STALE('tengu_marble_fox', false)) {
3937 return []
3938 }
3939
3940 if (!isAutoCompactEnabled()) {
3941 return []
3942 }
3943
3944 const contextWindow = getContextWindowForModel(model, getSdkBetas())
3945 if (contextWindow < 1_000_000) {
3946 return []
3947 }
3948
3949 const effectiveWindow = getEffectiveContextWindowSize(model)
3950 const usedTokens = tokenCountWithEstimation(messages)
3951 if (usedTokens < effectiveWindow * 0.25) {
3952 return []
3953 }
3954
3955 return [{ type: 'compaction_reminder' }]
3956}
3957
3958/**
3959 * 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