MCPcopy
hub / github.com/codeaashu/claude-code / getCompactionReminderAttachment

Function getCompactionReminderAttachment

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

Source from the content-addressed store, hash-verified

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