persistent-memory
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChinesePersistent Memory
持久化内存
Use this skill as the single memory system for this repository.
请将该Skill作为此仓库的唯一内存系统使用。
Commands
命令
Use either command style:
python3 .agents/skills/persistent-memory/scripts/memory.py <command>.agents/skills/persistent-memory/scripts/pmem <command>
Supported commands:
init- (database-only health check)
sync cleanup-legacybackfill-embeddings --batch 500prune --source "<label>" [--older-than <days>]search "<query>" --limit 8add "<memory text>" --tags "<comma,tags>" --source "assistant"recent --limit 10stats
可使用以下任意一种命令格式:
python3 .agents/skills/persistent-memory/scripts/memory.py <command>.agents/skills/persistent-memory/scripts/pmem <command>
支持的命令:
init- (仅数据库健康检查)
sync cleanup-legacybackfill-embeddings --batch 500prune --source "<label>" [--older-than <days>]search "<query>" --limit 8add "<memory text>" --tags "<comma,tags>" --source "assistant"recent --limit 10stats
Required Workflow
必备工作流
- Initialize memory in a fresh workspace:
pmem init
- At the start of substantial tasks:
- (database-only health check)
pmem sync pmem search "<topic keywords>" --limit 8
- When user explicitly says or when a durable preference/fact is learned:
remember
pmem add "<memory text>" --tags "<tags>" --source "assistant"
- Before finalizing memory-sensitive work, verify recall state:
pmem stats
- 在新工作区中初始化内存:
pmem init
- 在执行重要任务前:
- (仅数据库健康检查)
pmem sync pmem search "<topic keywords>" --limit 8
- 当用户明确说出“记住”或获取到持久化偏好/事实时:
pmem add "<memory text>" --tags "<tags>" --source "assistant"
- 在完成对内存敏感的工作前,验证召回状态:
pmem stats
One-Time Migration (If Upgrading From Older Setup)
一次性迁移(从旧版本升级时)
- Remove legacy imported rows:
pmem cleanup-legacy
- Generate vectors for existing notes:
pmem backfill-embeddings
- 删除旧版导入的记录:
pmem cleanup-legacy
- 为现有笔记生成向量:
pmem backfill-embeddings
Storage Rules
存储规则
- Store durable preferences, long-lived facts, stable workflows, and repeated constraints.
- Do not store noisy one-off transient details unless requested.
- Keep entries concise and specific.
- Prefer tags that improve retrieval quality (,
preferences,calendar,comms).product
- 存储持久化偏好、长期事实、稳定工作流以及重复出现的约束条件。
- 除非有要求,否则不要存储杂乱的一次性临时细节。
- 确保记录简洁且具体。
- 优先使用能提升检索质量的标签(如、
preferences、calendar、comms)。product
Retrieval Rules
检索规则
- Use targeted search queries instead of broad terms.
- Keep default low unless deeper recall is needed.
--limit - automatically reinforces recalled entries by updating
searchandhits.last_seen_at - are analytics-oriented and not used as a direct ranking boost.
hits - Search uses hybrid retrieval: lexical + semantic.
- Semantic search tries first and auto-falls back to Python cosine if needed.
sqlite-vec
- 使用针对性的搜索查询,而非宽泛的术语。
- 除非需要深度召回,否则保持默认的值较低。
--limit - 命令会通过更新
search和hits字段自动强化已召回的记录。last_seen_at - 字段用于分析,不会直接作为排名提升的依据。
hits - 搜索采用混合检索方式:词法检索 + 语义检索。
- 语义检索会优先尝试,必要时自动回退到Python余弦相似度计算。
sqlite-vec
Bootstrapping and Recovery
引导与恢复
- If is missing, run
.memory/.pmem init - is a lightweight database-only check (no markdown import/export).
pmem sync - If semantic mode degrades, run to inspect
pmem statsandsemantic_backend.embedding_coverage - For command examples and quick troubleshooting, read .
references/usage.md
- 如果目录缺失,请运行
.memory/。pmem init - 是轻量级的仅数据库检查(不涉及Markdown导入/导出)。
pmem sync - 如果语义模式性能下降,请运行检查
pmem stats和semantic_backend。embedding_coverage - 如需命令示例和快速故障排查,请查阅。
references/usage.md