mem0-plugin/skills/stats/SKILL.md
Show session and lifetime memory statistics.
Run the session stats reporter:
SCRIPT_DIR="${CLAUDE_PLUGIN_ROOT:-${CODEX_PLUGIN_ROOT:-${CURSOR_PLUGIN_ROOT:-}}}/scripts"
python3 "$SCRIPT_DIR/session_stats.py" peek 2>/dev/null || echo "{}"
The peek command returns JSON without clearing the stats file (unlike report).
If the script returns empty or errors, note "No session data available" and continue.
Lifetime stats:
Call get_memories to fetch all memories for this project:
filters={"AND": [{"user_id": "<active_user_id>"}, {"app_id": "<active_project_id>"}]}, page_size=100
Group by:
categories[0] (platform-assigned) — primary groupingmetadata.type (agent-assigned) — secondary if no categoriescreated_at date — for age analysisCategory normalization: Merge auto_capture and uncategorized into a single uncategorized row. These are memories where the platform didn't assign a meaningful content category. Do NOT show auto_capture as its own row in the table.
Session stats (local only):
Session stats come from the local stats file read in Step 1. Do NOT query the API with
run_id or metadata.session_id filters — these return unreliable results because
memories are stored without run_id and metadata filters on session_id are inconsistent.
The local stats file tracks adds and searches for the current session accurately.
Also run a search_memories MCP tool call with query="project", filters={"AND": [{"user_id": "<active_user_id>"}, {"app_id": "<active_project_id>"}]}, top_k=1 to measure round-trip latency. Note the time before and after the MCP call — do NOT attempt raw HTTP calls to the API.
Print a minimal dashboard. No ASCII bar charts — use a clean table layout:
## mem0 stats
**Session** (<session_id, first 12 chars>) — 3 written, 5 searches, categories: decision, convention
**Project: my-project** — 55 memories, API: 84ms
| Category | Count |
|----------------------|-------|
| decision | 24 |
| convention | 15 |
| anti_pattern | 6 |
| task_learning | 5 |
| user_preference | 3 |
| session_state | 2 |
**Age** — oldest: 2026-02-15, newest: 2026-05-23
< 7 days: 5 · 7–30d: 12 · 30–90d: 10 · > 90d: 8
**Identity** — user: kartik · project: my-project · branch: main
Display rules:
created_atWhen invoked with --weekly (e.g., /mem0:stats --weekly), append a weekly
activity digest after the standard stats dashboard:
Call search_memories in parallel with time-scoped queries:
query="decisions made this week", filters={"AND": [{"user_id": "<id>"}, {"app_id": "<pid>"}, {"created_at": {"gte": "<7 days ago YYYY-MM-DD>"}}]}, top_k=20query="bugs errors fixes", same time filter, top_k=20query="patterns conventions learnings", same time filter, top_k=20Merge by ID. Group into "New this week" by categories[0] or metadata.type.
Calculate: memories added last 7 days, most active categories, most active day.
Append after the standard stats:
### This week (May 16 – May 23)
+12 memories — most active: Wednesday (5)
| Category | New |
|---------------|-----|
| decision | 5 |
| task_learning | 4 |
| bug_fix | 3 |
**Highlights**
- <2-3 sentence summary of most important decisions/learnings this week>
Write to ~/.mem0/weekly-digest.md (overwrite). Append one-line to
~/.mem0/digest-history.log:
<YYYY-MM-DD> | <project_id> | +<new_count> memories | top: <top_category>
If no new memories in 7 days:
No new memories in the past week. Total: <N> memories in <project_id>.