# Use durable workspace storage

Persist guarded records, conversations and decisions in explicit namespaces with immediate commit semantics.

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

Storage persists records, conversations, questions and queues across events and runs. Its scope is the executing workspace plus an explicit namespace. Choose a stable namespace for one automation, such as `examples.document-review`; a node label or agent name does not infer it.

## Browse intentionally

Open Storage and choose workspace/namespace. Initial reads load namespace summaries rather than every private payload. Browse returns bounded metadata pages; Open reads one chosen key. Switching scope clears the previously displayed body and ignores stale responses from an earlier selection.

Create a record with expectedVersion zero. Read its current version before replacing/deleting it. A stale version conflicts instead of overwriting a concurrent update. Namespaces are logical scope, not a hostile-code security boundary in the trusted installation.

## Call from code

```ts
const store = context.storage('examples.document-review');
const before = await store.request('record.get', {key:'document-123'});
return {result:before};
```

The runtime forces the executing workflow's workspace. Await each request. Calls commit independently and immediately, so a later output error, cancellation or downstream failure does not roll back an accepted write. This differs from staged node-local `context.state`.

Runtime storage/variable IPC is bounded to 500 requests per node attempt, 16 in flight and a 1.2 MB envelope. Library tests use disposable memory-only storage that is discarded when that test ends; they do not inspect an installed persistent namespace.

## Records and typed graphs

`record.get` returns a record envelope or null. `record.put` requires key, data and expectedVersion, with optional expiry/create-if-absent policy. List operations provide cursors and metadata-oriented defaults. A lost acknowledgement should be reconciled through a read or stable identity rather than rewritten with guessed guards.

Operation nodes use named request/result types and require namespace configuration. Build requests with matching Encode, run the operation, then Decode the named result. Custom type IDs/versions remain nominal contracts. Optional missing values can skip dependent nodes; wire only fields that the chosen branch actually provides.

## Conversations and decisions

Create a conversation before its questions or queued work. Identity is an exact map of nonempty stable string fields, not a display name or guessed timestamp. Messages have stable IDs and bounded history.

Question correlation checks identity, actor policy and exact thread/reply anchors. Results distinguish matched, unknown, ambiguous, expired, closed, blocked and general. Only a matched result carries routing. General comments are not choices.

Use `question.decide` to select a stored option. It rechecks version, correlation, actor, expiry and conversation, then records the decision and enqueues work in one transaction. A generic question edit is not an equivalent decision operation.

## Retention and recovery

Prune removes eligible bodies while preserving correlation/deduplication tombstones. Scope clear removes data and history and requires exact workspace/namespace confirmations; active leases block it. Do not use clear to retry uncertain work.

Record bodies are bounded to 256 KiB, queue payloads to 1 MiB, JSON nesting to 32 and list pages to 200. Preserve encrypted storage with the complete database/key backup. See [queues](/wiki/queues/) for effect-safe dispatch and [run storage history](/wiki/run-storage-history/) for committed transitions.

---

## Documentation provenance

- `docs/STORAGE.md`
- `docs/AUTHORING.md`
- `docs/RUN-STORAGE-HISTORY.md`

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