MCPcopy Create free account
hub / github.com/betta-tech/byo-coding-agent / SlidingWindow

Struct SlidingWindow

internal/compact/slidingwindow.go:12–14  ·  view source on GitHub ↗

SlidingWindow keeps the last KeepLast messages and drops everything older. It snaps to a safe boundary so it never separates a tool_use from its tool_result.

Source from the content-addressed store, hash-verified

10// It snaps to a safe boundary so it never separates a tool_use from its
11// tool_result.
12type SlidingWindow struct {
13 KeepLast int
14}
15
16func (s *SlidingWindow) Compact(_ context.Context, messages []api.Message) ([]api.Message, error) {
17 if len(messages) <= s.KeepLast {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected