Optimizes Claude Code memory files in four interactive steps: removes duplicates, migrates rules to CLAUDE.md and rules/*.md files, compresses remaining entries, and validates with cleanup. Typical reduction: 30–50% in token count.
Optimize Claude Code memory files through a 4-step interactive workflow: remove duplicates, migrate rules to proper config files, compress remaining entries, and validate the result. Typical savings: 30-50% on token count in memory files, meaning faster context loading and lower API cost.
Install:
npx skills add kochetkov-ma/claude-brewcode
Use via slash command:
/memory-optimize
Or via natural language prompt:
Optimize my Claude memory files
Clean up memory duplicates
The skill scans all memory files under ~/.claude/projects/, cross-references them against your CLAUDE.md and rules files, then walks you through each optimization step with approval prompts before making changes.
.claude/rules/, ~/.claude/rules/) so they load reliably instead of depending on memoryFinds memory entries that already exist in CLAUDE.md or rules files. Shows a table of what is redundant, asks for approval before deleting.
Example:
Found 4 duplicate/redundant entries (35% of memory):
| Entry | Memory File | Already In | Action |
|-------|-------------|------------|--------|
| "Search via Bash grep" | MEMORY.md:5 | rules/code-search.md | DELETE |
| "Constructor injection" | MEMORY.md:12 | CLAUDE.md:## DI | DELETE |
| "No System.out" | MEMORY.md:18 | rules/best-practice.md:7 | DELETE |
| "Edit bottom-up" | MEMORY.md:23 | rules/avoid.md:8 | DELETE |
Options: "Yes, delete all" / "Review each" / "Skip this step"
Identifies remaining entries that belong in persistent config files rather than memory. Uses a decision tree to categorize each entry:
~/.claude/rules/.claude/rules/CLAUDE.mdShows a migration plan with target files and token savings, asks for approval before moving anything.
Converts remaining entries to token-efficient formats: prose to table rows, multiple entries to a single table, verbose descriptions to imperative one-liners.
Before:
## Plugin Development (2026-01-15)
When developing plugins, remember to update BOTH plugin.json and marketplace.json
files on version bump, otherwise autocomplete will break because versions won't match.
After:
## Plugin Dev
| Rule | Why |
|------|-----|
| Update BOTH plugin.json + marketplace.json on version bump | Autocomplete breaks on mismatch |
Shows 2-3 specific before/after samples with token savings, asks for approval.
Runs automatically after the previous steps. Checks for:
Reports any issues found and offers to fix them.
| Content Type | Goes In | Format |
|---|---|---|
| Rule applies to all projects | ~/.claude/rules/*.md | Table |
| Rule applies to this project | .claude/rules/*.md | Table |
| Architectural decision | CLAUDE.md | Section |
| Reusable fact/pattern | MEMORY.md | Section by topic |
| Session context | DELETE | -- |
This skill is extracted from brewdoc -- a documentation tools plugin for Claude Code with memory optimization, Claude installation docs, and Markdown to PDF.
claude plugin marketplace add https://github.com/kochetkov-ma/claude-brewcode
claude plugin install brewdoc@claude-brewcode
MIT
Search for places (restaurants, cafes, etc.) via Google Places API proxy on localhost.
Interact with GitHub using the `gh` CLI. Use `gh issue`, `gh pr`, `gh run`, and `gh api` for issues, PRs, CI runs, and advanced queries.
Create or update AgentSkills. Use when designing, structuring, or packaging skills with scripts, references, and assets.
Start voice calls via the OpenClaw voice-call plugin.
Notion API for creating and managing pages, databases, and blocks.
Gemini CLI for one-shot Q&A, summaries, and generation.
Category:developer