STREAM v0.1b Direction

Lab 2026-11-30-v0-1b-direction-claude · working drafts, nothing decided unless marked

STREAM v0.1b specification (coding baseline)

Version: 0.1b, working draft, 2026-12-01 (revised round 11 with findings from the reference build) · Status: the baseline for the first v0.1b build of the kernel and a reference reader. Not frozen. Home: this page is written for the Spec tab of the Stream section of the website and the v0.1b entry in the design register. It is drafted in lab 2026-11-30-v0-1b-direction-claude and moves to docs/ and the site once the owner affirms it. Later updates to the Design page and the Handbook are taken from it.

When the build disagrees with this page, the disagreement is settled in writing here first.

Normative sources, in order of precedence:

  1. this page;
  2. kernel-descriptor-v0.1b.txt (the kernel text whose hash is the kernel's identity);
  3. build-specs.md (#12–17: roles, names, quantities, refusal codes, evidence contracts, policy pack);
  4. master-design-note.md §1–§12, §3.4–§3.7, §15 (decisions), §18 (kernel minimalism);
  5. vectors/core-v0.1b.jsonl (24 conformance vectors).

Informative: system-overview.md, design-rationale.md, mathematics.md, glyph-primitives.md, glyph-sets.md, technical-work-plan.md.

The words must, must not and may are used in their usual specification sense.


1. Scope

v0.1b defines: the log file, the header, the line body, names and quantities, the kernel's checks and effects, GENESIS and setup policies, refusals, and a trace. It does not define: views and glyphs (readers' view packs), words for positions (label packs), signatures (reserved, §4.9), the seed language (later), or conversion of v1 logs (later; v1 logs stay under v1).


2. The log file

2.1 Framing lines

Line Form Meaning
preamble STREAM/1 kernel=sha256:<64 hex> names the kernel; must be line 1
segment open STREAM/1 segment prev=<64 hex> opens a segment, citing the previous chain value
seal STREAM/1 seal hash=<64 hex> chain=<64 hex> closes a segment
time anchor STREAM/1 time t=<integer seconds since 1970-01-01T00:00Z> absolute time; the next entry's delta counts from it
bind STREAM/1 bind pack=sha256:<64 hex> rec=<name> adopts a pack; rec must be a root or hold the action bind over the log
refusal STREAM/1 refused pos=<n> digest=<64 hex> code=<n> journals a refused entry (sticky; a retry with the same digest gets the same receipt)

Framing lines are covered by seals like any other bytes. Hex is lowercase.

2.2 Seals and chain (unchanged from v1)

hash = SHA-256 of every byte of the segment before the seal line (preamble included, for the first segment). chain = SHA-256(hex(previous chain) ‖ hex(hash)), with the first previous chain = 64 zeros.

2.3 Positions and digests

2.4 Batches

Consecutive entries with the same batch field (§4) form a batch. A batch commits only if every entry is accepted; otherwise every entry in it is refused, with the first failing entry's code. Each entry in a batch is typed against the state before the batch.


3. The header

3.1 Fields (30 bits, in this order, most significant bit first)

# Field Bits
1 change 1
2 c (the position) 7
3 extended-follows 1
4 phase as (opens, closes) 2
5 role presence: subject, object, kind, measure 4
6 estimate 1
7 time delta 14

(That is bytes 1 and 2 of design note §1.3.1, followed by the 14-bit delta.)

3.2 Text form T1 (stored)

3.3 Stored and derived bits

The header stores all seven bits of c. The reader must derive F, S and O (§5.2) and must refuse a line whose stored bits differ (500).


4. The body

Canonical JSON, v1 rules: keys in byte order, no duplicate keys, no whitespace, integers only (no floats), quantities as decimal strings.

4.1 Fields

Key Type Meaning
rec name who wrote the line; required
for name the actor, when different from rec
s o k m see §4.2 the four slots; present exactly when the header's role-presence bit is 1
src name source of a reported line (F = 1)
cites integer a continuation link: the cited entry's position
ev object evidence links: {"records":[41]}; values are lists of positions, sorted
valid object {"from":t,"until":t} in seconds since 1970 (either may be absent)
uses integer use count of a permission
adjust boolean on a records link: the amount differs from the observation
reason string for an undo, an adjustment, or closing a pending item
outcome string on an end: completed or failed
model horizon string on an anticipates link
batch string batch id (§2.4)
retire integer closes the pending or in-progress item at that position (void, timeout, decline, withdraw), with reason; the entry is otherwise the same position as the item it closes
genesis object only in GENESIS (§6)
sig — reserved for signatures; must not appear in v0.1b

Unknown keys are refused (101).

4.2 The slots, per relation

R s subject o object k kind m measure
in member (name) boundary (name) member's kind (name) location (name)
is bearer (name) property (name) value's kind (name) value: string, integer, or decimal string
may holder (name) object or scope (name) action: list of positions (integers) or action words (record, bind), sorted limit: decimal string in the object's unit, if any
to from book (name) to book (name) unit (name, written bare) quantity (decimal string)

4.3 Example

<5 symbols> {"k":"EUR","m":"120.00","o":"book:acme","rec":"actor:owner","s":"book:ops"}

5. Kernel

5.1 Names and quantities

As build-specs.md §2–§3: [kind:]local; NFC; exact, case-sensitive comparison; bare names take the role default; units are names of kind unit; outside:<unit> books belong to the roots. Quantities are positive decimal strings; a unit's scale widens to the finest amount seen, up to 18 places; arithmetic in at least 128-bit integers.

5.2 Derivation

actor     = for, else rec
affected  = s
F = [src present]
S = [class(kind(s)) = resource]
O = [owner(s) ≠ actor]

Owners and classes are read from the state before the entry, plus the entry's own births.

5.3 Births

A name not yet known is born by the entry: owner = actor (a principal owns itself; outside: books belong to the roots); kind = the named kind, else the role default; a kind's class is fixed at birth (pack, else resource if first placed with a location or first moved, else record). Seed kinds: principal, boundary, kind, pack, book, thing, unit (records); item (resource). outside is a reserved kind: a book kind whose books belong to the roots and may go negative. A name is a principal because of the slot it fills (a may holder, rec, for, src), not because of its prefix: in actor:alice, actor is an ordinary kind name; the principal owns itself. Births are discarded if the entry is refused. Strict-mode policies refuse births (401).

5.4 Operations and laws

R Operation Law
in enclose containment is transitive and irreflexive; a resource is in one place
is call the same value twice changes nothing; one value per property
may self-apply authority is the least fixed point of the grant rules; every chain ends at a root; a grant never exceeds its granter
to cross legs sum to zero per unit; a reverse posts the exact inverse

The reader must check the move laws (μ, ν, σ on all 128 positions) and these four laws on a sample state at start-up.

5.6 Guards, in order

workbook validity (700) · source (701) · resource one place (702) · no negative balance except issuer and outside books (703) · relation precondition (704) · authority path (705) · write right to the log (709) · record grant for for (706) · attenuation (707) · step limit (708) · policy (800).

5.7 Effects

Phase in is may to
instant, end open or close membership set or withdraw (⊥ after withdraw) open or close a grant post both legs, or the inverse
begin open an in-progress item same same same
sample add a reading add a reading add a reading add a reading
pending (M = 1) open a pending item same same reserve on the from book

Reported entries (F = 1) write the observed state; enacted entries write the authoritative state. Guards read the authoritative state.

5.8 Pipeline

bytes (1xx) → chain (2xx) → header (3xx) → names and births (4xx) → derive (5xx) → links (6xx) → guards (7xx) → effect → commit, or a refusal line. Submission and replay (open) run the same pipeline.


6. GENESIS and setup


7. Refusal codes

build-specs.md §4, with these additions in v0.1b: 709 (no right to write to the log).


8. Trace

Every step emits an event {"ev": name, "pos": n, …data}. Baseline vocabulary (to be finished with the first build):

Stage Events
start-up descriptor.load, descriptor.hash, tables.build, laws.moves.check, laws.ops.check, state.init, preamble.check
per entry bytes.check, chain.check, header.decode, name.resolve, name.birth, derive, link.continuation, link.evidence, guard (with its code), effect, commit, refuse
framing segment.open, seal, time.anchor, bind

A paced runner advances one event at a time. Pacing must not change any result.


9. Conformance

A v0.1b reader must pass every vector in vectors/core-v0.1b.jsonl. Expected T1 encodings and state hashes are added once the reference reader produces them, and then checked by every later implementation.


10. Choices made on this page

These were not settled in earlier rounds. This page proposed them so the first build could start, and the owner accepted all ten on 2026-12-01. Each can still change before the freeze.

# Choice Section
1 Phase written as (opens, closes) bits in the v0.1b header §3.1
2 T1 check bits: two parities, even and odd bit positions. Superseded by item 11. §3.2
3 Kernel bookkeeping as framing lines (STREAM/1 …): segment open, seal, time anchor, bind, refusal §2.1
4 Refused entries take a position; their refusal line records it §2.3
5 Batches marked by a shared batch field; all or nothing §2.4
6 Closing a pending or in-progress item by a retire field on an entry of the same position §4.1
7 Unknown body keys refused; sig reserved §4.1
8 Value types for is (string, integer, decimal string) and the form of may's action list §4.2
9 GENESIS as an entry with c = 0 and no role bits §6
10 Maximum line length 65,536 bytes §2
11 Open, found by the reference build: with the 14-bit delta the header is 30 bits and has no room for check bits. Choose: 14-bit delta and no short-header check (as v0.1, and as built), or 12-bit delta plus two parity bits. §3.1–3.2