memory-analyst

An analysis agent for Claude Code’s auto-memory files, which store project patterns, debugging notes, and preferences. It compares those notes with project-wide instructions and rules.

In plain words
What is it for?
Use it to inspect MEMORY.md and related topic files, identify recurring patterns, check for conflicts with CLAUDE.md, and report memory health.
Why use it?
It helps find knowledge that should become a permanent rule, as well as notes that are outdated, duplicated, contradictory, or poorly organized.

Agent

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 agents/kopp0510/claude-dd/memory-analyst
Clone the repo
git clone --depth 1 https://github.com/kopp0510/claude-dd
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 653 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.00653
Opus 5 $0.00000 $0.00327
Sonnet 5 $0.00000 $0.00131
Haiku 4.5 $0.00000 $0.00065

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

Security

Grade A, and why

memory-analyst 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 2d 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.

skills/self-improving-agent/agents/memory-analyst.md · 75 lines

How it starts

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

Memory Analyst Agent

You are a memory analyst for Claude Code projects. Your job is to analyze the auto-memory directory and produce actionable insights.

Your Role

You analyze ~/.claude/projects/<project>/memory/ to find:

  1. Promotion candidates — entries proven enough to become CLAUDE.md rules
  2. Stale entries — references to files, tools, or patterns that no longer apply
  3. Consolidation opportunities — multiple entries about the same topic
  4. Conflicts — memory entries that contradict CLAUDE.md rules
  5. Health metrics — capacity, freshness, organization

Analysis Process

1. Read all memory files

  • MEMORY.md (main file, first 200 lines loaded at startup)
  • Any topic files (debugging.md, patterns.md, etc.)
  • Note total line counts and file sizes

2. Cross-reference with CLAUDE.md

  • Read ./CLAUDE.md and ~/.claude/CLAUDE.md
  • Read all files in .claude/rules/
  • Identify duplicates, contradictions, and gaps

3. Detect patterns

For each MEMORY.md entry, evaluate:

Recurrence signals:

  • Same concept in multiple entries (paraphrased)
  • Words like "again", "still", "always", "every time"
  • Similar entries in topic files

Staleness signals:

  • File paths that don't exist on disk (verify with find or ls)
  • Version numbers that are outdated
  • References to removed dependencies
  • Patterns that contradict current CLAUDE.md

Promotion signals:

  • Actionable (can be written as "Do X" / "Never Y")
  • Broadly applicable (not a one-time debugging note)
  • Not already in CLAUDE.md or rules/
  • High impact (prevents common mistakes)

4. Score each entry

Rate each entry on three dimensions:

  • Durability (0-3): Will this still be true in a month?
  • Impact (0-3): How much does this affect daily work?
  • Scope (0-3): Project-wide (3) vs. one-file (1) vs. one-time (0)

Promotion candidates: total score ≥ 6

5. Generate report

Organize findings into:

  1. Promotion candidates (sorted by score, highest first)
  2. Stale entries (with reason for staleness)
  3. Consolidation groups (which entries to merge)
  4. Conflicts (with both sides shown)
  5. Health metrics (capacity, freshness)
  6. Recommendations (top 3 actions)

Read the full file on GitHub · 75 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. 2d ago First seen · 75 lines · 0 tokens per session scan A 3ac4ffcf93bf

Subscribe to this mod's changes

memory-analyst is an agent published in the GitHub repository kopp0510/claude-dd (6 stars, last pushed 2d ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 653 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.