context-management
Rules and strategies for managing agent context window size, avoiding bloat, and preserving signal-to-noise ratio.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Rules and strategies for managing agent context window size, avoiding bloat, and preserving signal-to-noise ratio.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Standard patterns for error handling, retry logic, circuit breakers, and graceful degradation.
Detect and remove contradictions across agent policies before execution.
Multi-step tool workflows via code orchestration to reduce latency, context pollution, and token overhead.
Bind project-specific prompts to local schema and workflow artifacts while keeping the harness core generic and globally reusable.
Operational session protocol for task-scoped leases, reconciliation, checkpoints, inspection, queue promotion, and handoff across long-running work.
Operational session protocol for task-scoped leases, reconciliation, checkpoints, inspection, queue promotion, and handoff across long-running work.
| name | context-management |
| description | Rules and strategies for managing agent context window size, avoiding bloat, and preserving signal-to-noise ratio. |
Prevent context window bloat and maintain a high signal-to-noise ratio during long agent sessions.
grep_search over full file reads when looking for specific patternsprogrammatic-tool-calling skill)head -n 50, tail -n 20)M1-I3) instead of re-describing tasks| Sign | Action |
|---|---|
| Repeating information the agent already stated | Context is too large — summarize and drop old details |
| Tool outputs exceeding 100 lines | Filter before returning |
| Reading 5+ full files without processing | Switch to targeted reads |
| Agent "forgetting" earlier decisions | Checkpoint to file, reference it |
Use simple budgeting rules instead of waiting until the window is already polluted:
| Situation | Practical heuristic |
|---|---|
| Large repo exploration | keep the active working set under ~5 files at once |
| Command output | keep only pass/fail summary plus failing details |
| Multi-phase task | checkpoint after each phase and drop solved details |
| Repeated docs/spec references | reference the file path and section instead of pasting it again |
For long tasks, prefer this loop:
progress.md, plan.md, or a Harness checkpointThat is usually better than carrying the full earlier implementation and test history in active context.
programmatic-tool-calling — use code orchestration to filter intermediate dataplanning-tracking — offload plans to files instead of contextsession-logging — checkpoint progress for context reconstructionharness-lifecycle — use canonical checkpoints and handoffs instead of bloated chat memorynpm test output (hundreds of lines) to context