Skip to main content

fork() for AI agents — snapshot, branch, and merge live agent state.

Project description

ProcessFork

git for AI agents. Snapshot, fork, and merge live LLM sessions in 8 ms.

snapshot a 4-hour Claude Code session in 8 ms, fork into 12 attempts, merge the winner back, push to a registry

60-second demo: pf snapshot → pf fork ×12 → pf merge → pf push file:// → pf clone on a fresh store
Replay it locally: asciinema play demo/processfork-demo.cast

crates.io PyPI npm release MIT

CI 200 tests 8 ms snapshot 88.96% line coverage Rust + Py + TS


Why

You're 4 hours into a refactor with Claude Code. The agent has read 200 files, run 47 tests, opened a database, started a dev server. Then it suggests a destructive change.

Today: lose everything, undo by hand, or restart. With ProcessFork: pf snapshot → 8 ms → safe. Try 12 alternatives in parallel, merge the winner back, ship the whole session to a teammate.

It's git — snapshot, branch, merge, push, clone — but for live AI agent state.

Highlights

  • 8 ms snapshots. Full agent state — model + KV-cache + files + tools + reasoning — into one content-addressed .pfimg.
  • 🌳 Real fork & merge. 12 parallel attempts share storage automatically (CoW). Merge the winner with a real 3-way diff (files, tools, trace) — git-style <<<<<<< markers and all.
  • 🔒 Won't double-send your email. HMAC-chained tool-call ledger; restored agents see prior side-effects as facts, not as actions to re-issue. (ACRFence-resistant.)
  • 🤝 Drop-in for Claude Code, LangGraph, OpenInterpreter, vLLM, SGLang, AutoGen, CrewAI.
  • 📦 Single binary, MIT, Rust core, Python + TypeScript SDKs. 200+ tests.

Quick start (60 seconds)

# install the CLI:
cargo install processfork                      # → `pf` on your $PATH

# snapshot a directory:
mkdir /tmp/sandbox && echo "fn main() {}" > /tmp/sandbox/main.rs
pf snapshot --agent-id demo --fs-root /tmp/sandbox
# → sha256:1c2497b0…   ⏱ 8 ms

# edit something, snapshot again, see the diff:
echo "fn main() { println!(\"hi\") }" > /tmp/sandbox/main.rs
pf snapshot --agent-id demo --fs-root /tmp/sandbox --name v2
pf log
pf diff <first-cid> <second-cid>

Prefer Python? pip install processfork. TypeScript? npm install @processfork/sdk.

The full 60-second demo (snapshot → fork ×12 → merge → push → clone on a fresh store) is bash demo/script.sh. Runs end-to-end on a laptop. No GPU, no API keys.

When you'd reach for it

Situation Command
Agent about to do something destructive pf snapshot pre-rm-rf
Stuck — want to try 12 approaches in parallel pf fork -n 12 --explore "fix bug"
Hand a complex session to a teammate pf push hf://you/session-name
Time-travel debug ("when did it go wrong?") pf log then pf checkout <CID>
RL rollout fabric for agent training snapshot, fan out, score, merge

Use it with your stack

Adapter Status What it gives you
Claude Code ✅ ships now /snapshot, /fork, /merge slash-commands inside any session
LangGraph ✅ ships now drop-in BaseCheckpointSaver (full 4-layer, not just state dict)
OpenInterpreter ✅ ships now interpreter.snapshot("pre-rm-rf") then .checkout("pre-rm-rf")
AutoGen ✅ ships now atomic snapshot across a whole agent group's state
CrewAI ✅ ships now CrewMemory drop-in; every step time-travelable
vLLM ✅ ships now bit-exact KV-cache snapshot/restore (V0 + V1 engine via collective_rpc)
SGLang ✅ ships now live RadixCache k_buffer/v_buffer capture, mock-mode parity tests

How it works

ProcessFork captures the five things that together make up a live agent — atomically — into one content-addressed file:

Layer What it captures
Model LoRA / IA³ / full-finetune weight diffs, in-place TTT updates
Cache Paged KV-cache, content-addressed per page (CoW across forks)
World Filesystem, env, in-flight subprocesses, browser DOM
Effects Append-only ledger of irreversible tool calls (HMAC-chained)
Trace Chat + tool-call message log

Identical content shares storage automatically — 12 parallel forks use ~1.5× the space of one, not 12×. The merge engine handles each layer with the right algorithm: git-style 3-way diff for files, TIES + DARE for model weights, an HMAC chain that defends against semantic-rollback attacks (ACRFence), and an LLM-summarized "what branch B learned" patch injected into branch A's reasoning trace without re-prefilling the cache.

Architecture deep-dive · Three-way merge protocol · Engineering specs

Status

v1.0.4 tagged. Closes 4 follow-up audit findings: --trace-from-jsonl now validates JSON content per line, real snapshot quiescence via --pause-pid (SIGSTOP/SIGCONT RAII guard), the 3 adapter recorders (Claude Code / OpenInterpreter / AutoGen) now persist their recorded tool calls into the effects ledger end-to-end (closing the ACRFence claim), and examples/02 reflects the live HF/file:// registries. v1.0.3 security advisories PF-SA-2026-001 (Zip Slip) and PF-SA-2026-002 (env-var leakage) remain in force — operators on v1.0.0–v1.0.2 should still upgrade and rotate any secrets that may have been in their environment at snapshot time.

metric observed target
Snapshot p50, synthetic 4-layer fixture (macOS arm64) 7.9 ms < 500 ms p99
Snapshot p50, real GPU host (Modal A10G, 64 × 4 KiB) 42 ms (warm) < 500 ms p99
Bit-exact KV-cache replay, vLLM 0.6.6 + TinyLlama-1.1B on A10G ✅ verified — 38 619 KV pages snapshotted, restored, regenerated text byte-identical out_a == out_b
Cache capture, 64 pages 531 µs
12-fork ÷ 1-fork storage ratio well < 1.5× ≤ 1.5×
Total tests passing 200

Synthetic-fixture numbers come from cargo bench --workspace. GPU numbers come from modal run scripts/gpu-validate-modal.py; raw JSON lives in benchmarks/gpu-validation/ and the breakdown in benchmarks/RESULTS.md. vLLM ≥0.10 (V1 engine, subprocess-worker architecture) is the v1.0.2 milestone — the v1.0.1 adapter targets V0's directly-introspectable CacheEngine.

Install

cargo install processfork                          # Rust CLI (the `pf` binary)
pip   install processfork                          # Python SDK
npm   install @processfork/sdk                     # TypeScript SDK

Per-adapter packages (one each on PyPI):

pip install processfork-claude-code
pip install processfork-langgraph
pip install processfork-openinterpreter
pip install "processfork-vllm[vllm]"               # needs CUDA + vllm ≥ 0.10
pip install "processfork-sglang[sglang]"           # needs CUDA + sglang ≥ 0.5
pip install "processfork-autogen[autogen]"
pip install "processfork-crewai[crewai]"

Build from source if you want to hack on it:

git clone https://github.com/manav8498/processfork && cd processfork
cargo build --release -p processfork               # → target/release/pf

Full build-from-source instructions in docs/install.md. Pre-built wheels cover macOS arm64, Linux x86_64, and Linux aarch64; macOS Intel + Windows wheels arrive in v1.0.1 (operator: same package, just more platforms).

Repo layout

crates/      Rust workspace (10 crates: pf-core, pf-cache, pf-world, pf-effects,
             pf-model, pf-merge, pf-registry, processfork (CLI, the `pf` binary), pf-py, pf-ts)
adapters/    7 first-party integration packages
benchmarks/  PFBench harness + Criterion microbench
docs/        mdBook source (25+ pages)
examples/    8 self-contained runnable examples
demo/        60-second demo recording script

Docs

Your first fork (5 min) · 60-second demo · Architecture · Merge protocol · Security model · Performance tuning · Engineering specs

Contributing

PRs welcome. The bar is cargo fmt, cargo clippy --all-targets -- -D warnings, cargo test --workspace, plus a green coverage delta. See CONTRIBUTING.md.

License

MIT.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

processfork-1.0.4-cp39-abi3-win_amd64.whl (771.2 kB view details)

Uploaded CPython 3.9+Windows x86-64

processfork-1.0.4-cp39-abi3-manylinux_2_28_x86_64.whl (1.0 MB view details)

Uploaded CPython 3.9+manylinux: glibc 2.28+ x86-64

processfork-1.0.4-cp39-abi3-manylinux_2_28_aarch64.whl (979.1 kB view details)

Uploaded CPython 3.9+manylinux: glibc 2.28+ ARM64

processfork-1.0.4-cp39-abi3-macosx_11_0_arm64.whl (833.0 kB view details)

Uploaded CPython 3.9+macOS 11.0+ ARM64

processfork-1.0.4-cp39-abi3-macosx_10_12_x86_64.whl (963.9 kB view details)

Uploaded CPython 3.9+macOS 10.12+ x86-64

File details

Details for the file processfork-1.0.4-cp39-abi3-win_amd64.whl.

File metadata

  • Download URL: processfork-1.0.4-cp39-abi3-win_amd64.whl
  • Upload date:
  • Size: 771.2 kB
  • Tags: CPython 3.9+, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for processfork-1.0.4-cp39-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 3fd5fa2a5199f0ef27ace07517306ea96cf751e05ac8d416dfc0b72746177c6d
MD5 615d6ebf5c9a12273222a71125f64af2
BLAKE2b-256 ad4bc7e7e932bce49bec5b2ba76a486b67f44143702b9e1309239d91cecbc340

See more details on using hashes here.

Provenance

The following attestation bundles were made for processfork-1.0.4-cp39-abi3-win_amd64.whl:

Publisher: release.yml on manav8498/processfork

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file processfork-1.0.4-cp39-abi3-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for processfork-1.0.4-cp39-abi3-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 c4927d1a1fe57f2cadd932b6f638cfbc8c91927a8119246f672b7dd5f4e9a63c
MD5 a71008783ee0649d68024a2856f49937
BLAKE2b-256 6ee16174028f23a923dcf22a69be23d36a15b919e206fc9d98e5bbe380fdbc71

See more details on using hashes here.

Provenance

The following attestation bundles were made for processfork-1.0.4-cp39-abi3-manylinux_2_28_x86_64.whl:

Publisher: release.yml on manav8498/processfork

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file processfork-1.0.4-cp39-abi3-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for processfork-1.0.4-cp39-abi3-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 47414ebe792c479c5fa470315f995518a64d78e0375ec20ee9962fb04640f0e0
MD5 de0f077185334ccd41bda6b9b3338bb5
BLAKE2b-256 f1f2558743e4fdeb8e1122f601e5a8b3188f9afd2300143e4547c05702e72d3e

See more details on using hashes here.

Provenance

The following attestation bundles were made for processfork-1.0.4-cp39-abi3-manylinux_2_28_aarch64.whl:

Publisher: release.yml on manav8498/processfork

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file processfork-1.0.4-cp39-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for processfork-1.0.4-cp39-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d6fc6d9e6a35f85fe30d4724bb0eb65a76680a8dd388cae691a3e54704945134
MD5 3acafa0f1e3d7ef28483fe545f8ea0ba
BLAKE2b-256 f8e10fa5a7ace411ce1b6bfbf25bb98f6bbaa9e51471a307293e32662afe28a4

See more details on using hashes here.

Provenance

The following attestation bundles were made for processfork-1.0.4-cp39-abi3-macosx_11_0_arm64.whl:

Publisher: release.yml on manav8498/processfork

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file processfork-1.0.4-cp39-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for processfork-1.0.4-cp39-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 0ea1ab9463aa8738370bdc63641c7aa625ef644c497cb129e3f6cbcb4ea2c763
MD5 770610ef7f696e3642f07ed9d594f5b4
BLAKE2b-256 14070cc730e4f34b4774ad7e672e80b531b31a6d75c67de53caef9df7372b30b

See more details on using hashes here.

Provenance

The following attestation bundles were made for processfork-1.0.4-cp39-abi3-macosx_10_12_x86_64.whl:

Publisher: release.yml on manav8498/processfork

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page