AdvancedAbout 18 min

    Context Engineering

    Read the full article on Substack

    7 min read.

    Curate a finite context window: watch the budget fill as the loop runs, break down what fills it, apply the select/compress/isolate/persist levers, and avoid context rot.

    Think of it this way: The context window is a small desk: only so much fits. Context engineering is choosing which papers to lay out, filing old ones into a one-page summary, and keeping the rest in a drawer you reach into on demand — a cluttered desk slows you down, it doesn't help.

    Compaction

    Each agent turn adds 1,300 tokens. Add turns and watch what happens past 80%.

    Context window800 / 8,000 tokens
    compact at 80%
    • system prompt and task (always kept)800

    Check your understanding

    Answer from memory before you scroll back up. Pulling an idea out of your head is what makes it stay there.

    Budget the context window

    Sort

    Sort each item by whether it earns its tokens on every call.

    Tap a piece, then tap where it goes — or drag it. Tap the tray to take one back.

    Always worth the tokens

    Drop items here

    Compress or retrieve instead

    Drop items here
    6 pieces left to place

    Quiz

    20 questions
    Question 1 of 20
    Score: 0

    Why can adding more context to the window hurt an agent?

    Done with this lesson?

    Sign in free to keep your progress, streak and quiz scores.

    Keep going