Expand description
Segment index (SPEC_DURABLE_CONVERSATION_MEMORY_2026_09_23.md §4.1, P1): one record per provider session an agent has run, so “this agent’s conversation” is a chain AgentMux owns rather than whatever session id a pane happens to hold.
Stored as an append-only event log, segments.jsonl in the global
transcript store’s agent-uid:<uid>:segments zone, not as a SQL table
(§4.1.1): that store is shared by every srv on the machine and takes
additions without a schema version bump, where a new table in
identity-store.db would bump its version and lock older builds out of
it (check_schema_compat). Events: start at spawn, session when a
fresh process reports its provider session id, end when the process
goes away. segments folds them back into one row per segment.
The zone is keyed by the agent’s UID (AGENTMUX_AGENT_UID), not its
definition id: a template launch shares the template’s transcript zone
but is a different agent. It is deliberately not the transcript zone, so
“New conversation” (which clears agent:<defId>:current) never erases the
chain; a new conversation is just a segment whose rung is fresh.
Structs§
- Head
- Where the agent’s conversation was last: the newest segment that has a provider session, and what that segment recorded about it.
- Segment
- One segment, folded from its events.
- Start
- What is known about a segment when its process starts.
Enums§
- Rung
- How a segment began (§4.2’s rungs;
relocatedarrives with P4).
Functions§
- chain_
head - Where the agent’s conversation was last, read from its chain in
fs.Nonewhen the UID has no chain. - fork_
source_ head - The chain head of the agent
agent_uidwas forked from (its definition has abranch_labeland aparent_id): what a fork with no conversation of its own starts from (ResumeGate::ForkFrom). Shared by the spawn’s gate and the pane’s resume preflight. - record_
start - Records a segment’s start and returns its id.
start.segment_idandstart.predecessor_segment_idare filled in here. - rung_
for_ spawn - The rung a spawn started on, from what the spawn knows: whether it passed
--resume, and whether it carries a continuation packet. - segments
- Every segment the agent has run, oldest first. A segment with no
endis running, or its srv died before it could record one. - with_
legacy_ identity - A head whose segment predates
identity_key(recorded by a build before #3839) takes the identity from its own config dir’s.claude.json, so an agent’s first upgrade from such a build can still relocate (spec §4.1). That file names whoever is signed in there now, which for an account’s own dir is the login the session ran under unless the dir was since re-logged-into as someone else; a recorded key always wins. Unreadable (the dir is gone) stays unknown, which never relocates. - zone_
for agent-uid:<uid>:segments, orNonefor a UID outside the safe zone-name character set.