Skip to content
Back to skills

Context Window Management

ASecurity

Manage LLM context budgets—prioritization, summarization, compaction, and what to load vs reference. Use for long sessions, large repos, or multi-doc tasks. Triggers: "context window", "too long", "summarize context", "token budget".

  • 25 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added May 27, 2026
developmentgo

Security analysis

A100/100

Scanned May 27, 2026

npx -y skills add charlieviettq/awesome-agent-skill --skill context-window-management --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Context Window Management?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Context Window Management
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/charlieviettq-context-window-management/badge)](https://www.skillsdirectory.com/skills/charlieviettq-context-window-management)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: context-window-management
description: >
  Manage LLM context budgets—prioritization, summarization, compaction, and
  what to load vs reference. Use for long sessions, large repos, or multi-doc tasks.
  Triggers: "context window", "too long", "summarize context", "token budget".
---

# 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

- Current objective and acceptance criteria
- Constraints (env, versions, "do not touch")
- Recent errors and fixes
- Open questions

## What to offload

- Full file contents already summarized
- Long command outputs (keep exit code + last N lines)
- Exploratory branches that did not ship

## Compaction pattern

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

## Multi-file work

- Load one module at a time when possible.
- Prefer ripgrep/semantic search over dumping trees.
- For RAG: retrieve only top-k relevant chunks.

## Anti-patterns

- Pasting entire repos or logs into chat.
- Re-explaining architecture every turn without delta.
- Keeping failed attempts at full length after resolution.

## 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.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…