Skip to main content

Module framer

Module framer 

Source
Expand description

The framer: compresses finished parts of the shared transcript store into frames (SPEC_HISTORY_STORE_COMPRESSION_AND_COMPACTION_2026_10_21.md §5).

On unless agent:transcriptframes is false (the operator’s call, 2026-10-25: on by default, the setting stays as the way out). Every srv whose own setting is on runs it (settings are per channel, so no one srv’s speaks for the machine); each frame is one transaction that checks its parts first, so two srvs framing at once never conflict. Before each pass it checks that every running agentmux-srv has said it reads frames, in a file under readers/ beside the store (written by mark_reader when a srv opens the store). An older build, or another agent’s dev build from an older branch, can’t read frames: while one runs, nothing is framed. The store is stamped user_version 3 before the first frame, so an older build started later refuses the store and runs from its own copy (filestore::core, GLOBAL_TRANSCRIPT_STORE_FRAMES_VERSION).

What is framed (SPEC_CONVERSATION_HISTORY_ONE_TOTAL_AND_COMPRESSION_AT_THE_BOUNDARY_2026_11_30.md section 4): every append-only stream of an agent’s zones (output, its sidecars, the provider copy and the imported session files), up to 16 parts (1 MiB) at a time, never the part a reader still tails. A live file keeps its last [TAIL_BYTES] raw; a file nobody has written to for [QUIET_MS] keeps only its last part, and its last group may be smaller than 16 parts. There is no longer a wait of hours: a block is framed as soon as it is behind the tail. frame_parts writes each frame, reads it back, compares every byte and only then removes the rows, in one transaction.

Structs§

PassReport
What one pass did.

Constants§

PASS_FRAMES
Frames written per pass, so a pass stays short (about 64 MiB).
SETTING_DELTAS
agent:transcriptdeltas: with frames on, also store the streaming deltas as uuid and length (codec 2). On unless false.
SETTING_FRAMES
agent:transcriptframes: compress the shared transcript store. On unless false.

Functions§

appended
Called after an append commits: when it pushed a group behind the live tail, the framer’s loop is woken at once instead of at its next turn, so a block is compressed seconds after it leaves the live conversation. Cheap: two integer operations and a name check on every append, a wake only when a group is ready.
enabled
Whether the framer runs (agent:transcriptframes): unset means on, only an explicit false turns it off.
install_config
Attach the live settings (bootstrap).
mark_reader
Say, in readers/<pid>.json beside the store, that this srv reads frames. Called when a srv opens the shared store. A file left by a process that has exited is pruned by the framer; the start time in it keeps a reused pid from passing for this one.
note_pass
Record a pass, for steady.
note_pass_failed
A pass that failed. A corrupt store is the person’s to hear about, once, and asks for the rebuild (damage::note_corrupt): a pass walks every part, so it finds damage that no append or read of one agent’s zone reaches, and a pass that only logged left the store damaged for days.
other_srv
Another running srv, any build, as a sentence for the log and the Storage view; None when this srv is the only one. A reclaim swaps the store’s file, so any open connection holds it off, not only an old build’s (filestore::reclaim).
pass
One pass over the agent transcripts in store (at store_dir), framing at most budget frames. skip carries the frames found ineligible (a lost or short part) across passes, so they aren’t read again and again.
steady
Whether compression has caught up here: off, or its last pass was done or framed at most 4 frames. Before then, giving space back would only have to be done again (SPEC_HISTORY_STORE_RECLAIM_SPACE_2026_10_23 §6).
who_blocks
The first running srv that hasn’t said it reads every frame codec, as a sentence for the log and the Storage view; None when all have. Prunes the readers files of processes that have exited.
woken
Resolves when an append has put a group behind a tail (see appended). A wake that came while nobody waited is kept.