| # ============================================================================ | |
| # 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() | |