Skip to content

simulatecraft.memory.reflection

simulatecraft.memory.reflection

Reflection: periodically distill recent memories into higher-level insights.

The LLM call is injected as a summarizer coroutine so this module stays dependency-free; brains/llm.py wires a pydantic-ai-backed summarizer in.

ReflectionEngine

ReflectionEngine(summarizer: Summarizer, *, every_n_records: int = 20, min_records: int = 5)

Triggers every every_n_records additions to the stream.

Source code in src/simulatecraft/memory/reflection.py
def __init__(
    self, summarizer: Summarizer, *, every_n_records: int = 20, min_records: int = 5
) -> None:
    self.summarizer = summarizer
    self.every_n_records = every_n_records
    self.min_records = min_records