Recently, Claude has been experiencing frequent compaction issues, so I consulted with Claude to see what the problem was. Claude mentioned that the PDCA plugin I was using was too heavy, and when I checked, there were far too many features we weren't using.
Every time I load a skill, an enormous amount of context pours in, so there was no way around it.
So I decided to extract only what we use and create a new skill.
With each harness cycle, 30k tokens were being wasted, but I was able to save almost 70 percent.
I thought that was quite an excellent result.
The next day, I was playing around with Claude as usual, but despite the work I did yesterday, I didn't feel much of a reduction in the speed at which compaction comes. So I asked Claude, "How much context is coming in when you start a session and when you start a turn?" and found out there were tons of unnecessary rules, plugins, and skills.
Whenever I watch YouTube and think "this is good, that's good," I reflexively install them, which is how it came to this...
I asked Claude to list all the rules, plugins, and skills we don't use, and there was an enormous amount.
When I combined all of these, I was able to save 8250 tokens.
Now I can use the remember skill I created to prepare for compaction without any burden.
Below is the report Claude wrote for me.
⚡ Claude Code Context Optimization
An audit and organization methodology to reduce unnecessary token waste when a session starts.
If coding rules and skills continue to load from projects unrelated to development, like Vault, it creates context pressure.
Items Loaded in Context
Item | Path | Trigger |
|---|
Global CLAUDE.md | ~/.claude/CLAUDE.md
| Always |
Project CLAUDE.md | {project}/CLAUDE.md
| Always |
Global rules | ~/.claude/rules/**/*.md
| Always (independent of skill calls) |
Local skills | ~/.claude/skills/
| Only metadata list loaded each turn (body on call) |
Plugin agents | When plugin is enabled | Always (including system prompt) |
Rules are always loaded regardless of skills or commands.
Skills inject only metadata list each turn until explicitly called (skill count × metadata size).
3 Optimization Methods
1. claudeMdExcludes — Exclude global rules per project
Add to {project}/.claude/settings.local.json:
{
"claudeMdExcludes": [
"/Users/macbook/.claude/rules/common/testing.md",
"/Users/macbook/.claude/rules/common/code-review.md",
"/Users/macbook/.claude/rules/common/git-workflow.md",
"/Users/macbook/.claude/rules/common/development-workflow.md",
"/Users/macbook/.claude/rules/common/security.md",
"/Users/macbook/.claude/rules/common/coding-style.md",
"/Users/macbook/.claude/rules/common/patterns.md",
"/Users/macbook/.claude/rules/web/**"
]
}
2. Skills Cleanup — Delete unused skills
ls ~/.claude/skills/
rm -rf ~/.claude/skills/{unused-skill}
Classification criteria:
Keep | Delete |
|---|
Skills you actually call | Language-specific auto-triggers (not used) |
Core workflow skills | Domain-specific (no such domain) |
| Experimental or unused skills |
3. Disable Plugins
~/.claude/settings.json:
{
"enabledPlugins": {
"bkit@bkit-marketplace": false
}
}
When bkit plugin is enabled, 39 agents + system prompt load every session.
Measured Savings Results (2026-04-19, Vault Project)
Optimization Item | Size Saved | Tokens Saved |
|---|
claudeMdExcludes 8 rules excluded
| ~23 KB | ~5,750 |
Skills cleaned from 163→37 | ~8 KB | ~2,000 |
bkit plugin OFF | ~2 KB+ | ~500 |
Total | ~33 KB | ~8,250 |
Audit Procedure
Check ~/.claude/rules/ list → Identify files unrelated to project type
Check ~/.claude/skills/ list → Classify by actual usage and delete
Check ~/.claude/settings.json enabledPlugins → Turn off unnecessary plugins
Apply claudeMdExcludes to settings.local.json
Start a new session and compare context tokens
When to Use
When setting up Claude Code for the first time in a new project
When session startup tokens are excessively high (3,000+ tokens)
When compaction occurs earlier than expected
For projects like Vault or documentation where development rules are unnecessary