Skip to main content

Module archive

Module archive 

Source

Re-exports§

pub use recovery::RecoveryId;
pub use recovery::RecoveryRefusal;
pub use recovery::recovery_lineage;
pub use recovery::retrieve_recovery_checked;
pub use recovery::store_recovery_with_lineage;

Modules§

authority
Source identity travels with an archive; a stored verdict is never authorization.
bindings
Source bindings of stored items whose own record has no place for one: knowledge facts and session findings.
delivered
Delivered-content lineage register (G03/G04).
presented
Presentation register: the authority of caller-supplied context sources.
recovery
Recovery copies bound to a Lineage (G02).
register
One persistence form for the small content-free registers next to the archive (delivered, presented, and the proxy’s register of provider-sealed items): 256 JSON shards under <data dir>/archives/<name>/<2 hex>.json, owner-only, replaced atomically under a bounded file lock, with no in-memory state — a second process reads exactly what the first one wrote.

Structs§

ArchiveEntry
ArchiveStoreResult

Enums§

ArchiveResolveError

Constants§

MAX_ARCHIVE_SIZE

Functions§

adopt_legacy_entry
Copy the legacy archive id into project_root: its stored text passes the admission of a normal archive write there and gets that project’s own id. The legacy entry is left as it is. Ok names the new id; Err is the content-free refusal.
bound_recovery_id
The id of the source-bound recovery copy that holds exactly content, if one was stored (by store_recovery_copy, or by the MCP pipeline for a tool that declares its sources). A lookup only: nothing is authorized here. Resolve the id with retrieve_checked, inside the request’s project scope — that re-admits every source under the current policy and role and refuses with a typed, content-free reason when rights are gone.
cleanup
Prune archived entries that exceed the age TTL (max_age_hours) or that push the on-disk store past its size budget (max_disk_mb). The content file, metadata, and FTS index are removed together so the two stores stay in sync. Returns the number of entries removed.
content_matches_id
Check the content-address contract used when the archive ID was minted: a public archive is addressed by its content, a source-bound one by its authority and content.
content_path_str
Filesystem path of an archived entry’s verbatim content. Exposed so recovery hints can offer the MCP-free “read this file directly” route alongside ctx_expand(id=...) — the same content is reachable both ways.
disk_usage_bytes
format_hint
format_json_keys
Describe JSON structure: navigate path (dot/slash separated) into parsed content, then format with describe_json. label appears in error messages. Shared by archive and ref store paths.
format_range
Format a range of lines from content with {:>6}| line-number gutter. Shared by retrieve_with_range (archive) and expand_reference (ref store).
format_search
Search content for lines matching pattern (case-insensitive) and return gutter-prefixed matches. label appears in the result message (e.g. “archive a1966…” or “reference ref_18bb…”). Shared by archive and ref store paths.
is_drifted
An archive whose partition no longer matches the current partition of the root it recorded: that project’s identity (remote, package name) changed since. Served to no project until adopted.
is_enabled
legacy_unscoped_entries
Archives without a source binding that were stored before archives named their project: served to no project (AP05-G4). Read for the explicit lean-ctx migrate legacy-context adoption only.
list_entries
remove_files
Remove only the on-disk content + metadata files for an archive id, leaving the FTS index untouched. Used by the FTS cap-enforcer so the .txt/.meta.json blobs of rows it evicts can’t outlive their index entry as orphans (#417).
resolve_alias
retrieve
retrieve_checked
Resolve a canonical archive ID under the current policy: untrusted handles never supply path components, the read never leaves the store, and source-bound archives are re-admitted against their source.
retrieve_head
Retrieve the first n lines of an archived entry, with a line-number gutter.
retrieve_json_keys
Describe the JSON structure of an archived entry.
retrieve_tail
Retrieve the last n lines of an archived entry, with a line-number gutter.
retrieve_with_range
retrieve_with_search
should_archive
store
store_background
Persist a terminal background-shell result and guarantee that lean-ctx’s managed cleanup paths retain it for at least one hour.
store_recovery_copy
Store a source-bound, revocable recovery copy of permitted content whose sources are known (G02): the copy can be handed back only while every source in authority is still admitted for the reader. Returns the archive id to put into a recovery handle (ctx_expand(id="…")), or None when the content may not be stored (withheld or restricted text, an incomplete authority, a source that no longer admits, archive disabled).
store_with_authority
store_with_result
tool_of
The tool whose output archive id holds (engine metrics K10).