Skip to content

Token Forecast

sarmakska edited this page Jun 4, 2026 · 1 revision

Token forecast

The context gauge tells you where you are now. The forecast tells you where you will be soon, so you can compact on your terms instead of getting trimmed mid-thought.

The equation in plain English

slipstream tracks the per-step token delta across the recent window of tool calls. It takes the rolling mean of how many tokens each step has added to the context, smooths it with an exponentially weighted average (heavier weight on the most recent steps), and projects forward:

steps_remaining = (warnPct * targetTokens - actualTokens) / mean_tokens_per_step

Where targetTokens and warnPct come from .claude/slipstream/budget.json and actualTokens is the live reading (true in Claude Code from the session transcript, estimated elsewhere). The forecaster floors negative or near-zero results, caps the upper bound at 99, and refuses to display a number when the recent window has fewer than three steps (the variance is too high to be useful).

Where it appears in the statusline

The statusline gains a forecast segment next to the budget level:

cp | ctx 47%* (~12 steps) | mem 4 | obs 37 | skill scoped-read

In the dashboard the same number sits on the budget gauge, and the gauge shades amber once the forecast drops below ten.

What (~12 steps) means

It means: at the current pace of context growth, you have about twelve more tool calls before you cross the warn threshold (the amber line on the gauge, default 70 %). It is a rolling estimate, not a hard guarantee. If you start pulling in big files the number shrinks fast; if you switch to sp_symbol and sp_lines it grows.

The tilde is deliberate. The forecast is a hint to act early, not a deadline. Common reactions when it dips below ten:

  • Run /slipstream:remember to checkpoint the decision in progress.
  • Switch to scoped reads exclusively.
  • Trigger a compaction on purpose so the PreCompact digest captures the session shape you want, instead of whatever Claude Code chooses to trim.

SarmaLinux . sarmalinux.com . Repository

Clone this wiki locally