Documentation
¶
Overview ¶
Package compact holds Summarizer, the agentcore.Compactor that replaces older history with a structured checkpoint summary.
cfg := agentcore.Config{
Model: model,
Compactor: compact.Summarizer{},
CompactAt: 100_000,
}
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Summarizer ¶
type Summarizer struct {
// Notes, if set, returns text appended to the summary of the messages it
// replaces, such as the files they worked on (tools.FileOps): what the
// summary must carry whatever the model wrote.
Notes func(replaced []agentcore.Message) string
}
Summarizer replaces the history with a checkpoint summary written by the conversation's own model, keeping as they are only the prompts at its end the model has yet to answer. Nothing else is replayed: a response kept past a rewrite of what came before it is one some providers reject, as Claude does reasoning bound to the history it was produced in, and the deferred tools the history loaded are found again when needed.
It first asks for the summary by extending the conversation's call for the history it replaces, so the provider serves that from the prompt cache; when the request no longer fits, or the model answers without the summary in <summary> tags, it asks again with a plain-text transcript. A previous summary is folded into the new one.