Session archive
Session archive keeps encrypted copies of Claude and Codex sessions in the S3 storage configured in Integrations / Overnight, for any session, not only the frozen sessions of temporary machines. Archived sessions stay in session search with an archived marker, can free their local native history, and come back with Restore from archive.
Everything is off by default. Nothing is archived until an administrator creates a session archive key and confirms its backup (keys).
What is archived
| Session | Archive | Free space |
|---|---|---|
| Ended (exited or failed) | full archive | optional, explicit |
| Frozen on its Host | full archive | no: Thaw needs the local files |
| Frozen to S3 by Freeze | no, Freeze already keeps it in S3 | no |
| Running | transcript snapshot only (manual); the session keeps running | never |
| Control Room, shell, sessions without an account | no | — |
| Other agents | no: devctrl has no verified native history locator for them | — |
A session archive (the default scope) contains:
- the session's native conversations: the current one and the earlier ones in
nativeConversationHistory, as the exact transcript files, plus the Claude companion directory beside each transcript (subagent transcripts, tool results). The Host copies them into private staging first, so a transcript that is still being written is archived up to its last complete JSONL record; - the session home, allowlisted:
.claude,.claude.json,.codex,.gemini,.agents,agent-config,launch-receipts,account-continuations,devctl-preserved-history,DEVCTRL.INVENTORY.mdand top-leveldevctl-*files. Scratch and caches (tmp,.local,.cache,.npm, browser profiles) and stores that can hold credentials (.docker,.config,.pki,.gnupg,.ssh, Git identity and credential configuration) are never included; - metadata: the Core session record, the recorded agent (below), the session's Task Graph tasks and saved handoffs, both redacted with the shared execution redaction, and the workspace identity.
A workspace archive adds what another Host needs: the repository or worktree, the source repository, the per-session checkout and its Git store, shared repositories and the Project interchange, exactly as Freeze archives them. The workspace container is paused only while the local snapshot is written, as for Freeze; other agent processes keep running.
The Freeze credential rules apply to every archive: .env*, .agent.env,
auth.json, .credentials.json, .netrc, .npmrc, .git-credentials,
.aws, .ssh, keys, tokens and managed secret directories are excluded, and
symbolic links and special files are skipped.
Agent identity
Each archive records the agent that wrote the conversation, in the manifest
(sessions[].agent) and in Core:
| Field | Source |
|---|---|
provider |
claude or codex |
cliVersion |
the CLI of the provider process that wrote it (launchedCliVersion), or null |
model |
the launch model or the last observed native model, or null |
productVersion |
the devctrl version of the Core that made the archive |
imageDigest |
the image digest of the session's container when it was observed, or null |
This is metadata only, kept so a later migration to current client versions is possible. The archive panel shows it and says when the CLI a resume would use now differs from the recorded one. A resume always uses the container's current CLI; devctrl does not pin a session to the recorded version.
Storage and format
Archives use the Freeze archive engine: a portable tar stream encrypted in
1 MiB AES-256-GCM frames with an authenticated end frame, uploaded, checked with
head and a streaming read-back hash, and committed to an owner-scoped index
with conditional writes. Session archives have their own namespace:
<archive-prefix>/sessions/owners/<owner-id>/index.json
<archive-prefix>/sessions/owners/<owner-id>/<archive-id>/workspace.tar.aes256
Core then verifies the receipt on its own: the catalog entry (compared by content, not key order), the object size and checksum, the owner namespace, the snapshot hash and the key ID. Only then is the archive verified. The engine does not compress; a session archive is about the size of its transcripts.
Encryption keys
Session archives use their own AES-256 keys, separate from the Freeze/Overnight
archive key and from Core's master key. They form a key ring: each key has an
ID derived from its fingerprint (sak- and 16 hex digits), every manifest
records the keyId that encrypted it, new archives use the newest confirmed
key and older archives stay readable with their own key.
An archive cannot be decrypted without its key. Keep a copy of every key outside the server.
The key material lives only in Core's encrypted credential store, like every other secret: encrypted at rest with the master key. Scheduled database backups keep that ciphertext but never the master key, and metadata backups delete the credential table, so no Core backup contains a session archive key in plaintext. Back up the keys themselves (and, separately, the master key) as described in control-plane maintenance.
Settings → Session archive → keys (installation-wide; writes need a server administrator):
- Create key (
g, theny). The console shows the key (base64, 44 characters), its fingerprint and a check code once. Core never shows the key again and never writes it to logs, audit events or receipts. - Confirm backup (
c): enter the check code (or the whole key). The code cannot be derived from the fingerprint, so it proves you kept the output. Only then does the key become active and archiving possible. - Rotate: create another key and confirm its backup. It becomes active; the previous key is retired and keeps decrypting its archives.
- Import key (
i): add an existing key, for example on a new server. It is active when the ring has no active key. Archives that name its key ID become restorable. - Verify backup (
v): enter a key to check it against the ring's fingerprints. Nothing is stored.
A restore whose key is missing fails before downloading with "key sak-… is
not in this Core's key ring; import it". A key that does not match the archive
fails authentication and nothing is written.
Free space
Free space removes a session's local native history after it was archived. It is a separate action (or the "Archive and free space" button, which queues it after verification); it never runs on its own unless the owner turned on Free local history after a verified archive in the automatic rule.
It applies to ended, unfrozen sessions and their latest verified archive. The Host:
- reads the S3 index again and requires the exact catalog entry;
- downloads and authenticates the whole archive into private staging;
- compares every local transcript and companion file with its archived copy by SHA-256;
- removes only the identical files, checking device and inode right before each removal and verifying that it is gone; files changed after the archive are kept;
- writes a journal of every file (
removedorkept) in its staging and keeps it.
The session home, repositories and anything else stay. The session remains in Core and in search. Resuming a freed session is refused with "restore it from the archive before resuming".
Search
Archived sessions keep their chunks and vectors in the Host's search index
($DEVCTL_DATA_DIR/session-search/index.sqlite), which is independent of the
transcript files: Core keeps planning them, and a missing transcript only skips
reading. No second index is kept, and searching never reads S3.
Results carry archived: { archivedAt, location: "s3", pruned } (null when the
session has no verified archive; an S3 Freeze also counts). The query accepts
archived: any (default), only or exclude. The Search screen shows
"archived" or "archived, history freed" after the state, and v cycles the
Archived filter. r on a freed session opens its archive panel to restore
it.
Restore
Restore from archive downloads, authenticates and checks the archive, then restores files the same way Thaw restores an S3 archive: only missing files are written, newer local files are kept, symbolic links and special files are refused. The panel shows the recorded agent identity first and notes a CLI difference. Afterwards the session resumes through the ordinary resume.
- Original Host (default): files return to their original locations.
- Another Host: only for workspace-scope archives, when the container has no running agents and every other session in it has ended. Core moves the stopped container to the chosen online Host (as Freeze recovery does), the session's account must already be signed in there, and the storage layout must be compatible. Credentials are never copied.
Automatic rule and retention
Settings → Session archive (per owner, off by default):
| Setting | Default | Meaning |
|---|---|---|
| Archive ended sessions automatically | off | Needs a confirmed key and S3 storage |
| Archive after (days) | 30 | Age trigger: ended sessions whose last activity is older |
| Also when Host free disk is below (GiB) | empty (off) | Free-disk trigger |
| Free local history after a verified archive | off | Also free space for archives the rule makes |
| Delete archives after (days) | empty (keep) | Retention |
The rule runs every 10 minutes. The age trigger starts at most 2 archives per owner and run, oldest first, skips sessions already archived after their last activity and retries a failed session after 6 hours. The free-disk trigger reads each Host's latest disk observation (at most 10 minutes old); below the threshold it archives at most 5 of the oldest ended sessions on that Host that ended at least a day ago, and, when free space is on, frees already archived ones. Every queued, freed, failed and expired item is written to the rule log (the last 100, shown in Settings) and to audit events.
Retention, when set, deletes archives older than the term. For each archive
Core removes its catalog entry with a conditional write, deletes the exact
object recorded in the entry, verifies that the object and the entry are gone,
and records expired with an audit event. A failed step keeps the archive in
deleting with its recorded identity and is retried. The latest archive of a
session whose history was freed is never deleted: it is the only copy. S3
bucket lifecycle rules, if configured, apply in addition and independently.
Consoles
- Projects / Sessions: Archive to S3 in the session's action menu opens the
archive panel:
aarchive,farchive and free space,pfree space,rrestore (withhto choose another Host for a workspace archive), Esc close. - Settings → Session archive: keys, rule, retention, counts,
rarchive eligible sessions now, rule log. - Search: the archived marker and the
vfilter.
CLI, API and MCP
devctl session archives '<session-id>'
devctl session archive '<session-id>' [--scope workspace] [--free-space]
devctl session archive-free-space '<session-id>' '<archive-id>'
devctl session archive-restore '<session-id>' '<archive-id>' [--host-id '<host-id>']
devctl session-archive status
devctl session-archive policy
devctl session-archive configure --expected-revision N --auto '{"enabled":true,...}' [--retention-days 90]
devctl session-archive run [--project-id ID] [--older-than-days N] [--dry-run]
| Route | Purpose |
|---|---|
GET /v1/sessions/:id/archives |
Archives, recorded agent, current CLI, mismatch, restore Hosts |
POST /v1/sessions/:id/archives |
{scope?, freeSpace?}: archive one session |
POST /v1/sessions/:id/archives/:archiveId/prune |
Free local native history |
POST /v1/sessions/:id/archives/:archiveId/restore |
{hostId?}: restore |
GET /v1/session-archive |
Storage, policy, counts, recent archives, rule log, key status |
GET/PUT /v1/session-archive/policy |
Automatic rule and retention (revision-checked) |
POST /v1/session-archive/run |
Archive eligible ended sessions now (dryRun) |
GET /v1/session-archive/keys |
Key ring status (no material) |
POST /v1/session-archive/keys |
Administrator: create a key; {acknowledge: "archives-unrecoverable-without-key"}; returns the key once |
POST /v1/session-archive/keys/:keyId/confirm-backup |
Administrator: {checkCode} or {key} |
POST /v1/session-archive/keys/import |
Administrator: {key, acknowledge} |
POST /v1/session-archive/keys/verify |
Administrator: {key}; nothing is stored |
The typed CLI commands and MCP tools cover the session and policy routes. The
key routes that return or accept key material have no typed MCP tool and are
excluded from Control Room, so key material never enters an agent
conversation; use the console, or devctl api call from a terminal.
Host command session.archive (archive, prune, restore) needs the Host
capability session-archive-v1; the Host reads its short-lived lease from
GET /v1/agents/:id/sessions/:sessionId/archives/:archiveId/lease.
Limitations
- Claude and Codex only.
- Deleting a session (or its container or Project) removes its search chunks; its archives and Core's archive records remain.
- A transcript snapshot of a running session cannot free space.
- Restore onto another Host moves the container's placement first; a restore that fails afterwards leaves it on the new Host, with the archive intact.
- The engine stores the tar stream uncompressed.