Zenaique

Defend a token budget split between rolling summary, recent turns, and retrieved context for a support chatbot

Short answer·Medium·4.0 · 0·~3 min·Asked atCitadelCohereFlowise
Attempt it

You have a 16k-token window for a customer support chatbot. Propose a budget split across system prompt, persistent memory, rolling summary, recent verbatim turns, and retrieved KB chunks. Justify the priorities.

Free · 2 AI evals / day
TL;DR

Protect output reservation and system prompt first, allocate the biggest content slot to retrieval, give recent turns more space than rolling summary, and keep slack to avoid prompt-cache misses.

Memory aid
Sign in to see the mnemonic that makes this stick.
Easy to grasp

Picture packing for a flight with a hard weight limit on the bag. Some things are fixed and non-negotiable: the boarding pass, your passport, the clothes you will wear off the plane. Those go in first and you do not weigh them again. After that, you allocate the remaining weight by how badly you need each thing. The textbook for the trip gets a lot because it is the whole point. A small notebook of personal preferences earns a little space because it changes every trip. Old itineraries from last year get a single summary card, not the full paper. And you leave a little slack so the bag still closes when you stuff something in at the gate. A token budget is the same shape.

Concept explanation~2 min read

Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.

A context-window budget is a multi-objective allocation problem. Each slot competes for the same finite token pool, but the slots are not interchangeable. Some carry the dominant signal for the task; others are scaffolding; some are non-negotiable. The art is in the priority order, not the exact numbers.

This card walks through a defensible split for a 16k-token customer-support chatbot, the reasoning behind each allocation, and how to evict under budget pressure without breaking the answer.

The four-tier priority

Every context-window allocation falls into one of four priority tiers. The tiers are about flexibility under budget pressure, not about absolute size.

Tier 1: Protected. Slots that cannot float. Output reservation and system prompt. The output slot is sized by the task floor, the smallest answer the system has to produce without truncation. The system prompt is sized by the rules the model must follow. Both are roughly fixed for a given application.

Tier 2: Signal-carrying. Slots that carry the dominant information for the task. For a grounded support chatbot, that is retrieved KB chunks and recent verbatim conversation turns. These two get the biggest share because the answer literally depends on what is in them.

Tier 3: Scaffolding. Slots that provide coherence and personalisation but are not the main signal. Rolling summary (connective tissue for older conversation) and persistent memory (cross-session user facts). These get modest budgets because their value is in being present at all, not in being large.

Tier 4: Slack. Tokens reserved for variation and prompt-cache stability. Not a content slot; the absence of slack causes production failures even when the content slots are sized correctly.

Why the order matters

When the budget tightens, you evict from the bottom of the priority list. The order determines what the system degrades to under load, which is what production correctness depends on.

Output reservation: the protected floor
The signal-carrying tier: KB chunks and recent turns
The scaffolding tier: summary and memory
Slack, eviction, and production tuning
Sign in to unlock the full deep dive.

Situations where this technique stops working.

Sign in to see when this approach fails.

2–4 min · Everything important, quickly.

Sign in to see the quick scan of the deep dive.

Real products, models, and research that use this idea.

  • Anthropic's Claude Opus 4.7 support-chatbot reference architecture uses a similar split: large retrieval slot, generous output reservation, modest rolling summary.
  • LangGraph's MemorySaver-plus-retrieval pattern for production support agents explicitly separates persistent memory from rolling summary as different stores.
Sign in to see more production examples.

What an interviewer would ask next. Try answering before peeking at the approach.

QHow would you change this split for a 200K-token window?
A

Output reservation and system prompt stay similar; retrieval can stretch to top-10 or top-15 chunks; verbatim turns can carry more history without needing summarization; rolling summary becomes optional for moderate-length conversations.

2 more follow-ups an interviewer would ask next. Sign in to reveal them.

Red flags & common mistakes

The phrases that signal junior thinking. Click to expand.

Most common mistake

Splitting the budget evenly across all slots, or letting output reservation float. Output tokens are fixed by the task, not negotiable against input; treating them as flexible is how production prompts truncate mid-answer.

Sign in to see all red flags and common mistakes.

60 second bullets to scan on the way to the call.

  • Which slots are protected and why output reservation tops the list

  • Why KB chunks get the largest content slot for a grounded task

Sign in to unlock the revision sheet.

Primary sources. Browse if you want the original framing.

Similar questions

Same topic, related formats. Practice these next.

4 curated
Next question
Pick the most effective intervention when an agent's context grows by 8KB every iteration
MCQ·Medium