Skip to main content

Module session_files

Module session_files 

Source
Expand description

A container agent’s provider session files, reached through its container (SPEC_HISTORY_COMPACT_FORM_ONLY_2026_11_23.md section 5.4).

The provider’s home in a container is the per-agent volume at CONTAINER_CLAUDE_DIR. A session is two paths in it, named from the project folder and the session id alone: projects/<project>/<sid>.jsonl and projects/<project>/<sid>/. Nothing here lists a folder or names anything else.

  • Reading is the archive API (docker cp), which works on a running and on a stopped container.
  • Removing is rm through an exec when the container runs; when it is stopped, a short helper container of the same image that mounts only the agent’s volume, has no network and no capability but the one rm needs, and is removed when it ends.

Structs§

SessionPaths
The two paths of one session in the container.

Constants§

HELPER_LABEL
The label every helper container carries, so a leftover can be found.

Functions§

extract
Unpack the archive of one path of a session (what docker cp gives) into dest. top is the one name the archive may hold at its root (<sid>.jsonl or <sid>). Only regular files and folders, only under top: a link, a device, a name that climbs out or a second root is an error and leaves nothing to trust. Returns how many bytes it wrote.
helper_config
The helper container’s configuration. Pure, so the locks are testable without a runtime.
remove_argv
The removal as an argv, run directly (no shell): exactly the two paths, the folder with what is under it.
session_paths
None unless both names are plain: nothing is ever named from a string with a separator in it.
valid_project
A project folder name: one plain path part, as the provider names it (the working folder with its separators turned into -).