# Context Optimizer

> Optimize token usage and context management. Use when sessions feel slow, context is degraded, or you're running out of budget.

- Skill: `jahangirhussen/context-optimizer` (Agent Skill)
- Install (CLI): `npx skillmds@latest add jahangirhussen/context-optimizer`
- Raw SKILL.md: https://api.skillmd.com/api/skills/jahangirhussen/context-optimizer/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Finance & Business
- Author: Jahangirhussen (https://skillmd.com/u/jahangirhussen)
- Updated: 2026-09-22
- Page: https://skillmd.com/skills/jahangirhussen/context-optimizer

---


# Context Optimizer

Manage your context window and token budget effectively.

## Quick Diagnosis

1. Run `/context` to check current usage
2. If > 70% → compact now before it degrades
3. If > 90% → you're in the "dumb zone", compact immediately

## Optimization Strategies

### Immediate

| Action | Saves | When |
|--------|-------|------|
| `/compact` | 30-50% context | At task boundaries |
| Disable unused MCPs | ~5% per MCP | When switching domains |
| Use subagents for exploration | Keeps main context clean | Heavy search/read tasks |
| Fresh session via `/resume` | 100% reset | When starting unrelated work |

### Configuration

Set proactive auto-compaction:
```json
{
  "env": {
    "CLAUDE_AUTOCOMPACT_PCT_OVERRIDE": "50"
  }
}
```

### MCP Audit

Keep <10 MCPs enabled, <80 tools total. Each MCP adds overhead to every request.

## Token Efficiency Rules (40-60% savings)

- No sycophantic openers ("Sure!", "Great question!")
- No closing fluff ("Let me know if you need anything!")
- No prompt restatement before answering
- Code first, explanation only if non-obvious
- Structured output (tables, bullets) over prose
- ASCII only: -- not em dashes

## One-Pass Coding

- Read all files first
- Understand test assertions before writing
- Write complete solution once
- Stop if green — never iterate more than twice on same failure

## Tool-Call Budgets

| Task | Max Calls |
|------|-----------|
| Quick fix | 20 |
| Medium feature | 40 |
| Large feature | 80 |

## Task Profiles

- **Coding**: code first, minimal explanation, simplest solution
- **Agent/Pipeline**: structured output only, no prose
- **Analysis**: finding first, tables over paragraphs

## When Context Is Degraded

Signs: Claude repeats itself, forgets earlier context, responses become generic.

Fix:
1. Manual `/compact`
2. If still bad: new session with `/resume`
3. For recurring issues: reduce CLAUDE.md size, disable MCPs

