Skip to main content

Module delivery

Module delivery 

Source
Expand description

An agent’s memory, delivered through Claude Code’s SessionStart hook (docs/specs/SPEC_GLOBAL_MEMORY_DELIVERY_2026_09_27.md §7 P2).

The hook’s additionalContext reaches the model without showing as a conversation turn — but, measured against the CLI AgentMux bundles (2.1.280), only up to about 10,000 characters per hook command: past that the CLI swaps it for a saved file plus a 2 KB preview, which the model can’t reliably read. Several hook commands’ contexts are all delivered, each under its own cap, in the order the hooks finish (they run in parallel). So the memory is split into MAX_PART_CHARS parts, each labelled “part N of M”, and HOOK_PARTS hook commands each ask for one.

This module is pure: composition, splitting and the source rules. The per-session cache, the acknowledgements and the notice live in the server handlers.

Personal Memory goes in as an index (index.rs), and the Global Memory the agent’s startup file already carries is not sent again (SPEC_MEMORY_DELIVERY_INDEX_NOT_FULL_TEXT_2026_11_17.md).

Structs§

Composed
A composed delivery and where each item sits in it.
Entry
One memory entry: a Global Memory section as the startup file carries it, or one Personal Memory file.
ItemSpan
Where one item sits in a composed delivery, in characters (SPEC_CONTEXT_DELIVERY_2026_09_30 §3.4 step 3).
Layout
What a delivery carries besides the entries it sends in full: how much Global Memory the startup file holds, the Personal Memory index, and a closing note (memory::fit’s left-out note and pruning nudge).

Enums§

CatchUpKind
Which resume phase a catch-up turn follows.
Delivered
How much of one item a delivery carried.
FallbackReason
Why the frontend’s fallback re-delivers memory (memory-reinjection.ts’s ReinjectionReason).
Reason
Why memory is being delivered — the SessionStart hook’s source, for the sources that get a delivery.
StartupCarry
How much of the Global Memory the agent’s startup file already carries (SPEC_MEMORY_DELIVERY_INDEX_NOT_FULL_TEXT_2026_11_17.md §3.1). A file AgentMux wrote that holds a section byte for byte carries it; a section the file lacks, or holds in an older form, is newer than the file and is sent whole.
Tier
Whether an entry is Global Memory (Operator Config included) or the agent’s own Personal Memory.

Constants§

CATCH_UP_SIGNATURE
What opens the catch-up block of a resume phase’s message, and what is_hidden_reinjection_text (srv) and the stream parser (frontend) know the message by when it carries no memory. The block is AgentMux’s, not the user’s: the pane shows a card for it, never the text, but the agent’s reply is shown (SPEC_RESUME_PHASE_CATCH_UP_TURN_2026_10_13.md §3.3).
CATCH_UP_TAIL
The last words of the instruction, which end every catch-up block. The frontend’s isCatchUpMessage matches the block by them too.
COMPACTION_CLAUSE
The sentence after the signature when a compaction caused the delivery: one definition for the hook’s text, the fallback’s, and the check that adds the running summary (continuity_state).
HOOK_PARTS
How many hook commands are installed, so the most a delivery can carry is HOOK_PARTS * MAX_PART_CHARS characters. A memory larger than that is cut at the end, and the last part says so.
MAX_PART_CHARS
The most characters one part carries. The measured per-hook cap is about 10,000; the margin covers the part label and any counting difference.
REINJECTION_SIGNATURE
The sentence every hidden memory re-delivery opens with, whatever the reason: what is_hidden_reinjection_text (srv) and isMemoryReinjectionMessage (frontend) recognise it by.

Functions§

compose_catch_up
The message of a catch-up turn: the memory re-delivery when memory is the text of one (compose_fallback), then the catch-up block, in one <system-reminder>. Without memory the block stands alone: the hook already delivered it, or the phase delivers none.
compose_fallback
The fallback’s hidden message, composed on srv (SPEC_CONTEXT_DELIVERY_2026_09_30.md §3.4 step 2, CD2b). Its wire format is the frontend’s composeReinjectionMessage, unchanged: the <system-reminder> envelope and REINJECTION_SIGNATURE are how srv’s digest, the continuation packet and replay recognise a hidden turn. No part cap: the fallback is one message. None when there is no memory. A compaction’s running summary is not here: srv’s input handler appends it (continuity_state::with_state_after_compaction).
compose_fallback_layout
compose_fallback_with with the Personal Memory index and a closing note, as the hook’s delivery has them. No part cap here, but the same classes: the index first, files marked always, the Global Memory the startup file lacks, then the note.
compose_fallback_with
compose_fallback, saying so when the Global Memory is left out because the new session’s startup file already carries it (entries then holds the Personal Memory only), as the hook’s delivery does (compose_items_with).
compose_items_tail
compose_items_with, with the Personal Memory index and a closing note (memory::fit’s left-out note and pruning nudge) after the memory and before the running summary.
compose_items_with
[compose_items], saying so when the Global Memory was left out because the agent’s startup file already carries it (a new Claude session that loaded AGENTMUX_MEMORY.md or an AgentMux-owned CLAUDE.md; SPEC_LAUNCH_CONTEXT_WORKSPACE_RULE_AND_STARTUP_FILES_2026_09_30.md §4.4).
is_catch_up_text
Whether text is a catch-up message, which has no reinjection signature when it carries no memory. Its input is hidden, but the agent’s reply is shown and read: the ambient digest and the continuation record skip the input without hiding what follows, and the hidden-reinjection gate (set_hidden_reinjection_active) is not set for it.
split_into_parts_counted
[split_into_parts], plus how many of text’s characters the parts carry: all of them unless the text was cut.