Appendix S

Source plates.

These listings are short excerpts from current SlOS source files, lightly trimmed where a plate would otherwise obscure the mechanism. They are not substitutes for reading the full files, and each path has been verified in the current source tree.

Read from event shape to operator surface.

The plates follow the causal path: event record, hot ring, durable journal, replay, HTTP mirror, scrub inspector, and timeline applications.

Plate 01 include/causal.h

The event record

typedef struct {
    uint32_t       id;                           /* unique event ID (starts at 1) */
    uint32_t       node_hash;                    /* node identity hash            */
    causal_time_t  time;                         /* when it happened              */
    causal_type_t  type;                         /* event category                */
    char           subsystem[16];                /* e.g. "sched", "fs", "tcp"     */
    char           desc[CAUSAL_DESC_LEN];        /* human-readable description    */
    uint8_t        payload[CAUSAL_PAYLOAD_LEN];  /* optional structured data      */
    uint32_t       payload_len;
    uint8_t        payload_hash[32];             /* cached when payload bytes are unavailable */
    bool           payload_hash_valid;
    uint16_t       schema_id;
    uint8_t        schema_version;
    uint32_t       parents[CAUSAL_MAX_PARENTS];  /* IDs of causal parent events   */
    uint8_t        num_parents;
    uint16_t       child_count;                  /* updated as children are added */
} causal_event_t;
Plate 02 kernel/graph/causal.c

Hot ring and read-through cache

static causal_event_t events[CAUSAL_MAX_EVENTS];
static uint32_t       event_count;          /* events currently in ring   */
static uint32_t       next_id = 1;          /* monotonically increasing   */
static uint64_t       lamport_clock;        /* Lamport logical clock      */
static uint32_t       node_hash;            /* mesh node identity (0=local) */
#define CAUSAL_HYDRATE_CACHE 512

static causal_event_t hydrated[CAUSAL_HYDRATE_CACHE]; /* read-through journal cache */
static uint32_t       hydrated_next;
Plate 03 kernel/graph/cjournal.c

Journal segment paths

static void seg_filename(uint32_t seg_num, char *buf, int bufsz)
{
    ksnprintf(buf, bufsz, "%s/seg-%08u.jnl", CJOURNAL_DIR, seg_num);
}

static void seg_hash_filename(uint32_t seg_num, char *buf, int bufsz)
{
    ksnprintf(buf, bufsz, "%s/seg-%08u.hsh", CJOURNAL_DIR, seg_num);
}

static void seg_root_filename(uint32_t seg_num, char *buf, int bufsz)
{
    ksnprintf(buf, bufsz, "%s/seg-%08u.ert", CJOURNAL_DIR, seg_num);
}
Plate 04 kernel/graph/replay.c

Replay scans to a tick

int replay_at(uint32_t tick, replay_snapshot_t *snap)
{
    if (!snap) return -1;

    /* Zero the snapshot */
    uint8_t *p = (uint8_t *)snap;
    for (size_t i = 0; i < sizeof(*snap); i++)
        p[i] = 0;

    snap->tick = tick;

    /* Walk the live causal ring from its oldest retained event up to the
     * newest, including every event whose wall_ticks is within [0, tick].
     * We filter rather than break: event ids are NOT strictly tick-ordered
     * (a journal restore re-emits historical events with fresh low ids but
     * their original large wall_ticks), so an early break could drop the live
     * session.  Walking the whole ring window (<= 16384 events) is cheap and,
     * unlike the old 256-event sample, yields accurate counts and the true
     * newest events at the requested tick. */
    uint32_t newest = causal_total_events();
    uint32_t oldest = causal_oldest_event_id();
    uint32_t count = 0;
Plate 05 programs/httpd.c

HTTP time-travel state endpoint

static int api_causal_state_at(char *buf, int max, uint32_t tick) {
    struct sys_replaysnap snap;
    if (replay_at_tick(tick, &snap) != 0)
        return buf_append(buf, 0, max, "{\"error\":\"replay failed\"}");

    int p = 0;
    p = buf_append(buf, p, max, "{\"tick\":");
    p = buf_uint(buf, p, max, snap.tick);
    p = buf_append(buf, p, max, ",\"total_events\":");
    p = buf_uint(buf, p, max, snap.total_events);
    p = buf_append(buf, p, max, ",\"tasks\":{\"alive\":");
    p = buf_uint(buf, p, max, snap.tasks_alive);
Plate 06 programs/scrub.c

Causal Inspector modes

/* SlOS — Causal Inspector: time-travel scrubber

   Scrub through the kernel's causal timeline and watch system state get
   reconstructed at any past tick via the replay engine (SYS_REPLAY_AT).

     scrub                interactive full-screen TUI (arrow keys scrub time;
                          'i' inspects an event and walks the causal DAG)
     scrub <tick>         print one reconstructed frame at <tick> and exit
     scrub event <id|last>  print one event's causal DAG focus and exit
     scrub whatif <id|last> print the counterfactual impact of dropping an event
     scrub diff <a> <b>     print what changed between tick a and tick b
     scrub json [tick]      print the reconstructed state at <tick> (or now) as JSON
*/
Plate 07 kernel/graph/timeline.c

Timeline creation

int timeline_create(const char *name, const char *app)
{
    if (!name || !app) return -1;

    /* Check for duplicate */
    for (int i = 0; i < TIMELINE_MAX; i++) {
        if (timelines[i].active && strcmp(timelines[i].name, name) == 0)
            return -1;
    }

    /* Find free slot */
    for (int i = 0; i < TIMELINE_MAX; i++) {
        if (!timelines[i].active) {
            memset(&timelines[i], 0, sizeof(timeline_t));
            timeline_cache_reset(i);
            strncpy(timelines[i].name, name, TIMELINE_NAME_LEN - 1);
            strncpy(timelines[i].app, app, 15);
            timelines[i].active = true;
            timelines[i].create_tick = system_ticks;
Plate 08 kernel/apps/telnetd.c

Remote shell ports and NAWS

#define TELNET_PORT      23
#define NOISE_SHELL_PORT 5200
#define NAWS 31      /* Negotiate About Window Size */
Plate 09 kernel/core/syscall.c

Terminal input and size syscalls

case SYS_TERM_GETKEY:
    regs->REG_AX = (uint32_t)term_getkey(cur);
    break;

case SYS_CON_GETSIZE:
    {
        int rows = 25, cols = 80;
        task_get_term_size(task_current(), &rows, &cols);
        regs->REG_AX = (rows << 16) | cols;
    }
    break;
Plate 10 kernel/drivers/console.c

ANSI console redirection

void console_clear(void) {
    if (remote_console_task())
        remote_ansi("\x1b[2J\x1b[H");
}

void console_set_cursor(int row, int col) {
    cursor_y = row;
    cursor_x = col;
    if (remote_console_task())
        remote_ansi("\x1b[%d;%dH", row + 1, col + 1);
    update_cursor();
}

How to read the plates.

CausalityStart with include/causal.h for the record shape, then read kernel/graph/causal.c for ring mechanics and hash computation.
DurabilityRead kernel/graph/cjournal.c beside journal and cq -a command output. Segment files, hash files, and root files are named there.
Time travelRead kernel/graph/replay.c with programs/scrub.c. The shell, TUI, JSON, and HTTP views all rely on the same replay shape.
Webprograms/httpd.c carries both the dark dashboard and the /causal explorer. It also serves the API routes used by external inspection.
RemoteRead docs/remote-access.md first, then kernel/apps/telnetd.c beside kernel/core/syscall.c and kernel/drivers/console.c. The claim is telnet plus a small unauthenticated encrypted channel, not OpenSSH.
ConsolidationDo not cite old annotate/narrate/enrich, blame/centropy/critpath, barrier plus cbreak, csearch plus epattern, heal/supervise/reactive/trigger, ghost plus diagnose, kvstore plus kvwatch, snapshot plus merkle, or tldiff implementation paths; their code has been consolidated into the files listed below.

Current paths only.

kernel/graph/causal.cCausal event ring, Lamport clock, event hashing, parent links, and read-through hydration.
kernel/graph/cjournal.cPersistent causal journal segments, hash sidecars, roots, index, and proof health.
kernel/graph/replay.cSnapshot reconstruction and replay-derived state.
kernel/graph/timeline.cNamed event chains and timeline cursor state.
kernel/graph/actor.cActor registry, mailboxes, route table, and remote proxy logic.
kernel/graph/mesh.cPeer discovery and encrypted mesh transport.
kernel/graph/federation.cRemote actor delivery and causal graph exchange.
kernel/graph/prove.cCausal proof commands and verification helpers.
kernel/graph/describe.cConsolidated annotate, narrate, enrich, and context descriptions.
kernel/graph/whatif.cCounterfactual impact analysis.
kernel/graph/analysis.cConsolidated blame, entropy, and critical-path analysis.
kernel/graph/control.cConsolidated barrier and circuit-breaker control.
kernel/graph/search.cConsolidated causal search and pattern logic.
kernel/graph/ops.cConsolidated heal, supervise, reactive, and trigger operations.
kernel/graph/diagnostics.cConsolidated ghost and diagnose tools.
kernel/graph/kv.cConsolidated key-value store and watcher.
kernel/graph/integrity.cSnapshot and Merkle integrity support.
kernel/graph/provenance.cProvenance and timeline diff support.
kernel/apps/cmd_graph.cKernel graph command implementations, including cpath and cdot.
programs/shell.cUser shell command table and operator surfaces.
programs/httpd.cDashboard, /causal explorer, and causal API endpoints.
programs/scrub.cTime-travel TUI and one-shot replay/what-if modes.
kernel/apps/telnetd.ctelnetd on port 23, noiseshd on port 5200, per-task I/O hooks, telnet NAWS, and encrypted shell sessions.
kernel/core/syscall.cSyscall dispatch, terminal cooked-key decode (SYS_TERM_GETKEY), terminal sizing (SYS_CON_GETSIZE), and causal context.
kernel/drivers/console.cConsole output, ANSI clear/cursor/colour emission through remote io_write hooks, VGA/serial mirroring.
programs/editor.cFull-screen editor that uses cooked terminal keys and console sizing, so it can run remotely.
kernel/apps/script.cslosh scripting: variables, expr, if/while/for, functions, positional parameters, return, recursion, and shell passthrough.
kernel/apps/cmd_files.cCoherent file commands over RAM scratch and SlFS fallback/persistence.
docs/remote-access.mdCanonical remote workstation guide: telnet, noiseshd, terminal behaviour, filesystem routing, and daemon survival.
scripts/noise-shell-client.pyHost-side client for the Noise-encrypted shell, including interactive and command modes.
kernel/fs/blockfs.cPersistent SlFS implementation.
kernel/net/tcp.cTCP state machine and causal network events.