From claude-optimize
Use when running /optimize:memory to analyze memory file hygiene, detect stale entries, find duplicates, identify migration candidates to CLAUDE.md, and suggest reorganization. Triggers on memory optimization, memory cleanup, or memory hygiene analysis. Do NOT trigger on general coding tasks or file editing.
npx claudepluginhub btcdlabs/btcd-cc-marketplace --plugin claude-optimizeThis skill uses the workspace's default tool permissions.
Analyzes Claude Code memory files for hygiene, staleness, duplicates, and migration opportunities. Powers the `/optimize:memory` mode.
Compares coding agents like Claude Code and Aider on custom YAML-defined codebase tasks using git worktrees, measuring pass rate, cost, time, and consistency.
Designs and optimizes AI agent action spaces, tool definitions, observation formats, error recovery, and context for higher task completion rates.
Designs, implements, and audits WCAG 2.2 AA accessible UIs for Web (ARIA/HTML5), iOS (SwiftUI traits), and Android (Compose semantics). Audits code for compliance gaps.
Analyzes Claude Code memory files for hygiene, staleness, duplicates, and migration opportunities. Powers the /optimize:memory mode.
ALWAYS use the bundled scripts. Do NOT use Glob to find memory directories, manually read ~/.claude/projects/, count lines, estimate tokens, or run any ad-hoc shell commands.
# Discover and inventory all memory files with token counts
python3 ${CLAUDE_PLUGIN_ROOT}/scripts/env_inventory.py --component memory --json
# Detect stale entries and find duplicates
python3 ${CLAUDE_PLUGIN_ROOT}/scripts/memory_staleness.py --check-duplicates --json
The env_inventory automatically discovers the project's memory directory under ~/.claude/projects/, finds all .md files including MEMORY.md, and reports token counts.
The staleness script automatically:
Score entries on four dimensions (each 0-25, total 0-100):
The staleness script (Step 2) provides automated staleness scores. For accuracy, relevance, and actionability, use the scoring rubric below.
Entries should migrate to CLAUDE.md if they meet ALL of:
Entries should become skills if they:
Compare entries across all memory files for:
## Memory Health Report
**Files analyzed**: [count]
**Total entries**: [count]
**Total tokens**: [estimate]
**MEMORY.md status**: [lines]/200 line limit
### Scoring Summary
| File | Entries | Avg Score | Stale | Duplicates |
|------|---------|-----------|-------|------------|
| MEMORY.md | N | XX | N | N |
| file2.md | N | XX | N | N |
### Stale Entries (recommend removal)
[List entries with staleness score < 10]
### Migration Candidates (recommend move to CLAUDE.md)
[List entries meeting migration criteria]
### Skill Candidates (recommend creating skills)
[List entries describing repeatable workflows]
### Duplicates Found
[List duplicate pairs with file locations]
### Contradictions Found
[List contradicting entries]
### Recommended Actions
1. [Specific action with file path]
2. [Specific action with file path]
...
Present the report and ask: "Which actions would you like me to take? (e.g., 1,3,5 or all or none)"
NEVER modify memory files without explicit user approval.
Memory hygiene dimension (10% of total):