principle-guard-the-context-window

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Guard the Context Window

守护上下文窗口

The context window is finite and non-renewable within a session. Every token should be worth its cost.
Why: Context overflow degrades reasoning quality, creates compression artifacts, and halts progress.
Pattern:
  • Isolate large payloads. Route verbose outputs, screenshots, and large documents to subagents. The main context gets summaries, not raw data.
  • Keep frequently used content inline. Templates and references used on every invocation belong in the skill file, not in separate files that cost a read each time.
  • Size phases and cap scope. Limit files per phase, set turn budgets, account for mechanism costs.
上下文窗口是有限的,并且在一个会话内无法续期。每个 token 都应物有所值。
原因: 上下文溢出会降低推理质量、产生压缩伪影并中断进度。
模式:
  • 隔离大型载荷。 将冗长输出、截图和大型文档分流给子 Agent。主上下文只接收摘要,而非原始数据。
  • 将常用内容保留在上下文中。 每次调用都会使用的模板和引用应放在 skill 文件中,而不是放在每次读取都需要额外开销的独立文件中。
  • 划分阶段并限制范围。 限制每个阶段处理的文件数量,设置轮次预算,并考虑机制成本。