Compute ContextBudget on demand from typed sources

Remove cached context_budget field and measure_budget(). Budget
is computed on demand via budget() which calls
ContextState::budget(). Each bucket counted from its typed source.
Memory split from conversation by identifying memory tool calls.

Co-Authored-By: Proof of Concept <poc@bcachefs.org>
This commit is contained in:
Kent Overstreet 2026-04-02 03:07:45 -04:00
parent acdfbeeac3
commit eb4dae04cb
3 changed files with 72 additions and 34 deletions

View file

@ -964,7 +964,7 @@ async fn run(cli: cli::CliArgs) -> Result<()> {
completion_tokens: 0,
model: agent_guard.model().to_string(),
turn_tools: 0,
context_budget: agent_guard.context_budget.status_string(),
context_budget: agent_guard.budget().status_string(),
}));
}