Documentation
¶
Overview ¶
Package compact owns bounded structured handoffs, never canonical history. Adapted from Goose 14741e9a (Apache-2.0); see ../model/LICENSE.goose.
Index ¶
- Constants
- func Cap(contextLimit, outputLimit uint64) uint64
- func Output(contextLimit uint64) uint64
- func Pending(records []canonical.Record) []canonical.Record
- func Prepare(records []canonical.Record, contextLimit, outputLimit uint64, ...) (string, error)
- func Visible(records []canonical.Record) []canonical.Record
- type File
- type Selection
- type Summary
Constants ¶
const Request = "Please summarize the conversation history provided in the system prompt."
Variables ¶
This section is empty.
Functions ¶
func Cap ¶
Cap bounds the rendered handoff to half the actual summary output budget. Normal windows target 2% of context, between 4,000 and 12,000 tokens; smaller windows and model output limits can reduce that target.
func Output ¶
Output is the output limit a summary request asks for in a context window: twice the handoff's cap, since the JSON document is larger than the text rendered from it. Small windows reserve at most a quarter for output so the transcript has room. The model's own output limit also bounds it.
func Pending ¶
Pending includes empty messages because source token accounting reserves their role wrappers even though summary transcripts discard empty content.
Types ¶
type Selection ¶
type Selection struct {
Prefix []canonical.Record
Tail []canonical.Record
Boundary canonical.Record
}
Selection replaces Prefix through Boundary and leaves Tail in canonical history. Prefix retains the prior compaction record so Prepare can pin it.
func Select ¶
Select keeps recent complete turns within a soft budget of 20% of context, capped at 20,000 tokens. A long turn can split only between complete tool exchanges. The newest exchange stays whole even when it exceeds the budget. keepRecent=false selects all visible history; the caller preserves any unprocessed user input when using that fallback.
type Summary ¶
type Summary struct {
UserIntent []string `json:"user_intent"`
TechnicalConcepts []string `json:"technical_concepts"`
Files []File `json:"files"`
ErrorsAndFixes []string `json:"errors_and_fixes"`
ProblemSolving []string `json:"problem_solving"`
UserMessages []string `json:"user_messages"`
PendingTasks []string `json:"pending_tasks"`
CurrentWork *string `json:"current_work"`
NextStep *string `json:"next_step"`
}
func Parse ¶
Parse reads the handoff of a summary response and bounds its rendered text to limit tokens.