Skip to content
Sign in
EvalsContext window mapMenu

Context window mapPro

What fills a model's context window as one stacked bar and a table: system prompt, tools, history, files, the reply's reserve and what is free, with drill in.

ProA long support session at 82%: open History to see which tool results fill it, or compact.

Installation

$ pnpm dlx shadcn@latest add @chatcn-pro/context-window-map

Usage

tsx
import { ContextWindowMap } from "@/components/ui/chatcn/pro/context-window-map"

<ContextWindowMap
  limit={200_000}
  model="Claude Sonnet 5.5"
  categories={categories}
  reservedOutput={8_192}
  compactAt={0.9}
  onCompact={compact}
/>

Each category lists the items it is made of: tool schemas, turns, files. Open a row to see them largest first, in steps of the category's color, so the one tool result that ate 28 000 tokens stands out. The free context-meter is the small ring for a toolbar; this is the full breakdown behind it.

Past warnAt the map turns amber and quotes what compaction would free; past the limit it turns red and says the request will fail. compactAt draws the point where your app compacts on its own.

Examples

States

ProDrilled into tool schemas, a fresh session, over the window and counting.

Props

PropTypeNotes
limitnumberWindow size in tokens
categoriesContextMapCategory[]{ key, label, description?, tokens?, items?: { id, label, tokens, detail? }[] }
reservedOutputnumberTokens held for the reply
warnAt, compactAtnumberShares of the window. Warn default 0.8
compactSaves, onCompactnumber, () => voidQuote the saving and add Compact
open, defaultOpenstring | nullThe category drilled into
loadingbooleanCounting is still running

Keyboard

KeyAction
Enter on a rowShow what the category is made of
EscBack to all context

Accessibility

  • Rows with items are buttons; focus moves to Back on drill in and returns to the row after.
  • The bar is an image with its totals as its name; the table carries every number in text.

Motion

Drilling in crossfades the bar and table in 150 ms when opened by pointer; keyboard and reduced motion swap them instantly.