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 skills add h4vzz/awesome-ai-agent-skills --skill context-optimizationgit clone --depth 1 https://github.com/h4vzz/awesome-ai-agent-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/h4vzz/awesome-ai-agent-skills/context-optimization)<a href="https://agentmods.dev/skills/h4vzz/awesome-ai-agent-skills/context-optimization"><img src="https://agentmods.dev/badge/skills/h4vzz/awesome-ai-agent-skills/context-optimization/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/skills/h4vzz/awesome-ai-agent-skills/context-optimization"><img src="https://agentmods.dev/badge/skills/h4vzz/awesome-ai-agent-skills/context-optimization.svg" alt="Reviewed on agentmods" width="80" 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.1 | $0.00033 | $0.02502 |
| Opus 5 | $0.00016 | $0.01251 |
| Sonnet 5 | $0.00007 | $0.00500 |
| Haiku 4.5 | $0.00003 | $0.00250 |
Grade A, and why
context-optimization 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 10d 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.
This is a copy
95% identical to context-optimization — 2 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.
How it starts
The opening of the file, as written. The whole thing — 107 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Context Optimization
Context optimization is the process of refining the raw context assembled for an AI model so that every token contributes meaningfully to the task. In a typical RAG or agent pipeline, the retrieved context often contains redundant passages, marginally relevant chunks, and poorly ordered information. Optimization transforms this raw material into a lean, high-signal context block that improves answer quality, reduces inference cost, and makes the most of the model's attention budget.
Workflow
-
Audit the Raw Context: Inventory every piece of context that has been gathered -- retrieved documents, conversation history, tool outputs, and metadata. Measure the total token count and compare it against the available context budget. Identify the compression ratio needed if the raw context exceeds the budget.
-
Deduplicate Overlapping Content: Scan the context for near-duplicate passages that convey the same information. This is common in RAG pipelines where chunking with overlap produces multiple chunks covering the same paragraph, or when multiple source documents repeat the same facts. Use semantic similarity (cosine distance > 0.92) or exact n-gram overlap detection to identify duplicates, then keep only the most complete version of each piece of information.
-
Score Relevance and Information Density: Assign each context chunk two scores: a relevance score (how closely it relates to the current query) and an information density score (how many useful facts it conveys per token). Relevance can be measured via the retrieval score or a lightweight cross-encoder pass. Density can be estimated by counting named entities, code identifiers, numerical data, and key terms relative to chunk length. Multiply the two scores to produce a composite utility score.
-
Filter Low-Value Content: Remove chunks whose composite utility score falls below a threshold. A good starting point is to keep the top 60-70% of chunks by utility score. Also remove boilerplate text (copyright notices, navigation menus, repeated headers) that contributes zero information. Be conservative -- it is better to include a marginally relevant chunk than to lose a critical fact.
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.
- 10d ago First seen · 107 lines · 33 tokens per session scan A 73d428e5637f
context-optimization is a skill published in the GitHub repository h4vzz/awesome-ai-agent-skills (34 stars, last pushed yesterday), licensed MIT. It adds 33 tokens to every session and 2,502 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. It is 95% identical to context-optimization, differing in 2 lines, and is treated as a copy.
Other skills, from other repositories
skills-backup-keeper
Keeps dated backups of the Cowork skills folder and an append-only session journal so work survives crashes, context compaction and skills wipes. Use when the user asks to back up skills, checkpoint or journal the current session, resume where a previous conversation left off, or restore skills from a backup. Also use…
hive.note-taking
Maintain a free-form scratchpad of decisions, extracted values, and open questions so context pruning doesn't lose anything you still need.
notes
Skill "notes" from Pinvou/pinvou-agent, covering ima notes, operations, write rules, examples and response handling.
exploiting-format-string-vulnerabilities
Methodology for exploiting format string bugs where attacker-controlled data reaches the format argument of printf-family functions, enabling stack/memory disclosure (info leaks for ASLR/PIE/canary defeat) and arbitrary write primitives (%n) to hijack control flow via GOT/.finiarray overwrites.
context-engineering
A project documentation framework that records a project's goals, requirements, roadmap, and current state in separate files. It also keeps those documents within set size limits for an AI coding agent.
taiyi-compress
A workflow tool for shrinking large coding-agent conversations and work files into shorter context notes. It can also coordinate separate agents for parallel development and create handoff notes for continuing work in a new session.