context-window-management

Strategies for managing LLM context windows including summarization, trimming, routing, and avoiding context rot

By sickn33 · 1,471 installs

npx skills add sickn33/agentic-awesome-skills --skill context-window-management

Source repository · Upstream listing

Context Window Management Strategies for managing LLM context windows including summarization, trimming, routing, and avoiding context rot Capabilities context engineering context summarization context trimming context routing token counting context prioritization Prerequisites Knowledge: LLM fundamentals, Tokenization basics, Prompt engineering Skills recommended: prompt engineering Scope Does not cover: RAG implementation details, Model fine tuning, Embedding models Boundaries: Focus is context optimization, Covers strategies not specific implementations Ecosystem Primary tools tiktoken OpenAI's tokenizer for counting tokens LangChain Framework with context management utilities Claude API 200K+ context with caching support Patterns Tiered Context Strategy Different strategies based on context size When to use : Building any multi turn conversation system Serial Position Optimization Place important content at start and end When to use : Constructing prompts with significant context Intelligent Summarization Summarize by importance, not just recency When to use : Context exceeds optimal size Token Budget Allocation Allocate token budget across context components When to use : Need predictable context management Validation Checks No Token Counting Severity: WARNING Message: Building context without token counting. May exceed model limits. Fix action: Count tokens before sending, implement budget allocation Naive Message Truncation Severity: WARNING Message: Truncating messages without summarization. Critical context may be lost. Fix action: Summarize old messages instead of simply removing them Hardcoded Token Limit Severity: INFO Message: Hardcoded token limit. Consider making configurable per model. Fix action: Use model specific limits from configuration No Context Management Strategy Severity: WARNING Message: LLM calls without context management strategy. Fix action: Implement context management: budgets, summarization, or RAG Collaboration Delegation Triggers retrieval rag search rag implementation (Need retrieval system) memory persistence remember conversation memory (Need memory storage) cache caching prompt caching (Need caching optimization) Complete Context System Skills: context window management, rag implementation, conversation memory, prompt caching Workflow: Related Skills Works well with: rag implementation , conversation memory , prompt caching , llm npc dialogue When to Use User mentions or implies: context window User mentions or implies: token limit User mentions or implies: context management User mentions or implies: context engineering User mentions or implies: long context User mentions or implies: context overflow Limitations Use this skill only when the task clearly matches the scope described above. Do not treat the output as a substitute for environment specific validation, testing, or expert review. Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.