brain_session_relay
Hand over an open session to a successor: capture knowledge, write a handover, end the old session, and open a new one atomically.
Instructions
Relay an open session onto its slot, or its project base: capture, end, restart.
One transaction: the named knowledge_ids are captured into the old session,
the handover is written under a compare-and-swap, the old session ends, and
a successor opens under new_client_key; its briefing follows. Two forms,
and exactly one revision per call.
Bound session: send expected_slot_revision; the handover (at most 4,000
characters) becomes the slot body and the successor stays on the slot. A
closed slot or a stale revision changes nothing and leaves the session open.
Unbound session: send expected_focus_revision, the BASE revision; the
handover becomes the project's whole base focus and the successor is
unbound. A stale revision (focus_revision_conflict) changes nothing and
leaves the session open, unlike end, which closes anyway. SHRINK GUARD: a
handover under 70% of the current base focus is refused (base_focus_shrink,
both lengths in the message), because it REPLACES the whole base: carry the
durable content over. Only an operator relay may pass allow_focus_shrink = true; a guard mod never can.
An equal replay returns the same successor with replayed = true; any other
payload on an ended session is terminal_conflict. The successor's next end
or relay sends result.slot.revision (bound: the SLOT revision, from bind,
resume, or relay) or result.focus_revision (unbound: the new BASE revision),
never started_focus_revision for a bound one.
A guard mod the operator explicitly enabled may make this call as a standing
user command, and only this one (Amendment โ slot relay (ADR #34)); with
initiator = 'guard_mod' it is refused while
BRAIN_SESSION_RELAY_GUARD_MOD_ENABLED is false.
An agent tracer is the only session the server opens or closes on its own; no hook and no auto-close may invoke this lifecycle boundary.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| summary | Yes | ||
| handover | Yes | ||
| initiator | Yes | ||
| session_id | Yes | ||
| knowledge_ids | No | ||
| new_client_key | Yes | Stable identity for one intended session. Reuse it for every retry of that session; use a distinct stable key for each parallel session. | |
| allow_focus_shrink | No | ||
| expected_client_key | Yes | Client identity expected for the addressed session UUID. The pair must match before any session mutation. This is an isolation guard, not authentication. | |
| expected_slot_revision | No | ||
| expected_focus_revision | No | ||
| nothing_to_capture_reason | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| slot | No | ||
| session | Yes | Persistent state of one explicitly controlled concurrent session. | |
| briefing | No | ||
| replayed | Yes | ||
| focus_revision | No | ||
| ended_session_id | Yes |