You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 865ce80
Browse filesBrowse the repository at this point in the historyBrowse files
Address review: validate strategy output inside the failure path, default once in maybeCompact, reuse moduleSourceRefSchema, resolve relative imports in rule 54, distinct compaction recall in the fixture, document event model id
Copy file name to clipboardExpand all lines: docs/concepts/compaction-strategies.md
+3-1Lines changed: 3 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -25,10 +25,12 @@ eve measures the next request, decides when compaction can run, and owns everyth
25
25
|`shouldCompact(facts)`| Whether the next request needs compacting, from the numbers eve measured. |
26
26
|`compact(history, ctx)`| The messages that replace `history`. |
27
27
28
-
`facts` holds `inputTokens`, `requestEnvelopeTokens`, `threshold`, `recentWindowSize` and `reason`. A user-requested compaction (`reason: "manual"`) runs whatever `shouldCompact` returns. `history` is the conversation without memory records; eve places recalled memory ahead of the result, so a strategy never sees or reorders it. A user message you return needs a `kind`; build one with `createCompactionUserMessage(content)` from `eve/compaction`, for example to mark a checkpoint.
28
+
`facts` holds `inputTokens`, `requestEnvelopeTokens`, `threshold`, `recentWindowSize` and `reason`. `shouldCompact` decides automatic compaction only: a user-requested compaction (`reason: "manual"`) runs `compact` without calling it. `history` is the conversation without memory records; eve places recalled memory ahead of the result, so a strategy never sees or reorders it. A user message you return needs a `kind`; build one with `createCompactionUserMessage(content)` from `eve/compaction`, for example to mark a checkpoint.
29
29
30
30
`ctx` adds `summarize({ messages, system })`, which runs the compaction model and bills the session, `estimateTokens(messages)`, and, when the turn can be cancelled, an `abortSignal`. A strategy that never summarizes makes no model call.
31
31
32
+
The `modelId` on `compaction.requested` and `compaction.completed` is the id of the configured compaction model (`compaction.model`, or the agent's model when none is set), whether or not the strategy summarizes. It is not the id `summarize` resolved.
33
+
32
34
## Failure
33
35
34
36
Throw `CompactionOverLimitError` (exported from `eve/compaction`) when no history the strategy could return fits. Any thrown error fails the compaction the way a failed summary does.
0 commit comments