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/vodailocz/kilo-kit-mcp/context-optimizationnpx skills add VoDaiLocz/kilo-kit-mcp --skill context-optimizationgit clone --depth 1 https://github.com/VoDaiLocz/kilo-kit-mcpWrote 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/vodailocz/kilo-kit-mcp/context-optimization)<a href="https://agentmods.dev/skills/vodailocz/kilo-kit-mcp/context-optimization"><img src="https://agentmods.dev/badge/skills/vodailocz/kilo-kit-mcp/context-optimization.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.1 | $0.00045 | $0.00869 |
| Opus 5 | $0.00023 | $0.00434 |
| Sonnet 5 | $0.00009 | $0.00174 |
| Haiku 4.5 | $0.00005 | $0.00087 |
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 6d 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.
How it starts
The opening of the file, as written. The whole thing — 82 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Context Optimization Skill
This skill provides methodologies and best practices for maximizing context window efficiency, reducing token costs, and improving the performance of LLM-based agentic workflows.
1. Prompt Cache Alignment
To maximize Key-Value (KV) cache hits, prioritize stability in the early parts of the prompt.
- Static Prefixes: Design system prompts to remain identical across agent turns.
- Tool Order: Sort tool definitions alphabetically or by frequency of use. Keep this ordering constant.
- Prefix Consistency: Reserve the top 70% of the KV cache for global system instructions and tool definitions.
- Avoid Dynamic Data: Move dynamic session-specific data (dates, current file list) to the end of the context window.
2. Semantic Pruning & AST Compaction
Reduce unnecessary data before sending it to the model.
- Removal of Non-Essentials: Strip comments, debug logs, and unused boilerplate code.
- AST Compaction: Convert deep code structures into simplified, representative summaries or pseudocode.
- Whitespace Stripping: Use minification for configuration files (JSON, YAML) and standard code.
- Irrelevant Body Dropping: Replace large, irrelevant function bodies with docstrings or signatures if the model doesn't need to reason about the implementation details.
3. Lost-in-the-Middle Mitigation
LLMs often suffer from recall degradation for information in the center of the context window.
- Boundary Priority: Place high-priority constraints, critical instructions, and schema definitions at the very beginning (Head) or the very end (Tail) of the context.
- Sandwich Strategy: If critical information must be in the middle, sandwich it between two clear, high-level summary points that repeat its purpose.
4. Sliding Windows & Recursive Summarization
Manage long-running conversations without exceeding token thresholds.
- Sliding Window: Keep only the N most recent turns for immediate interaction.
- Recursive Summarization: Periodically collapse historical turns into a compressed "Session State Summary".
- State Archiving: Store older, less relevant interactions in a side-car file (e.g.,
archive.md) that the agent can read only when necessary.
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.
- 6d ago First seen · 82 lines · 45 tokens per session scan A a5fcdfaa867d
context-optimization is a skill published in the GitHub repository VoDaiLocz/kilo-kit-mcp (26 stars, last pushed 3d ago), licensed Apache-2.0. It adds 45 tokens to every session and 869 once invoked, about $0.0002 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.
Other skills, from other repositories
ai-wrapper-product
Expert in building products that wrap AI APIs (OpenAI, Anthropic, etc. ) into focused tools people will pay for. Not just "ChatGPT but different" - products that solve specific problems with AI.
prompt-writing
Create, refine, and optimize high-quality YAML prompts for AI assistants. Use when working with prompt templates, system prompts, agent prompts, or any prompt engineering tasks. Provides structure guidelines, template patterns, and quality standards for YAML-based prompts.
ai-product
Every product will be AI-powered. The question is whether you'll build it right or ship a demo that falls apart in production.
chain-of-thought-prompts
Chain-of-thought and step-by-step reasoning prompts for complex problem solving.
few-shot-example-gen
Few-shot example generation and optimization for improved LLM performance.
llm-classifier
LLM-based zero-shot and few-shot classification for flexible intent detection.