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.
INCOMING_MAX_AGE 🔒
incoming/ files older than this are leftovers from a crash or a cancelled copy.
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§

blob_ext 🔒
The extension part of a stored blob’s file name.
default_kind 🔒
filetime_now 🔒
fingerprint
The key derived files are stored under for a given send edge.
io_error 🔒
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.
mime_for 🔒
MIME type of a non-image original.
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.
set_mtime 🔒
stored_extension 🔒
The extension a new original is stored under. It follows the content where the content decides it (image formats, PDF, SVG, RTF), and otherwise the user’s extension if it fits the kind (docx vs odt vs doc, mp3 vs wav, …). Text and unknown files are bin: the same bytes can arrive as notes.txt and script.py, and agents get a correctly named link per delivery instead (named_link).
walk_files 🔒
write_atomic 🔒