Expand description
The token estimate every AgentMux surface shows, labelled “~N tok (est.)”:
⌈Unicode scalar values ÷ 4⌉. The frontend’s estimateTokenCount
(frontend/util/format-count.ts) counts the same way, and both test the
same vector, so the Memory pane, the context delivery card and the
reinjection card agree to the token (SPEC_MEMORY_PANE_TOKENS_2026_10_15.md
§4.1).
Functions§
- count_
lines - Lines in
text, asstr::linescounts them: a final line needs no newline, and an empty text has none. - estimate_
tokens - Estimated tokens in
text. - tokens_
for_ chars - Estimated tokens in a text of
charsUnicode scalar values.