STREAM Bitpack Header Lab

Pack the main characteristics of a STREAM log line into a short block of symbols — 5 characters for the common case, 10 when the extended header is needed — and filter on the header bits alone, without reading payloads.

Prototype proposal. This lab is a working sketch of a proposed packed header for STREAM log lines. It is not the shipped Rust kernel and not Loom. The bit layout used here is this lab's own definition, defined below, and everything runs in your browser — nothing is saved or sent anywhere.

1 · Encoder

Set the fields; the header, its binary, and the bit breakdown update live.

12 bits: 0–4095 s from the previous entry.
Flags
Roles present
Header length
—

Bit breakdown

FieldBitsValueCarried by

2 · Decoder

Paste a 5-character (short) or 10-character (extended) header. Extended headers have their 6 check bits verified against the other 54 bits.

3 · Filter test — header bits only

Six example headers, all produced by the same encoder logic as panel 1 (the three presets plus three more). Pick a position and phase: matching is decided from the decoded header bits alone, so every non-matching payload can be skipped unread.

#HeaderWhat it isPosPhaseΔt (s)Result

4 · Bit budget

Alphabet: ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_ — 64 symbols, 6 bits each, MSB first.

BlockBitsWhat fits
4 chars24Position (7) + phase (2) + role presence (4) + a short time delta (8) + flags — enough to filter and route, not enough to say how a role is missing.
5 chars30The short header in this lab: everything above plus modality, direction, estimate and change flags, a full 12-bit time delta, and the extended-follows bit.
8 chars48Room for absence kinds per role (12) on top of the short header, with bits to spare — but no clean place for both a dictionary index and check bits.
10 chars60The full header in this lab: short header + absence kind per role (12) + object/kind dictionary index (12) + 6 check bits.

Two honest caveats

Case is not a free bit here. In this alphabet, upper- and lower-case letters are simply different alphabet positions — A is value 0 and a is value 26 — so a capital carries ordinary payload bits, not a separate “change” signal. The caps-as-change idea (a capital marking a new item or context reset inside a compressed string) would need a different alphabet choice: one where case is reserved as a channel of its own instead of spending it on symbol values. This lab instead gives “change” its own dedicated bit (bit 13).

Check bits are partial protection. The 6 check bits are an XOR fold of the other 54 bits, and because those 54 bits are exactly nine whole characters, every single-character error is caught: change any one data character and the computed fold changes with it; change the check character itself and stored no longer equals computed. What escapes is compensating damage — two changes that cancel in the fold, such as the same bit flipped in two different characters, or a data change paired with a matching change to the check character. So the fold is complete against single typos and partial against everything else: a tripwire, not a proof of integrity — that is what seals are for.

5 · Round-trip self-test

Runs in your browser on load: each preset is encoded, decoded, and compared field by field; the last case corrupts one character of an extended header and expects the check bits to reject it.