Context window management

From charlieviettq/awesome-agent-skill · View interactive version

Context window management is an AI agent skill from the GitHub repository charlieviettq/awesome-agent-skill. Manage LLM context budgets—prioritization, summarization, compaction, and what to load vs reference. Use for long sessions, large repos, or multi-doc tasks.

How to use this skill

Skill file

Context window management

Lifecycle

| Phase | Action |

|-------|--------|

| Bootstrap | Load spec, constraints, key paths only—not whole repo |

| During task | Append deltas; replace full file reads with summaries after use |

| Before compaction | Write Session state block (objective, done, open, paths) |

| Session end | Drop tool noise; keep decisions and verification evidence |

Strategy order

  1. Do not load — use search/read targeted files only.
  2. Reference — pointers (paths, line ranges) instead of full paste.
  3. Summarize — compress completed work; keep decisions and open items.
  4. Drop — remove obsolete tool output and duplicated content.

What to keep in active context

What to offload

Compaction pattern

## Session state (compacted)
Objective: ...
Done: ...
Open: ...
Key paths: ...
Do not repeat: [list already-established facts]

Multi-file work

Anti-patterns

Session setup (context engineering)

Before long tasks, establish a minimal working set:

  1. Objective block — one paragraph: goal, non-goals, done-when
  2. Constraint block — versions, env, files off-limits
  3. Reference map — paths to spec, ADR, or ticket; load on demand
  4. Tool policy — which tools/skills apply; avoid loading unused skill bodies

Refresh the objective block after major pivots; do not re-paste full history.

Pairing

Use with rag-systems for external knowledge; clarify-underspecified when scope grows mid-session; interview-me before loading large specs.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.