Context window (grid)Pro
The context window as 200 cells grouped by category with a threshold row: send, attach and compact show exactly how much still fits, crossing the threshold compacts on its own, and switching models re-scales every cell.
oxyn add context-gridThe preview stays free for everyone. Pro opens the code of every Pro component, screen, agent-app template, block and kit, plus the Pro CLI.
Rendered from Rust at build time · goes live when visible
When to use
- An AI context window as 200 cells in 20 columns.
- Items (GridItem { cat, label, tokens }) are grouped by category in fill order: system prompt, tools, files, summary, messages; the reply reserve fills the tail as dashed cells.
- A dashed threshold row marks where compaction starts (threshold, 0.8).
- Send message and Attach file add the next turn or file; crossing the threshold compacts on its own: messages fold into a summary (about 6 %, 4K–24K tokens, summarize) placed after the files, and the status line reports folded count, summary size and before → after.
When not to use
- Prompt composer with model picker, voice input, app connections and approval request: use Chat Composer instead.
- The model menu of an AI chat: use Model Picker instead.
- The prompt box for an agent, in six layouts: use Composer instead.
Installation
Context window (grid) is part of Oxyn Pro; the preview is free. Pro items install with the oxyn CLI once your licence is signed in; until then Pro members copy the code from this page.
oxyn add context-gridUsage
The preview is free. Pro opens the code of every Pro component, screen and template.
Examples
Default
Send messages until it compacts on its own.
Code Pro
The preview is free. Pro opens the code of every Pro component, screen and template.
Near
Close to the threshold.
Code Pro
The preview is free. Pro opens the code of every Pro component, screen and template.
Early
A low threshold.
Code Pro
The preview is free. Pro opens the code of every Pro component, screen and template.
API reference
ContextWindowGrid
| Prop | Type | Default | Description |
|---|---|---|---|
modelsrequired | Vec<CtxModel> | — | Models to switch between. |
itemsrequired | Vec<GridItem> | — | What is in the window. |
threshold | f64 | 0.8 | Compaction threshold. |
turns | Vec<(String, u64)> | Default::default() | Turns that Send message adds, in order. |
files | Vec<(String, u64)> | Default::default() | Files that Attach file adds, in order. |
cells | usize | 200 | Number of cells. |
nowrequired | ClockMs | — | Shared clock (the model menu's type-ahead). |
on_compact | EventHandler<(usize, u64, u64, u64, bool)> | — | After each compaction: folded, summary, before, after, automatic. |
Read from the Rust signature and doc comments.
Keyboard interactions
| Key | Action |
|---|---|
| Tab | Model menu, Send message, Attach file, Compact now |
| EnterorSpace | Open the menu or run an action |
| ↑or↓orEnter | Choose a model |
| Escape | Close the menu |
Accessibility
- The grid is role=img with totals and the threshold; status lines are role=status.
- Reduced motion changes cells and numbers at once.
From the spec
- The grid is role=img with totals and the threshold; the status line is role=status.
Motion & interaction
Timing
- Wave 6 ms per cell from the origin, max 360 ms; numbers roll 260 ms; status crossfades 200 ms.
- Reduced motion changes cells and numbers at once.
Responsive behaviour
- Twenty columns that scale with the card.
Edge cases (spec)
- Twenty columns scale with the card.
Notes for AI
- Import
ContextWindowGridfromoxyn_dioxusand includeSTATUS_INDICATOR_CSSplus the token stylesheet once. - A GPUI version exists:
ContextGridElinoxyn_gpui. - Props to set first:
models,items,now. - It reads a clock (
now) for live timers; pass one clock for the whole page rather than one per component. - Keep its states and timings as they ship; restyle it through the CSS variables rather than by hand.