# `Puck.Compaction.SlidingWindow`
[🔗](https://github.com/bradleygolden/puck/blob/v0.2.25/lib/puck/compaction/sliding_window.ex#L1)

Sliding window compaction strategy.

This strategy keeps the most recent N messages, discarding older ones.
Simple and predictable, but loses conversation history.

## Configuration

- `:window_size` - Number of messages to keep (default: 20)

## Example

    {:ok, compacted} = Puck.Compaction.compact(context, {Puck.Compaction.SlidingWindow, %{
      window_size: 30
    }})

---

*Consult [api-reference.md](api-reference.md) for complete listing*
