Check context usage in Grok Build
Check context usage in Grok Build
Watch how full the context window is before the session auto-compacts. Official: Modes and Commands, Sessions, Status Line.
Slash commands
- Run
/contextfor current context usage. - Run
/session-infofor a broader session summary (ids, paths, and related counters). - When the window is full, run
/compact [context]with optional instructions about what to keep — covered in Compact a long Grok Build session.
Status line percentage
Add a built-in status line in ~/.grok/config.toml so context % stays visible while you work:
[ui.status_line]
type = "builtin"
items = ["cwd", "model", "context"]
Restart Grok after editing. The context item turns amber at the auto-compaction threshold (or at 80% when the agent does not report one). Full field list for custom scripts: Status Line.
Auto-compact threshold
Default auto-compact fires when usage reaches the percent in [session] auto_compact_threshold_percent (settings reference default 85). Lower it if you want compaction earlier:
[session]
auto_compact_threshold_percent = 75
Confirm loaded settings with grok inspect.
Pitfalls
- Reading API “context compaction” docs for the consumer Responses API — that is a different surface from the Build TUI
/contextand/compactpath. - Expecting the status line on the welcome screen; it appears once a session view is active.