affectUI › Guides

Context window UI: showing what fills an LLM's context

Show the context window as a share of its limit, split by what fills it – system prompt, tools, memory, files and the conversation – so people see at a glance what takes the most space. Warn before it's full, let people remove files or compact the conversation in place, and keep long-term memory as a separate, editable list.

Why show the context at all

When the context fills up, answers get worse, slower and more expensive, and eventually the model forgets the start of the conversation. People can't fix what they can't see. A small view of what's in the context turns a mysterious drop in quality into something they can act on.

What fills it

A single token count says little. Split it into the parts people recognise:

  • System prompt and instructions – usually fixed
  • Tool definitions – grow with every connected app
  • Memory – what the assistant remembers about the user
  • Files and attachments – often the biggest part
  • The conversation – grows with every message
  • Context Window – What fills the model's context, as a field of cells – hover a part to light it up, remove files, and compact the conversation while its cells shimmer and clear
  • Context Map – What fills an agent's context window, as a living treemap – system prompt, tools, memory, every file, the chat and tool results as tiles that glide as it grows, the free space dashed, and compaction squeezing old turns into a summary

How full is it

Show the total as a share of the window, not as "84,213 tokens". A bar or a field of cells reads instantly; color it as it approaches the limit and warn before the next message would overflow, not after the model has dropped something.

  • Context Window – What fills the model's context, as a field of cells – hover a part to light it up, remove files, and compact the conversation while its cells shimmer and clear

Let people make room

The fix should sit right next to the problem. Hovering a part highlights how much it takes; files can be removed in one click; and a compact action summarises the older conversation and shows how much space it freed.

  • Context Window – What fills the model's context, as a field of cells – hover a part to light it up, remove files, and compact the conversation while its cells shimmer and clear
  • Context Map – What fills an agent's context window, as a living treemap – system prompt, tools, memory, every file, the chat and tool results as tiles that glide as it grows, the free space dashed, and compaction squeezing old turns into a summary

Memory is different

Long-term memory outlives a conversation, so it needs its own place: a list people can read, edit and switch off, grouped by topic and showing where each memory came from. Show how much of the context it takes, but manage it in settings rather than in the chat.

  • Memory Panel – What the assistant remembers about you, grouped and editable – a master switch, category filters, and on every memory edit in place, pause or forget with Undo on the tray

Context and cost

Every token in the context is paid for on every request. Showing the context next to usage and budget makes clear why long conversations with big files cost more – and why compacting helps.

  • Usage Meter – Plan usage and AI credits – a stacked credits meter by category, daily sparkline, limits and a button that speaks up near the limit

Questions

Where do I get the token counts?

Most model APIs return input and output token counts with every response, and offer a token-counting endpoint or library for counting parts before sending. Pass the counts per part to the component.

Should every user see the context window?

Power users and developers benefit most. For everyone else, a small indicator that turns into a warning near the limit is enough, with the detailed view one click away.

What does compacting do?

It replaces older messages with a short summary, keeping the gist while freeing space. Show what was summarised and how much space it saved, so it doesn't feel like the assistant forgot things.

Updated 2026-10-29