Keep at most 5,000 lines and 8 MiB of retained UTF-8 terminal history. Discard the oldest text at either limit while preserving complete live output.
Track bytes and newlines in small chunks. Join split surrogates before eviction. Restore only the needed file tail, handle short reads, and close the file before rewriting current or legacy history.
Created with GPT-6 Astra (preview) in Codex.
Co-authored-by: will <[email protected]>
Append terminal history incrementally and materialize text for snapshots and coalesced disk writes.
Clear evicted line references without changing retained output.
Continues [#9357](https://github.com/pingdotgg/t3code/pull/9357). The original contribution and author credit are preserved.
The current line limit and wire format stay unchanged. A strict byte limit remains separate work.
Created with GPT-6 Astra (preview) in Codex.
Co-authored-by: will <[email protected]>