StateFork: Branchable Infrastructure for Agent Exploration

Jiakai Xu, Tianle Zhou, Georgios Liargkovas, Danielle Gillai, Ruizhe Fu, Patrick Shen, Eugene Wu, Kostis KaffesarXiv 2026

TL;DR

StateFork and Waypoint provide a high-performance "save-game" system for AI agents exploring terminal environments. By combining efficient filesystem layering with process checkpointing, this infrastructure allows agents to branch, backtrack, and reuse intermediate states, achieving 26% higher task accuracy and up to 70% faster exploration than traditional methods.

What Problem Does This Paper Address?

When a human solves a complex coding problem, they often try a path, realize it’s a dead end, and "undo" their changes to try something else. For AI agents, this "exploration" is critical for success. However, while backtracking in a pure reasoning task is as simple as deleting text, backtracking in a computer-use environment is a systems nightmare.

Every command an agent runs—like pip install, rm -rf, or starting a database—mutates the environment. To branch from an intermediate point, the system must satisfy two requirements:

  1. Observation Equivalence: The restored state must be indistinguishable to the agent from the original state (files, shell variables, and running processes must match).
  2. Physical Efficiency: Creating and restoring these states must be fast and "cheap" in terms of storage.

Existing solutions fail this balance: Replay (re-running all commands from the start) is too slow for deep search trees; Docker/VM snapshots are too heavy and slow for fine-grained exploration; and Filesystem-only snapshots lose critical context like running servers or shell aliases.

Methods

The authors propose a two-layered stack to solve this, as illustrated in the terminal-agent stack:

Figure 1. Terminal-agent stack (our work in green). An agent or search policy expands a logical tree over command– observation trajectories. StateFork provides the logical con- trol plane: it exposes branchable sessions, chooses whether branch points are physical or virtual, and maps logical oper- ations to substrate-specific restore mechanisms. Execution substrates materialize logical branch points using mecha- nisms such as replay-to-node, filesystem snapshots, and con- tainer/VM snapshots; Waypoint is our optimized substrate for terminal agents, capturing the task-facing execution- session state: filesystem, process/memory, and persistent terminal-session state.

1. StateFork: The Logical Control Plane

StateFork separates the search algorithm (like MCTS) from the physical state management. It exposes a simple API (snapshot, restore, cleanup) to the agent.

  • Smart Decider: A key innovation within StateFork that decides whether to create a "Physical" checkpoint (expensive to save, fast to load) or a "Virtual" one (free to save, but requires replaying a few commands to load). This optimization significantly reduces storage and latency.

2. Waypoint: The Physical Substrate

Waypoint is a specialized engine designed specifically for terminal sessions. It captures the "Execution Session" boundary using three coordinated Linux primitives:

  • OverlayFS: For "in-place" filesystem checkpointing. It only stores the changes (deltas) between branches, avoiding expensive file copying.
  • CRIU (Checkpoint/Restore In Userspace): To freeze and resume the entire process tree, including memory and open sockets.
  • Persistent PTY: A long-lived pseudo-terminal that preserves shell-local state like exported variables and the current working directory.
Figure 3. Waypoint architecture. A live session consists of a command server, a PTY-backed long-lived shell, and process state (purple) running over an OverlayFS-backed ses- sion root. The session root is exposed through the OverlayFS merge view (red), backed by the writable current upperdir (blue) and read-only lowerdirs (green). At checkpoint time, Waypoint stores process state with CRIU, seals the current upperdir and records it by reference rather than copying file data, and updates checkpoint lineage metadata main- tained by the manager. At restore time, Waypoint rebuilds the lowerdir stack from checkpoint ancestry, attaches a fresh writable upperdir, and restores the process tree.

Datasets

The researchers evaluated their system using Terminal-Bench, a comprehensive benchmark consisting of 77 diverse computer-use tasks (e.g., debugging code, setting up services, data processing). To understand the requirements, they manually labeled these tasks to identify what kind of state they rely on.

Table 1. Task-relevant state in manually labeled Terminal- Bench tasks. Categories are not mutually exclusive.

Key Insights and Ideas

  • The "Execution Session" is the Right Abstraction: You don't need to snapshot the entire Virtual Machine. By focusing only on what the agent can observe through the terminal, you can achieve massive speedups without losing correctness.
  • Branching > Restarting: The paper proves that reusing intermediate nodes via Monte Carlo Tree Search (MCTS) is far more sample-efficient than the standard "Pass@k" approach (running $k$ independent trials from scratch).
  • Virtual vs. Physical Trade-offs: Not every node in a search tree needs a full system snapshot. Replaying a few lightweight commands (like ls or cd) is often faster than the overhead of a disk write.

Key Results

  • Higher Accuracy: On Terminal-Bench, StateFork + Waypoint achieved a 26% higher task completion rate than other execution substrates.
  • Massive Speedups: Exploration was up to 70% faster than replaying commands from the root and achieved 10x lower latency for checkpoint/restore operations compared to VM-based baselines.
  • Sample Efficiency: As shown in Figure 2, MCTS (which reuses states) consistently outperforms Pass@20 for the same "node budget" (number of LLM calls).
Figure 2. Terminal-Bench task success as a function of vis- ited search nodes, where each node corresponds to an LLM call. MCTS achieves higher success than pass@20 at the same node budget because it reuses observations and intermediate environment states across sibling branches.

Limitations and Future Work

  • Containment, not Sandboxing: Waypoint is designed for efficiency, not security. It prevents accidental state leakage between branches but is not a hardened security boundary against malicious agents.
  • External State: The system cannot currently snapshot state that lives outside the local machine, such as remote API databases or internet-based services.
  • GUI Support: While currently focused on text-based terminals, the authors suggest that extending Waypoint to support GUIs (by snapshotting headless display servers and window managers) is a promising next step.

Summary updated

BibTeX
@misc{xu2026statefork,
  author = {Jiakai Xu and Tianle Zhou and Georgios Liargkovas and Danielle Gillai and Ruizhe Fu and Patrick Shen and Eugene Wu and Kostis Kaffes},
  title = {{StateFork: Branchable Infrastructure for Agent Exploration}},
  year = {2026},
  eprint = {2609.38648},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2609.38648},
}
Figure