context-analyzer

context-analyzer is an agent for coding agents from egorfedorov/claude-context-optimizer. It costs 39 tokens per session (481 once invoked), scanned A, original, MIT.

An agent that examines how a coding session uses its context, meaning the information given to the model while it works.

In plain words
What is it for?
It is for reviewing session records, spotting reading patterns, estimating token costs, and suggesting more efficient context templates.
Why use it?
It helps find information that was loaded but not used, repeated reading, and other sources of wasted context and cost.

Agent

Installs and runs on its own, but its text points at files inside its plugin — anything it tells you to read at a ${CLAUDE_PLUGIN_ROOT} path is only there once the plugin is installed. Installing the plugin gets both.

Part of the claude-context-optimizer plugin — 22 skills, 1 agent, 6 hooks shipped together

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add agents/egorfedorov/claude-context-optimizer/context-analyzer
Clone the repo
git clone --depth 1 https://github.com/egorfedorov/claude-context-optimizer

Or install claude-context-optimizer, the plugin that ships this one along with the rest of its 22 skills, 1 agent, 6 hooks.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for context-analyzer

README.md
[![agentmods](https://agentmods.dev/badge/agents/egorfedorov/claude-context-optimizer/context-analyzer.svg)](https://agentmods.dev/agents/egorfedorov/claude-context-optimizer/context-analyzer)
Your own site
<a href="https://agentmods.dev/agents/egorfedorov/claude-context-optimizer/context-analyzer"><img src="https://agentmods.dev/badge/agents/egorfedorov/claude-context-optimizer/context-analyzer.svg" alt="Measured on agentmods" height="20"></a>
Per session 39 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 481 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00039 $0.00481
Opus 5 $0.00019 $0.00241
Sonnet 5 $0.00008 $0.00096
Haiku 4.5 $0.00004 $0.00048

Measured 4d ago against content hash 03d5db13f753, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

context-analyzer scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 4d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

agents/context-analyzer.md · 58 lines

What it actually says

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:
node ${CLAUDE_PLUGIN_ROOT}/src/tracker.js report
  1. Load pattern data:
node ${CLAUDE_PLUGIN_ROOT}/src/tracker.js patterns
  1. For the current project, get suggestions:
node ${CLAUDE_PLUGIN_ROOT}/src/tracker.js suggest "$(pwd)"
  1. Look at individual sessions if needed:
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
Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 4d ago First seen · 58 lines · 39 tokens per session scan A 03d5db13f753

Subscribe to this mod's changes

context-analyzer is an agent published in the GitHub repository egorfedorov/claude-context-optimizer (104 stars, last pushed 2d ago), licensed MIT. It adds 39 tokens to every session and 481 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other agents, from other repositories

ia-database-guardian

Reviews database schema, constraints, and migration code for safety. Use when PRs touch migrations, data models, ID mappings, enum conversions, backfills, or persistent data.

iliaal/whetstone · 41 tokens

health-monitor

Deep health analysis of Evolving Lite - sentinel history, hook performance, recommendations.

primeline-ai/evolving-lite · 15 tokens

architect

Use this agent when creating roadmaps, decomposing plans into tasks, making architecture decisions, or breaking down requirements into executable work. Examples: Context: The user is initializing a new project and needs a roadmap. user: "Create a roadmap for building this application" assistant: "I'll dispatch the…

lgbarn/shipyard · 272 tokens

reviewer

Use this agent when performing code review, verifying spec compliance, conducting quality review after a build, or checking that an implementation matches its plan. Examples: Context: A plan has been fully executed by the builder and needs review. user: "Review the authentication implementation" assistant: "I'll…

lgbarn/shipyard · 200 tokens

ia-best-practices-researcher

Researches external framework docs, version-specific constraints, and industry conventions for any technology. Use when you need authoritative external documentation.

iliaal/whetstone · 34 tokens

reviewer-opus

Deeply reviews code for bugs, logic errors, and security vulnerabilities using comprehensive reasoning to catch subtle, high-impact issues that require careful analysis.

Joncik91/ucai · 32 tokens