# Durable data for agents

Use versioned records, exact correlation and leased queues to coordinate repeatable automation.

Canonical URL: https://opennodeflow.dev/wiki/agent-storage/
JSON reference: https://opennodeflow.dev/wiki/agent-storage/index.json
Source snapshot: 2026-10-23

ONF provides durable workspace data for automation that outlives one agent turn or workflow run. Declared [variables](/wiki/variables/) hold typed values within a workspace. [Storage](/wiki/storage/) holds versioned records, conversations, questions and queued work within a workspace plus explicit namespace.

## Select the right scope

A runtime workflow cannot request another workspace through the supported variable/storage bridge. Choose a stable namespace for one automation rather than deriving it from a node label or a transient run ID. Administrative MCP tools take explicit workspace IDs; workspace organization does not add a user authorization boundary.

Lists intentionally omit full private bodies. Use `onf_list_variables` or storage metadata lists for navigation, then deliberately read the selected value/body only when needed. Known credentials can be redacted. Do not roundtrip redacted objects as replacements.

## Write under the correct guard

Variable updates use `expectedRevision`. Storage records/questions/queue entries use `expectedVersion` and operation-specific lease or confirmation fields. For new versioned records, the initial expected version is 0. A conflict is a reason to reread and reconcile; it is not permission to overwrite the current value.

Atomic variable operations include increment, append, compare-and-set and path update. They validate the complete result against the variable's declared contract. A variable binding identifies an exact existing variable/workspace/type; it is not inferred by name after deletion/recreation.

Storage writes commit independently and immediately. A later node error, cancellation or failed output validation does not roll them back. Run storage history can reveal accepted mutations even when the final node result failed.

## Correlate questions before deciding

A stored question carries exact business identity, outbound thread/reply anchors, offered option IDs, expiry and conversation identity. `question.correlate` reports matched, unknown, ambiguous, expired, closed, blocked or general outcomes. Only an exact matched result provides decision routing.

Use `question.decide` rather than a generic edit to select an option. It rechecks version, correlation, actor policy, expiry and the offered option, then records the decision and enqueues work atomically. Free text or a plausible thread name is not sufficient authority to choose an option.

## Coordinate external work explicitly

Queue progression is strict FIFO per conversation. Claiming returns a lease token; await `queue.start` immediately before external work, then acknowledge using the current token/version. Full ordinary reads do not reveal lease tokens. A failed or uncertain head cannot be silently skipped to process later work.

Use stable domain deduplication keys rather than new run IDs. Reusing a key for different content conflicts. After uncertain external completion, inspect the actual target and use an explicit recovery decision. Storage itself does not perform provider calls or guarantee exactly-once external effects.

Scoped clear destroys data and deduplication history and requires exact workspace/namespace confirmations. Retention pruning is separate and preserves relevant tombstones. Neither operation is an automatic repair for an agent error.

---

## Documentation provenance

- `docs/STORAGE.md`
- `docs/VARIABLES.md`
- `docs/RUN-STORAGE-HISTORY.md`
- `shared/storage-model.ts`
- `server/platform-tools.ts`

This page describes maintained source, not a live inventory or an authorization to perform actions.
