pub struct ContextBreakdown {
pub system_prompt_tokens: u32,
pub system_tools_tokens: u32,
pub mcp_tools_tokens: u32,
pub memory_tokens: u32,
pub skills_tokens: u32,
pub messages_tokens: u32,
pub used_tokens: u32,
pub limit_tokens: Option<u32>,
pub compact_buffer_tokens: u32,
}Expand description
Per-category breakdown of context-window occupancy.
used_tokens is anchored on the provider-reported occupancy once the
session has seen a model response; before that it is estimated. The
per-category fields are estimates that normally sum to used_tokens, but
estimation error can make them disagree slightly — clients should clamp
rather than assume an exact identity.
Fields§
§system_prompt_tokens: u32System prompt, excluding the skills and memory sections counted below.
system_tools_tokens: u32Built-in tool schemas.
mcp_tools_tokens: u32MCP tool schemas.
memory_tokens: u32Memory content: project/user instruction files and the auto-memory prompt.
skills_tokens: u32The available-skills listing.
messages_tokens: u32Conversation messages: everything not attributed to a category above.
used_tokens: u32Total context-window occupancy.
limit_tokens: Option<u32>Model context limit. None when unverified, so clients never render a
confidently-wrong percentage.
compact_buffer_tokens: u32Tokens reserved at the top of the window; auto-compaction triggers once occupancy grows into this reserve.