Expand description
The compact form of a conversation’s transcript lines
(SPEC_HISTORY_COMPACT_FORM_ONLY_2026_11_23.md section 2).
The compact form is the store’s existing line format minus the streaming fragments, and it is
lossless: every other line is kept byte for byte. The only lines this module ever drops are
stream_event lines of a message whose complete assistant lines hold every block those
fragments reassemble to. A reply that was cut off has fragments and no complete line; its
fragments are reassembled into one assistant line marked interrupted, with the text and tool
input received so far, so nothing a person could see is lost.
- Keep by default.
DROP_RULESnames what may be dropped; a line kind it does not name is kept. A new CLI line kind is never lost by an omission. A stream event this module cannot prove (an unknown block or delta kind, a message it never saw start, a fragment that differs from the complete line) is kept as it is and counted, never guessed at. - Replay lines stay. A stored
isReplayline is either the echo of a turn srv wrote (dropped before it is stored, instdout_reader, with the ledger only the write path has) or a frame of the CLI’s own, such as a local command’s output, which must stay. Nothing in a stored line tells the two apart, so the compact form keeps every one. - Pure. No I/O and no clock: lines in, a
Planout.verifyre-checks a result against its input with its own, separate reassembly (checks L1 to L3 of the spec), andno_fragmentsis check L4. Nothing calls this module yet.
Structs§
- Before
- What
LiveReply::beforesays of the line it took. - Drop
Rule - A line kind the compact form may drop, and what it needs first.
- Live
Reply - The write path’s view of one agent’s reply as it streams: fragments are held in
output.live, and this tells when they have become redundant (every block is in a complete line and the message has stopped), and what must go tooutputinstead when a turn ends without that. - Plan
- The result of planning one window of lines.
- Stats
- Counts of what a plan did, for the migration’s report. No content.
- Synth
- A line written in place of fragments: the reassembled interrupted reply.
Enums§
- Action
- What to do with one input line.
- Check
Failure - Which check failed, with counts and positions only (never line content).
- Emit
- A line the write path appends to
outputin place of fragments it held back. - Requires
- What a drop rule needs before it may drop a line.
- Window
End - Whether a window of lines ends the zone’s stream, or is only a slice of it.
Constants§
- DROP_
RULES - The whole list of what may be dropped. Anything not named here is kept.
Functions§
- compact_
lines - The compact lines of a window, with the plan that made them.
- is_
turn_ boundary - Whether a stored line is a turn boundary (a
result, or a sessioninit), as the planner reads it. - last_
quiet_ line - The last line after which no reply is in flight: every message that has a fragment by then has its complete
line and its closing fragments, was taken over by a newer message on its stream, or a turn boundary closed it. A window cut there splits no message between two windows. It is the cut for
a stretch so long that no turn boundary comes within the window limit.
Nonewhen no line qualifies. - no_
fragments - Check L4: no
stream_eventline remains. A file that still has one is not declared compact. Returns how many remain. - plan_
window - Plan one window of lines (each one JSON line, without its newline).
endsays whether more lines follow. - recover_
live - What a start finds in
output.live, left by a process that was killed mid-reply:tailis the last complete lines ofoutput(theirassistantlines say which blocks are already stored),livethe held fragments. Returns what must be appended tooutputbeforeoutput.liveis emptied. - verify
- Checks L1 to L3 of the spec:
newis a correct compact form ofold. Written apart fromplan_window: its own reassembly, so a fault in one does not pass the other.