Skip to main content

Crate pf_world

Crate pf_world 

Source
Expand description

§pf-world

Captures and restores the world a sandboxed agent inhabits: the filesystem, environment variables, in-flight subprocess state (Linux only via CRIU), and — eventually — an attached browser DOM via CDP.

See agent_docs/world-layer.md for the spec.

§What ships in Phase 2 (this commit)

  • WalkFsCapture: portable rayon-parallel file walker that content-addresses every file into a pf_core::cas::BlobStore and emits a tree manifest. Restorable via restore_tree.
  • EnvCapture: serializes std::env::vars() + cwd, with --scrub-env <regex> redaction.
  • ProcsCapture: CRIU dump on Linux (shellout); on every other host a self-describing JSON placeholder per agent_docs/world-layer.md.

§What’s planned but stubbed

  • macOS APFS clone fast-path via clonefile(2): when the source dir sits on APFS, WalkFsCapture::with_apfs_clone first clones the dir in O(1), then walks the clone — giving a stable read-snapshot without pausing the agent. Wired but not enabled by default; see WalkFsCapture::use_apfs_clone.
  • Linux overlayfs upper-dir capture: deferred to v1.1 (documented in the v2 list of claude-progress.json).

Re-exports§

pub use browser::BrowserBlob;
pub use browser::BrowserCapture;
pub use browser::PageSnapshot;
pub use env::EnvCapture;
pub use fs::FsEntryKind;
pub use fs::FsTree;
pub use fs::FsTreeEntry;
pub use fs::RestoreOptions;
pub use fs::WalkFsCapture;
pub use fs::restore_tree;
pub use fs::restore_tree_with_options;
pub use procs::ProcsCapture;

Modules§

browser
Browser DOM capture via Chrome DevTools Protocol.
env
Environment-variable + cwd capture, with regex redaction.
fs
Filesystem layer: walk + content-address + restore.
procs
In-flight subprocess capture.