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
- Stored
Meta - What
derived/<id>.jsonrecords 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 🔒