class

Smith::Context::Breakdown

Inherits Reference < Object

Where the context window actually goes. Built by the caller, which is the only thing that knows what went into the system prompt.

This is also how the agent computes the reserved overhead it hands back to compact: one class doing the arithmetic for both the breakdown the user reads and the decision compaction makes, so the two cannot disagree.

Constructors

new(budget : Budget)
Source

Instance methods

add(label : String, text : String) : Nil

Empty parts are kept: "Skills 0" answers "are skills eating my context?", a missing line leaves the question open.

Source
add(label : String, messages : Array(LLM::Message)) : Nil
Source
add_history(label : String, messages : Array(LLM::Message)) : Nil

The transcript, which is the one part compaction can shorten. Everything else is overhead it has to work around.

Source
budget
Source
charged(tokens : Int32) : Int32

A raw estimate as the provider will charge it. Identical to the input until the session has learned how far the byte heuristic is off.

Source
charged_total
Source
entries
Source
max_tokens
Source
overhead_tokens

Everything compaction cannot touch.

Source
percent(tokens : Int32) : Int32
Source
total
Source

Nested types