Reference: amplihack sessions¶
Archive old Claude Code session logs out of ~/.claude/projects, and put an
archived session back. The rotator
also runs the archive once a day.
Claude Code keeps one log per session under ~/.claude/projects, and never
removes them. The directory grows by several GiB a month and fills the root
filesystem. Since #1844, amplihack profile usage reads usage directly and
starts claude only as a fallback (a
failed direct read, an overflow profile, or usage credits turned on); that
fallback's /usage still reads the whole directory, so it slows down as the
directory grows (#1698). sessions archive moves each old session into one
compressed archive under ~/.amplihack/session-archive, and
sessions restore brings one back. Claude Code cannot resume an archived
session until it is restored; see
Resume an archived session. Nothing removes
archives, so that directory keeps growing; see Disk use.
Contents¶
- Synopsis
- Archive
- What a session is
- Age
- Live sessions
- Archive steps
- Archive names
- Output
- Restore
- Resume an archived session
- Destination layout
- Disk use
- Manifest
- Lock
- Configuration
- Exit status
- Messages
- Troubleshooting
- Privacy
- Platform support
- Related
Synopsis¶
amplihack sessions archive [--days N] [--dest DIR] [--apply]
amplihack sessions restore <SESSION_ID> [--dest DIR]
| Command | Behaviour |
|---|---|
archive |
Dry run. Prints how many sessions, and how many bytes, would be archived. Creates, locks and changes nothing, but does check that DEST does not overlap the projects root. |
archive --apply |
Archives every old session that is not live, then removes its originals. |
restore <SESSION_ID> |
Extracts one archived session back into ~/.claude/projects/<project>/. Never overwrites a file. Keeps the archive. |
| Flag | Default | Meaning |
|---|---|---|
--days N |
sessions.archive_days, else 3 |
A session is old when nothing in it has been written for N days. N is a whole number of at least 1; --days 0 is a usage error. |
--dest DIR |
sessions.archive_dest, else ~/.amplihack/session-archive |
The archive directory, called DEST below. A relative path is taken from the current directory. |
--apply |
off | Archive and remove. Without it nothing changes. |
Both commands refuse to run when the effective user id differs from the real
one, for example under a setuid wrapper. They print
refusing to run with an effective user id different from the real user id
and exit 1.
Archive¶
What a session is¶
The projects root is ~/.claude/projects, resolved once. CLAUDE_CONFIG_DIR
does not change it, and there is no option to. A missing root means zero
sessions and exit 0.
| Path | Treated as |
|---|---|
<root>/<project>/ |
A project, when it is a real directory. A symlinked project is skipped and not counted. |
<root>/<project>/<id>.jsonl |
A session with id <id>, when it is a regular file. |
<root>/<project>/<id>/ |
Part of session <id> (subagent logs, tool results), only when <id>.jsonl exists. |
<root>/<project>/memory/ and any other directory with no matching .jsonl |
Not a session. Never read or touched. |
An id must be valid UTF-8, non-empty, must not start with ., and must not
contain /, NUL or a control character. A session with any other id is
skipped.
If <id>.jsonl, <id>/ or anything below <id>/ is a symlink, FIFO,
socket or device, the whole session is skipped. Nothing in it is followed,
archived or removed, and stderr gets one skipped line (see
Messages). Skipped sessions are not in the summary counts. Every
walk uses lstat, so no symlink is ever followed out of the projects root.
For each session the command records, from metadata only:
| Value | Definition |
|---|---|
| bytes | The sum of the sizes of the session's regular files. |
| parts | Regular files plus directories: <id>.jsonl is 1, <id>/ and each subdirectory are 1 each, and each file is 1. This is the number of members its archive must hold. |
| newest mtime | The latest modification time of any part. |
Age¶
A session is old when every part's modification time is at or before
now − N × 86400 seconds. One recently written file anywhere in <id>/
keeps the whole session.
Live sessions¶
A session that is still running is never archived, however old its log
looks. Claude Code writes sessions/<pid>.json in its config directory for
each running session, with the session's sessionId and pid. The command
reads every such directory it can find:
| Source | Which directories |
|---|---|
| Home | ~/.claude/sessions |
| Profiles | <profile>/sessions for every profile in the profile root. Profiles share projects/ with ~/.claude, but each has its own sessions/. |
| Running processes (Linux) | <CLAUDE_CONFIG_DIR>/sessions for each process of the same user whose /proc/<pid>/environ sets CLAUDE_CONFIG_DIR. A process that exited is skipped, and so is one whose environment cannot be read and whose command line does not name claude or amplihack (such as a non-dumpable ssh-agent). If /proc cannot be listed, or a Claude or amplihack process's environment or working directory cannot be read, the check fails closed with cannot read live sessions in /proc (<kind>); nothing archived. |
The same directory reached twice is read once.
A session can also be live with no process at all. The
agent supervisor resumes a registered agent's
conversation by id after its process has gone, and an agent in state
stopped waits for a user to bring it back, which may be days later. The
conversation id of every agent in ~/.amplihack/agents/registry.json whose
state is active or stopped therefore counts as live, so its transcript is
kept for as long as the agent is registered. An ended agent's conversation
is treated like any other session. Run amplihack agent unregister NAME to
let an agent's transcript be archived.
The check first asks whether ~/.amplihack/agents/registry.json exists.
If it does not, no agent is registered and the check adds nothing; the
supervisor's rules for ~/.amplihack are not applied, so ~/.amplihack may
be a symlink to another disk. Only when the file exists is it read the way
amplihack agent status reads it, and anything that stops it from loading
fails the check closed with cannot read live sessions in <path> (<reason>);
nothing archived. <path> is ~/.amplihack, ~/.amplihack/agents or the
registry file, whichever is at fault, and <reason> is the registry's own
message, for example is a symlink, is not private (owner-only mode
0700), or not valid JSON (line 1, column 2); it was not changed. A
symlinked ~/.amplihack that holds a registry is refused in the same way
the supervisor refuses it.
A pid file counts when it is a regular *.json file. It is opened without
following symlinks and read up to 64 KiB. Only sessionId and pid are
used; other fields are ignored. Two pids are checked: pid from the file
and the file name's numeric stem. The session is live when either is
alive. A pid outside 1 to 2147483647 is not checked, so pid: 0 or a
negative pid protects nothing. A pid is alive when kill(pid, 0) succeeds or
fails with EPERM; only ESRCH means dead.
sessionId is matched against session ids in every project. A pid file
that cannot be parsed, or whose sessionId is missing, not a string or
breaks the id rules, protects nothing. Each run prints
ignored unreadable pid file <path> once for it, the dry run included, so
the daily run repeats that line in the rotator log every day while the file
remains. A pid file refused before it is parsed (a symlink, a non-regular
file or one over 64 KiB) is passed over without a message. A dead process's
pid file protects nothing.
The check fails closed. A missing sessions/ directory is empty, but any
other error reading one, or reading the profile root, stops the command
before anything is archived. The dry run stops and exits 1 in the same
way:
cannot read live sessions in /home/you/.claude-profiles/work/sessions (permission denied); nothing archived
The live set is built once at the start. With --apply, just before a
session's originals are removed, every sessions/ directory listed above is
read again, the agent registry is loaded again, and that session is checked
again, so a session resumed during the run counts as live even before it has
written anything. Only the walk of
/proc for CLAUDE_CONFIG_DIR values is reused, for up to 30 seconds; the
directories it found are read again each time.
A process that has reused a dead session's pid keeps that session. This errs towards keeping logs.
Archive steps¶
With --apply, the command first checks DEST (see
Destination layout), creates it if needed, takes the
lock, and removes temporary files left by a run that crashed. Then,
for each old session that is not live:
- Writes
<DEST>/<project>/.<id>.tar.gz.tmp-<pid>(mode0600). Each file is opened without following symlinks, and its tar header is built from the open file, so a file swapped for a symlink during the run is not followed. Members are named<id>.jsonland<id>/…, relative to the project directory, and keep their modes and mtimes. - Flushes the archive to disk.
- Reads the whole archive back. The member names must match the parts recorded when the session was walked, the member count must equal parts, the member sizes must add up to bytes, and the gzip trailer checksum must be correct.
- Links the archive to its final name without replacing anything, then removes the temporary name and flushes the project directory.
- Checks the session again: its parts and mtimes must be unchanged and it must not be live. If this check fails, the command removes the final archive it linked in step 4, so no archive is left for a session whose originals are kept.
- Appends one line to the manifest and flushes it.
- Removes
<id>.jsonland<id>/. Removal never follows symlinks.
If any of steps 1 to 6 fails, the command removes the temporary file and any
final archive it made, keeps the originals, reports the session as failed
and goes on to the next one. If step 7 fails part-way, the archive and its
manifest line stay, and the session is reported as failed with the path it
could not remove and the archive it was saved as.
<id>.jsonl is removed before <id>/. If <id>/ then cannot be removed,
or is removed only in part, the leftover <id>/ has no .jsonl, so later
runs do not treat it as a session and never touch it. Its contents are
already in the archive, and it can be deleted by hand. The order is
deliberate: removing <id>/ first would let a part-way failure leave a
complete-looking session, which a later run would archive again as a
subset, and restore would then pick that subset.
A first run over a large backlog takes a while: on the host that prompted this command, about 28,000 sessions and 8 GiB.
Archive names¶
The archive is <DEST>/<project>/<id>.tar.gz. If that name already exists,
for example because the session was archived, restored and has aged again,
the archive is <id>.<YYYYMMDDTHHMMSSZ>.tar.gz, using the UTC time of the
run, then <id>.<YYYYMMDDTHHMMSSZ>-1.tar.gz up to -9. An existing archive
is never overwritten. If all eleven names are taken, the session fails with
no free archive name.
The manifest records the name used, so restore finds the
newest archive of a session.
Output¶
With --apply, one line on stdout:
As a dry run:
would archive 28,013 sessions, 8.02 GiB (older than 3 days; 61 live sessions kept); dry run, nothing changed (use --apply)
| Field | Meaning |
|---|---|
| sessions | Sessions archived, or that would be. Counts use thousands separators, and the word is always sessions, for example archived 1 sessions. |
| GiB | Their bytes divided by 2³⁰, to two decimal places, for example 0.00 GiB. |
| live sessions kept | Sessions old enough to archive that were kept only because they are live. |
| failed | Sessions that went wrong in Archive steps. |
There is no line per session archived. Each skipped or failed session gets one line on stderr; see Messages.
Restore¶
- Checks that the id follows the id rules, that DEST
is private, and takes the lock. Restore
never creates DEST. A missing DEST prints
cannot prepare <DEST> (not found)and exits 1. - Finds the session in
<DEST>/MANIFEST.jsonl. When the id appears on more than one line, the last line wins. An unknown id, or a missing manifest, printssession <id> not found in <DEST>/MANIFEST.jsonland exits 1. The manifest is read one line at a time, so its size has no limit: it only grows, one line per archived session. A line longer than 64 KiB is skipped without being held in memory, like a line that cannot be parsed; a real line is under 2 KiB. - Checks the line's fields.
projectmust be one valid name.archivemust be relative, contain no.., start with the project, and end in.tar.gz. Anything else printsrefused session <id>: bad manifest lineand exits 1. - Opens the archive once, without following symlinks. A missing archive
prints
archive <DEST>/<archive> not foundand exits 1. - Reads every member before writing anything. Each member must be a regular
file or a directory, with a path of
<id>.jsonlor<id>/…and no absolute,..or other special component, including after PAX long-name handling. The member count must equal the manifest'spartsand the sizes must add up to itsbytes. If any member fails, the whole archive is refused, nothing is written, and restore printsrefused <DEST>/<archive>: bad member <member>orrefused <DEST>/<archive>: member count or size mismatchand exits 1. - Refuses with
refused <path>: symlinkif~/.claude/projects/<project>is a symlink. Otherwise extracts into~/.claude/projects/<project>/, creating that directory if needed. Missing directories are created with mode0700, and an existing one is used only if it is a real directory. Files are created with mode0600and never replace an existing file. If writing a file fails part-way (for example the disk is full), that file is removed, since restore created it, so the next restore does not count it as a conflict; the error is printed and restore exits 1. If the data exceeds the manifest'sbytes, writing stops, the file being written is removed, files already complete are kept, and restore printsrefused <DEST>/<archive>: more data than the manifest recordsand exits 1.
On success:
N in restored N files counts regular files written, not directories.
The word is always files, for example restored 1 files.
An existing file, or an existing non-directory where a directory is needed, is kept. It is reported on stderr as a conflict and the rest of the session is still restored:
conflict: /home/you/.claude/projects/-home-you-src-amplihack-rs/4f1c2a7e-9b3d-4c55-8e21-6a0f3d9b7c10.jsonl already exists; kept
restored 4 files to /home/you/.claude/projects/-home-you-src-amplihack-rs; 1 conflict kept
The summary ends ; 1 conflict kept for one conflict and
; N conflicts kept for more, for example ; 2 conflicts kept. Any
conflict makes the exit status 1.
Restored files get the time of the restore as their modification time, not
the time stored in the archive. A restored session is therefore new: it is
kept for --days days and is not archived again by the next daily run.
The archive and the manifest are left unchanged. When the restored session is archived again later, its archive gets a timestamped name and a new manifest line.
Resume an archived session¶
claude --resume <id>, and the /resume picker inside Claude Code, read
session logs from ~/.claude/projects. Once a session has been archived,
by sessions archive --apply or by the
daily run, its log is no
longer there, so Claude Code does not list it and cannot resume it.
Restore the session first, then resume it from the directory it ran in:
amplihack sessions restore 4f1c2a7e-9b3d-4c55-8e21-6a0f3d9b7c10
cd /home/you/src/amplihack-rs
claude --resume 4f1c2a7e-9b3d-4c55-8e21-6a0f3d9b7c10
Claude Code names the project directory after that working directory, for
example -home-you-src-amplihack-rs for /home/you/src/amplihack-rs, and
the restored N files to <dir> line prints it. To find the id of an
archived session, search the manifest in DEST, for example by
project:
A restored session counts as new, so the daily run keeps it for another
sessions.archive_days days (see Restore). To keep every session
where Claude Code can see it, turn the daily run off:
Destination layout¶
~/.amplihack/session-archive/ 0700
├── .archive.lock 0600
├── MANIFEST.jsonl 0600
└── -home-you-src-amplihack-rs/ 0700
├── 4f1c2a7e-9b3d-4c55-8e21-6a0f3d9b7c10.tar.gz 0600
└── 4f1c2a7e-9b3d-4c55-8e21-6a0f3d9b7c10.20261102T031500Z.tar.gz
Each project under DEST has the same name as its directory under
~/.claude/projects.
Before it changes anything, archive --apply and restore check DEST:
| Check | Error |
|---|---|
| DEST is not the projects root, inside it, or a directory that contains it. The dry run checks this too. | destination <DEST> overlaps <root>; nothing changed |
| DEST is a directory owned by you and not writable by group or others. A DEST you named that is a symlink is checked at its target. | destination <DEST> is not private (must be your own directory, not writable by group or others) |
Each <DEST>/<project>/ is a real directory owned by you. |
The session fails with archive directory not private. |
DEST is created with mode 0700 when missing. Archives are not encrypted;
their privacy rests on these modes.
Only DEST itself is checked, not its parent directories. Do not put DEST in
a world-writable directory that lacks the sticky bit, where another user
could replace it after the check. /tmp has the sticky bit, and the default
under ~/.amplihack is not affected.
Disk use¶
The archive moves session logs; it does not delete them. Apart from the
temporary files a crashed run leaves (see Lock) and the archive of
a session that failed after it was written, nothing in amplihack removes
anything from DEST, so DEST only grows. The default DEST,
~/.amplihack/session-archive, is normally on the same filesystem as
~/.claude, and the
daily run is on by
default, so DEST grows without anyone running a command.
Session logs are text and compress well. On one development host, 212 MB of
logs older than three days compressed to 52 MB with gzip, about a quarter
of their size; the ratio depends on what the sessions hold. DEST therefore
grows at roughly a quarter of the rate at which ~/.claude/projects grew
before, and a backlog of 15 GiB becomes a little under 4 GiB of
archives. The manifest also grows, by one line of under 2 KiB
per archived session.
To see how large DEST is:
To keep new archives on another disk, set sessions.archive_dest:
The daily run and restore use the new directory from their next run.
Archives already written stay in the old directory, with its manifest, and
restore reaches them only when given that directory:
There is no command that prunes DEST. To reclaim space, delete old
<DEST>/<project>/*.tar.gz files by hand. An archive's modification time is
when it was written, so this removes archives written more than 90 days ago:
A deleted archive cannot be brought back by amplihack, and Claude Code
cannot resume its session. Its manifest line stays, so restore for that
session prints archive <DEST>/<archive> not found and exits 1. Leave
MANIFEST.jsonl and .archive.lock in place: the archive and restore
both use them.
Manifest¶
<DEST>/MANIFEST.jsonl has one JSON line per archived session, appended
after the archive is in place and before the originals are removed:
{"time":"2026-10-29T12:00:00Z","session_id":"4f1c2a7e-9b3d-4c55-8e21-6a0f3d9b7c10","project":"-home-you-src-amplihack-rs","bytes":184213,"archive":"-home-you-src-amplihack-rs/4f1c2a7e-9b3d-4c55-8e21-6a0f3d9b7c10.tar.gz","parts":5}
| Field | Type | Meaning |
|---|---|---|
time |
string | When the session was archived, UTC. |
session_id |
string | The session id. |
project |
string | The project directory name. |
bytes |
integer | The sum of the session's file sizes. |
archive |
string | The archive's path relative to DEST. |
parts |
integer | Files plus directories in the archive. |
The file is opened with O_APPEND and without following symlinks, and each
line is written in one write and flushed. If the file does not end in a
newline, for example after a write that failed part-way, a newline is
written before the new line so the two do not merge. Readers skip lines
they cannot parse and ignore unknown fields. restore reads the file one
line at a time and skips lines over 64 KiB, so the manifest has no size
limit; see Restore.
Lock¶
archive --apply and restore take an exclusive lock on
<DEST>/.archive.lock without waiting, and hold it until they finish. The
file stays on disk. The dry run takes no lock.
When another run holds the lock:
another sessions archive run is in progress (lock: /home/you/.amplihack/session-archive/.archive.lock)
The command then exits 1 and changes nothing.
Temporary files from a crashed run (<DEST>/<project>/.<id>.tar.gz.tmp-<pid>)
are removed at the start of the next --apply run, under the lock. Only
regular files with exactly that name pattern, one level below DEST, are
removed.
Configuration¶
| Setting | Flag | Config key | Default |
|---|---|---|---|
| Days | --days |
sessions.archive_days |
3 |
| Destination | --dest |
sessions.archive_dest |
~/.amplihack/session-archive |
| Daily run | none | sessions.daily_archive |
on |
A flag overrides its key, and the key overrides the default. Set the keys
with amplihack config set:
amplihack config set sessions.archive_days 7
amplihack config set sessions.archive_dest /mnt/backup/claude-sessions
The keys live in ~/.amplihack/config.toml and are user-only: a project's
.amplihack/config.toml cannot set them. sessions.archive_dest must be an
absolute path. archive, restore and the
daily run all read the
file each time they start, so they always agree on the destination, and a
rotator that is already running uses a new value from its next run.
There are no environment variables for these settings. The background
rotator keeps the environment it was started with, so a variable exported
later in your shell would change where restore looks but not where the
daily run writes, and restore would then report session <id> not found.
A key is read only when its flag is absent. When the file cannot give a key a value, because it cannot be read or parsed, holds an invalid value for the key, or is writable by group or others, the command does not fall back to the default. It prints one line naming the key, the file and the problem, never the value, and exits 1:
cannot read sessions.archive_days (/home/you/.amplihack/config.toml: sessions.archive_days: must be an integer from 1 to 4294967295)
HOME must be set; otherwise the command prints HOME is not set and
exits 1.
To archive sessions older than a week into a directory on another disk, for one run:
amplihack sessions archive --days 7 --dest /mnt/backup/claude-sessions
amplihack sessions archive --days 7 --dest /mnt/backup/claude-sessions --apply
A session archived with --dest is restored with the same --dest. To use
that directory for the daily run and for restore as well, set
sessions.archive_dest instead.
Exit status¶
| Status | When |
|---|---|
| 0 | Every session was archived, or would be, or skipped; or the restore wrote every file. |
| 1 | A session failed, a restore had a conflict, the lock was held, the live check could not read a source, DEST failed a check, the session or archive was not found, or another setup error. |
| 2 | Usage error, such as --days 0, an unknown flag or a missing session id. |
Messages¶
Every path and name in a message has its control characters escaped. Error
detail is reduced to one of permission denied, not found,
already exists, disk full or I/O error, shown as <kind> below. The
one exception is a registry that exists but cannot be loaded: then the
reason is the agent registry's own fixed message, shown as <reason>.
Every message below goes to stderr. The tests check these strings exactly.
| Message | Meaning |
|---|---|
skipped <project>/<id>: symlink |
The session contains a symlink. Left as it is. |
skipped <project>/<id>: special file |
The session contains a FIFO, socket or device. Left as it is. |
skipped <project>/<id>: bad name |
The id breaks the id rules. Left as it is. |
skipped <project>/<id>: unreadable (<kind>) |
Its metadata could not be read. Left as it is. |
skipped <project>/: unreadable (<kind>) |
The project directory could not be listed, or its listing failed part-way. None of its sessions is archived; the run goes on. |
failed <project>/<id>: write failed (<kind>) |
The archive could not be written. Originals kept. |
failed <project>/<id>: verify mismatch |
The archive read back did not match the session. Originals kept. |
failed <project>/<id>: changed during archive |
A part was written, added, removed or replaced while it was archived. Originals kept. |
failed <project>/<id>: now live |
The session started running during the run. Originals kept. |
failed <project>/<id>: no free archive name |
All eleven archive names exist. Originals kept. |
failed <project>/<id>: archive directory not private |
<DEST>/<project> is not a real directory owned by you. Originals kept. |
failed <project>/<id>: manifest write failed (<kind>) |
The manifest line could not be written. Originals kept. |
failed <project>/<id>: cannot read live sessions (<kind>) |
The live set could not be read again before removal. Originals kept. For the agent registry, <reason> replaces <kind>. |
failed <project>/<id>: remove failed (<kind>): <path>; session archived as <archive> |
Archived and recorded as <DEST>/<archive>, but <path> could not be removed. See Archive steps. |
failed <project>/<id>: <reason>; archive left at <path> |
After a failure that keeps the originals, the final archive <path> could not be removed either. It has no manifest line and can be deleted by hand. |
ignored unreadable pid file <path> |
A pid file could not be parsed or names no valid session; it protects nothing. See Live sessions. The run goes on. |
cannot read live sessions in <path> (<kind>); nothing archived |
The live check failed closed. |
cannot read live sessions in <path> (<reason>); nothing archived |
An agent registry exists but could not be loaded; see Live sessions. |
cannot prepare <path> (<kind>) |
DEST, its lock or its manifest could not be created or opened. |
cannot remove <path> (<kind>) |
A crash leftover could not be removed. The run goes on. |
cannot read the current directory for a relative destination |
--dest is relative and the current directory is gone. Nothing read. |
another sessions archive run is in progress (lock: <path>) |
The lock is held. Nothing changed. |
destination <DEST> overlaps <root>; nothing changed |
DEST is, contains or lies inside the projects root. |
destination <DEST> is not private (must be your own directory, not writable by group or others) |
DEST failed the privacy check. |
refusing to run with an effective user id different from the real user id |
The command runs setuid or similar. Nothing read. |
HOME is not set |
The home directory is unknown. Nothing read. |
AMPLIHACK_TEST_HOME_GUARD is set and <HOME or DEST> (<path>) is outside the temp dir; nothing changed |
The process was started by a test, which sets that variable, and HOME or DEST is outside the temp dir. HOME is checked before anything is read, and DEST before anything is changed, whichever flags were given. Never seen outside tests. |
cannot read <key> (<why>) |
<key> is sessions.archive_days or sessions.archive_dest. The user config file cannot give it a value, and its flag was not given; see Configuration. <why> names the file and the problem, never the value. Nothing read. |
session <id> not found in <DEST>/MANIFEST.jsonl |
restore: no manifest line for <id>, or no manifest. |
refused session <id>: bad session id |
restore: the id breaks the id rules. Nothing read. |
refused session <id>: bad manifest line |
restore: the line's project or archive field breaks the rules. Nothing written. |
archive <DEST>/<archive> not found |
restore: the manifest names an archive that does not exist, for example one deleted by hand to reclaim space; see Disk use. |
refused <DEST>/<archive>: bad member <member> |
restore: a member is not a regular file or directory, or its path is unsafe. Nothing written. |
refused <DEST>/<archive>: member count or size mismatch |
restore: the archive does not match the manifest's parts or bytes. Nothing written. |
refused <DEST>/<archive>: not a readable archive |
restore: the file is not a gzip tar, or is truncated or corrupt. Nothing written. |
cannot write <path> (<kind>) |
restore: a directory or file could not be created or written. A file restore created but could not finish is removed; files already complete are kept. |
refused <DEST>/<archive>: more data than the manifest records |
restore: extraction stopped. The file being written is removed; files already complete are kept. |
refused <path>: symlink |
restore: the target project directory is a symlink. Nothing written. |
conflict: <path> already exists; kept |
restore did not overwrite <path>. |
The summary lines archived …, would archive … and restored N files to
<target>, with its optional conflict ending, go to stdout; see
Output and Restore. In the rotator log, the daily run
also writes
sessions archive: cannot read sessions.daily_archive (<why>); not run
when the user config file cannot be used to decide whether it is on; see the
daily session archive.
On a filesystem without hard links, every session fails with
write failed (<kind>) and every original is kept.
Troubleshooting¶
cannot read live sessions in <path> (<kind>); nothing archived can come
from a process of yours whose CLAUDE_CONFIG_DIR points at a regular file
or at a directory that cannot be read. <path> is then
<CLAUDE_CONFIG_DIR>/sessions for that process. The run stops on purpose:
the live check cannot tell whether that process is using
an old session, so nothing is archived. Fix or unset the variable for that
process, or end it. The daily run stops in the same way until then.
If <path> is ~/.amplihack, ~/.amplihack/agents or its
registry.json, a registry exists but could not be loaded, and <reason>
says why. Until it is fixed, neither the archive nor the supervisor runs.
Without a registry file the check does not look at ~/.amplihack.
If the profile root cannot be read, the path is the root you configured
with AMPLIHACK_CLAUDE_PROFILE_ROOT, or ~/.amplihack when it is unset.
When the filesystem holding DEST is full, sessions fail with
write failed (disk full) or manifest write failed (disk full), and their
originals are kept. DEST grows with every run; see Disk use
for how large it gets, how to move it to another disk and how to delete old
archives.
Privacy¶
The commands read file metadata, pid files and, on Linux, the
CLAUDE_CONFIG_DIR value of your own processes. They copy session files
into archives byte for byte, but never parse, print or log their contents.
They never open credential files. No message contains file contents, the
text of an I/O error, or an environment value. The agent registry's
messages give at most the line and column where its JSON fails to parse.
Platform support¶
The sessions commands exist on Unix only. On macOS there is no /proc, so
the live check uses ~/.claude/sessions and the profiles'
sessions/ directories only. A session run with a CLAUDE_CONFIG_DIR
outside those is not seen as live there.
Related¶
-
amplihack agentreference - Supervised agents, whose conversations count as live -
amplihack profilereference: daily session archive - How the rotator runs the archive once a day - Shared session directories - Why every profile's
projects/is the same directory - User config:
sessions.archive_daysandsessions.archive_dest- The days and destination keys in full - User config:
sessions.daily_archive- The switch for the daily run