ZENSHINZO全心像Truth Heart Vision

Signal offlineSoutheast Asia · UTC+7

Words

7 Habits to Stop Burning Tokens in AI Coding Agents

tech

Claude Code, Codex, Grok Build and Antigravity

Stop burning tokens

These seven habits work with any CLI coding agent: Claude Code, Codex, Grok Build, Antigravity. They all work the same way underneath, so the same fixes cut usage in all of them. The examples come from my daily Claude Code setup.

On a monthly plan, these habits mean you hit your limits later. On pay-per-token, they mean a smaller bill.

Why usage piles up

The size of what each turn carries drives usage, not how often you use the agent. Three mechanics explain most of it:

  • Every turn re-sends the whole conversation. A message in a long, crowded session costs more than the same message in a short, focused one.
  • Caching makes repeats cheap. The part of the conversation already sent is cached and billed at a fraction of the normal price. The discount varies by provider; with Claude it's about a tenth. The cache expires after a period of inactivity, and the next turn then pays full price to rebuild it.
  • Output costs the most. Long explanations, full rewrites, multiple drafts and the model's own thinking burn tokens faster than anything you type.

Habit 1: One session per subject

Run several named sessions, each with a single job: research, infrastructure, one per project. Every session then carries only its own subject.

  • Name each session for its job, so it's obvious where a task goes.
  • When something belongs to another session, send it there. Don't do it in the session you happen to be in.
  • More sessions don't save anything on their own. The saving comes from each session staying narrow.

Habit 2: Keep sessions running

Keep long-lived sessions open, for example in tmux, and come back to them through the day. Steady use keeps the cache warm, so most of each turn counts as a cheap cache read.

  • Don't start a fresh chat for every question. Each new chat rebuilds its context at full price.
  • If a session does close, resume it instead of starting over. Every one of these tools can (see the table below).
  • Let the tool compact a long session on its own rather than restarting it.

Habit 3: Keep background in notes, not in the chat

Keep your facts, decisions and rules in a notes vault (for example Obsidian, tracked in git) plus your agent's instructions file. The agent looks up the one note it needs, so only that note enters the session.

  • Don't re-paste background like who you are, how your setup works or what you decided last week. Write it down once.
  • Put standing rules ("answer only the question asked") in the instructions file, so you never type them again.
  • Keep that file short: one line per rule, with the detail in linked notes. The whole file is loaded on every turn.
  • Run skills and MCP servers as light as possible. Each one adds its description to what the agent carries. Before adding one, ask whether you actually need it.

Habit 4: Ask for short, literal answers

Tell the agent to answer only the question asked, with no caveats, extras or recaps. Output tokens cost the most, so this is the fastest single saving.

  • Ask one thing at a time and let the agent do that one step, then wait.
  • When you want options, ask for them as a short list with costs first and a recommendation after. Don't ask for an essay.
  • Say "don't do anything, just answer" when you only want information. That stops the agent from opening files or running tools.

Habit 5: Hand work off instead of reloading it

When one session finishes something another needs, hand it over: a short message pointing to the file or note. The receiving session reads just that, and doesn't rebuild the whole history.

  • Pass a file path, not pasted contents.
  • End each piece of work with a short log line and a commit. Any session can pick it up later from the log, and you don't have to re-explain it.

Habit 6: Match the model and the effort to the job

Every tool offers a range of models, from small and fast to large and expensive, and lets you set how hard the model thinks. Running the top model at high effort for everything is the most expensive way to work, because bigger models cost more per token and thinking is billed as output.

In Claude Code, Opus runs most of my work. I bring in Fable only for the really heavy problems. When Opus or Fable has a lot of work to get through, Sonnet does the bulk of it as the worker, while the bigger model directs. Most of my sessions run at medium effort, not high.

  • Pick a solid middle model as your default, not the biggest one.
  • Save the top model for the hardest problems: deep debugging, architecture, decisions that are expensive to get wrong.
  • Give bulk, repetitive work to a smaller model, especially when it's split across subagents.
  • Run at medium effort by default. Switch to high for hard problems, then switch back.
  • If an answer comes back weak, rerun that one question with a bigger model or more effort. Don't run everything at max just in case.

Habit 7: Script the repeat jobs

If a job runs the same way every time, have the agent write a script for it once, then run the script. A script costs no tokens. Asking the agent to walk through the same steps again pays full price every time.

My daily log, my session restore after a reboot and the build and deploy for this site are all scripts the agent wrote once. Now I run them, and the agent only gets involved when something needs judgment.

  • Backups, logs, deploys, status checks: script them.
  • Keep the agent for the parts that need thinking.
  • When a script breaks, have the agent fix the script, not do the job by hand.

Where each tool keeps its settings

Each agent reads a plain Markdown instructions file from your project folder on every turn, can pick a closed session back up, and lets you change the model and effort. Three of the four share the same instructions file name.

ToolInstructions fileResume the last sessionModel and effort
Claude CodeCLAUDE.md, plus its memory filesclaude -c/model, /effort
CodexAGENTS.mdcodex resume --last/model (picks both)
Grok BuildAGENTS.md (also reads CLAUDE.md)grok -c/model, /effort
Antigravity (agy)AGENTS.md (GEMINI.md still works)agy -c/model, /effort

You can also set both when you start a session: --model plus --effort in Claude Code, Grok Build and Antigravity; in Codex, -m plus -c model_reasoning_effort=medium. Using more than one tool? Keep one AGENTS.md and point CLAUDE.md at it, so every agent reads the same rules.

What burns tokens

Check before you guess. In Claude Code, /context shows what's filling the current session and /usage shows how much of your plan you've used. The other tools have a status or usage view of their own. Most people guess wrong about what's expensive until they look.

HabitWhy it's expensiveDo this instead
Top model at max effort for everythingBig models cost more per token, and thinking is billed as outputA middle model at medium effort, stepping up only when needed
Having the agent repeat the same routine jobEvery run pays full price for the same stepsHave it write a script once, then run the script
Lots of skills, plugins and MCP servers switched onEach one adds its description to what the agent carriesKeep only what you need; ask before adding one
Many parallel subagents or multi-agent workflowsEach agent loads its own full contextUse them only for big, truly parallel jobs, on a smaller model
Pasting large logs, files or screenshotsThe paste rides along on every later turnSave it to a file and point the agent at the path
Letting the agent read a whole codebase or folderEverything it reads stays in the session's contextName the file or ask it to search first
Retry loops on a failing commandEach attempt adds output to the contextStop after 2 or 3 tries and change approach
One session for everythingUnrelated history is re-sent on every turnOne session per subject
Asking for long explanations or rewritesOutput is the costliest partAsk for the answer only

Quick-start checklist

  • Check what's filling your sessions before you change anything
  • Split your work into a few named sessions, one subject each
  • Keep them running, and resume them instead of opening new chats
  • Move your background and standing rules into notes and your instructions file
  • Turn off skills and MCP servers you don't need
  • Add a rule: "answer only the question asked, no extras"
  • Point the agent at file paths instead of pasting contents
  • Default to a middle model at medium effort; step up only for hard problems
  • Use subagents only for large, parallel jobs, on a smaller model
  • Script any job that runs the same way every time
  • End each task with a log line and a commit so any session can pick it up