proto/stream_header.proto#

Normative. proto/** is part of specs/ ([STYL.2.14.1]); message names, field numbers, types and reserved ranges carry the same force as a clause of English ([STYL.2.14.2]). Cite this file as proto/stream_header.proto and a message within it as proto/stream_header.proto#<Message> ([STYL.2.14.3]). This page is the protobuf source, rendered.

/* SPDX-FileCopyrightText: 2026 Dan Finster and the Desert Sage Contributors */
/* SPDX-License-Identifier: BSD-4-Clause OR AGPL-3.0-or-later */
syntax = "proto3";

package ds.v1;

import "capabilities.proto";

StreamHeader#

// StreamHeader — atom body.  First atom in every DS fact stream file.
// Per [RFCS.4].
message StreamHeader {
  // [LDET.1.10]: a stream carries no version of its own: `ds_version` below is the
  // DS version that wrote it, and a reader accepts its own `<major>.<minor>.`
  // series and rejects every other. Number and name never reused
  // ([STYL.2.8.7]).
  reserved 1;
  reserved "version";
  reserved 2, 3;           // never reused
  bytes  dsc_hash    = 4;  // the DSC header's dsc_sha256, copied (RBND.3.1); REQUIRED (RBND.1.3)
  string session_id  = 5;  // the run id the integrator gave the engine (RFCS.4.3); "" if none
  string tier_id     = 6;  // the tier id the integrator gave the engine (RFCS.4.4); "" if none

  // Dialect-binding tuple ([RBND.1.3]).
  reserved 7, 8;
  reserved "dialect_tier", "dialect_extensions";
  repeated Capability capabilities   = 16;  // enabled settings, ascending ([RBND.1.3])
  bytes           dialect_def_sha256 = 9;   // 32 raw bytes
  string          ds_version         = 10;  // [LDET.1.10] — the DS version that wrote this
                                            // stream, and THE version a reader accepts on.

  // RT-config (contract) binding. See [RBND.1.4 / RBND.4b / RTCT].
  reserved 11;
  reserved "rt_mode";
  bytes           rt_config_sha256   = 12;  // 32 raw bytes (canonical contract hash)
  RealtimeConfig      rt_config          = 13;  // inline forensic values (RBND.2.3)

  // Wall-clock anchor: host UTC ISO 8601 when the stream opened (RFCS.4.8).
  // Provenance metadata, NOT a replay input — replay drives off the engine
  // monotonic clock (RFCS.6.6). The offset is carried inline in the ISO-8601
  // string. "" when unanchored.
  string          wall_start_iso8601 = 14;

  // The engine emits a PumpBoundary atom per pump to quiescence
  // ([RFCS.22]), so a reader reads the cadence off the trace. Number and name
  // never reused ([STYL.2.8.7]).
  reserved 15;
  reserved "fire_cadence";
}

RealtimeConfig#

// Inline forensic copy of the contract the engine was running under
// when this stream was produced. The values MUST hash to
// StreamHeader.rt_config_sha256 under the canonical serialization of
// [RBND.4b]; readers verify on load.
message RealtimeConfig {
  uint32          wm_max              = 1;
  uint32          agenda_cap          = 2;
  uint32          max_fires_per_pump  = 3;
  uint32          token_pool_cap      = 4;
  uint32          intern_cap          = 5;
  uint32          intern_bytes_cap    = 6;
  uint64          pump_wcet_ns        = 7;
  repeated RealtimeNodeCap   nodes        = 8;  // ascending node_id
  repeated RealtimeSeriesCap series       = 9;  // ascending series_id
}

RealtimeNodeCap#

message RealtimeNodeCap {
  uint32 node_id   = 1;
  string kind      = 2;  // "alpha" | "beta" | "term"
  uint32 capacity  = 3;
}

RealtimeSeriesCap#

message RealtimeSeriesCap {
  uint32 series_id = 1;
  uint32 capacity  = 2;
}

Checkpoint#

// Checkpoint — atom body.  Inline WM checkpoint.
// Per [RFCS.9], which is deferred: field 259 of atom.proto's Atom is held for
// it and not allocated.
message Checkpoint {
  uint64 seq      = 1;  // stream position of this checkpoint
  int64  clock_ns = 2;  // monotonic clock at checkpoint time ([LTIM.2.8.2])
  uint64 wm_count = 3;  // number of live facts in the following FactAssert atoms
  int64  wall_ns  = 4;  // wall clock at checkpoint time, UTC ns ([LTIM.2.8.3])
  repeated CacheEntry cache = 5;  // one per live cache key ([RFCS.9.3a])
  bool   has_wall = 6;  // false: the wall clock had no value; wall_ns is ignored ([RFCS.9.4])

  // One engine-cache entry in the snapshot ([RFCS.9.3a]).
  message CacheEntry {
    string key             = 1;
    string value_json      = 2;  // the opaque stored value
    int64  ttl_deadline_ns = 3;  // monotonic deadline; 0 = no expiry
  }
}

ClockAdvance#

// ClockAdvance — atom body.  One sample of the engine's two clocks.
// Per [RFCS.10].
message ClockAdvance {
  uint64 seq      = 1;
  int64  clock_ns = 2;  // monotonic clock after this sample ([LTIM.2.8.2])
  int64  wall_ns  = 3;  // wall clock after this sample, UTC ns ([LTIM.2.8.3])
  bool   has_wall = 4;  // false: the wall clock has no value; wall_ns is ignored ([RFCS.10.1])
}

RuleFireAnnotation#

// RuleFireAnnotation — atom body.  Rule-fire annotation.
// Per [RFCS.11].
message RuleFireAnnotation {
  uint64 seq           = 1;
  int64  clock_ns      = 2;
  string rule_name     = 3;
  reserved 4;                // no numeric activation id exists: identity is
  reserved "activation_id";  // (timetag, rule_name). Never reused.
  bool   end           = 5;  // false = begin, true = end
  int64  timetag       = 6;  // firing activation identity; byte-identical to
                             // CallIssued.timetag. (timetag, rule_name) is the
                             // CallIssued↔RuleFireAnnotation join key (RFCS.11.2 / RFCS.15.2).
}

TextNote#

// TextNote — atom body.  Optional clear-text annotation, per [RFCS.25].
// DEFERRED: not a member of `Atom.oneof body` in this edition; field 323 is
// held for it ([RFCS.3.1]). `text` is `bytes` (not `string`) so it decodes
// identically everywhere regardless of UTF-8 validity ([RFCS.25.1]).
message TextNote {
  bytes tag  = 1;   // exactly 16 bytes, NUL-right-padded — the kind of text ([RFCS.25.1])
  bytes text = 2;   // the clear-text annotation; conventionally UTF-8, uninterpreted ([RFCS.25.1])
}