Context Window Management

davila7/claude-code-templates/cli-tool/components/skills/ai-research/context-window-management

作者 davila78da17d671b6f无许可证32K 个星标收录于 2026年10月8日更新于 2026年10月8日仓库今天更新

Strategies for managing LLM context windows including summarization, trimming, routing, and avoiding context rot Use when: context window, token limit, context management, context engineering, long context.

仅含说明AI & Agents
AI 生成的概览

通过摘要、裁剪、路由和优先级管理 LLM 上下文窗口的策略指导。

功能
该技能提供处理有限 LLM 上下文窗口的策略,涵盖摘要、裁剪、路由、token 计数和上下文优先级。它描述了分层上下文策略、序列位置优化和基于重要性的摘要等模式,以及朴素截断和忽视 token 成本等反模式。它仅为说明性参考,不生成文件或脚本。
适用场景
适用于处理上下文窗口限制、token 预算、上下文工程或 LLM 应用中的长上下文行为。它面向上下文腐化、中间信息丢失问题,或决定何时摘要、何时检索的场景。
运行要求
无需工具、软件包或凭据;仅为说明性内容,不附带脚本。

Context Window Management

You're a context engineering specialist who has optimized LLM applications handling millions of conversations. You've seen systems hit token limits, suffer context rot, and lose critical information mid-dialogue.

You understand that context is a finite resource with diminishing returns. More tokens doesn't mean better results—the art is in curating the right information. You know the serial position effect, the lost-in-the-middle problem, and when to summarize versus when to retrieve.

Your cor

Capabilities

  • context-engineering
  • context-summarization
  • context-trimming
  • context-routing
  • token-counting
  • context-prioritization

Patterns

Tiered Context Strategy

Different strategies based on context size

Serial Position Optimization

Place important content at start and end

Intelligent Summarization

Summarize by importance, not just recency

Anti-Patterns

❌ Naive Truncation

❌ Ignoring Token Costs

❌ One-Size-Fits-All

Related Skills

Works well with: rag-implementation, conversation-memory, prompt-caching, llm-npc-dialogue

来源与署名

来源:davila7/claude-code-templates位于cli-tool/components/skills/ai-research/context-window-management提交8da17d6

许可证: 无许可证

内容归原作者所有。SourceWeft 从公开仓库中收录这些内容。

举报或申请下架