File size: 1,192 Bytes
9ebfd41 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | # ============================================================================
# memory.py — working memory for the Grounded Theory workbench (stub)
# ============================================================================
#
# This is a scaffolding stub. Future rounds will grow this into a real
# per-run memory that nodes can read from and write to for inter-node
# continuity beyond what fits in the TypedDict state.
#
# For round 1 this is just a dict with a consistent interface, so nodes
# that want to remember something across invocations have a place to
# put it. Not currently used by any real node.
# ============================================================================
class WorkbenchMemory:
"""Tiny in-process memory store. Keyed by arbitrary string."""
def __init__(self):
self._store = {}
def get(self, key, default=None):
return self._store.get(key, default)
def put(self, key, value):
self._store[key] = value
def clear(self):
self._store.clear()
def items(self):
return list(self._store.items())
# Module-level singleton. Nodes can import and use, or ignore.
memory = WorkbenchMemory()
|