Skip to main content

Module workspace_snapshot

Module workspace_snapshot 

Source
Expand description

Cheap workspace environment-delta observability.

Long-horizon agents operate in a changing environment: files are written, processes mutate state, git trees move. The harness needs a fast way to detect that the environment drifted between turns so it can re-ground assumptions instead of trusting a stale picture.

WorkspaceSnapshot captures a lightweight fingerprint of every tracked file (size + mtime + a short content hash of the head), and diff computes added/changed/removed paths. Snapshots are cheap enough to take at each turn boundary and to persist as a derived view.

Structs§

FileStat
A compact fingerprint of a single file.
SnapshotDelta
The difference between two workspace snapshots.
WorkspaceSnapshot
A point-in-time fingerprint of a workspace’s tracked files.

Functions§

capture
Capture a snapshot of workspace, skipping VCS/ build/ cache directories.
diff
Compute the delta from old to new.
is_drift
Whether the delta indicates meaningful environment drift.
load_json
Load a previously persisted snapshot.
save_json
Persist a snapshot as JSON (e.g. as a session derived view).
snapshot_path
Resolve the on-disk path for a session’s environment snapshot.