Skip to main content

Module agent_archive

Module agent_archive 

Source
Expand description

The portable agent: one archive file holding what an agent is (its definition, Personal Memory and conversation), written as a stream and read without trusting it. Spec: SPEC_MOVE_AN_AGENT_TO_ANOTHER_COMPUTER_2026_11_24.md section 4. This module is the format only: the writer, the reader, the manifest and the definition allowlist. What goes into an archive, and what is done with one that came in, is the caller’s.

Re-exports§

pub use manifest::Manifest;
pub use manifest::Part;
pub use manifest::SignatureState;
pub use reader::ArchiveReader;
pub use writer::ArchiveWriter;

Modules§

build
What goes into an agent archive, and from where (spec section 4): the definition through the allowlist, Personal Memory refreshed from the live folder, and the conversation in the history store’s compact form, newest first under the cap of decision 12, plus the conversation as one readable file and the rolling state. A value srv holds secret is withheld from every part that holds text from the store; scrub_shape also withholds anything shaped like a key, which a saved file does and a move does not. Nothing here reads a provider’s own session file.
definition
The definition an archive carries: an allowlist, not a denylist (spec section 4.1). A definition is instructions for a process that runs commands, so a field an archive could set that widens what the agent may do at the destination (permission mode, extra directories, shell, remote connections, MCP servers, environment, hooks, auto-approve rules, accounts, the working directory, the container’s image and volumes) is not a field of PortableDefinition at all. Reading an archive keeps the fields below, drops every other key and lists what it dropped, so the arrival note can say so.
manifest
The manifest of an agent archive: what is in it, with a hash per part and per chunk, and the signature of the computer that wrote it (SPEC_MOVE_AN_AGENT_TO_ANOTHER_COMPUTER section 4).
place
Putting the parts of an archive where this computer keeps them (spec section 7.2): the conversation as imported history in the agent’s zones of the shared transcript store, Personal Memory in the record, and the note the agent reads when it first starts. The caller has already verified every part; nothing here trusts a line’s own claims.
reader
Reads an agent archive without trusting it. Opening checks everything that can be checked without reading a part: the manifest (kind, format, shape, paths, sizes, caps), that the file holds exactly the parts the manifest names and nothing else, that no entry is a link or a directory, that no part claims a size its compressed form cannot hold, and the signature. Reading a part checks it chunk by chunk before any chunk is handed on, so a part that was changed is never used up to the point it was changed.
transcript_md
The conversation as one readable file (history/transcript.md): what an agent that cannot resume the old thread reads to know what was said (spec section 7.3). It reads the compact form line by line and keeps the words of the person and of the agent. A tool call is one short line naming the tool; a tool’s output is a note of how long it was, because the output is in the conversation files and a fresh thread needs the decisions, not the logs.
writer
Writes an agent archive as a stream: each part is read from its source and written to the file as it goes, hashed per chunk on the way, so a history of any size never sits in memory (and never goes through base64). The manifest is written last, because it holds what the parts turned out to be.

Structs§

Limits
The caps on one archive. A writer refuses to pass them; a reader refuses an archive whose manifest does.

Enums§

ArchiveError