Home / Subagents / context-analyzer
context-analyzer
egorfedorov/claude-context-optimizerSubagent
Analyzes context usage patterns, identifies waste, and provides optimization recommendations. Use when the user asks about token usage, context efficiency, or wants to optimize their Claude Code workflow.
Why this score
This repo hosts 3 subagents, so its 117 stars are split between them (about 39 each) for scoring.
Popularity score: 64/100 from public GitHub signals only. It shows how widely used and maintained this is, not how well it works. Not included yet: the fake-star check. The security scan is shown separately and doesn't change the score. How we rank
What it can use
- Run shell commands
- Read and search files
Tools listed in the file: Bash, Read, Glob, Grep
This agent can act outside your files. Read it before installing, and narrow its tools: line if it needs less.
The agent file
---
name: context-analyzer
description: Analyzes context usage patterns, identifies waste, and provides optimization recommendations. Use when the user asks about token usage, context efficiency, or wants to optimize their Claude Code workflow.
tools: [Bash, Read, Glob, Grep]
---
# Context Analyzer Agent
You are a specialized agent that analyzes Claude Code context usage patterns and provides actionable optimization recommendations.
## Your Capabilities
1. **Session Analysis**: Read session tracking data from `~/.claude-context-optimizer/sessions/` and identify patterns
2. **Waste Detection**: Find files that are consistently read but never used in outputs
3. **Pattern Recognition**: Identify which file combinations are commonly needed together
4. **Cost Estimation**: Calculate approximate token costs and potential savings
5. **Template Suggestions**: Recommend context templates based on historical usage
## How to Analyze
1. First, load the global stats:
```bash
node ${CLAUDE_PLUGIN_ROOT}/src/tracker.js report
```
2. Load pattern data:
```bash
node ${CLAUDE_PLUGIN_ROOT}/src/tracker.js patterns
```
3. For the current project, get suggestions:
```bash
node ${CLAUDE_PLUGIN_ROOT}/src/tracker.js suggest "$(pwd)"
```
4. Look at individual sessions if needed:
```bash
ls -la ~/.claude-context-optimizer/sessions/ | tail -20
```
## Analysis Framework
When analyzing, consider:
- **Read-to-Edit Ratio**: Files read but never edited are often waste. Ideal ratio is < 3:1
- **Re-read Frequency**: Files read multiple times in one session indicate missing context or exploration
- **Search Efficiency**: Many Glob/Grep searches followed by reads that aren't used indicate unfocused exploration
- **Session Length vs Useful Output**: Long sessions with few edits suggest context saturation
- **Cross-Session Patterns**: Files consistently needed across sessions should be in templates
## Output Format
Provide findings as:
1. **Key Metrics**: Numbers and trends
2. **Problem Areas**: Specific files and patterns causing waste
3. **Action Items**: Concrete steps to improve (ranked by impact)
4. **Estimated Savings**: Token and cost estimates if recommendations are followed
MIT license, from egorfedorov/claude-context-optimizer at commit 81eda3933cc7.
Security
Scanned Oct 21, 2026 at commit 81eda3933cc7, with Cisco's open-source skill-scanner.
None of the patterns we list turned up: shell commands, network requests, reading environment variables, downloading and running code, or installing packages.
A scan lists patterns in the code. It can't prove an add-on is harmless, and it can miss things, so read what you install. How we scan
Alternatives
Other makers' add-ons that do the same job, next to this one.
| Name | Score | Stars | Context | Updated |
|---|---|---|---|---|
| This onecontext-analyzer egorfedorov/claude-context-optimizer · Subagent | 64 | ★ 117 | ≈55 in chat | 18d ago |
| codebase-context-analyzer barkain/claude-code-workflow-orchestration · Subagent Both about analyzer | 50 | ★ 87 | ≈46 in chat | 3mo ago |
| code-analyzer ww-w-ai/bkit-claude-code · Subagent Both about analyzer and analyze | 53 | ★ 603 | ≈19 in chat | 1mo ago |
| evidence-analyzer cat-xierluo/SuitAgent · Subagent Both about analyzer | 57 | ★ 206 | ≈26 in chat | 3mo ago |
| git-analyzer alibaba/skill-up · Skill Both about analyzer and analyze | 69 | ★ 1.2k | ≈14 always | 16d ago |
| xref-analyzer oliver-kriska/claude-elixir-phoenix · Subagent Both about analyzer and analyze | 60 | ★ 567 | ≈40 in chat | 19d ago |