Files
mem0/mem0-plugin/skills/mem0-forget/SKILL.md
T
kartik-mem0 1daa7ece66 fix(mem0-plugin): fix 3 critical + 5 important issues from review
Critical fixes:
- C1: Pin/dream update_memory now reads content first via get_memory
  before updating, preventing metadata-only calls that wipe content
- C2: SessionStart memory count uses GET /v3/memories/?page_size=1 for
  real count from pagination envelope instead of search limit=100
- C3: on_task_completed.sh uses ${MEM0_PROJECT_ID:-unknown} to avoid
  crash when identity resolution fails under set -u

Important fixes:
- I1: session_stats.py tracks recent_ids (memory IDs + timestamps) for
  /mem0:forget undo support. Capped at 50 entries.
- I2: /mem0:health --deep mode adds memory quality analysis: duplicate
  detection, stale entry scan, contradiction flags, orphan tagging
- I3: /mem0:stats ASCII histogram for category distribution with bar
  chart, sorted by count descending
- I4: mem0-mcp skill documents access counter pattern: get_memory then
  update_memory to track which memories are actually used
- I5: on_pre_commit.py reads COMMIT_EDITMSG first (current commit),
  falls back to HEAD only if EDITMSG unavailable

Tests: 91 -> 94 (3 new for recent_ids tracking)
2026-05-21 18:46:08 +05:30

2.2 KiB

name, description
name description
mem0-forget Delete memories by search query or memory ID. Shows matches for confirmation before deleting. Safe — always confirms before destructive action. TRIGGER: user runs /mem0:forget <query>, or says "forget this", "delete memory", "remove that memory about X".

Mem0 Forget

Delete specific memories from mem0.

Execution

Step 1: Parse input

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

Step 2: Find memories

If memory ID provided (looks like a UUID or hex string):

  • Call get_memory with the ID to verify it exists.
  • Show: Found: "<memory content first 120 chars>" (created <date>)

If search query provided:

  • Call search_memories with:
    • query=<user's query>
    • user_id=<active_user_id>
    • filters={"AND": [{"user_id": "<id>"}, {"app_id": "<project_id>"}]}
    • limit=10
  • Show numbered list:
    Found <N> memories matching "<query>":
    1. <content, 120 chars> (type: <type>, created: <date>) [ID: <short_id>]
    2. ...
    

Step 3: Confirm

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.

Step 4: Delete

For each confirmed memory, call delete_memory with the memory ID.

Step 5: Report

Deleted <N> memories.

If any deletions failed, report which ones and why.

Undo recent writes

If the user says "undo last N memories" or "undo last write":

  1. Read session stats to get recently written memory IDs:
    SCRIPT_DIR="${CLAUDE_PLUGIN_ROOT:-${CODEX_PLUGIN_ROOT:-${CURSOR_PLUGIN_ROOT:-}}}/scripts"
    python3 "$SCRIPT_DIR/session_stats.py" peek
    
  2. Parse the recent_ids array from the JSON output. Each entry has id, category, ts.
  3. Show the last N entries (default 1) and ask for confirmation.
  4. Delete confirmed entries via delete_memory.

If recent_ids is empty, tell the user: "No recent memory IDs tracked this session. Use a search query instead."