Guides
Practical notes on keeping AI coding agents (Claude Code, Codex CLI, Cursor) from quietly burning money or usage limits.
How to stop runaway Claude Code, Codex and Cursor agent loops
Why AI coding agents get stuck in loops, how to interrupt one now, and how to enforce limits with hooks: repeated-call detection, cost-spiral checks and session/daily dollar caps.
How to track AI coding agent token costs per session
Where Claude Code, Codex CLI and Cursor store token usage on your machine, how to turn it into an estimated dollar cost per session, and what the numbers tell you.
How to set a spending limit for Claude Code
Every native way to cap Claude Code spend (Console workspace limits, usage-credit limits, --max-budget-usd for headless runs) and how to add a per-session and daily dollar cap to interactive sessions with a hook.
How to limit Cursor agent usage costs
How Cursor bills agent usage, where to set the monthly spend limit (and what it does not cover), and how to add loop detection and per-session caps to the Cursor agent with hooks.
How to cap OpenAI Codex CLI spend
Hard spend limits for Codex CLI on an API key, credit and auto-reload limits on a ChatGPT plan, and how to add per-session and daily caps to Codex with hooks.
Claude Code usage limit reached: why it happens and how to monitor it
The 5-hour and weekly limits on Claude Pro and Max, what each "You've hit your limit" message means, why long sessions drain them, how to watch usage with /usage and a status line, and how to stop runaway sessions early.
How to set a hard budget for AI coding agents in CI
Per-run caps, job timeouts and key-level spend limits for Claude Code (claude -p), Codex CLI (codex exec) and Cursor CLI in GitHub Actions and other headless runs, plus loop detection with hooks.
Claude Code stuck in a loop: how to break it and stop it repeating the same command
How to interrupt Claude Code when it keeps rerunning the same failing command, undo what the loop changed with /rewind and git, restart without walking back into it, and make a hook refuse the next no-progress repeat.
Codex usage limit reached: 5-hour and weekly limits explained
The 5-hour and weekly Codex windows on ChatGPT plans, what each "You've hit your usage limit" message means, usage limits vs rate limits, how to check /status and /usage, your options when it runs out, and how to catch a looping session early.
Cursor agent stuck in a loop: how to stop it, roll back, and keep it from repeating
How to stop or steer the Cursor agent when it keeps rerunning the same failing fix, restore a checkpoint (and what it won't undo), restart in a fresh chat without walking back into the loop, and make a hook deny the next no-progress repeat.
Why Claude Code uses so many tokens, and how to use fewer
Where Claude Code's tokens actually go (re-sent context, cache misses, subagent fan-out, thinking, Opus, loops), how to find the culprit with /usage and /context, the changes that cut usage most, and how to cap runaway sessions.
How to set a budget limit for Aider
Aider has no built-in dollar cap. How to put a hard limit on the API key, read Aider's per-message and session cost, cut tokens per message with /tokens, /drop and --max-chat-history-tokens, and bound scripted and CI runs.
GitHub Copilot agent mode stuck in a loop: how to stop it and keep it from repeating
How to stop Copilot agent mode when it keeps rerunning the same failing fix, restore a checkpoint, restart without walking back into the loop, the settings and premium-request budget that bound it, and a preToolUse hook that denies identical repeats.
Cline stuck in a loop: how to stop it, roll back, and cap what it spends
How to stop Cline when it keeps rerunning the same failing fix, restore a checkpoint (and what it won't undo), restart in a fresh task without walking back into the loop, and the key limits, auto-approve settings and hooks that keep the next loop small.
Gemini CLI usage limits: daily quotas, the June 2026 change, and keeping costs in check
Gemini CLI's daily request limits by sign-in type, what changed for free, Pro and Ultra users on June 18, 2026, how to check usage with /stats, and the settings and billing controls that bound a runaway session.
Codex stuck in a loop: how to stop it, undo it, and keep it from repeating
How to interrupt Codex CLI when it keeps rerunning the same failing command, undo its edits with /diff and git, restart in a clean chat without walking back into the loop, and make a PreToolUse hook deny the next no-progress repeat.