Skip to main content

context_usage

Function context_usage 

Source
pub fn context_usage(talk: &Talk, cfg: Option<&Config>) -> ContextUsage
Expand description

Context usage of talk, measured against its current model.

Only the latest agent reply counts (magi’s own notes are skipped) and a reply without usage makes the answer unknown - older replies are never consulted, since a stale count passed off as current is worse than “unknown”. The window comes from the current agent’s model, so switching model moves the denominator at once.

Switching agent (or model, which is an agent change) mints a fresh CLI session, so the next turn re-sends the whole transcript and the count resets or jumps. Until that turn lands, the old figure is reported with since_switch set. Deterministic: same talk and config, same answer.