Expand description
Git-free file snapshots and rewind.
Content-addressed blobs, stat-cached manifests, per-session snapshot logs with mark-and-sweep collection, and a restore planner that captures a rescue point before it writes and deletes only against a tombstone.
The engine knows nothing about its host: it takes opaque string ids and
absolute paths, and never reads or writes the user’s git state. Git
appears only as one source of file names, and a directory that has
never seen git init is a first-class workspace.
§What is covered, and what is not
A file enters the tracked set three ways: the project’s git index lists it, a recency walk finds it, or an edit declares it. Each has a shape worth knowing:
- the index cannot see an untracked file;
- the recency walk skips hidden directories and a fixed list of build
directories, drops files over
ScanLimits::max_file_bytes, and keeps at mostScanLimits::max_filespaths per root; - a declared path stays watched for as long as
DeclaredWindowsays, which the host chooses per session and may set toDeclaredWindow::Unlimited.
So a file created by a shell command inside target/, inside a dotted
directory, over the size limit, or beyond the recency budget on a busy
turn is covered only if it also flowed through the host’s edit API.
This is a real gap and it is stated rather than implied: total coverage is
not promised, and scan_report answers “what in my project is not
protected” for any particular workspace.
The rules this crate is built to keep, and the places it does not yet
keep them, are in .specify/memory/constitution.md and
.specify/memory/compliance.md.
Structs§
- Apply
Stats - What an apply managed, and what it could not.
- Blob
Store - Checkpoint
- Checkpoint
Stats - Declare
Outcome - What a declare did.
- Delete
Outcome - What a delete did, and what it declined to touch.
- File
Entry - GcStats
- Gitignore
- Gitignore is a matcher for the globs in one or more gitignore files in the same directory.
- Gitignore
Builder - Builds a matcher for a single set of globs from a .gitignore file.
- Manifest
- Manifest
Store - Recent
- What one root’s recency pass picked up, and what it passed over.
- RefStore
- Restore
Outcome - Restore
Plan - Restore
Target - The state a restore moves the workspace to.
- Scan
- What a scan picked up, and what it passed over.
- Scan
Limits - What bounds the recency partition.
- Snapshot
Ref - Snapshot
Tracker - A session’s tracking decision plus the scope it captures at.
- Thread
Log - Turn
Scope - Where a turn is happening, and how far a scan may reach.
- Workspace
Key - Identifies one workspace’s partition.
- Workspace
Store - One workspace’s records, plus the content store they share with every other workspace.
- Write
Action
Enums§
- Declared
Window - How long a declared path keeps being watched after the turn that last declared it.
- Drop
Reason - Why a file the scan saw is not in the snapshot.
- Hidden
Files - Whether a scan descends into dot-files and dot-directories.
- PreEdit
Image - What a path held immediately before an edit changed it.
- Restore
Kind - Which direction a restore moves the workspace’s undo history, and whose undo stack it touches.
- Session
Start - How this session’s tracking state is decided. Fixed at session start; it never changes while the session runs, so a session’s snapshot chain is always complete-from-the-first-turn or absent.
- Snapshot
Error
Constants§
- DECLARED_
WINDOW_ TURNS - The default window, and a default rather than a rule — see
DeclaredWindow. - DROP_
SAMPLE_ LIMIT - How many drops a per-turn report carries. Small: it is printed every turn, and the reader wants a hint, not an inventory.
- FORMAT_
VERSION - The format version this build reads and writes.
- RESTORE_
TMP_ SUFFIX - Suffix of the sibling a restore writes before renaming into place.
- SAFETY_
TURN_ PREFIX - Turn-id prefix for the safety checkpoint recorded before every restore.
- SNAPSHOT_
IGNORE_ FILENAME - Name of the dedicated snapshot ignore file, in gitignore syntax.
Functions§
- apply_
plan - Apply a plan: write blob contents (atomically, restoring permissions) and remove paths the target recorded as absent. Missing targets are fine.
- canonical_
key - One spelling of a path, so a manifest key does not depend on how the caller happened to write it.
- capture
- Capture the state of
filesinto a new persisted manifest. - capture_
turn - Capture the state of
scopeat the start ofturn_id. - collect_
garbage - Reclaim what nothing references, across every workspace in the store.
- content_
disk_ usage - How many bytes the shared content store holds.
- declare_
edits - Record what
pre_imagesheld before an edit changes them, and register the paths so later captures keep watching them. - find_
workspace_ root - Git-style marker walk-up: return the nearest ancestor of
start(inclusive) containing one ofmarkers. - git_
tracked_ files - Files the project’s own index lists that lie under
root. - is_
ignored - Symmetric protection check: is
pathinvisible to snapshot operations? - load_
ignore - Compile the ignore matcher for
rootfrom its snapshot ignore file. A missing ignore file yields an empty matcher (nothing ignored). - mode_of
- Permission bits to record for a file (
mode & 0o7777), orNonewhere the platform has none to report. - mtime_
parts - Extract
(secs, nanos)of the mtime relative to the unix epoch. Pre-epoch or unreadable mtimes collapse to(0, 0), which simply disables the stat-cache fast path for that file. - plan_
restore - Plan the move from
currenttotarget. - recent_
files - The most recently modified files under
dirthatcovereddoes not already account for — the residue partition. - residue_
in - Stray restore temporaries in
dirthat are old enough to be nobody’s. - residue_
under - Every stray restore temporary under
root, wherever a restore reached. - restore_
scope - What a restore must be asked to look at.
- scan_
report - Everything in
rootsthe scan would leave out of a snapshot, with reasons. - tracked_
files - Everything a capture should look at: the three partitions over
roots, plusalready_known— paths this thread has observed before, whatever partition first brought them in.