Skip to main content

Module adopt

Module adopt 

Source
Expand description

Adopting an agent’s memory from its earlier accounts (SPEC_MEMORY_FOLLOWS_THE_AGENT_2026_09_24.md §2.1.4, phase M3c).

An agent’s memory folder is keyed by account, so every account it ever ran under left a folder behind. The agent’s own live folder is adopted automatically at first sighting (§2.1.2); every other folder is only offered:

  • list enumerates the candidates — the same project folder under every account on this machine, minus the agent’s own and any folder another agent uses — and issues the list a list_id. Paths never leave the server.
  • adopt takes (list_id, index, dir hash) choices only. It is reached through the person’s confirmation in the Memory pane, never an agent-held credential (agent:memory:adopt is the window’s only). A folder that changed since the list was issued is refused.

Merging never replaces the agent’s current memory: a file the record already has keeps its head, the adopted bodies are kept as its history; a file it doesn’t have is adopted, newest by modification time as the head. The MEMORY.md indexes are unioned line by line, deduplicated by link target, so no adopted topic becomes invisible to Claude. The next spawn writes the result into the agent’s folder.

Structs§

AdoptReport
AdoptionList

Enums§

AdoptError

Functions§

adopt
Adopt the chosen folders of list list_id into agent_uid’s record. Choices are (index, dir_hash) from the list; nothing else from the caller is trusted.
list
The candidates for an agent, from its verified memory folder. None when the agent has none yet (no spawn, no working directory).