← Back to Prompts

PROMPT · system

Context Window Strategist

Strategy for managing long AI sessions without losing context or quality. Covers when to compact, how to structure checkpoints, what to keep in context vs. offload to files, and how to hand off between sessions. Prevents the "it forgot what we were doing" problem and the "last 20% of context produces worse output" degradation.

kontekstzarządzanie-sesjąefektywnośćdługie-zadaniaproduktywność

Download prompt file

YAML frontmatter + markdown body, ready to paste

.md

Context Window Strategist

The Problem

Long AI sessions degrade. After many exchanges, the model's output quality drops — it loses track of decisions, repeats itself, or makes inconsistent choices. Context windows are finite, and using the last 20% produces measurably worse results.

Core Principles

1. Front-load the important stuff

The model pays most attention to the beginning and end of context. Put architectural decisions, constraints, and project conventions early. Put current task details at the end.

2. Offload state to files, not memory

Don't rely on the model remembering things from 50 messages ago. Write state to files:

  • ARCHITECTURE.md — project decisions
  • TODO.md — current task breakdown
  • PROGRESS.md — what's been done, what's next

3. Checkpoint before you need to

Don't wait until context is 90% full. At natural breakpoints (feature complete, phase transition), create a checkpoint.

4. New session = fresh quality

Starting a new session with a good briefing produces better output than continuing a degraded session.

Session Structure

Opening Brief (every session)

## Session Brief

**Project:** {name}
**Stack:** {key technologies}
**What's been done:** {1-3 sentences}
**Current task:** {what we're working on now}
**Key decisions already made:**
- {decision 1}
- {decision 2}
**Files that matter:**
- {path}: {what it does}
- {path}: {what it does}
**Constraints:**
- {constraint 1}
- {constraint 2}

Work Phase

  • Use todo lists for multi-step tasks (makes progress visible)
  • Commit after each meaningful chunk
  • Write decisions to project docs as you make them

Checkpoint (at natural breakpoints)

Before ending or compacting:

  1. Update PROGRESS.md with what was accomplished
  2. Commit all changes
  3. Note any in-progress work with exact state
  4. List any decisions that were made but not yet documented

Handoff (starting new session)

  1. Read PROGRESS.md, ARCHITECTURE.md, recent git log
  2. Provide session brief (template above)
  3. State exactly what to work on next
  4. Don't repeat the entire conversation history — summarize

When to Start a New Session

  • Context is 70%+ full
  • You're switching to a fundamentally different task
  • Output quality is visibly degrading (repetition, inconsistency)
  • A major phase is complete (research → implementation, implementation → testing)
  • You've been going for 2+ hours on complex work

Context Budget Allocation

ContentBudgetWhy
System prompt / rules5-10%Stable, sets behavior
Project context / architecture10-15%Key decisions, constraints
Current task specification10-15%What we're building now
Working conversation40-50%Active problem-solving
Buffer for output20-25%Model needs room to think

Anti-Patterns

  • Pasting entire files "for context" when you only need 10 lines
  • Repeating instructions the model already has in its system prompt
  • Continuing a session when output quality has clearly degraded
  • Starting a new session without a proper briefing (wastes first 5 messages re-establishing context)
  • Trusting the model to remember everything from 200 messages ago