Skip to main content

Module tokens

Module tokens 

Source
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, as str::lines counts 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 chars Unicode scalar values.