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/jnpiyush/agentx/context-managementnpx skills add jnPiyush/AgentX --skill context-managementgit clone --depth 1 https://github.com/jnPiyush/AgentXWrote 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/jnpiyush/agentx/context-management)<a href="https://agentmods.dev/skills/jnpiyush/agentx/context-management"><img src="https://agentmods.dev/badge/skills/jnpiyush/agentx/context-management.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.00038 | $0.02467 |
| Opus 5 | $0.00019 | $0.01234 |
| Sonnet 5 | $0.00008 | $0.00493 |
| Haiku 4.5 | $0.00004 | $0.00247 |
Grade A, and why
context-management 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 today.
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 — 318 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Context Management
Purpose: Maximize the effective use of LLM context windows through compaction, summarization, and strategic token allocation.
When to Use This Skill
- Managing long conversations that exceed context window limits
- Implementing context compaction for multi-turn agent interactions
- Designing token budget allocation across system prompt, context, and history
- Building summarization pipelines for conversation history
- Optimizing prompt length for cost efficiency without quality loss
- Managing context in multi-agent handoffs
Prerequisites
- Understanding of target model's context window size
- Token counting library (tiktoken, cl100k_base, or equivalent)
- Access to LLM for summarization (can be same or cheaper model)
Decision Tree
Context getting too long?
+- Single conversation overflow?
| +- Recent messages most important? -> Sliding window
| +- Full history needed? -> Progressive summarization
| +- Mixed importance? -> Hybrid (summary + recent window)
+- Multiple data sources competing for tokens?
| +- Prioritize by relevance -> Dynamic token budgeting
| +- All required? -> Compress each source independently
+- System prompt consuming too many tokens?
| +- Load instructions on demand (progressive disclosure)
| +- Split into core (always) + situational (on-demand)
+- Multi-agent context?
| +- Full context transfer? -> Summarize before handoff
| +- Selective transfer? -> Extract relevant artifacts only
+- Cost optimization?
+- Reduce input tokens -> Compaction + caching
+- Reduce output tokens -> Constrain response format
Context Window Budgeting
Token Budget Template
Total Context Window: N tokens
|
+-- System Prompt: 10-15% (instructions, role, constraints)
+-- Retrieved Context: 30-40% (RAG chunks, documents)
+-- Conversation History: 20-30% (recent messages + summary)
+-- Current User Message: 5-10% (the actual request)
+-- Reserved for Output: 15-20% (model's response tokens)
|
= 100% allocated (MUST NOT exceed window)
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.
- today Changed · +7 lines a987de479e39
- 4d ago First seen · 311 lines · 38 tokens per session scan A 532c04c2b856
context-management is a skill published in the GitHub repository jnPiyush/AgentX (15 stars, last pushed today), licensed Apache-2.0. It adds 38 tokens to every session and 2,467 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
pick-a-pii-model
Select an on-device OpenMed PII model from the committed registry by language, runtime format, and size budget, then require recall validation before deployment. Use when an agent must choose a local PII detector for CPU, Apple Silicon, or a mobile export without relying on live model discovery.
context-fundamentals
This skill should be used when the user asks to "understand context", "explain context windows", "design agent architecture", "debug context issues", "optimize context usage", or discusses context components, attention mechanics, progressive disclosure, or context budgeting. Provides foundational understanding of…
letta-guide
Read the official Letta documentation (docs.letta.com) through its cached, ETag-checked fetch route. Load before ANY docs.letta.com retrieval — answering how Letta works, what Letta (or you) can do, setting up providers, models, channels, skills, memory, schedules, permissions, self-hosting, pricing, or billing, AND…
agents-build
Use to extend an existing agent project with memory, app integration, VPC, multi-agent, migration, model, browser, code interpreter, payments, or resource removal. Triggers: "add memory", "remember across sessions", "call agent from app", "invoke agent from code", "agent auth", "streaming", "VPC", "VPC connectivity"…
moai-foundation-core
Provides MoAI-ADK foundational principles including TRUST 5 quality framework, SPEC-First DDD methodology, delegation patterns, progressive disclosure, agent catalog reference, and token budget management (absorbed from moai-foundation-context). Use when referencing TRUST 5 gates, SPEC workflow, or context window…
tradememory
AI trading memory with outcome-weighted recall and autonomous strategy evolution. 17 MCP tools, 1,233 tests, works with any trading platform.