mirror of
https://github.com/Ark0N/Codeman.git
synced 2026-11-14 10:39:32 +01:00
Both checks compared getTotalTokens() against the threshold. That counter leaves out cache reads, so it stays far below the real context, and the 500k cap ruled out thresholds on a 1M window. POST /api/status-telemetry now hands context_window.total_input_tokens and context_window_size to Session.noteContextReport(), which runs both checks. The decision is a pure function, decideAutoThreshold(). The counter stays the fallback when no report has arrived. After a /compact or /clear the pre-command report is ignored by value, since it stays the newest number until the command finishes. The first differing report came later, so a swallowed command fires again instead of locking the automation off. A counter summed from JSON usage never drops after a compact, so it counts from its value at the last one. The pane parser's counter is absolute and only moves past its high, so a move clears that baseline and it fires as it did before. Thresholds go up to the reported window, 1M when unknown, and a higher value stops at the window. MAX_SESSION_TOKENS follows, and the pane parser's M-suffix guard checks that cap instead of a fixed 0.5. Refs #585 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>