memem-mine-history

memem-mine-history is a skill for Claude Code from TT-Wang/memem. It costs 22 tokens per session (379 once invoked), scanned B, original, MIT.

A backfill command for memem that reads old Claude Code conversation files and extracts knowledge from them. It can also opt future sessions into automatic knowledge extraction.

In plain words
What is it for?
Use it to count and process existing Claude Code sessions, start the work in the background, and keep processing new sessions after the backfill begins.
Why use it?
It fills the gap where automatic processing only sees sessions created after setup. It saves you from reviewing old conversations manually, though large histories can take a long time and make many API calls.

Skill for Claude Code

Written for Claude Code: allowed-tools in frontmatter. Also seen: reads .claude/ paths; mentions subagents; mentions Claude Code.

Runs only inside its plugin — its command needs a path that Claude Code sets for a plugin’s own hooks and for nothing else. Install the plugin, not this.

Part of the memem plugin — 6 skills, 4 hooks, 1 MCP server shipped together

Good fit Use it to count and process existing Claude Code sessions, start the work in the background, and keep processing new sessions after the backfill begins.

Compare 6 skills from other repositories ↓
Install

Getting it into your agent

This one installs as part of its plugin. Adding the marketplace and installing the plugin brings it with everything else the plugin ships.

Claude Code
/plugin marketplace add TT-Wang/memem
Claude Code
/plugin install memem

Made for: Claude Code.

Or install memem, the plugin that ships this one along with the rest of its 6 skills, 4 hooks, 1 MCP server.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for memem-mine-history

README.md
[![agentmods](https://agentmods.dev/badge/skills/tt-wang/memem/memem-mine-history/github.svg)](https://agentmods.dev/skills/tt-wang/memem/memem-mine-history)
Your own site
<a href="https://agentmods.dev/skills/tt-wang/memem/memem-mine-history"><img src="https://agentmods.dev/badge/skills/tt-wang/memem/memem-mine-history/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for memem-mine-history

Your own site · 80×15
<a href="https://agentmods.dev/skills/tt-wang/memem/memem-mine-history"><img src="https://agentmods.dev/badge/skills/tt-wang/memem/memem-mine-history.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 22 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 379 The whole file, excluding the scripts and references it only reads on demand.
Security scan B 1 finding. A grade says what 26 rules found in the file — not that it is safe.
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.1 $0.00022 $0.00379
Opus 5 $0.00011 $0.00189
Sonnet 5 $0.00004 $0.00076
Haiku 4.5 $0.00002 $0.00038

Measured 12d ago against content hash 09549d3bcd2c, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-11, from the pricing page.

Security

Grade B, and why

memem-mine-history scanned grade B with 1 finding 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 12d 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.

Reads agent configuration directoriesmediumAgent snooping

.claude/, .codex/, .gemini/ hold keys, settings and other credentials a mod has no legitimate need for.

find ~/.claude/projects/ -name "*.jsonl" ! -path "*/subagents/*" -size +5k | wc -l
skills/memem-mine-history/SKILL.md · 32 lines

What it actually says

Mine all historical Claude Code sessions for knowledge. By default the Stop hook only handles new sessions; this command backfills existing JSONL transcripts. It also opts you in to event-triggered mining for future sessions.

  1. Show how many sessions exist:
find ~/.claude/projects/ -name "*.jsonl" ! -path "*/subagents/*" -size +5k | wc -l
  1. Tell the user approximately how long it will take (~3-5 seconds per session, plus Haiku API costs).

  2. Confirm with the user before starting — this can take hours for large histories and makes many Haiku API calls.

  3. Record the opt-in and start history backfill in the background:

mkdir -p ~/.memem && touch ~/.memem/.miner-opted-in
nohup PYTHONPATH="${CLAUDE_PLUGIN_ROOT}" python3 -m memem.server --mine-all > ~/.memem/mine-all.log 2>&1 &
echo "History mining started in background (PID $!)"
  1. Tell the user:
  • History mining is running in the background (log at ~/.memem/mine-all.log)
  • Future sessions will also be mined automatically — every Claude Code Stop event spawns mine_delta to extract new turns
  • They can continue working normally
  • New memories appear as they're extracted (Haiku-extracted, written to ~/obsidian-brain/memem/memories/)
  • Run /memem-status to check progress and Stop-hook registration
  • To opt out: rm ~/.memem/.miner-opted-in (no daemon to stop)
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. 12d ago First seen · 32 lines · 22 tokens per session scan B 09549d3bcd2c

Subscribe to this mod's changes

memem-mine-history is a skill published in the GitHub repository TT-Wang/memem (32 stars, last pushed 10d ago), licensed MIT. It adds 22 tokens to every session and 379 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it B with 1 finding (reads agent configuration directories). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.