diff --git a/server/src/session/claude.rs b/server/src/session/claude.rs index f891ba4..79d89f5 100644 --- a/server/src/session/claude.rs +++ b/server/src/session/claude.rs @@ -179,12 +179,18 @@ const STDERR_LOG: &str = "stderr.log"; /// The context size the CLI compacts at, rather than letting it choose. /// /// Left to `auto` a phone session drifts: these run for hours, nobody -/// closes them, and the transcript carries screenshots. One measured here -/// reached 491,562 tokens before the CLI compacted it, and *every* API -/// call re-reads the whole context -- so at that size a single tool call -/// bills about 49k tokens before it does anything, and one ordinary -/// request ("can you make it so you can rename a session?") cost 4.2 -/// million across its 130 calls. +/// closes them, and the transcript carries screenshots. Measured on one +/// here, the window the CLI chose was 1M and it compacted at the ceiling +/// -- its only automatic compaction fired at 1,000,184 tokens, and the +/// context peaked at 999,668. Every API call re-reads the whole context, +/// so near that ceiling a single tool call bills about 100k tokens +/// before it does anything. +/// +/// What kept that session usable was the person in it running `/compact` +/// by hand, four times. That is the state this constant is really for: +/// even between those manual compactions, at the merely-large contexts +/// they left behind, one ordinary request ("can you make it so you can +/// rename a session?") cost 4.2 million tokens across its 130 calls. /// /// 100k is the smallest window the CLI accepts and roughly the cheapest: /// per-call cost falls with the cap, while the compaction it forces costs