Skip to content

What SessionCost finds

SessionCost does two jobs while your agent works: it finds token waste and proposes the fix, and the Live Guard stops risky steps before they run. Both run on your computer and send nothing anywhere.

How you see it: type /sessioncost for the report, /sessioncost fix for the list. With tips on, a one-line tip ends the agent’s reply when there is waste worth fixing.

What “fix it” does: shows the change first, makes a backup, then applies it. sessioncost fix --undo puts it back. The report later shows what the fix saved.

  • Long chat. Every message re-sends the whole chat. Fix: the agent writes a handover; you start a fresh chat.
  • Cache gone. A long pause or a mid-chat change of model, tools or settings re-sends everything at full price.
  • Same file read again. A second copy rides along with every later message.
  • Whole file rewritten for a few changed lines.
  • Failing step retried again and again with no change.
  • Tests re-run with nothing changed in between.
  • Helpers checked on over and over instead of reporting back.
  • Helpers re-reading what the main agent already knew.
  • Turns spent asking “may I?” for steps you would always allow.
  • Tools never used: connected servers and built-in tools. Fix: switched off for this project (Claude Code).
  • Old big output still carried in the chat.
  • Big tool results: whole lockfiles, build folders, long logs.
  • Long always-on instructions sent with every message.
  • Screenshots where text would do.
  • Long answers and deep thinking on routine steps.
  • A big model on routine steps. Fix: you choose the model at the start of the next chat.

Stopped before it happens: when the agent is about to read all of a big file (about 10k tokens, or a lockfile from about 3k) without a line range, it is turned back once and told to search first or read only the lines it needs. Reading it again goes through. Works with the guard on or tips on; it asks you nothing.

For the other items, “fix it” adds one short rule to your agent’s own rules file (CLAUDE.md, AGENTS.md, GEMINI.md, Cursor rules or Copilot instructions).

Each item says how many tokens it cost, what that is in money, why it costs, and the best practice.

Token best practices · Save tokens

How you see it: a blocked or asked step shows a line in the chat saying what and why. /sessioncost starts with this chat’s count of steps checked, blocked and asked; the report’s Trace & risk map lists each one.

What it does: checks every tool step before it runs. Blocked steps never run; asked steps wait for your yes; the rest go ahead and are logged. Say “allow it” to stop being asked about that step in this project.

  • Reading or sending a secret: .env, SSH keys, cloud logins, also disguised (cat .e*).
  • A secrets file in a commit, including what git add . would pick up.
  • Printing the environment (printenv, echo $API_KEY).
  • Running code from the internet (curl … | sh).
  • Hidden commands (-EncodedCommand, base64 -d | sh).
  • Rewriting shared history (git push --force).
  • Switching off commit checks (--no-verify, core.hooksPath).
  • Persistence: scheduled tasks, startup entries, shell profiles.
  • Switching off a security tool: Defender, the firewall.
  • Wiping a disk or home folder (rm -rf ~, format).
  • Changing the guard: its settings, log or the agents’ hooks.
  • A poisoned MCP server’s tools, for the whole chat.
  • A risky step right after a prompt injection.
  • Push, once per destination.
  • Install, once per package.
  • A package not in the project’s lists, every time.
  • Deleting files or work (git restore, stash drop).
  • Writing outside the project.
  • A new website, once per site.
  • The agent’s own rules and checks (CLAUDE.md, CI), every time.
  • An MCP tool that changes or sends, once per server.
  • Raising its own rights (sudo, registry, PATH), every time.
  • A script that prints a key.
  • Sending data out after a key appeared, every time.
  • A script on disk with a never-list step, per version.
  • A new or changed skill, plugin or MCP server (Claude Code).
  • A third try of a command that failed twice.
  • Rules and memory files read for prompt injection.
  • MCP tool descriptions read; a poisoned server is blocked.
  • Fingerprints of skills, plugins and servers (Claude Code).
  • Injection signs: steering phrases, fake system tags, hidden characters.
  • Keys: from then on, sending data out asks.

After a web page or an outside file, pushes, secrets and rule changes ask again until your next message.

What the guard checks · Stay safe

Not every agent shows the guard everything. Codex and Cursor do not tell it about web pages or failed commands, and Antigravity does not pass on what a step returned. The full table is on What the guard checks.