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:
listenumerates 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 alist_id. Paths never leave the server.adopttakes(list_id, index, dir hash)choices only. It is reached through the host’s confirmation window, never an agent-held credential (the service gates it on the host secret). 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§
- Adopt
Report 🔒 - Adoption
List 🔒 - Candidate 🔒
- One folder offered for adoption. No path: the client refers to it by
indexanddir_hash. - Candidate
File 🔒 - Issued 🔒
- Issued
Dir 🔒 - One listed folder, as the server remembers it.
Enums§
Constants§
- INDEX_
FILE 🔒 - LIST_
TTL 🔒 - How long an issued list stays valid.
Functions§
- account_
project_ 🔒roots - Every account’s projects folder on this machine: each linked account’s
(
identities/<acct>/claude/projects), and the unlinked default home’s. - adopt 🔒
- Adopt the chosen folders of list
list_idintoagent_uid’s record. Choices are(index, dir_hash)from the list; nothing else from the caller is trusted. - adopt_
under_ 🔒lease - dir_
hash 🔒 - folder_
files 🔒 - A folder’s memory files, sorted by name — only
only’s, when given. Unreadable and oversized files are left out. - issued 🔒
- link_
target 🔒 - The link target of an index line (
[title](target)), if it has one. - list 🔒
- The candidates for an agent, from its verified memory folder.
Nonewhen the agent has none yet (no spawn, no working directory). - list_in 🔒
- The candidates for
agent_uid, whose own live folder isown_dir, among the accounts undershared. - union_
index 🔒 basewith every line ofothersit lacks: a linked line when its target is new, any other line when no line ofbaseequals it. Returns the union and how many lines were added.