Skip to main content

Module global_memory_record

Module global_memory_record 

Source
Expand description

AgentMux’s own record of Global Memory (SPEC_MEMORY_FOLLOWS_THE_AGENT_2026_09_24.md §2.1.6, phase M4).

Global Memory lives in db_bundles (is_global = 1) in the channel’s identity store: per channel on an isolated channel, shared/store.db otherwise. This record, in the global transcript store, is what it can later follow agents from — into a new isolated channel’s import step, and to other machines (M5). db_bundles stays the cache every reader uses; nothing here changes what an agent receives.

Zone global-memory:<scope>, <scope> being shared for channels that share their identity store and channel:<id> for an isolated one — the same boundary isolation draws today, so an isolated test channel’s edits never reach the real record.

  • log.jsonl: entry events (a version of an entry, by its stable id — the bundle id; a tombstone when it stops being Global Memory) and order events (the full id list).
  • blob/<sha>: {name, instructions} per distinct version.
  • heads.json: each entry’s head, and the current order.

Write-through. The store’s Global Memory write methods tell an observer after each change (attach); the observer only queues the change, and a worker thread reads the committed row and records it — never blocking a write. The record only appends when content differs, so several srv processes on one store record each change once. The source is the latest db_bundle_versions row’s when that matches the content.

Older builds write db_bundles without it; each start compares every entry with the record and records what differs as legacy-build (as baseline the first time).

Structs§

Body 🔒
EntryHead 🔒
EntryVersion 🔒
Heads 🔒
ImportEntry 🔒
ImportReport 🔒
ImportSource 🔒
Another scope whose record holds entries this channel lacks.
ImportSources 🔒
IssuedImport 🔒
Recorder 🔒
Handle for queueing the start-up comparison once seeding is done.

Enums§

Event 🔒
Job 🔒
What the worker is asked to do.

Constants§

HEADS_FILE 🔒
IMPORT_LIST_TTL 🔒
LOG_FILE 🔒

Functions§

attach 🔒
Start recording store’s Global Memory into fs: attach the observer and start the worker thread.
attribution 🔒
Who wrote what an entry now holds: the latest version row, when it holds this content.
heads 🔒
import 🔒
Bring source index of list list_id into this channel’s Global Memory: the entries it still lacks, each keeping its id, after the ones here. An entry already here is never overwritten; a name another entry here has is taken as <name> (<id short>).
import_sources 🔒
import_sources_in 🔒
The other scopes this channel could import Global Memory from, under a new list_id. Empty unless this channel is isolated.
issued_imports 🔒
line 🔒
missing_from 🔒
The live, non-system entries of the record in zone that store doesn’t have as Global Memory, in that record’s order.
process 🔒
read_heads 🔒
scope 🔒
This channel’s Global Memory scope: shared, or channel:<id> when it is isolated.
sync_all 🔒
At start: record every entry and the order as the store has them — baseline the first time, legacy-build for what an older build (or a change the worker never reached) left different. Returns how many entries were recorded.
sync_entry 🔒
Record entry id as the store now has it, if the record differs: a new version while it is Global Memory, a tombstone once it isn’t. source overrides the attribution (the startup comparison). Returns whether anything was recorded.
sync_order 🔒
Record the Global Memory order if it differs from the record’s.
zone 🔒