FORG's most important metric — how many tokens it saved you — now works correctly for all models and all session types, including context compactions.
FORG's core value proposition — showing you how many tokens it saved — was broken for most sessions. Two root causes:
1. The savings formula only counted Anthropic prompt cache reads. Sessions using other models (minimax-m3, o3, Gemini, etc.) had no pricing data, so calcSavingsUsd() returned null and the UI fell back to 0.
2. The PreCompact hook's context window size was silently discarded — the hookStdin struct in the agent was missing the ContextWindowCurrent and ContextWindowMax fields, so context compaction savings were never tracked.
v3.1.1 fixes both. Token Savings now shows the real combined number.
Each time Claude Code compacts the context (the PreCompact hook fires), FORG now records the size of the context that was compacted.
This is stored as compaction_tokens — a separate column from tokens_saved (which tracks Anthropic prompt cache reads). The dashboard shows the combined total as "Tokens Saved" with a tooltip that breaks down: • X cache — from Anthropic prompt cache reads (90% discount) • Y compacted — context tokens compacted by FORG's PreCompact hook
Both metrics show up in the sessions list and the session detail page.
The following models now have accurate pricing in FORG's cost engine:
minimax-m3 $0.80/M input $2.30/M output minimax-m1 $0.30/M input $1.10/M output o3 $10.00/M input $40.00/M output o3-mini $1.10/M input $4.40/M output o4-mini $1.10/M input $4.40/M output claude-opus-4-6 $15.00/M input $75.00/M output claude-opus-4-7 $15.00/M input $75.00/M output claude-opus-4-8 $15.00/M input $75.00/M output claude-sonnet-4-6 $3.00/M input $15.00/M output claude-haiku-4-5 $0.80/M input $4.00/M output
Sessions using these models now show accurate cost and savings estimates.
Running forg update now downloads v3.1.1 binaries for all 5 platforms (darwin-arm64, darwin-amd64, linux-amd64, linux-arm64, windows-amd64) and replaces the running binary in-place.
The fix: binaries were rebuilt with VERSION=3.1.1 injected via -ldflags, uploaded to the forg-dist R2 bucket under releases/3.1.1/, and registered as stable in the D1 releases table.