Persistent Memory
Overview
Give the agent durable, cross-session memory through a simple file-based system. Avoid context amnesia by persisting facts, preferences, and decisions to disk, retrieving them on demand, and periodically distilling raw daily logs into a compact long-term record.
When to Use
- The user says "记住 X", "记下来", "长期记忆", "别忘记", "recall X", "remember", "memory", "跨会话上下文".
- After completing substantive work that should survive future sessions.
- When the user references something discussed in a prior session.
Memory Layout
Use a memory directory (default ./memory/ or the project's .novera-ai-skills/memory/). Two file types:
YYYY-MM-DD.md— append-only daily log for ephemeral, dated events.MEMORY.md— curated long-term notes: durable facts, user preferences, project conventions, decisions.
Procedures
1. Write (remember)
- Durable fact / preference / convention → append a concise bullet to
MEMORY.md(group by topic). - Ephemeral / dated event → append to today's
YYYY-MM-DD.md(create with a date header if missing). - Keep entries atomic and scannable. Never store secrets unless explicitly requested.
2. Recall (search)
- Identify topic keywords, then search the memory directory with Grep or
scripts/search_memory.py. - Prefer
MEMORY.mdfor durable facts; use daily logs for dated specifics. - Read the matched file(s) for full context before answering.
3. Distill (periodic)
- When a daily log is older than 30 days: merge its durable insights into
MEMORY.mdby topic, then delete the old log. - Merge, never overwrite
MEMORY.mdblindly.
Bundled Resources
scripts/search_memory.py— deterministic keyword search across the memory directory (avoids loading the whole tree into context).references/schema.md— exact file formats and naming rules.
Guardrails
- Daily logs are append-only; never delete today's log.
- Do not invent memories. If unsure whether something was stored, search first.
- Respect privacy: do not persist secrets or sensitive personal data without explicit instruction.