memory-lifecycle

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Memory Lifecycle

内存生命周期

Manage how entities move through status stages in Basic Memory. The core principle: archive, never delete. Completed work is valuable context — move it out of the active view, but keep it in the knowledge graph.
管理Basic Memory中实体在各个状态阶段的流转。核心原则:归档,永不删除。 已完成的工作是极具价值的上下文信息——只需将其移出活跃视图,但仍要保留在知识图谱中。

When to Use

适用场景

  • User says something is "done", "finished", "completed", "submitted", "missed", or "cancelled"
  • Moving entities between status folders (active → archive, pipeline → active, etc.)
  • Reverting a mistaken completion
  • Periodic cleanup of stale active items
  • 用户提到某件事是「done」、「finished」、「completed」、「submitted」、「missed」或者「cancelled」
  • 在不同状态文件夹间移动实体(比如活跃→归档、待启动→活跃等)
  • 撤销错误的完成标记
  • 定期清理过时的活跃条目

Core Principle: Archive, Never Delete

核心原则:归档,永不删除

Deleting a note removes it from the knowledge graph — all its observations, relations, and history disappear. Archiving preserves everything while signaling the entity is no longer active.
undefined
删除笔记会将其从知识图谱中移除,它对应的所有观测信息、关联关系和历史记录都会消失。归档则会保留所有数据,同时标记该实体不再处于活跃状态。
undefined

Good — entity stays in the knowledge graph

推荐做法 —— 实体保留在知识图谱中

move_note → active/ to archive/
move_note → active/ 到 archive/

Bad — knowledge is lost

不推荐做法 —— 知识会丢失

delete_note

The only exception: notes created by mistake (typos, true duplicates) can be deleted.
delete_note

唯一例外情况:错误创建的笔记(拼写错误、完全重复的内容)可以删除。

Folder Conventions

文件夹规范

Organize entities by status using folders. The exact folder names depend on your domain, but follow a consistent pattern:
entities/
  active/          # Currently relevant, in-progress
  archive/         # Completed, no longer active, but worth keeping
  pipeline/        # Future items, not yet started
For tasks specifically:
tasks/
  active/          # Work in progress
  completed/       # Finished work
For any entity type with a clear lifecycle:
[type]/
  active/          # Current
  [end-state]/     # Whatever "done" means for this type
Pick folder names that match your domain. The pattern matters more than the specific names.
使用文件夹按状态归类实体。具体的文件夹名称可根据你的业务领域自定义,但需遵循一致的命名规则:
entities/
  active/          # 当前相关、进行中的实体
  archive/         # 已完成、不再活跃但值得保留的实体
  pipeline/        # 未来待启动、尚未开始的实体
专门针对任务的文件夹结构:
tasks/
  active/          # 进行中的任务
  completed/       # 已完成的任务
对于有明确生命周期的任意实体类型:
[type]/
  active/          # 当前状态的实体
  [end-state]/     # 对应该类型的「已完成」终态文件夹
选择符合你业务领域的文件夹名称即可。命名规则的一致性比具体名称更重要。

Status Detection

状态识别

When the user mentions completion or status change, extract the intent:
SignalStatusAction
"finished", "done", "completed", "shipped"CompleteMove to archive/completed folder
"submitted", "sent", "delivered"CompleteMove to archive/completed folder
"missed", "passed", "skipped", "expired"MissedMove to archive or missed folder
"cancelled", "abandoned", "killed"CancelledMove to archive folder
"paused", "on hold", "deferred"PausedUpdate frontmatter status, keep in place
"restarting", "reopening", "reviving"ReactivateMove back to active folder
当用户提及完成状态或状态变更时,提取对应的操作意图:
触发信号对应状态执行操作
"finished", "done", "completed", "shipped"已完成移动到归档/已完成文件夹
"submitted", "sent", "delivered"已完成移动到归档/已完成文件夹
"missed", "passed", "skipped", "expired"已错过移动到归档或已错过文件夹
"cancelled", "abandoned", "killed"已取消移动到归档文件夹
"paused", "on hold", "deferred"已暂停更新frontmatter状态,保留原位置
"restarting", "reopening", "reviving"重新激活移回活跃文件夹

Workflow

工作流程

1. Find the Entity

1. 查找实体

Search Basic Memory with multiple variations to locate the entity:
python
search_notes(query="quarterly report")
search_notes(query="Q1 report")
If multiple matches come back, present options and ask which one.
If no match is found, ask for clarification — don't guess.
使用多个关键词变体搜索Basic Memory来定位目标实体:
python
search_notes(query="quarterly report")
search_notes(query="Q1 report")
如果返回多个匹配结果,列出选项询问用户要操作的是哪一个。
如果没有找到匹配结果,询问用户进一步澄清,不要猜测。

2. Move the File

2. 移动文件

Use
move_note
to relocate the entity to the appropriate status folder:
python
move_note(
  identifier="tasks/active/quarterly-report",
  destination_path="tasks/completed/quarterly-report.md"
)
The permalink stays the same, so all existing
[[wiki-links]]
and
memory://
URLs continue to resolve.
使用
move_note
将实体移动到对应的状态文件夹:
python
move_note(
  identifier="tasks/active/quarterly-report",
  destination_path="tasks/completed/quarterly-report.md"
)
永久链接保持不变,因此所有已有的
[[wiki-links]]
memory://
URL都可以继续正常访问。

3. Update Frontmatter

3. 更新Frontmatter

After moving, update the status in frontmatter to match:
python
edit_note(
  identifier="quarterly-report",
  operation="find_replace",
  find_text="status: active",
  content="status: completed"
)
If there's a completion date field, set it:
python
edit_note(
  identifier="quarterly-report",
  operation="find_replace",
  find_text="completed:",
  content="completed: 2026-02-22"
)
移动完成后,更新frontmatter中的状态字段以匹配新状态:
python
edit_note(
  identifier="quarterly-report",
  operation="find_replace",
  find_text="status: active",
  content="status: completed"
)
如果有完成日期字段,同步更新:
python
edit_note(
  identifier="quarterly-report",
  operation="find_replace",
  find_text="completed:",
  content="completed: 2026-02-22"
)

4. Confirm

4. 操作确认

Report what was done concisely:
Marked complete: Quarterly Report
  Moved to: tasks/completed/quarterly-report.md
  Status: completed
简洁地告知用户执行的操作:
已标记完成:Quarterly Report
  移动到:tasks/completed/quarterly-report.md
  状态:completed

Edge Cases

边界情况

Already Archived

已归档状态

If the entity is already in an archive/completed folder, notify the user:
"Quarterly Report is already in tasks/completed/. Want me to update anything on it?"
如果实体已经位于归档/已完成文件夹中,告知用户:
"Quarterly Report已经位于tasks/completed/文件夹下。需要我更新它的其他内容吗?"

Partial Completion

部分完成

Sometimes only part of an entity is done. Don't move it — instead, update observations or status notes within the entity to reflect partial progress.
有时实体只有部分内容完成。此时不要移动文件,而是更新实体内的观测信息或状态备注来反映部分进度即可。

Revert / Reactivate

撤销/重新激活

If something was archived by mistake, move it back:
python
move_note(
  identifier="tasks/completed/quarterly-report",
  destination_path="tasks/active/quarterly-report.md"
)

edit_note(
  identifier="quarterly-report",
  operation="find_replace",
  find_text="status: completed",
  content="status: active"
)
如果实体被错误归档,将其移回原位置:
python
move_note(
  identifier="tasks/completed/quarterly-report",
  destination_path="tasks/active/quarterly-report.md"
)

edit_note(
  identifier="quarterly-report",
  operation="find_replace",
  find_text="status: completed",
  content="status: active"
)

Status Without Movement

无需移动的状态变更

Some status changes don't require a folder move — "paused" or "blocked" items often stay in
active/
with just a frontmatter update. Reserve folder moves for terminal or major state transitions.
部分状态变更不需要移动文件夹——标记为「paused」或「blocked」的条目通常仍保留在
active/
文件夹中,只需更新frontmatter即可。仅当状态进入终态或发生重大变更时才移动文件夹。

Relationship to Other Skills

与其他技能的关联

  • memory-tasks: Tasks are a specific lifecycle case. This skill covers the general pattern; memory-tasks covers task-specific fields (steps, current_step, context).
  • memory-notes: Use search-before-create (from memory-notes) to find the entity before transitioning it.
  • memory-defrag: Periodic defrag can identify stale active items that should be archived.
  • memory-tasks:任务是一种特殊的生命周期场景。本技能覆盖通用流转规则,memory-tasks覆盖任务专属字段(步骤、当前步骤、上下文)。
  • memory-notes:在流转实体前,使用memory-notes中的创建前搜索功能查找目标实体。
  • memory-defrag:定期整理可以识别出需要归档的过时活跃条目。

Guidelines

指导原则

  • Archive, never delete. The knowledge graph benefits from historical context.
  • Move first, then update frontmatter. This order ensures the file is in the right place even if the edit step fails.
  • Permalinks survive moves. Links to the entity keep working after a
    move_note
    .
  • Be concise in confirmations. The user knows their system — just report what changed.
  • Ask when ambiguous. If multiple entities match or the target folder isn't clear, ask rather than guess.
  • Batch operations are fine. If the user says "archive all completed tasks", find them all, confirm the list, then move them in sequence.
  • 归档,永不删除。 历史上下文能为知识图谱提供巨大价值。
  • 先移动,再更新frontmatter。 这个顺序可以保证即使编辑步骤失败,文件也已经位于正确的位置。
  • 永久链接不受移动影响。 执行
    move_note
    操作后,指向该实体的链接仍然可以正常访问。
  • 确认信息简洁明了。 用户熟悉自己的系统,只需告知变更内容即可。
  • 存在歧义时询问用户。 如果匹配到多个实体,或者目标文件夹不明确,不要猜测,直接询问用户。
  • 支持批量操作。 如果用户要求「归档所有已完成任务」,先找出所有符合条件的任务,确认列表后再依次移动。