stats

A report of memory activity for the current session and project. It shows counts by category, how old the memories are, and API response times.

In plain words
What is it for?
Use it to check how many memories exist, review recent activity, and audit how memories are distributed and how quickly the API responds.
Why use it?
It makes memory usage easier to inspect without manually reviewing every saved item.

Skill for Claude CodeCodex

▶ Mem0 + Claude Code MCP — Give Your AI Agent a Permanent Memory Prompt Engineer · about mem0ai/mem0 · on YouTube →
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/mem0ai/mem0/stats
Any agent
npx skills add mem0ai/mem0 --skill stats
Clone the repo
git clone --depth 1 https://github.com/mem0ai/mem0

Made for: Claude Code, Codex.

Per session 43 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,191 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00043 $0.01191
Opus 5 $0.00022 $0.00596
Sonnet 5 $0.00009 $0.00238
Haiku 4.5 $0.00004 $0.00119

Measured 3d ago against content hash de987418433f, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

stats scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

integrations/mem0-plugin/skills/stats/SKILL.md · 131 lines

How it starts

The opening of the file, as written. The whole thing — 131 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Mem0 Stats

Show session and lifetime memory statistics.

Execution

Step 1: Gather session stats

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.

Step 2: Fetch lifetime and session stats from API

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:

  1. categories[0] (platform-assigned) — primary grouping
  2. metadata.type (agent-assigned) — secondary if no categories
  3. created_at date — for age analysis

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

Step 3: Display

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

Read the full file on GitHub · 131 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 3d ago First seen · 131 lines · 43 tokens per session scan A de987418433f

Subscribe to this mod's changes

stats is a skill published in the GitHub repository mem0ai/mem0 (64,535 stars, last pushed today), licensed Apache-2.0. It adds 43 tokens to every session and 1,191 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.