# AgentFork: Explicit Possibility State for Tool-Using Agents

Sharath VC<br>
Private research draft, 24 November 2026

## Abstract

Tool-using agents often act before uncertainty has been resolved. Their logs may
contain alternative explanations, but those alternatives usually lack a stable
external representation, evidence provenance, or a rule governing when one
alternative becomes actionable. AgentFork is a classically implemented,
quantum-inspired protocol that represents an unresolved question as concurrent
weighted candidates. Versioned events apply inspectable evidence; exact integer
arithmetic updates the candidates; and a one-way lifecycle permits resolution
only through declared thresholds or an explicit authority override.

This paper specifies the implemented v1 kernel and reports both a mechanism
evaluation and a preregistered synthetic local-model evaluation. The Rust
workspace has measured 100% line, function, and branch coverage under the
repository gates, and an independent Python reference reproduces frozen
conformance bytes. In 25 held-out episodes generated only after prompt and
policy freeze, full-threshold state improved paired utility over weight-only by
0.4748 for a frozen Llama 3.1 8B artifact (bootstrap 95% interval 0.1364 to
0.8424). The corresponding Qwen 2.5 14B difference was 0.1564 with an interval
of -0.0028 to 0.3948 and is inconclusive. The margin ablation changed no
outcome; the minimum-evidence gate accounted for the observed difference.
Evidence strengths were poorly calibrated. These mixed results support a
narrow premise—that explicit gating can reduce premature commitment on this
synthetic protocol—but do not establish general agent improvement.

## 1. Problem

An agent investigating an incident may simultaneously consider an expired
token, clock skew, a stale cache, and malformed configuration. Ordinary logs
can list these hypotheses, but a list alone does not answer:

1. Which possibilities remain live?
2. Which external evidence changed them?
3. Has enough evidence accumulated to authorize action?
4. Can the unresolved state survive restart and replay?
5. Can another implementation reproduce the same transition?

AgentFork treats this interval before commitment as protocol state. It is not a
mechanism for exposing private chain-of-thought. Candidate propositions and
evidence observations are intentionally concise, external, and inspectable.

## 2. Scope and terminology

The quantum terminology is an analogy, not a physical claim:

| Analogy | Implemented meaning |
|---|---|
| Superposition | Several concurrently represented candidate states |
| Observation | An evidence event supporting or opposing one candidate |
| Decoherence | Evidence and policy reducing actionable uncertainty |
| Collapse | A terminal resolution event |
| Entanglement | Future explicit relationships among otherwise separate forks |

The v1 implementation uses ordinary deterministic computation. It has no
complex amplitudes, interference, Born-rule measurement, quantum hardware, or
claim that an agent is a quantum system.

## 3. Related work

Belief state under partial observability is established in decision theory.
Kaelbling, Littman, and Cassandra formalized planning and acting in partially
observable stochastic domains and described controllers operating over belief
state [1]. AgentFork is not a POMDP solver: it does not require a transition or
observation model and does not claim optimal control. It instead defines a
small interoperable event representation for explicit candidate state and
resolution governance.

Recent language-model methods also preserve alternatives. Self-consistency
samples diverse reasoning paths and marginalizes their answers [2]. Tree of
Thoughts explores and evaluates multiple textual reasoning paths with search
and backtracking [3]. ReAct interleaves reasoning traces with actions that
gather external information [4]. AgentFork differs in level and purpose: it is
an external state protocol that can sit beneath any of these inference methods,
persist across processes, reject invalid transitions, and record an actionable
resolution basis without retaining private reasoning traces.

These relationships mean the broad concept of “multiple possible states” is
not a novelty claim. The research question is narrower: whether a deterministic
possibility-state and resolution protocol reduces premature commitment in
tool-using agents at acceptable cost.

## 4. Protocol

### 4.1 Event stream

An AgentFork is reconstructed from a contiguous event stream. The first event
opens a question with two or more candidates. Later events apply evidence or
enter one terminal state:

```text
ACTIVE -> RESOLVED | EXPIRED | VETOED
```

Terminal states cannot return to active. Sequence gaps, duplicates, fork-ID
mismatches, unsupported protocol versions, unknown candidates, reused evidence
identifiers, and post-terminal mutations fail closed without partial mutation.

### 4.2 Exact weights

Weights are integer parts on a scale \(S=10^9\). They are not asserted to be
calibrated probabilities. For selected weight \(w\) and evidence strength \(s\):

```text
support: selected_raw = wS + s(S-w)
oppose:  selected_raw = w(S-s)
other:   candidate_raw = wS
```

The raw vector is normalized to \(S\) with integer division. Remaining parts
are assigned by descending fractional remainder; candidate identifier breaks
ties. This makes replay independent of platform floating-point behavior.

Events and materialized state use the RFC 8785 JSON Canonicalization Scheme.
Protocol values contain no floating-point numbers, and sequence numbers are
bounded by the largest I-JSON exact integer. Rust and Python conformance vectors
exercise nested key order and Unicode/escape behavior. Received member order
and whitespace are not trusted for hashing or signature input; values are
decoded and canonically re-encoded first.

### 4.3 Resolution basis

A threshold resolution records minimum leader weight, minimum leader-to-runner
margin, and minimum evidence count. The reducer recomputes all three against
the immediately preceding state. A caller may instead record an authorized
override. The pure reducer validates that the authority reference is present;
identity and authorization verification remain an external trust boundary.

## 5. Implementation and verification

The production kernel is implemented in safe Rust. The core performs no I/O,
network access, clock access, random generation, or model execution. It forbids
unsafe Rust and receives all identifiers and sequencing from the caller.

The current workspace contains:

- `agentfork-core`: types, exact arithmetic, lifecycle, and reducer;
- `agentfork-codec`: versioned JSON and deterministic replay;
- `agentfork-cli`: newline-delimited event replay;
- `agentfork-store`: synchronized immutable event segments with atomic
  same-filesystem publication and fail-closed recovery;
- an independent Python v1 reference model;
- frozen valid conformance vectors;
- deterministic generated tests spanning 8,192 evidence transitions.

Verification at revision `f431747` established 100% stable line/function
coverage and 98/98 measured branches under pinned nightly `2026-11-20`. Store
tests cover orphaned temporary files, malformed and non-contiguous segments,
injected write/sync/publication failures, and same-slot writer contention. The
result should be interpreted narrowly: coverage shows that the declared paths
were executed, not that the implementation is free of defects. Subsequent
recorded campaigns found no missed viable production mutants among 141 caught mutations,
completed 5,000,000 deterministic fuzz executions for each of the decoder and
replay harnesses, exercised a requirement-mapped generated property suite and
eight cross-language invalid streams, and discharged two selected bounded proofs
over the weight constructor and two-candidate normalization. These results do
not verify the full reducer, arbitrary event sequences, storage, liveness, or
agent-task performance. Process-kill testing across filesystems and operating
systems and external review remain release gates.

## 6. Preliminary mechanism evaluation

### 6.1 Research question

Does requiring a leader weight, leader margin, and minimum evidence count avoid
premature terminal decisions in sequential diagnostic fixtures compared with
resolving on the first signal or on weight alone?

### 6.2 Scenarios and policies

Six synthetic scenarios cover authentication, cache invalidation, payment
retry, wire-version mismatch, disk exhaustion, and irreducible network
ambiguity. The first four deliberately begin with strong but misleading
evidence. The disk scenario begins with a strong correct signal. The final
scenario never provides enough discriminating evidence.

Three deterministic policies consume the same evidence:

1. **First signal:** resolve the current leader after one observation.
2. **Weight only:** resolve when the scenario's leader-weight threshold is met.
3. **AgentFork threshold:** require leader weight, margin, and evidence count.

Utility is `+1` for correct resolution, `-1` for incorrect resolution, `-0.25`
for remaining unresolved, less `0.01` per evidence item consumed. This utility
is a declared fixture parameter, not an estimated real-world cost.

### 6.3 Results

| Policy | Correct | Incorrect | Unresolved | Mean evidence | Mean utility |
|---|---:|---:|---:|---:|---:|
| First signal | 1/6 | 5/6 | 0/6 | 1.000 | -0.676667 |
| Weight only | 1/6 | 4/6 | 1/6 | 1.333333 | -0.555000 |
| AgentFork threshold | 5/6 | 0/6 | 1/6 | 3.333333 | 0.758333 |

The full policy waits longer and declines to resolve the intentionally
ambiguous scenario. It also succeeds on fixtures constructed around precisely
that behavior. Therefore this result is a functional demonstration, not an
unbiased estimate of advantage.

The immutable result is `benchmark/results/mechanism-v0.1.json`, generated from
source revision `7834ba9689d29da762e343b4eb662aa818415fe4`. Its SHA-256 is
`fac33e9d31d18fc25dffdadff5043cc8776e93bd8d2bfcac551a0fa4b9dfa8f1`.

## 7. Preregistered synthetic local-model evaluation

### 7.1 Freeze and construction

The prompts, policies, model digests, inference settings, generator, metrics,
and analysis were committed at revision `fe41565` before held-out generation.
The sole generator seed was derived from that commit; no candidate seed was
inspected. The resulting 25 episodes cross five incident domains with five
patterns: misleading early evidence, clear confirmation, competing evidence,
genuine ambiguity, and weak but consistent evidence designed as a conservative
threshold counterexample. Candidate identifiers were randomly assigned generic
option names. Prompts excluded ground truth, pattern names, and evidence labels.

The frozen artifacts were quantized local `llama3.1:8b` and `qwen2.5:14b`
models served by Ollama 0.30.7. Each received one direct-final request per
episode and one independent evidence-classification request per observation.
All 240 exact requests and responses, model digests, durations, token counts,
validated parses, and 550 counterfactual arm outcomes are retained. There were
no retries and no schema-validation failures.

### 7.2 Arms and analysis

The parsed evidence stream was shared by five deterministic arms: first signal,
weight only, no margin, no evidence count, and the full threshold. The same
arms were evaluated against oracle generator labels to separate policy behavior
from extraction error. A secondary direct-final arm saw the complete evidence
sequence in one request, but its call budget differs and it is not the primary
comparison.

For resolve episodes, correct selection receives utility +1, a wrong selection
-1, and unresolved -0.25. For ambiguity episodes, deferral receives +1 and any
selection -1. Every consumed observation subtracts 0.01. The preregistered
primary contrast is paired mean utility, full threshold minus weight only,
reported separately by model with 10,000-resample percentile bootstrap
intervals over the fixed 25 episodes.

### 7.3 Results

| Model and arm | Correct | Incorrect resolutions | Deferrals | Mean observations | Mean utility |
|---|---:|---:|---:|---:|---:|
| Llama direct final | 9/25 | 15 | 1 | 3.80 | -0.2880 |
| Llama parsed weight only | 14/25 | 10 | 5 | 1.84 | 0.1316 |
| Llama parsed full threshold | 19/25 | 2 | 8 | 3.36 | 0.6064 |
| Qwen direct final | 12/25 | 13 | 0 | 3.80 | -0.0780 |
| Qwen parsed weight only | 20/25 | 2 | 8 | 2.88 | 0.6612 |
| Qwen parsed full threshold | 22/25 | 0 | 8 | 3.24 | 0.8176 |
| Oracle full threshold | 20/25 | 0 | 10 | 3.00 | 0.7200 |

For Llama, the paired full-minus-weight utility difference was 0.4748 with a
95% bootstrap interval of [0.1364, 0.8424]. For Qwen it was 0.1564 with an
interval of [-0.0028, 0.3948]. Under the preregistration, the former is positive
on this benchmark and the latter is inconclusive. Full gating reduced incorrect
resolutions but consumed 1.52 more observations for Llama and 0.36 more for
Qwen. Accuracy intervals and all arms are reported in the immutable result.

### 7.4 Ablations and extraction failures

The margin did no measurable work: removing it changed no decision, observation
count, or utility across all 50 model/episode pairs. Removing the minimum
evidence count exactly reproduced weight-only. Thus this run supports an
evidence-count gate, not the separate value of the declared margin.

All extraction responses were structurally valid, but strength was not
calibrated. Llama matched candidate plus direction on 74/95 observations and
the full candidate/direction/strength label on 18/95; it assigned maximum
strength to every observation. Qwen achieved 88/95 and 23/95 respectively,
with mean parsed strength 0.750 against mean labeled strength 0.618. Qwen's
parsed full arm outperformed the oracle arm partly because it promoted weak
evidence. That is an overstatement artifact, not probability calibration.

The complete preregistration and report are
`benchmark/empirical/PREREGISTRATION.md` and
`benchmark/results/empirical-v1/REPORT.md`. The run can be semantically checked
from raw responses with `bash scripts/check-empirical.sh`.

## 8. Threats to validity

1. The scenario templates and utility were written by the system designer, who
   knew the hypothesis; instances are synthetic rather than an operational
   sample.
2. Twenty-five balanced episodes and two quantized artifacts provide weak
   population evidence. Bootstrap intervals resample only this fixed set.
3. Parsed arms use more calls than direct final, and there was one deterministic
   run per model rather than a distribution over sampling seeds.
4. The update rule is heuristic, not Bayesian inference or calibrated belief;
   the measured evidence-strength overstatement demonstrates this risk.
5. Resolution thresholds can defer useful action or create denial-of-service
   pressure through perpetual ambiguity.
6. Evidence provenance is text in v1; cryptographic verification and authority
   enforcement are outside the current kernel.
7. Full code coverage and cross-language agreement can reproduce the same
   specification error.
8. Exact instances were generated after prompt freeze, but no external
   contamination assay or independently authored benchmark was performed.

## 9. Conclusion

AgentFork makes unresolved possibility state a deterministic, replayable, and
governed object. The kernel and independent reference establish the mechanics
within their tested scope. The preregistered synthetic evaluation adds mixed
model evidence: full gating produced a positive paired result for one frozen
model and an inconclusive result for another, reduced premature resolutions,
and required more observations. It also showed that the margin was inert and
model-produced strengths were uncalibrated. The next decisive evidence is an
independently authored, budget-matched operational benchmark, not a broader
claim based on these templates.

## References

1. L. P. Kaelbling, M. L. Littman, and A. R. Cassandra. “Planning and Acting in
   Partially Observable Stochastic Domains.” *Artificial Intelligence* 101,
   99–134, 1998. DOI: [10.1016/S0004-3702(98)00023-X](https://doi.org/10.1016/S0004-3702(98)00023-X).
2. X. Wang et al. “Self-Consistency Improves Chain of Thought Reasoning in
   Language Models.” 2022. [arXiv:2203.11171](https://arxiv.org/abs/2203.11171).
3. S. Yao et al. “Tree of Thoughts: Deliberate Problem Solving with Large
   Language Models.” 2023. [arXiv:2305.10601](https://arxiv.org/abs/2305.10601).
4. S. Yao et al. “ReAct: Synergizing Reasoning and Acting in Language Models.”
   ICLR 2023. [arXiv:2210.03629](https://arxiv.org/abs/2210.03629).
