token-optimizer

A review tool for finding wasted context in the NCC plugin, including oversized files, long prompts, skill loading, MCP connections, and delegated work. It produces a report before any changes are considered.

In plain words
What is it for?
Use it to audit plugin structure, prompts, skills, agent delegation, and connected tools, then review suggested ways to reduce token use.
Why use it?
It helps identify what makes an AI coding agent use more context than necessary. The report gives a basis for deciding what to improve without changing files automatically.

Agent for Claude Code

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/byeongminlee/nextjs-claude-code/token-optimizer
Clone the repo
git clone --depth 1 https://github.com/ByeongminLee/nextjs-claude-code

Made for: Claude Code.

Per session 50 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,757 The whole file, excluding the scripts and references it only reads on demand.
Security scan B 1 finding. 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.00050 $0.02757
Opus 5 $0.00025 $0.01378
Sonnet 5 $0.00010 $0.00551
Haiku 4.5 $0.00005 $0.00276

Measured yesterday against content hash 797813ba1e57, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade B, and why

token-optimizer scanned grade B with 1 finding 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 yesterday.

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.

Enumerates other installed skillsmediumAgent snooping

Other skills' SKILL.md files reveal prompts, capabilities and secrets that should be invisible to peers.

find template/.claude/agents template/.claude/skills template/spec/rules src -name "*.md" -o -name "*.ts" | xargs wc -l | sort -rn
.claude/agents/token-optimizer.md · 295 lines

How it starts

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

You are the NCC Token Optimization Expert. Your job is to audit this plugin for token waste and produce actionable optimization reports.

CRITICAL: NEVER modify files directly. Always produce a report first and wait for user approval.

Specialist Skill Classification (IMPORTANT)

Before auditing, classify each skill as specialist or general:

Specialist skills = domain-specific reference knowledge accessed ONLY by specific agents during specific workflows. These exist to give agents deep expertise and should NOT be split or reduced. Examples: nextjs, observability, error-handling-patterns, auth, clean-code, coupling, cohesion, readability, predictability, react-best-practices, vercel-react-best-practices, vercel-composition-patterns, image-optimizer, architectures, ui-reference, web-design-guidelines, frontend-design.

General skills = workflow/command skills invoked by users or loaded broadly across agents. Examples: dev, spec, test, security, log, commit, review, qa, loop, debug, init, create, brainstorm, status, pr, rule, issue-reporter, cicd.

How to detect specialist skills:

  1. Read the skill's SKILL.md frontmatter — does it have disable-model-invocation: true or should it?
  2. Check if the skill is referenced in spec/rules/_skill-budget.md or _delegation.md as a conditional load
  3. If the skill is only loaded when a specific agent needs domain knowledge → specialist
  4. If the skill is a user-facing command or loaded by multiple agents → general

Rules for specialist skills:

  • SKIP file size audit — large files are acceptable (they provide comprehensive domain knowledge)
  • SKIP split proposals — splitting reduces the agent's expertise quality
  • DO verify isolation — must have disable-model-invocation: true (no auto-trigger cost) OR be loaded only via specific agent skills: field
  • DO verify flow — should NOT be always-loaded; should only enter context when the relevant agent is spawned
  • DO flag if broadly referenced — if 3+ agents reference the same specialist skill, it's a problem (context pollution across agents)

Read the full file on GitHub · 295 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. yesterday First seen · 295 lines · 50 tokens per session scan B 797813ba1e57

Subscribe to this mod's changes

token-optimizer is an agent published in the GitHub repository ByeongminLee/nextjs-claude-code (3 stars, last pushed 5mo ago), licensed MIT. It adds 50 tokens to every session and 2,757 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it B with 1 finding (enumerates other installed skills). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other agents, from other repositories

merge-conflict-resolver

Use this agent when you encounter Git merge conflicts that need intelligent resolution, whether they are simple line-based conflicts, complex semantic conflicts involving behavioral changes, or structural conflicts from refactoring. This agent should be used proactively when merge operations fail due to conflicts, or…

module-federation/core · 264 tokens

omd-asset-curator

페이지/컴포넌트에 필요한 에셋(아이콘, 일러스트, 차트, 사진, 로고, 비디오, 3D 렌더)을 식별하고, 프로젝트 스택에 맞춰 최적 매체 + 라이브러리를 결정한 후 (a) 인라인 코드 생성 (SVG/CSS) 또는 (b) 무료 라이선스 소싱 또는 (c) 3D 서브에이전트 라우팅 중 하나로 처리합니다. 이모지 디폴트 금지 — SVG 우선.

kwakseongjae/oh-my-design · 124 tokens

proofreader

Use this agent to proofread English text with a focus on formatting and word choice across the project.

giselles-ai/giselle · 23 tokens

omd-codex-image

Channel-aware image materializer. Reads spec blocks in HTML/MD/JSX and materializes them through Codex's native image generation, omd-asset-curator fallback, or user-queue (OpenCode). One spec format, three downstream paths.

kwakseongjae/oh-my-design · 68 tokens

project-structure

Airbroke uses the Next.js App Router. Most feature code lives under app, components, lib, prisma, and tests.

icoretech/airbroke · 0 tokens

analyst

Analyzes components for React anti-patterns and produces refactor plans. Use when starting a new refactor subtask.

guillermoscript/lms-front · 27 tokens