MCPcopy Create free account
hub / github.com/QodeXcli/QodeX / shouldCompact

Function shouldCompact

src/utils/compaction.ts:198–201  ·  view source on GitHub ↗
(messages: Message[], ctxWindow: number, threshold = 0.70)

Source from the content-addressed store, hash-verified

196 //
197 // Skipping one compaction is cheap: the caller keeps its messages and tries again next
198 // turn. Losing the conversation is not.
199 const summaryBody = summaryText.replace(SUMMARY_PREFIX, '').trim();
200 if (summaryBody.length < MIN_SUMMARY_CHARS) {
201 logger.warn('Compaction produced an unusably short summary; keeping original messages', {
202 summaryChars: summaryBody.length,
203 minRequired: MIN_SUMMARY_CHARS,
204 turnsNotCompacted: turnsCompacted,

Callers 1

runMethod · 0.85

Calls 1

estimateTokensFunction · 0.70

Tested by

no test coverage detected