A long session accumulates conversation until every turn pays for the whole history. Compaction summarizes the middle of it, keeping the earliest turns (which hold the task) and the most recent (which hold the state).

// config/clutch.php
'compaction' => [
    'enabled' => true,
    'trigger_at_fraction' => 0.7,  // of the token budget
    'keep_first' => 2,
    'keep_recent' => 8,
],

The summary comes from Laravel AI’s own SummarizeAgent, which is marked to use the cheapest model available, so compaction does not cost more than the context it saves. It is off by default: quietly rewriting an application’s conversation is not something to do without being asked.


Back to top

A community package, not affiliated with or endorsed by Laravel. Released under the MIT licence.

This site uses Just the Docs, a documentation theme for Jekyll.