iii-state
v0.12.0Distributed key-value state management with reactive change triggers.
skill doc
iii-state
indexiii-state
The iii-state worker is a server-side key-value store. Values are addressed by a scope (namespace) and a key, shared across every worker connected to the engine, and persisted through a pluggable adapter (kv, redis, or bridge). It does not push updates to clients — reactivity is delivered by a state trigger type that fires on every create, update, and delete.
Callers reach the store through six engine functions invoked with iii.trigger({ function_id: 'state::...', payload }). Use them when you need shared state between functions without standing up a separate database, when a counter or per-entity document needs atomic partial updates, or when downstream functions need to react to data changes.
state::*functions (iii-state::state::*) — CRUD and atomic partial-update operations against the configured adapter.statetrigger type — firesstate:created,state:updated, orstate:deletedevents after every successful mutation. Triggers register viaiii.registerTrigger({ type: 'state', ... })with optionalscope,key, andcondition_function_idfilters and are not invoked throughstate::*. See React to state changes.
Adapter notes: kv is the default and supports in_memory or file_based persistence; redis proxies state to a Redis backend; bridge forwards operations to a remote III Engine. The function surface is identical across adapters.
How-tos
state::*
state::set— write or replace the value at ascope/keyand fan out astate:createdorstate:updatedevent.state::get— read one value when you already know thescopeandkey.state::delete— remove a key and emit astate:deletedevent with the prior value.state::update— apply ordered atomic ops (set,merge,increment,decrement,append,remove) instead of a read-modify-write cycle.state::list— enumerate every value stored in a scope.state::list_groups— discover which scopes contain data.
state triggers
- React to state changes — register a handler and
statetrigger to run side effects whenstate::set,state::update, orstate::deletemutates a watchedscope/key.