MCPcopy Create free account
hub / github.com/codehamr/codehamr / Pack

Function Pack

internal/ctx/ctx.go:140–188  ·  view source on GitHub ↗

Pack keeps whole messages newest-first until the budget is full, then returns them chronologically. The newest message is always kept, even if it alone exceeds the budget. Two clean-up passes then keep the wire well-formed: dropDanglingToolCalls drops an assistant whose tool_calls weren't all answer

(history []Message, budget int)

Source from the content-addressed store, hash-verified

source not stored for this graph (policy: none)

Calls 8

dropDanglingToolCallsFunction · 0.85
dropOrphanToolsFunction · 0.85
newestToolIndexFunction · 0.85
onlyNonSubstantiveFunction · 0.85
newestToolGroupFunction · 0.85
anchorUserMessageFunction · 0.85
demoteSystemMessagesFunction · 0.85
TokensMethod · 0.80