extract

extract is a command for coding agents from xiaolai/echo-sleuth-for-claude. It costs 0 tokens per session (567 once invoked), scanned A, original, ISC.

A command for finding a past Claude Code conversation and extracting its decisions, corrections, patterns, lessons, and references.

In plain words
What is it for?
Use it to review recent or specified sessions and decide what information to save to memory, project instructions, or knowledge files.
Why use it?
It turns useful information from an old conversation into candidates for lasting project or personal knowledge.

Command

Installs and runs on its own, but its text points at files inside its plugin — anything it tells you to read at a ${CLAUDE_PLUGIN_ROOT} path is only there once the plugin is installed. Installing the plugin gets both.

Part of the echo-sleuth plugin — 4 skills, 8 commands, 5 agents shipped together

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 commands/xiaolai/echo-sleuth-for-claude/extract
Clone the repo
git clone --depth 1 https://github.com/xiaolai/echo-sleuth-for-claude

Or install echo-sleuth, the plugin that ships this one along with the rest of its 4 skills, 8 commands, 5 agents.

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 extract

README.md
[![agentmods](https://agentmods.dev/badge/commands/xiaolai/echo-sleuth-for-claude/extract.svg)](https://agentmods.dev/commands/xiaolai/echo-sleuth-for-claude/extract)
Your own site
<a href="https://agentmods.dev/commands/xiaolai/echo-sleuth-for-claude/extract"><img src="https://agentmods.dev/badge/commands/xiaolai/echo-sleuth-for-claude/extract.svg" alt="Measured on agentmods" height="20"></a>
Per session 0 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 567 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.00000 $0.00567
Opus 5 $0.00000 $0.00283
Sonnet 5 $0.00000 $0.00113
Haiku 4.5 $0.00000 $0.00057

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

Security

Grade A, and why

extract 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 5d 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.

commands/extract.md · 67 lines

What it actually says

Extract durable knowledge from a past Claude Code conversation session.

Arguments: $ARGUMENTS

Step 1: Find the session

If a session-id UUID is provided, locate it directly. Otherwise, list recent sessions:

bash "${CLAUDE_PLUGIN_ROOT}/scripts/list-sessions.sh" current --limit 7 --since "$(date -v-7d +%Y-%m-%d 2>/dev/null || date -d '7 days ago' +%Y-%m-%d)"

Present the list and ask the user which session to extract from (or default to the most recent).

Step 2: Run extraction

bash "${CLAUDE_PLUGIN_ROOT}/scripts/extract-knowledge.sh" SESSION_JSONL_PATH

This outputs a JSON array of candidate extractable items, each with:

  • category: value | decision | correction | pattern | lesson | reference
  • content: summary text
  • timestamp: when it occurred
  • suggested_destination: memory | claude_md | knowledge_file | skip
  • suggested_type: value | user | feedback | project | reference

Step 3: Present items to user

For each item, present:

  1. The category and content
  2. The suggested destination and type
  3. Ask the user to choose:
    • Memory — save as a memory file (ask for name if not obvious)
    • CLAUDE.md — add to project's CLAUDE.md instructions
    • Knowledge file — save as human-readable markdown (ask for path, default: docs/knowledge/)
    • Skip — discard

Step 4: Write approved items

For each approved item, write to the chosen destination:

Memory file: Create ~/.claude/projects/<project>/memory/<name>.md with frontmatter:

---
name: <name>
description: <one-line summary>
type: <chosen type>
---

<content>

Then append an entry to MEMORY.md. If MEMORY.md doesn't exist, create it. If only a standalone MEMORY.md exists (no individual files), create the first individual file and convert MEMORY.md to an index.

CLAUDE.md: Append to the project's CLAUDE.md at the resolved project root. If project root is unresolvable, offer memory file as fallback.

Knowledge file: Write markdown to the chosen path.

Step 5: Summary

Report what was extracted and where it was saved.

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. 5d ago First seen · 67 lines · 0 tokens per session scan A 6ce3c6e97d08

Subscribe to this mod's changes

extract is a command published in the GitHub repository xiaolai/echo-sleuth-for-claude (9 stars, last pushed 11d ago), licensed ISC. It costs nothing until one of its globs matches a file; then it loads 567 tokens. 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-31.