Closed per-Skill prompt budget derived from canonical fragments.
A budget is part of the Skill Definition rather than a best-effort option at render time. Runtime Skills must cap every fragment, and the sum of those caps must fit inside the Skill ceiling. Compiled Skills may retain legacy uncapped fragments; their current content estimate is charged in full.
Summary
Functions
Returns the canonical SHA-256 budget digest.
Restores and validates a budget from canonical data.
Builds and validates a budget from canonical fragments.
Builds a prompt budget or raises with its stable validation reason.
Returns the current Skill prompt-budget schema version.
Returns the portable canonical representation.
Types
@type t() :: %Spectre.Skill.PromptBudget{ estimated_tokens: non_neg_integer(), fragment_count: non_neg_integer(), reserved_tokens: non_neg_integer(), schema_version: pos_integer(), token_cap: pos_integer() }
Functions
Returns the canonical SHA-256 budget digest.
Restores and validates a budget from canonical data.
@spec new( [Spectre.Prompt.Fragment.t() | map()], keyword() ) :: {:ok, t()} | {:error, term()}
Builds and validates a budget from canonical fragments.
@spec new!( [Spectre.Prompt.Fragment.t() | map()], keyword() ) :: t()
Builds a prompt budget or raises with its stable validation reason.
@spec schema_version() :: pos_integer()
Returns the current Skill prompt-budget schema version.
Returns the portable canonical representation.