Memory
Mister Morph memory is append-first and rebuildable.
Architecture
- Source of truth:
memory/log/*.jsonl(WAL) - Read model: markdown projections
memory/index.md(long-term)memory/YYYY-MM-DD/*.md(short-term)
- Projection runs asynchronously; hot path writes only WAL.
Runtime Flow
- Before LLM call: runtime prepares memory snapshot and injects it into prompt blocks.
- After final reply: runtime records raw memory event to WAL.
- Projection worker replays WAL and updates markdown files.
Injection Rules
Memory injection runs only when all conditions match:
memory.enabled = truememory.injection.enabled = true- runtime provides a valid
subject_id - snapshot content is not empty
memory.injection.max_items limits injected summary items.
Writeback Rules
Writeback runs only when:
- final reply is actually published
- memory orchestrator exists
subject_idexists
If final output is empty/lightweight, writeback may be skipped.
Config Keys
yaml
memory:
enabled: true
dir_name: "memory"
short_term_days: 7
injection:
enabled: true
max_items: 50Operational Notes
- If markdown projections are damaged, rebuild from WAL.
- Treat
memory/log/*.jsonlas durable data. - Keep
file_state_diron persistent storage in production.