compact-never-exceeds-budget
IN premise
`compact()` guarantees the returned string's estimated token count (chars/4) does not exceed the `budget` parameter, enforced by pre-checking every line addition against remaining space.
Summary
The compaction function enforces a hard ceiling on output size by checking each line against the remaining token budget before including it, so callers can trust that the result will never blow past the limit they specified. This matters because downstream consumers can safely allocate context windows knowing the compacted output will fit within the requested bounds.
Dependents
These beliefs depend on this one:
- compact-is-deterministic-pure-and-bounded — The compact module produces output that is simultaneously deterministic (pure function with fixed priority ordering), bounded (guaranteed to never exceed the token budget), and self-describing (includes its own token count for auditability).
Details
| Source | entries/2026/04/29/reasons_lib-compact.md |