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.
npx agentmods add skills/richfrem/agent-plugins-skills/optimize-contextnpx skills add richfrem/agent-plugins-skills --skill optimize-contextgit clone --depth 1 https://github.com/richfrem/agent-plugins-skillsWrote 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.
[](https://agentmods.dev/skills/richfrem/agent-plugins-skills/optimize-context)<a href="https://agentmods.dev/skills/richfrem/agent-plugins-skills/optimize-context"><img src="https://agentmods.dev/badge/skills/richfrem/agent-plugins-skills/optimize-context.svg" alt="Measured on agentmods" height="20"></a>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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.00164 | $0.02870 |
| Opus 5 | $0.00082 | $0.01435 |
| Sonnet 5 | $0.00033 | $0.00574 |
| Haiku 4.5 | $0.00016 | $0.00287 |
Grade D, and why
optimize-context scanned grade D with 2 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 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.
ls .claude/skills 2>/dev/null | wc -l Recursive force deletehighDestructive command
rm -rf with a variable or a broad path is one typo away from removing the wrong tree.
rm -rf .claude/skills/* .claude/agents/* .claude/commands/* .claude/hooks/* How it starts
The opening of the file, as written. The whole thing — 284 lines — stays where its author put it; the contents beside it link to each section on GitHub.
optimize-context: Agent Context Hygiene
Two-pass context optimization. Run both passes each time unless the user specifies otherwise.
Prerequisites
plugins/directory present (plugin-canonical skills source)scripts/optimize_context.pyavailable in this plugin- At least one instruction file readable at project root:
CLAUDE.md,GEMINI.md, or.github/copilot-instructions.md
Phase 1: Intent Capture
Parse $ARGUMENTS:
--dry-run→ report only, no writes--verbose→ print every skill found--project-root PATH→ override project root (default: CWD)--skills-only→ skip instruction file audit--instructions-only→ skip skill deduplication
Confirm with the user before writing in live mode.
Phase 2: Skill Deduplication
Root cause: Through experiment, we confirmed Claude Code auto-scans the entire
repository for SKILL.md files (identifying them as "Plugin" skills). It
also scans .claude/skills/ (identifying them as "Project" skills).
Because the installer used to symlink everything into .claude/, Claude Code
was loading every skill twice.
What ships with it
3 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.
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.
- yesterday First seen · 284 lines · 164 tokens per session scan D 07b5d73d5865
optimize-context is a skill published in the GitHub repository richfrem/agent-plugins-skills (6 stars, last pushed yesterday), licensed MIT. It adds 164 tokens to every session and 2,870 once invoked, about $0.0008 per session on Opus 5. A static security scan graded it D with 2 findings (enumerates other installed skills, recursive force delete). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.
Other skills, from other repositories
todos
Handle the agent personal todos.md file.
slip
Send AI-written text to a HUMAN outside this chat via a one-tap Slip note and reply with a single URL. Default: toss — a one-shot note (Markdown rendered, readable on open, tear-to-delete, auto-expires in 24 hours) for one-way delivery like checklists, summaries, code snippets. Use push only when the human is expected…
situate-what
Use when the user asks what is going on and needs a five-line summary of the session, branch, pull request, and ticket.
claude-nextsession
Schedule a set of instructions to run automatically once the current Claude Code usage session resets, using the local rate-limit cache (no API key needed). Trigger: "postpone this to next session", "run this once my usage resets", "queue this for later / after the reset", /claude-nextsession.
disk-reclaim
Reclaim disk space through a proof-gated plan — clears regenerable caches, merges proved-redundant copies, and protects agent history.
situate-brief
Use when confusion is only “huh,” “wait, what,” “sorry, you lost me,” or “slow down; explain simply and keep it short.”.