Read .optimusprime/cost-log.json (walk up from cwd to find .optimusprime/).
Estimate current session tokens from context window size (4 chars ≈ 1 token).
Output:
COST REPORT — Session: ~Xk in / ~Yk out | ~$Z.ZZ (Sonnet 4 pricing: $3/M in, $15/M out)
Previous sessions: N total | ~$W.WW cumulative
Budget alert based on complexity_budget in contract.json:
minimal+ usage > 20k tokens → warnmoderate+ usage > 60k tokens → warnfull+ usage > 150k tokens → warn
Alert: COST ALERT: ~$X.XX used this session — over [minimal/moderate/full] budget
Append to .optimusprime/cost-log.json (create if missing):
{"session_id": "...", "estimated_input_tokens": N, "estimated_output_tokens": N, "estimated_cost_usd": N, "recorded_at": "ISO 8601"}