context-optimizer

context-optimizer is an agent for Claude Code from athola/claude-night-market. It costs 136 tokens per session (871 once invoked), scanned A, original, MIT.

An agent that audits context-window usage across many skills and plugin files and recommends or applies reductions.

In plain words
What is it for?
Use it for full context audits, pre-release checks, periodic health checks, or optimizing several skills at once.
Why use it?
It helps keep large collections of instructions within practical context limits and identifies skills that have grown too large.

Agent for Claude Code

Written for Claude Code: hooks in frontmatter. Also seen: model in frontmatter; mentions subagents.

Part of the conserve plugin — 15 skills, 6 commands, 5 agents shipped together

Good fit Use it for full context audits, pre-release checks, periodic health checks, or…

Compare 6 agents from other repositories ↓
Install with agentmods
npx agentmods add agents/athola/claude-night-market/context-optimizer
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.

Clone the repo
git clone --depth 1 https://github.com/athola/claude-night-market

Made for: Claude Code.

Or install conserve, the plugin that ships this one along with the rest of its 15 skills, 6 commands, 5 agents.

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-optimizer

README.md
[![agentmods](https://agentmods.dev/badge/agents/athola/claude-night-market/context-optimizer.svg)](https://agentmods.dev/agents/athola/claude-night-market/context-optimizer)
Your own site
<a href="https://agentmods.dev/agents/athola/claude-night-market/context-optimizer"><img src="https://agentmods.dev/badge/agents/athola/claude-night-market/context-optimizer.svg" alt="Measured on agentmods" height="20"></a>
Per session 136 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 871 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
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.1 $0.00136 $0.00871
Opus 5 $0.00068 $0.00436
Sonnet 5 $0.00027 $0.00174
Haiku 4.5 $0.00014 $0.00087

Measured 3d ago against content hash 95f6c24e18b3, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade A, and why

context-optimizer 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 3d 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.

plugins/conserve/agents/context-optimizer.md · 120 lines

How it starts

The opening of the file, as written. The whole thing — 120 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Context Optimizer Agent

Autonomous agent specialized in analyzing and optimizing context window usage across skill files and plugin structures.

Capabilities

  • Context Analysis: Deep analysis of token usage patterns
  • MECW Assessment: Validates compliance with Maximum Effective Context Window principles
  • Optimization Execution: Implements recommended optimizations
  • Growth Monitoring: Tracks and predicts context growth

When To Use

Dispatch this agent for:

  • Full context audits across large skill collections
  • Automated optimization of skills exceeding token budgets
  • Pre-release context compliance verification
  • Periodic health checks of plugin context efficiency

When NOT To Use

  • Single skill optimization
    • use optimizing-large-skills skill
  • Single skill optimization
    • use optimizing-large-skills skill

Agent Workflow

Step 0: Complexity Check (MANDATORY)

Before any work, assess if this task justifies subagent overhead:

Return early if:

  • Single skill token count → "SIMPLE: wc -w skill.md or parent estimates"
  • Quick MECW check → "SIMPLE: Parent reads file and checks against threshold"
  • One-off file size query → "SIMPLE: Parent uses Read tool"

Continue if:

  • Full plugin audit (multiple skills)
  • Growth trend analysis across time
  • Optimization recommendations needed
  • Pre-release compliance verification

Steps 1-5 (Only if Complexity Check passes)

  1. Discovery: Find all SKILL.md files in target directory
  2. Analysis: Calculate token usage and growth patterns for each
  3. Assessment: Evaluate against MECW thresholds
  4. Recommendations: Generate prioritized optimization suggestions
  5. Reporting: Produce detailed context health report

Example Dispatch

Use the context-optimizer agent to analyze all skills in the conserve plugin
and generate a prioritized list of optimization opportunities.

Output Format

The agent produces a structured report including:

  • Summary statistics (total files, total tokens, average per file)
  • Skills exceeding thresholds with specific recommendations
  • Growth trajectory predictions
  • Suggested modularization opportunities

Read the full file on GitHub · 120 lines

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. 3d ago First seen · 120 lines · 136 tokens per session scan A 95f6c24e18b3

Subscribe to this mod's changes

context-optimizer is an agent published in the GitHub repository athola/claude-night-market (335 stars, last pushed today), licensed MIT. It adds 136 tokens to every session and 871 once invoked, about $0.0007 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-09-03.