Expand description
F-045: reversible evidence store and retrieval (roadmap.md F-045, interfaces.md
“Retrieval Marker Grammar” and the [retrieval] tokenfold.toml schema block).
Granularity in this pass is whole-payload, not per-span: pipeline.rs stores the entire
pre-transform input under its SHA-256 content hash when CompressionPolicy.store_originals
is set and the payload contains no secret-shaped content. Per-span inline
[tokenfold:retrieve ...] markers are an explicitly out-of-scope future enhancement (see
the marker grammar’s own fallback rule: “If a format cannot carry markers safely, markers
live only in CompressionReport.retrieval”).
Hash algorithm is SHA-256 only in this pass; blake3 is a documented, rejected scope cut
(see RetrievalStore::open). Backends are memory (in-process, used in tests) and
filesystem (the default persistent backend); sqlite is likewise a documented, rejected
scope cut.
Structs§
- GcOutcome
- Memory
Entry - Retrieval
Marker - One retrieval marker’s worth of metadata, per
interfaces.md’s Retrieval Marker Grammar:[tokenfold:retrieve hash=<hex> alg=sha256 namespace=<ns> bytes=<n> ttl=<seconds>].
Enums§
- Retrieval
Outcome - Result of a retrieval lookup. Deliberately has no “partial” variant: a caller either gets the exact original bytes back, or an explicit reason it did not.
- Retrieval
Store - A content-addressed, namespaced store for reversible originals. Backend-dispatching enum rather than a trait object: only two live variants exist in this pass, so a trait would add indirection without buying any real polymorphism.
Constants§
- DEFAULT_
TTL_ SECONDS tokenfold.toml’s documented[retrieval].ttl_secondsdefault (7 days).
Functions§
- default_
store_ path $XDG_DATA_HOME/tokenfold/retrieve, falling back to<home>/.local/share/tokenfold/retrievewhenXDG_DATA_HOMEis unset — mirrorstokenfold-cli::config’s HOME/USERPROFILE fallback forhome_dir(). Deliberately not a Windows-native path (e.g.%LOCALAPPDATA%): the rest of the codebase is XDG-everywhere by convention.- hex_
sha256 - Lowercase hex SHA-256 of
bytes.