Skip to main content

Module store

Module store 

Source
Expand description

The on-disk attachment store: content-addressed originals, derived files, and the retention sweep. SPEC_AGENT_PANE_IMAGE_ATTACHMENTS_2026_09_26.md §6.3.

<root>/blobs/ab/<sha256>.<ext>       original bytes
<root>/derived/ab/<sha256>.<fp>.thumb.<ext>
<root>/derived/ab/<sha256>.<fp>.send.<ext>
<root>/derived/ab/<sha256>.<fp>.json   StoredMeta
<root>/derived/ab/<sha256>.sent        marker: sent to an agent at least once
<root>/incoming/<uuid>.part          in-flight copy / upload
<root>/sessions/<sha256(key)>.json     base64 inlined into one Claude session
<root>/derived/ab/<sha256>.<fp>.text.txt  text version of a document
<root>/named/<sha256>/<file name>     per-delivery copy of the original

<fp> is the transform fingerprint (fingerprint): derived bytes depend on the send edge and the pipeline, not only on the original, so a settings change re-derives instead of reusing stale files.

Structs§

Store
StoredMeta
What derived/<id>.json records about an attachment.

Enums§

Kind
Which stored file to serve.

Constants§

DERIVE_VERSION
Bump when the derive pipeline’s output changes, so existing derived files stop being reused.
HELD_FILES_FLOOR
The shortest a file is kept, whatever the retention setting: the hold’s 24 h and an hour’s margin.
UNSENT_MAX_AGE
Attachments never sent to an agent (drafts, abandoned or lost on restart) are kept at most this long, instead of the full retention window.

Functions§

fingerprint
The key derived files are stored under for a given send edge.
is_valid_id
Hex SHA-256, lowercase. Every public entry point that turns an id into a path validates it with this first, so an id can never carry a separator.
safe_file_name
A user’s file name made safe as a single path component: separators, control characters and Windows-reserved characters replaced, leading dots and trailing dots/spaces trimmed, length bounded.
text_cache_ids
The attachments whose extracted text text names: a message tells the agent where the text version is (.../derived/<xx>/<id>.<fp>.text.<ext>), so the session that was told holds that path. Ids only, each once, in order of appearance; what it names is removed from this store only (Store::remove_text_caches).