Skip to main content

Module record

Module record 

Source
Expand description

What AgentMux’s own record says about an agent’s conversations.

Every agent’s provider output is mirrored into the global transcript store (~/.agentmux/shared/agents/transcripts/filestore.db): zone agent:<id>:current, moved to agent:<id>:archive:<ms> by “New conversation”. For a user agent <id> is its UID (db_agents.id), the same in every channel and version and across account switches, so this record is the one place that holds every session the agent ran — including sessions whose provider transcript is gone (75 of 190 sessions across the 15 agents on one host, measured 2026-09-24). A template launch writes into its template’s shared zone; that zone is not the agent’s alone and is never read here.

Sessions come from the record, not from guessing by folder or account: every line the provider writes carries its session_id. A line without one — a message a person typed, echoed by AgentMux — belongs to the session of the next line that has one, the process that received it. The record only grows until it’s archived, so each zone remembers how far it has been read and a later search reads only what was appended.

Claude’s stream-json only: a line from a provider whose output carries no session_id never starts a session here.

Structs§

AgentRecords 🔒
Reads agents’ records from the global transcript store. No store (a test, or a srv that couldn’t attach it) reads nothing.
RecordSession 🔒
A session, as the agent’s record holds it.
Run 🔒
Consecutive lines of one session.
ZoneScan 🔒
How far a zone has been read, and what was found.

Enums§

StoreSource 🔒

Constants§

READ_CHUNK 🔒
How much of a zone is read per step.

Functions§

for_each_line 🔒
Call f(line, offset) for every complete (newline-terminated) line of the zone’s output in [start, end). A trailing unterminated line is left for the next read — it’s an append in progress.
init_cwd 🔒
The working directory an init line reports.
is_agents_own_zone 🔒
agent:<uid>:current and agent:<uid>:archive:<ms> — never another id’s zone, and never a template’s shared one (its key isn’t this UID).
is_stream_event 🔒
Streaming deltas: most of the record’s bytes, and never a message.
line_session_id 🔒
The session a line belongs to, if it names one. A streaming delta’s shape is fixed and its payload holds only escaped strings, so its last "session_id":" key is the line’s own; anything else is parsed.
line_stamps 🔒
Receive times for line offsets from the zone’s output.tsidx; None if the zone has none.
scan_line 🔒
scan_zone 🔒
Read what was appended to zone since the last scan. A zone smaller than what was read (archived and started over) is read again from the start.
zone_stamps 🔒
(first, last) receive time for each run: its first line and the line holding its last byte.