Expand description
The endpoints Claude Code’s SessionStart hook calls to deliver an agent’s
memory (docs/specs/SPEC_GLOBAL_MEMORY_DELIVERY_2026_09_27.md §7 P2). The
composition and the part rules are backend::memory::delivery.
POST /api/v1/agent/memory/session-start/part— one part. Each of theHOOK_PARTShook commands asks for its own part number. They run in parallel, so the first request for a (block, session, reason) composes the delivery and caches it, and every other part comes from that same composition.POST /api/v1/agent/memory/session-start/ack— a hook wrote its part to Claude. Once every part is acknowledged the delivery is complete: the pane gets one persistedagentmux_memory_injectedframe naming each entry and its size (owner decision D11). A part fetched but never acknowledged (the hook crashed or timed out) leaves the delivery incomplete, and no notice claims otherwise.
The agent comes from the request’s credential (X-Agent-Token →
Caller::Agent): its Personal Memory is that
agent’s. Without a token only Global Memory is delivered.
Structs§
- AckRequest 🔒
- Claim
Result 🔒 - What a fallback’s claim found:
deliver, or stand down because the hook delivered, or because the event was another block’s (foreign). - Gate
Entry 🔒 - Removes a delivery’s compose gate when the part that took it is done.
- Launch
Dirs 🔒 - Where a session’s CLI looked for its startup files.
- Part
Request 🔒 - Part
Response 🔒
Functions§
- acknowledge 🔒
- Marks
partwritten. True exactly once: when this makes every part written and no notice has gone out yet. - append_
notice 🔒 - Appends one notice line to the block’s output and its transcript zone.
- bind_
to_ 🔒grant - A container agent asks for its own block’s delivery only. Its block is the grant’s (an empty one is filled in); another block’s is refused, since the delivery is cached and composed per block, and a compaction summary is a block’s own conversation.
- block_
is_ 🔒container - Whether the pane is a container agent’s: its host folders aren’t readable from inside, so an index line
names the
Memorytool’s form only. - card_
frame 🔒 - The
agentmux_memory_injectedframe both delivery routes write: the fields the card reads, thenextra(the route’s own: the hook’s session and part count, the fallback’s delivery id). - carried_
items 🔒 - The card’s rows for the Global entries the startup file carried (every one that is not in
newer): listed, sized 0 (the file’s row counts them). - claim_
fallback 🔒 - Whether the frontend’s hidden-reinjection fallback should deliver this
event (
true) or stand down because theSessionStarthook delivered it (false). Waits out a hook delivery still in flight for up toPENDING_WAIT, then lets the fallback deliver, so a hook that died part-way never leaves the agent without its memory. With aboundary_uuid, only the block whose CLI compacted can deliver. Withevent_at_ms(a fresh session’s time), the hook’s delivery for that session counts however late the claim comes. - compose_
delivery 🔒 - Reads the memory and composes the delivery.
Nonewhen there is nothing to deliver. A new session’s delivery also lists the startup files the CLI loaded fromlaunch(startup_items_of), ahead of the memory items. - compose_
fallback_ 🔒delivery - Composes the fallback’s hidden message from the same memory the hook
delivers (
global_entries,personal_entries), and the card that will stand for it.Nonewhen there is no memory. - delivery_
items 🔒 - The notice’s items, in delivery order, sized by what the parts carried.
- fallback_
frame 🔒 - The card for a fallback re-delivery: the hook notice’s shape, under the
delivery’s own id.
fallback: truetells replay that the hidden message right after it is this delivery’s echo, not a second one. - finish_
part 🔒 - The reply for one part of a composed delivery. A delivery with nothing for the hook to carry still gets its card, on the first part asked for.
- fit_
and_ 🔒compose - The delivery’s entries sorted by what each gets (
fit::fit), composed and split the way the hooks will carry them. The character budget is only a guess at how the parts break at line ends, so when the real split still cuts (the notes at the end are what can tip it), a little more room is kept back and the fit is redone, so the reserved summary and the notes are never the part that is lost. - global_
against_ 🔒startup_ files - Which current Global sections the CLI already got from a startup file: one AgentMux wrote that holds the section byte for byte. Returns the sections newer than the files (absent, or held in an older form, which the CLI never saw in its current form), and how much of the Global Memory the files carry. A foreign file doesn’t count, or the hook would drop current entries the agent never saw.
- global_
entries 🔒 - Global Memory as the startup file carries it — its sections, Operator
Config first (
globalmemory:sections, P1). - global_
left_ 🔒out_ item - The card’s row for a Global Memory entry left out of the delivery whole because it was full.
- handle_
session_ 🔒start_ ack POST /api/v1/agent/memory/session-start/ack- handle_
session_ 🔒start_ part POST /api/v1/agent/memory/session-start/part- in_
startup_ 🔒file_ item - A Global Memory entry that reached the agent through its startup file: listed in the card, sized 0 (the file’s own row counts it).
- indexed_
items 🔒 - The card’s rows for the Personal files listed in the index: each sized by its index line, not “0 B”.
- latest_
startup_ 🔒files - The startup files of the agent’s latest Claude spawn, from where its continuity segment says the CLI started: the fallback has no hook request to read them from.
- modified_
ms_ 🔒of - When a Personal Memory file was last modified, in Unix ms: its
modifiedfrontmatter when it has one that parses, else the file’s mtime. - notice_
frame 🔒 - The persisted notice (D11): which memory was delivered, and each entry’s
size.
idis stable for the delivery, so a live frame and a replay of the same line render once. - part_
response 🔒 - personal_
entries 🔒 - The agent’s Personal Memory files from its latest spawn’s memory folder,
by name, without the
MEMORY.mdindex (the CLI’s own table of contents). - personal_
entries_ 🔒in - reason_
for_ 🔒fallback - The event a frontend reinjection reason stands for: a compaction, or a
fresh session (a spawn without
--resume, whose hooksourceisstartup).Nonefor anything else. - register_
memory_ 🔒delivery_ handlers - Registers
memorydelivery:claim_fallback— the frontend’s hidden memory reinjection asks it right before it would fire — andmemorydelivery:compose, which composes what it sends. - send_
partless_ 🔒notice - A delivery with nothing for the hook to carry (its Global Memory is in the startup file, and there’s no Personal Memory) still has a card: written on the first part request, exactly once, since no part will be acknowledged.
- session_
start_ 🔒ack - session_
start_ 🔒part from_container: the request’scwdandconfig_dirare paths inside the container, so nothing is read from the host for them. The startup files are the ones in the block’s own mounted workspace, as the CLI there read them.- startup_
files 🔒 - The files the CLI read by itself at session start.
- startup_
items_ 🔒of - take_
fallback_ 🔒frame - The card of the fallback delivery
delivery_id, taken once, when its hidden message reaches srv.Nonefor an unknown or expired id, or one composed for another block.