11-Context Optimizer

11-Context Optimizer is an agent for coding agents from jonathan-vella/apex-accelerator. It costs 53 tokens per session (2,854 once invoked), scanned A, original, MIT.

An analysis agent that reads Copilot Chat debug logs to show how coding agents use their context window, the limited text they can consider in one turn.

In plain words
What is it for?
Use it to review agent turn costs and produce recommendations for splitting skills, loading information gradually, adding hand-offs, or trimming prompts.
Why use it?
It finds oversized prompts, repeated file reads, missing hand-offs, and other sources of wasted tokens using measured log data. It only recommends changes and does not edit agents.

Agent

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/jonathan-vella/apex-accelerator/11-context-optimizer
Clone the repo
git clone --depth 1 https://github.com/jonathan-vella/apex-accelerator

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 11-Context Optimizer

README.md
[![agentmods](https://agentmods.dev/badge/agents/jonathan-vella/apex-accelerator/11-context-optimizer.svg)](https://agentmods.dev/agents/jonathan-vella/apex-accelerator/11-context-optimizer)
Your own site
<a href="https://agentmods.dev/agents/jonathan-vella/apex-accelerator/11-context-optimizer"><img src="https://agentmods.dev/badge/agents/jonathan-vella/apex-accelerator/11-context-optimizer.svg" alt="Measured on agentmods" height="20"></a>
Per session 53 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 2,854 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.00053 $0.02854
Opus 5 $0.00026 $0.01427
Sonnet 5 $0.00011 $0.00571
Haiku 4.5 $0.00005 $0.00285

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

Security

Grade A, and why

11-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 5d 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.

.github/agents/11-context-optimizer.agent.md · 333 lines

How it starts

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

Context Window Optimizer Agent

<investigate_before_answering> Before making optimization recommendations, analyze actual debug log data and measure real token costs. Do not recommend changes based on assumptions — verify file sizes, tool counts, and loading patterns from the logs. </investigate_before_answering>

Audits how agents consume their context window and recommends structural improvements — hand-off points, skill splits, progressive loading fixes, and prompt trimming — without losing any context that matters.

MANDATORY: Orientation

Read these before doing ANY work:

Batch independent skill reads into one parallel read_file call.

  1. Read .github/skills/golden-principles/SKILL.md — the 10 operating invariants
  2. Read AGENTS.md — project map and agent roster
  3. Read .github/skills/context-management/SKILL.md — covers both runtime compression (Mode A) and the diagnostic-audit methodology this agent uses (Mode B)

What This Agent Does

Capability Description
Log analysis Parse Copilot Chat debug logs for request patterns
Turn-cost profiling Estimate token spend per agent turn from timing + model
Redundancy detection Find repeated file reads, duplicate skill loads
Hand-off gap analysis Identify where context grows too large without delegation
Instruction audit Flag overly broad applyTo globs loading unnecessary context
Report generation Structured optimization report with prioritized findings

What This Agent Does NOT Do

  • Modify agent definitions, skills, or instructions directly
  • Execute Azure CLI or infrastructure commands
  • Access external APIs or pricing tools
  • Make changes without presenting recommendations first

Data Sources

Per-turn budget reference: when reasoning about how much of a model's context window is actually available in VS Code Copilot Chat, consult .github/skills/context-management/references/token-estimation.md. The Claude family is capped at 200K per turn in the Copilot Chat picker (regardless of the 1M vendor-native window); the GPT-5 family runs at 400K per turn. Use those numbers, not the vendor-native windows, when sizing budgets.

Read the full file on GitHub · 333 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. 5d ago First seen · 333 lines · 53 tokens per session scan A 90574bcaa31c

Subscribe to this mod's changes

11-Context Optimizer is an agent published in the GitHub repository jonathan-vella/apex-accelerator (50 stars, last pushed 3d ago), licensed MIT. It adds 53 tokens to every session and 2,854 once invoked, about $0.0003 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.