Watch
1
0
Fork
You've already forked souveraine
0

pressure: calculate_pressure counts every block kind

Was Text-only, blind to tool_use/tool_result/reasoning — ~74% of a real
thread. This is the number behind the 80/90/95 tier warnings and the
archivist's emergency trigger, so both fired late or not at all.

countable_text() (7530d6d) is exhaustive. turn.rs::bifrost_pressure is
still a second counter and still blind to tool_calls by shape; collapsing
the two is not done.
This commit is contained in:
Fimeg 2026-08-12 21:11:48 -04:00
commit 764a4b8e35

View file

@ -1087,11 +1087,7 @@ Resolve entries: `[YYYY-MM-DD HH:MM] RESOLVED — note`"#;
let tokens: usize = messages
.iter()
.flat_map(|m| &m.blocks)
.filter_map(|b| match b {
crate::core::session::ContentBlock::Text { text } => Some(text.as_str()),
_ => None,
})
.map(|t| self.counter.count(t))
.map(|b| self.counter.count(b.countable_text().as_ref()))
.sum();
let limit = context_limit.max(1);
(tokens as f32 / limit as f32).min(1.0)