Skip to content
DocsChartsContext rulerLast updated Nov 2, 2026

Context ruler

What fills a model's context window. Sample data: context of four requests on a 128K scale, split into system, history, tools, docs and output.

Open in
Context window useTokens per request in a 128K window, compaction at 100K: REQ 4812 91K, REQ 4809 48K, REQ 4801 117K, REQ 4795 61K; 1 request past the compaction line.032K64K96K128KREQ 4812REQ 4809REQ 4801REQ 4795SYSTEMHISTORYTOOLSDOCSOUTPUT
Context window use
RequestSystem (K)History (K)Tools (K)Docs (K)Output (K)Total (K)
REQ 48123421226891
REQ 4809318814548
REQ 480136114309117
REQ 479538440661
Context window useTokens per request in a 128K window, compaction at 100K: REQ 4812 91K, REQ 4809 48K, REQ 4801 117K, REQ 4795 61K; 1 request past the compaction line.032K64K96K128KREQ 4812REQ 4809REQ 4801REQ 4795SYSTEMHISTORYTOOLSDOCSOUTPUT
Context window use
RequestSystem (K)History (K)Tools (K)Docs (K)Output (K)Total (K)
REQ 48123421226891
REQ 4809318814548
REQ 480136114309117
REQ 479538440661

Installation

  1. 1

    Set up the registry once

    This chart is free in Hearth and MIT licensed: no token. Add @chartory to components.json once (the URL alone, no headers), or skip this when another chart is already installed.

    Installation guide
  2. 2

    Add the chart

    One command adds the Context ruler component to your project.

    npx shadcn add @chartory/context-ruler
  3. 3

    Use it

    Pass your rows. The props are the Figma properties.

    usage.tsx
    import { ContextRuler }  from "@/components/chartory/context-ruler"<ContextRuler  data={requestContext}  size="m"  legend/>

Props

<ContextRuler>

Every prop but data is a Figma property with the same name and values.

PropTypeDefault
data: The chart's data. The tables below list every field.ContextRulerDataRequired
size: The size class. Each one is laid out again from the data."xs" | "s" | "m" | "l""m"
legend: Shows the legend row under the plot.booleantrue
color: The data colour of the primary marks (data/primary)."cat-1" | "cat-2" | "cat-3" | "cat-4""cat-1"

ContextRulerData

The data prop: one object for the whole chart.

PropTypeDefault
max: The top of the value scale.numberRequired
limit: The limit.numberRequired
ticks: The axis tick values.number[]Required
kinds: One entry per kind: label and colour.ContextRulerKind[]Required
rows: One entry per row.ContextRulerRow[]Required

ContextRulerKind

One object per entry in kinds.

PropTypeDefault
label: The name shown on the chart.stringRequired
tok: The colour token, e.g. "data/primary".stringRequired

ContextRulerRow

One object per entry in rows.

PropTypeDefault
label: The name shown on the chart.stringRequired
segs: The segments.number[]Required

The data as a JSON Schema: schemas/context-ruler.json

Context ruler: a React and Figma chart in four sizes

What does a context ruler show?

A context ruler draws each request's context as a bar on a token scale, split into system, history, tools, documents and output. You see what takes the room and how close each request is to the limit. Use it for LLM apps and agents.

Chartory ships it as a Figma component and a React component with the same name. The code installs from the shadcn registry with one command and lands in your project as a file you own.

What is the Context ruler component?

It is one <ContextRuler> component. Its props are the Figma properties with the same names and values, and the props table above lists them. The data is tokens per part, per request.

Sizes XS, S, M and L re-lay the chart out from the data instead of scaling it, so labels stay readable at every size.

When should I use it?

  • Is there a token limit? Yes means the context ruler fits.
  • Are requests compared? Yes means the context ruler fits.
  • Is it the split, not the trend? Yes means the context ruler fits.

When does another type fit better?

  • Parts of one total, no limit. Use Stacked bars instead.
  • One request in detail. Use Flame graph instead.
  • Usage over time. Use Area chart instead.

Context ruler questions

Installing, data, Figma and plans.

  • Yes. It installs through the shadcn registry with the shadcn CLI, and the file lands in your project.

Stay in the loop

New charts, by email.

Get an email when new chart types and releases ship.

Unsubscribe any time.