claude-memory-curator
Audit, review, clean up, and prune Claude Code durable context. Use when the user asks about CLAUDE.md, CLAUDE.local.md, .claude/rules, user Claude rules, Claude Code auto memory, /memory, stale instructions, memory pollution, sensitive context, settings such as autoMemoryEnabled or claudeMdExcludes
Install
mkdir -p .claude/skills/claude-memory-curator && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/17001" && unzip -o skill.zip -d .claude/skills/claude-memory-curator && rm skill.zipInstalls to .claude/skills/claude-memory-curator
Activation
This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.
Audit, review, clean up, and prune Claude Code durable context. Use when the user asks about CLAUDE.md, CLAUDE.local.md, .claude/rules, user Claude rules, Claude Code auto memory, /memory, stale instructions, memory pollution, sensitive context, settings such as autoMemoryEnabled or claudeMdExcludes, or where a Claude instruction should live. Do not use for Codex memory, Cursor rules, Claude app memory, Anthropic API Memory Stores, or generic docs cleanup.About this skill
Claude Memory Curator
Goal
Audit Claude Code durable context as user-owned agent state: expose stale, unsafe, duplicated, over-broad, conflicting, misplaced, or unenforceable entries; propose better destinations; and apply cleanup only after a report, backup, and explicit approval.
Keep the subject scoped to Claude Code surfaces: CLAUDE.md, CLAUDE.local.md, .claude/rules/, user-level Claude rules, settings, hooks, managed policy evidence, and auto memory files. Do not treat this as a Codex, Cursor, Claude app, or Anthropic API Memory Stores curator.
When to use
- The user asks to review, audit, clean up, prune, rewrite, or remove Claude Code memory or persistent Claude instructions.
- The user mentions
CLAUDE.md,CLAUDE.local.md,.claude/rules,~/.claude/rules,/memory, auto memory,~/.claude/projects/<project>/memory/,autoMemoryEnabled,autoMemoryDirectory, orclaudeMdExcludes. - The user wants to decide whether a Claude context entry belongs in
CLAUDE.md,CLAUDE.local.md, a Claude rule, auto memory, settings, hooks,AGENTS.md, repo docs, a skill, managed policy, or deletion. - The user reports stale Claude instructions, memory pollution, conflicting Claude rules, sensitive memory contents, or Claude repeatedly using old guidance.
When not to use
- Do not use for Codex memory cleanup; use a Codex memory skill instead.
- Do not use for Cursor rules or Cursor context cleanup; use a Cursor memory skill instead.
- Do not use for Claude web/app account memory or Anthropic API Memory Stores.
- Do not use for ordinary repo documentation cleanup unless Claude durable context is part of the task.
- Do not use for generic prompt engineering that does not inspect Claude persistent context.
- Do not modify files when the user only asked for review.
- Do not edit managed policy files such as
/etc/claude-code/CLAUDE.mdormanaged-settings.jsonby default.
Inputs to inspect
- Current repo root, or the user-provided repo path.
- Project
CLAUDE.md,./.claude/CLAUDE.md,CLAUDE.local.md,.claude/rules/**/*.md,.claude/settings.json, and.claude/settings.local.json. - User-level
~/.claude/CLAUDE.md,~/.claude/rules/**/*.md, and~/.claude/settings.json. - Derived or configured auto memory directory, especially
MEMORY.mdand topic files. - Managed policy locations only as read-only evidence unless the user explicitly asks for managed-policy editing.
references/context-surface-anatomy.mdwhen deciding which Claude surface owns a claim.references/classification-rubric.mdwhen a destination is not obvious.references/conflict-resolution.mdwhen Claude context conflicts with current repo evidence.references/settings-and-hooks.mdwhen an entry should become enforced configuration or a hook.references/safe-editing-procedure.mdbefore modifying context files.assets/review-report-template.mdwhen report shape is unclear.assets/cleanup-plan-template.mdwhen a structured cleanup plan is useful or requested.
Workflow
-
Identify the target repo path from the user request or current working directory.
-
Inventory Claude context without dumping contents:
node scripts/inventory-claude-memory.mjs --repo .Add
--claude-home PATHor--memory-dir PATHwhen the user provides non-default locations. Use--jsonwhen structured evidence is useful. -
Run the redacted risk scanner when looking for sensitive, stale, broad, local, repo-specific, ignored, or conflict-prone entries:
node scripts/scan-claude-memory-risks.mjs --repo . --jsonExit code
1means findings were found, not that the scan failed. Summarize counts and highest-signal redacted findings instead of pasting the full payload. -
Parse
.claude/rules/**/*.mdfrontmatter forpathsso path-scoped guidance is not treated like always-loaded guidance. -
Inspect visible settings for
autoMemoryEnabled,autoMemoryDirectory,claudeMdExcludes, permission rules, and hooks when they affect placement. -
Treat managed policy files and managed settings as higher-precedence read-only evidence by default.
-
Treat
MEMORY.mdas the auto-memory entrypoint. Treat topic files as on-demand detail unless the user asks to audit the whole memory directory. -
Read context files in bounded chunks and redact sensitive values.
-
Extract one atomic claim per row. Split compound entries before classification.
-
Verify disputed claims against only the repo files needed for the dispute. Load
references/conflict-resolution.mdwhen precedence is unclear. -
Assign exactly one primary classification per atomic claim:
KEEP,KEEP BUT REWRITE,MOVE TO CLAUDE.md,MOVE TO CLAUDE.local.md,MOVE TO CLAUDE RULE,MOVE TO AUTO MEMORY TOPIC,MOVE TO AGENTS.md,MOVE TO REPO DOCS,MOVE TO SKILL,MOVE TO SETTINGS,MOVE TO HOOK,MOVE TO MANAGED POLICY,DELETE, orASK USER. -
Tag high-risk entries as useful context only:
stale,duplicated,too-broad,too-specific,repo-specific,workflow,config,sensitive,conflicting,unenforced,managed-policy, oruseful. -
Add confidence (
high,medium, orlow) and a proposed action to every entry. -
Produce the review report before editing. Add a structured cleanup plan when the user wants ID-by-ID approval, the schema is unknown, sensitive cleanup is proposed, or the edit set is large.
-
If cleanup is approved, load
references/safe-editing-procedure.md, runnode scripts/backup-claude-memory.mjs --repo ., apply only approved minimal edits by entry ID, re-read changed sections, and show a trimmed diff summary.
Safety rules
-
Never silently delete, rewrite, truncate, or move Claude context files.
-
Ask exactly this before content-changing cleanup:
Do you want me to apply the safe cleanup now? I will back up the Claude memory and instruction files first. -
Do not edit unless the user clearly approves that cleanup.
-
Back up Claude memory and instruction files before approved edits and report the backup path.
-
Do not print full secrets, tokens, credentials, customer data, private identifiers, internal hostnames, or sensitive personal data.
-
If secret-like data is found, redact values in output, identify file and line when possible, recommend removal, and recommend rotation for real credentials.
-
If an auto-memory topic file schema is unclear, do not edit the original file. Write a sibling
.proposed.mdcleanup plan instead. -
Treat
CLAUDE.mdand auto memory as context, not enforcement. Recommend settings or hooks for deterministic restrictions. -
Do not apply repo-specific assumptions globally. Prefer project
CLAUDE.md,.claude/rules,AGENTS.md, or repo docs for repo rules. -
Do not run broad destructive commands.
References
Read only when needed:
references/context-surface-anatomy.mdfor Claude instruction files, rules, settings, managed policy, and auto memory surfaces.references/classification-rubric.mdfor detailed classification rules and rewrite examples.references/conflict-resolution.mdfor precedence rules when Claude context conflicts with repo evidence.references/settings-and-hooks.mdwhen an entry may belong in Claude settings or hooks.references/example-review-report.mdfor report shape examples.references/safe-editing-procedure.mdbefore modifying context files.assets/review-report-template.mdwhen a concise report template is useful.assets/cleanup-plan-template.mdwhen a structured cleanup plan is needed.
Scripts
Use only when needed. All scripts are non-interactive, use Node.js stdlib only, and accept --help.
node scripts/inventory-claude-memory.mjs [--repo PATH] [--claude-home PATH] [--memory-dir PATH] [--json]
node scripts/scan-claude-memory-risks.mjs [--repo PATH] [--claude-home PATH] [--memory-dir PATH] [--json] [--max-findings N]
node scripts/backup-claude-memory.mjs [--repo PATH] [--claude-home PATH] [--memory-dir PATH]
inventory-claude-memory.mjsis read-only and lists Claude context files with type, size, modified time, and relevant frontmatter or settings signals.scan-claude-memory-risks.mjsis read-only, redacts matching lines by default, labels risk categories, limits returned findings, and exits1when findings exist.backup-claude-memory.mjscreates a timestamped backup copy under the target repo; it does not edit or delete context files.
Output format
Before edits, lead with this report shape:
# Claude Memory Review
## Top Decisions
1.
2.
3.
## Summary
- Claude context files inspected:
- Entries extracted:
- Keep:
- Rewrite:
- Move to CLAUDE.md:
- Move to CLAUDE.local.md:
- Move to Claude rule:
- Move to auto memory topic:
- Move to AGENTS.md:
- Move to repo docs:
- Move to skill:
- Move to settings:
- Move to hook:
- Move to managed policy:
- Delete:
- Ask user:
## Highest-Risk Context
| ID | Source | Risk | Recommendation |
| --- | ------ | ---- | -------------- |
## Proposed Cleanup Table
| ID | Current claim | Classification | Risk tags | Confidence | Reason | Proposed action |
| --- | ------------- | -------------- | --------- | ---------- | ------ | --------------- |
## Conflict Notes
| ID | Higher source | Conflict | Recommendation |
| --- | ------------- | -------- | -------------- |
## Settings And Hook Recommendations
- Settings:
- Hooks:
- Managed policy:
## Optional Cleanup Plan Artifact
- Plan path:
- Plan format: `assets/cleanup-plan-template.md`
## Recommended Next Action
After approved edits, also include backup path, files changed, trimmed diff summary, skipped managed-policy actions, and residual risks.
Completion criteria
- Relevant Claude context files were inventoried, or missing paths were reported.
.claude/rulesfrontmatter and visible Claude settings were considered when relevant.- Auto memory was distinguished from
CLAUDE.mdinstr
Content truncated.