# Persistent Memory

> This skill should be used when the user asks the AI to remember information across sessions, keep long-term memory, recall prior context, or distill accumulated notes. Trigger phrases include "记住", "记下来", "长期记忆", "别忘记", "跨会话", "recall", "remember", "memory". It implements a file-based memory system with dated daily logs, a curated MEMORY.md, topic search, and periodic distillation.

- Skill: `whaojie797-design/persistent-memory` (Agent Skill, multi-file: 3 files)
- Install (CLI): `npx skillmds@latest add whaojie797-design/persistent-memory`
- Raw SKILL.md: https://api.skillmd.com/api/skills/whaojie797-design/persistent-memory/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: whaojie797-design (https://skillmd.com/u/whaojie797-design)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/whaojie797-design/persistent-memory

---


# 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.md` for 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.md` by topic, then delete the old log.
- Merge, never overwrite `MEMORY.md` blindly.

## 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.

