BUILD / set-auto-compact-threshold-in-grok-build

Build

Set auto-compact threshold in Grok Build

Set auto-compact threshold in Grok Build

Grok Build can compact conversation history automatically when context usage crosses a percent threshold. Official session settings live in the settings reference. Manual compact stays on /compact — see Compact a long Grok Build session.

Set the threshold

User ~/.grok/config.toml / $GROK_HOME/config.toml:

[session]
auto_compact_threshold_percent = 85

Allowed range is 0100. Documented default is 85.

Project .grok/config.toml does not own [session] — keep this in the user config.

Check usage before it trips

/context

/context shows current fill so you can compact early with /compact [context] or raise/lower the threshold for longer or shorter sessions.

Related session knobs

Setting Default Role
auto_compact_threshold_percent 85 Auto-compact when usage reaches this percent
load_envrc true Inject .envrc variables into bash

Model context_window on custom / BYOK models also drives when auto-compact timing makes sense — larger windows delay the same percent trip.

Pitfalls

  • A threshold of 0 is valid in the documented range; treat very low values as aggressive compaction, not a disable switch.
  • Auto-compact does not replace /rewind or /new when you need a clean thread rather than a smaller working set.
  • API request compaction is a different surface — Use context compaction.