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, the previous summary among them, 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. Before the summary it keeps the user's latest messages word for word, up to keptWordsTokens: what the user asked for is what a summary must not reword. After it come the prompts at the end the model has yet to answer. No response is replayed: Claude's reasoning holds only after the history it was produced in, unchanged, 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. A focus the user gave goes with either request.