forget
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseMem0 Forget
Mem0 遗忘功能
Delete specific memories from mem0.
从mem0中删除特定记忆。
Execution
执行流程
Step 1: Parse input
步骤1:解析输入
The user provides either:
- A search query:
/mem0:forget auth module decisions - A memory ID:
/mem0:forget <memory_id>
If no argument, ask: "What should I forget? Provide a search query or memory ID."
用户提供以下任一内容:
- 搜索查询:
/mem0:forget auth module decisions - 记忆ID:
/mem0:forget <memory_id>
如果未提供参数,询问:"我应该遗忘什么?请提供搜索查询或记忆ID。"
Step 2: Find memories
步骤2:查找记忆
If memory ID provided (looks like a UUID or hex string):
- Call with the ID to verify it exists.
get_memory - Show:
Found: "<memory content first 120 chars>" (created <date>)
If search query provided:
- Call with:
search_memoriesquery=<user's query>filters={"AND": [{"user_id": "<active_user_id>"}, {"app_id": "<project_id>"}]}top_k=10
- Show numbered list:
Found <N> memories matching "<query>": 1. <content, 120 chars> (type: <type>, created: <date>) [ID: <short_id>] 2. ...
如果提供了记忆ID(格式类似UUID或十六进制字符串):
- 调用接口传入该ID以验证其是否存在。
get_memory - 显示:
已找到:"<记忆内容前120个字符>"(创建于<日期>)
如果提供了搜索查询:
- 调用接口,参数如下:
search_memoriesquery=<用户的查询内容>filters={"AND": [{"user_id": "<当前用户ID>"}, {"app_id": "<项目ID>"}]}top_k=10
- 显示编号列表:
找到<N>条匹配"<查询内容>"的记忆: 1. <内容,120字符>(类型:<类型>,创建于:<日期>)[ID:<短ID>] 2. ...
Step 3: Confirm
步骤3:确认
Ask: "Delete which memories? Enter numbers (e.g., 1,3,5), 'all', or 'cancel'."
For a single memory ID, ask: "Delete this memory? [y/N]"
Never delete without confirmation. This is destructive.
询问:"要删除哪些记忆?请输入编号(例如:1,3,5)、'all'(全部)或'cancel'(取消)。"
如果是单个记忆ID,询问:"是否删除该记忆?[y/N]"
未经确认绝不能删除,此操作具有破坏性。
Step 4: Delete
步骤4:删除
For each confirmed memory, call with the memory ID.
delete_memory对于每个确认要删除的记忆,调用接口传入对应的记忆ID。
delete_memoryStep 5: Report
步骤5:反馈结果
Deleted <N> memories.If any deletions failed, report which ones and why.
已删除<N>条记忆。如果有删除失败的情况,反馈对应的记忆ID及失败原因。
Undo recent writes
撤销最近写入的内容
If the user says "undo last N memories" or "undo last write":
- Read session stats to get recently written memory IDs:
bash
SCRIPT_DIR="${CLAUDE_PLUGIN_ROOT:-${CODEX_PLUGIN_ROOT:-${CURSOR_PLUGIN_ROOT:-}}}/scripts" python3 "$SCRIPT_DIR/session_stats.py" peek - Parse the array from the JSON output. Each entry has
recent_ids,id,category.ts - Show the last N entries (default 1) and ask for confirmation.
- Delete confirmed entries via .
delete_memory
If is empty, tell the user: "No recent memory IDs tracked this session. Try to browse recent memories, or to find specific ones."
recent_ids/mem0:tour/mem0:forget <search query>如果用户输入"undo last N memories"或"undo last write":
- 读取会话统计信息以获取最近写入的记忆ID:
bash
SCRIPT_DIR="${CLAUDE_PLUGIN_ROOT:-${CODEX_PLUGIN_ROOT:-${CURSOR_PLUGIN_ROOT:-}}}/scripts" python3 "$SCRIPT_DIR/session_stats.py" peek - 解析JSON输出中的数组,每个条目包含
recent_ids、id、category字段。ts - 显示最近的N条记录(默认1条)并请求确认。
- 通过接口删除确认的条目。
delete_memory
如果为空,告知用户:"本次会话未跟踪到最近的记忆ID。尝试使用浏览最近的记忆,或使用查找特定记忆。"",
recent_ids/mem0:tour/mem0:forget <搜索查询>