MemoryWriteNode¶
POC node (FR-27, design §3.4) that persists a single
Episode into an injected memory-store provider — a
MemoryStore such as
stargraph.stores.sqlite_memory.SQLiteMemoryStore.
Constructor¶
| Parameter | Type | Default | Description |
|---|---|---|---|
memory_store |
MemoryStore |
required (positional) | Injected provider implementing the MemoryStore protocol. |
episode_field |
str |
"episode" |
Name of the state field carrying the Episode payload. |
memory_store is positional; episode_field is keyword-only.
State contract¶
- Reads —
state.<episode_field>(defaultstate.episode). - Writes —
{"memory_written": True, "episode_id": episode.id}.
The (user, session, agent) triple is read from ctx. Phase-1's
ExecutionContext Protocol is intentionally minimal (run_id
only), so the node falls back to "anon" / "default" / "default" when
the concrete context object lacks the optional fields. Phase 2 tightens the
Protocol (design §3.4).
Side effects + replay¶
| Field | Value |
|---|---|
SIDE_EFFECTS |
SideEffects.write |
REPLAY_POLICY |
ReplayPolicy.must_stub |
Mutates external state — must be stubbed under replay (FR-33, design §3.4.2).
YAML¶
The memory: store binding lives at the IR top level:
Errors¶
AttributeError—state.<episode_field>missing.- Whatever
MemoryStore.put(...)raises — provider-specific.