This guide defines the ReAct data model after the thread -> context materialized-view rename.
- Core append-only event log:
agent.state[:__thread__](Jido.Thread). - ReAct materialized LLM state:
agent.state[:__strategy__].context(Jido.AI.Context). - In-flight turn state:
agent.state[:__strategy__].run_context.
Jido.Thread remains the source-of-truth audit log. ReAct context is a deterministic projection for LLM input.
Payload fields:
context_refrole(:user | :assistant | :tool)content- optional
tool_calls,tool_call_id,name,thinking request_id,run_id
Payload fields:
op_idcontext_refoperation
Operation map fields:
type(:replaceimplemented now,:switchimplemented now)reason(:manual | :restore | :compaction | :system)result_contextfor:replace(full context snapshot)- optional
base_seq,meta
contextrun_contextactive_context_refpending_context_op(deferred while run active, latest wins)applied_context_ops(bounded op-id dedupe list)projection_cursor_seq
- Run start:
- use materialized
contextforactive_context_ref - append user
:ai_messageto core thread - initialize
run_context
- Run progression:
- append assistant/tool
:ai_messageentries as runtime events arrive - append drained steering/injection input as user
:ai_messagewhen runtime emits:input_injected - update
run_contextin lockstep
- Context modify during active run:
- store only
pending_context_op - do not mutate
run_contextmid-flight
- Terminal transition:
- finalize run state first
- apply deferred op second (append
:ai_context_operation, then update materialized context)
For a lane (context_ref):
- find latest
:replaceanchor - fold subsequent
:ai_messageevents by sequence - produce deterministic
Jido.AI.Contextat any seq boundary
- ReAct steering is user-style only in this version
- drained
steer/injectinput projects asrole: :user - hidden/system-role steering is not projected or persisted
op_id is required for deterministic operation semantics. If already applied:
- no duplicate core-thread append
- no duplicate materialized mutation
Compaction is represented as a normal context operation:
type: :replacereason: :compactionresult_context: compacted snapshot- provenance in
meta
Core thread remains append-only.
ReAct runtime/checkpoint payload is now context-only:
threadkey removed- token payload version bumped (
v2,rt2.prefix) - legacy payloads with
threadkey are rejected