mirror of
https://github.com/Ark0N/Codeman.git
synced 2026-11-15 10:59:32 +01:00
feat: auto-compact and auto-clear from the statusLine context size
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>
This commit is contained in:
1 parent
fc25bf5f83
commit
84a6896cae
16 files changed
+579
-45
No files matched your search
@@ -1,13 +1,13 @@
|
||||
/**
|
||||
* @fileoverview Token validation constants.
|
||||
*
|
||||
* Claude's context window is ~200k tokens, so 500k is a generous upper bound.
|
||||
* Claude's context window is 200k tokens, or 1M with extended context.
|
||||
*
|
||||
* @module utils/token-validation
|
||||
*/
|
||||
|
||||
/**
|
||||
* Maximum tokens allowed per session.
|
||||
* Claude's context is ~200k, so 500k is a safe upper bound for validation.
|
||||
* The largest context Claude reports today is 1M, the upper bound for validation.
|
||||
*/
|
||||
export const MAX_SESSION_TOKENS = 500_000;
|
||||
export const MAX_SESSION_TOKENS = 1_000_000;
|
||||
Reference in new issue
Block a user