On this page
- RiftMemorySystem
RiftMemorySystemRiftMemorySystem.cleanup()RiftMemorySystem.rift_idRiftMemorySystem.space_typeRiftMemorySystem.step_counterRiftMemorySystem.epoch_counterRiftMemorySystem.memory_enabledRiftMemorySystem.increment_step()RiftMemorySystem.reset_step()RiftMemorySystem.increment_epoch()RiftMemorySystem.reset_epoch()RiftMemorySystem.update_context()RiftMemorySystem.clear_context()RiftMemorySystem.describe_state()RiftMemorySystem.create_memory()RiftMemorySystem.register_memory_callback()RiftMemorySystem.unregister_memory_callback()RiftMemorySystem.emit_memory()RiftMemorySystem.create_and_emit_memory()
RiftMemorySystem๏
Receive this surface through rift.space.memory_system; use that owning object's public entry point.
- class RiftMemorySystem(*, rift_id: str, space_type: str, step_counter: int = 0, epoch_counter: int = 0)[source]๏
Internal
Locked source of truth for RiftSpace memory sequencing and shared context.
- Purpose:
Centralize the counters and shared metadata used to build immutable RiftMemory records so command/view/workstation emission can reuse one coherent memory context.
Contract:
Owns step_counter and epoch_counter.
Owns shared memory metadata including rift_id, space_type, and optional CommandOps context fields.
Produces immutable RiftMemory snapshots.
Cleanup is idempotent and clears all owned mutable state.
- Registration:
MELDER KERNEL - guarded. Owned by one RiftSpace; reached through the room.
- Subsystem Context:
The room's memory sequencing hub, paired with the room-local RiftEventSystem (outbound publication). Commands, views, and the workstation all emit through this one object.
- System Context:
Centralizing the counters is what makes room memory COHERENT rather than merely present. step_counter and epoch_counter live in exactly one place, so records emitted from a command, a view, and the workstation share one ordering - if each emitter kept its own counter, the room's history could not be linearized and "what happened before what" would be unanswerable. Producing IMMUTABLE RiftMemory snapshots is the second half: a record that could change after emission would make the history a live view of the present rather than an account of the past. This is the system codegen rooms emit FULL-SOURCE records through, which is why the shared metadata carries rift_id, space_type, and the optional CommandOps context fields - a record has to identify where and under what posture it happened to be worth keeping.
AGENT_ACCESS: internal
- AGENT_PURPOSE:
access: internal. The room's memory-sequencing hub: it owns the step/epoch counters and shared metadata and mints immutable RiftMemory records that command/view/workstation emission share. Read it to understand room memory; you receive the RiftMemory records, not this system.
- property rift_id: str๏
Return the owning Rift id.
- property space_type: str๏
Return the owning space type.
- property step_counter: int๏
Return the current step counter.
- property epoch_counter: int๏
Return the current epoch counter.
- property memory_enabled: bool๏
Return whether memory emission is currently enabled.
- increment_epoch(*, reset_step: bool = True) int[source]๏
Increment the epoch counter and optionally reset step.
- update_context(*, task_name: str | None = None, activity_name: str | None = None, mission_name: str | None = None, agent_name: str | None = None, agent_id: str | None = None, metadata: Dict[str, object] | None = None) None[source]๏
Update shared CommandOps-facing memory context.
- Returns:
None.
- clear_context() None[source]๏
Clear optional CommandOps-facing context and shared metadata.
- Returns:
None.
- describe_state() Dict[str, object][source]๏
Return a detached snapshot of current memory-system state.
- create_memory(*, frame_name: str, action_name: str, metadata: Dict[str, object] | None = None, increment_step: bool = True) RiftMemory[source]๏
Create one immutable Rift memory snapshot.
- Parameters:
frame_name -- Required frame name.
action_name -- Required action name.
metadata -- Optional action-specific metadata.
increment_step -- When True, increments step before capturing the snapshot.
- Returns:
New immutable memory record.
- Return type:
RiftMemory
- register_memory_callback(callback: Callable[[RiftMemory], None]) str[source]๏
Register one callback for emitted memory records.
- Parameters:
callback -- Callback invoked once per emitted memory record.
- Returns:
Stable subscription id for later unregistration.
- Return type:
str
- Raises:
TypeError -- If callback is not callable.
- unregister_memory_callback(subscription_id: str) None[source]๏
Remove one memory callback subscription by id.
- Parameters:
subscription_id -- Subscription id returned by register_memory_callback(...).
- Returns:
None.
- Raises:
ValueError -- If subscription_id is empty.
- emit_memory(memory: RiftMemory) None[source]๏
Emit one memory record to every registered callback.
- Parameters:
memory -- Memory record to emit.
- Returns:
None.
- create_and_emit_memory(*, frame_name: str, action_name: str, metadata: Dict[str, object] | None = None, increment_step: bool = True) RiftMemory[source]๏
Create one memory record and emit it immediately.
- Parameters:
frame_name -- Required frame name.
action_name -- Required action name.
metadata -- Optional action-specific metadata.
increment_step -- When True, increments step before capturing the snapshot.
- Returns:
Emitted immutable memory record.
- Return type:
RiftMemory