with one click
with one click
| name | health |
| description | Diagnose mem0 connection, API key, and memory read/write |
Run a diagnostic check on the mem0 plugin. Useful for troubleshooting.
Run ALL checks, then display a single summary. Do not stop on the first failure.
echo "${MEM0_API_KEY:-${CLAUDE_PLUGIN_OPTION_MEM0_API_KEY:-NOT_SET}}"
NOT_SET: FAIL โ "No API key configured"... (never print the full key)Read the active identity from the SessionStart banner or resolve manually:
user_id: from MEM0_RESOLVED_USER_ID or $USERproject_id: from MEM0_PROJECT_ID or current directory namebranch: from MEM0_BRANCH or git rev-parse --abbrev-ref HEADPASS if all three are non-empty. WARN if any falls back to defaults.
Call search_memories with:
query="health check", user_id=<id>, limit=1
filters={"AND": [{"user_id": "<id>"}, {"app_id": "<project_id>"}]}
If returns successfully (even empty): PASS
If errors: FAIL โ show the error message
Call add_memory with:
messages=[{"role": "user", "content": "Health check probe โ safe to delete."}]user_id=<id>, app_id=<project_id>metadata={"type": "health_check", "probe": true}If it returns a memory ID: PASS โ then immediately call delete_memory with that ID to clean up.
If it errors: FAIL โ show the error.
Check if the session stats file exists and is readable:
STATS_FILE="/tmp/mem0_session_stats_${USER}.json"
if [ -f "$STATS_FILE" ] && python3 -c "import json; json.load(open('$STATS_FILE'))" 2>/dev/null; then
echo "OK"
else
echo "FAIL"
fi
This file is created by the SessionStart hook and updated by PostToolUse hooks throughout the session. If it doesn't exist, the session hooks may not have fired yet โ try sending a message first, then recheck.
## mem0 health
PASS API Key m0-dVe...
PASS Identity user=kartik, project=mem0, branch=main
PASS MCP Connection 142ms
PASS Write/Read write + delete OK
PASS Session Tracker stats file active
All checks passed.
If any check fails, add a ## Troubleshooting section with specific fix steps for each failure.
When invoked with --deep (e.g., /mem0:health --deep), run the standard 5 checks above plus a memory quality scan.
Call get_memories with user_id, app_id, page_size=200. Compare all pairs within the same metadata.type group for high textual overlap (shared nouns/keywords > 60%). Report:
Potential duplicates: <N> pairs
[mem0:<id1>] โ [mem0:<id2>] โ both about "<shared topic>"
Flag memories where:
metadata.type is session_state or compact_summary AND older than 90 daysmetadata.confidence < 0.3 AND older than 30 daysStale candidates: <N>
[mem0:<id>] โ session_state, 142d old
Flag memories where metadata.confidence < 0.5 (regardless of age). Report separately from stale:
Low-confidence memories: <N>
[mem0:<id>] โ confidence=0.3, "<content preview>"
Within each metadata.type group, flag pairs that assert opposing facts about the same topic. Use semantic judgment โ look for negation patterns, conflicting tool/framework choices, or reversed decisions.
Possible contradictions: <N>
[mem0:<idA>] vs [mem0:<idB>] โ conflicting on "<topic>"
Memories with no metadata.type set, or with metadata.type not in the 17 known coding categories. These were likely written without proper tagging.
Untagged/orphan memories: <N>
## Memory Quality
Duplicates: <N> ยท Stale: <N> ยท Contradictions: <N> ยท Orphans: <N>
If all counts are 0: Memory quality: clean.
If any non-zero: append Run /mem0:dream to fix.
To fix issues found by --deep, run /mem0:dream for automated consolidation (merges, prunes, conflict resolution).
Pre-load relevant memories for current task
Consolidate memories โ merge duplicates, resolve contradictions, prune stale
Export project memories to a portable Markdown file
Delete memories by search or ID โ confirms before deleting
Import memories from an export file into this project
List all projects that have stored memories