Agent Budget Exhausted Halfway Through the Task
Your agent burns its token or cost budget before finishing and leaves work half-done. Diagnose where the spend went, recover the partial work, and resume from a checkpoint.
Articles tagged with #AI coding
Your agent burns its token or cost budget before finishing and leaves work half-done. Diagnose where the spend went, recover the partial work, and resume from a checkpoint.
Your agent resumes from a checkpoint but the state is garbled, missing fields, or wrong-typed. Detect the corruption, recover from a good generation, and write crash-durable checkpoints.
Your pipeline reports $2 but the invoice says $18. Sub-agent token usage isn't attributed to the parent run. Here's how to close the gap, verified June 2026.
Agents hand off to each other in a loop that never terminates because nothing checks for cycles. Here is how to catch the cycle, set the right framework limit, and bound the loop for good.
A downstream agent re-asks answered questions or contradicts earlier decisions. Find the lossy handoff boundary and wire durable, structured state in under an hour.
Two agents block forever waiting for each other's output. Find the cycle, add a timeout, and break the deadlock in minutes — with LangGraph, Temporal, and AutoGen specifics.
An AI agent wrote a real API key, token, or password into your logs, traces, or a committed file. Here is the fastest containment path, plus how to scrub output and stop it recurring.
Your agent wraps JSON in a markdown fence or adds prose, so the downstream parser crashes. Fix it for good with native structured outputs (June 2026).
Your agent ran without its required pre-flight checks and failed hours later on a problem it could have caught in seconds. Here is how to make those checks a blocking gate that no code path can skip.
Your agent pipeline promotes flawed output because the quality gate is too broad or easy to satisfy. Tighten gates with critical-vs-cosmetic weighting, grounded checks, and adversarial tests without over-blocking.
Different agent instances run subtly different system prompts, so output quality changes depending on which one handles a request. Here's how to pin prompt versions, log the exact prompt per run, and detect drift before it ships.
One rate-limited agent stalls the whole pipeline as waiting agents time out. Isolate the bucket, decouple stages, and stop 429 cascades for good.
One unreliable tool call makes your agent retry hundreds of times, burning budget and tripping rate limits. Add a retry cap, backoff with jitter, 429 handling, and a circuit breaker.
Your agent pipeline promoted unvalidated output because a lint/test gate was skipped. Enforce non-skippable validation in LangGraph, CrewAI, OpenAI Agents SDK, and Claude Code.
After a crash or restart, your agent thinks the world is in a state that no longer matches reality. Here's how to detect the drift and resync reliably with LangGraph, Temporal, and custom checkpoints.
Two agents read the same shared memory, both write back, and one update silently vanishes. Diagnose the lost-update race and fix it with atomic ops, optimistic locking, or per-agent partitions.
An AI agent launches a dev server or watcher, then exits without killing it. The process keeps holding a port and burning CPU. Here is how to track every subprocess and guarantee it dies.
Your CrewAI, LangGraph, or AutoGen router sends tasks to the wrong specialist agent and produces garbage. Diagnose the routing logic and fix the misclassification.
Your LangSmith or Langfuse trace shows a result but no tool call span. Here's how to find which of seven causes you hit and make traces complete again.
Parallel AI agents silently overwrite each other's edits to a shared file. The fastest fix in June 2026 is worktree isolation. Here's how to detect, fix, and prevent lost writes.
Turn git log into a two-tier release note readers actually finish, with a review pass that catches buried breaking changes.
The three things AI gets wrong on migrations: reversibility, backfill, and the NOT NULL on a big table.
A step-by-step workflow to draft a blameless postmortem with AI in 60 minutes without letting the model round off the uncomfortable truths.
AI clears most git merge conflicts in minutes. The workflow is knowing which 10% it must never touch — and how to catch the 'merged by deleting one side' failure.
Get paged at 3am? A tested AI workflow for triage, hypothesis ranking, a calm-down protocol before destructive commands, and turning the chat into a runbook.
Turn a git diff into a PR body a reviewer will actually read, with prompts that don't invent test plans for tests that don't exist. Verified workflow, June 2026.
Install Aider, point it at a git repo, and run the see-diff/accept loop from your shell. No IDE, no browser, no lock-in. Updated June 2026.
How to wire MCP servers into Claude Code with claude mcp add: the three transports, the three scopes (local/project/user), and which servers to install first (June 2026).
The four Cursor rule types, .cursor/rules/*.mdc vs legacy .cursorrules vs AGENTS.md, and how to scope rules so the model obeys them. Current to June 2026.
Set up Windsurf — rebranded Devin Desktop in June 2026 — install, sign in, write a rules file, and ship your first reviewed multi-file Cascade diff.
AI registered an endpoint outside the authenticated route group, leaking internal data. The fastest fix: move the route under the authed router and enforce auth at the data layer, not in middleware.
AI calls a method that does not exist: wrong arg order, made-up option name, fabricated return type. Diagnose against the real .d.ts and ground future answers in current docs.
An AI-written migration runs clean on an empty dev DB but blows up on prod with constraint, lock, or NULL errors. Fix it with prod-clone testing and safe SQL patterns.
AI wrote an UPDATE or DELETE that holds long locks on a production Postgres table and blocks reads and writes. Cancel it, then rewrite it into lock-friendly batches.
AI generates code with deprecated APIs, fixes one lint error, then re-introduces it in the next file. Pin the ban in .cursor/rules and make ESLint a hard CI error.
AI runs npm install and drops package-lock.json into a pnpm-only repo, breaking the lockfile invariant. Pin the manager with devEngines/corepack and a preinstall guard.
Codex landed your work on main, on a leftover branch, or split it across two — because cloud tasks default to your repo's default branch and local worktrees collide. How to force clean per-task isolation, plus how to rescue commits that already landed wrong.
Codex's PR is green in CI but the app crashes after deploy. Why agent fixes that target the test surface miss the runtime, and the smoke-gate that closes the gap.
Cursor's Auto router sends a complex refactor to a small model and you get shallow edits. Diagnose the routing signals and force the right model for hard tasks.
Cmd-K (Ctrl+K) spins forever or shows "Taking longer than expected…" with no diff. The fast fix: Reload Window or update Cursor. Walk the six verified causes.
Cursor uses system Python instead of your project venv, breaking imports, linting, and agent edits. Fix the interpreter picker, venv discovery, shell PATH, and the new Python Environments panel.
Cursor has no native Settings Sync. When a Gist-sync extension, dotfiles symlink, or cloud folder pushes stale config to a second machine, your rules, keybindings, or MCP servers get clobbered. Diagnose which sync layer did it and recover the good version.
Cursor's SSH Remote session disconnects while you edit, losing agent context and unsaved buffers. Fix it with the right keepalive values, and check for the v1.0.51 reconnect bug.
A verified Codex CLI keyboard shortcut reference: cancel and interrupt keys, newline with Ctrl+J, Ctrl+G external editor, Ctrl+R history search, Esc Esc to edit, Shift+Tab approval modes, and terminal fixes.
How Codex Agent Skills work in June 2026: what a SKILL.md is, the exact .agents/skills/ load order, how /skills and $name invocation differ, and skill vs AGENTS.md vs MCP vs plugin.
An AI agent recommended an abandoned npm/PyPI package. Triage it in 3 seconds with npm view, swap it for the modern replacement, and stop it recurring.
All green, ship it, prod breaks. The tests covered the happy path only and mocks shielded the real branches. Five causes and the fastest fix.
Autocomplete predicts your next edit in ~100ms from local context; agents plan across files over 5-120s. A decision rule that maps task shape to the right mode, with current tool tiers.
Use Claude Code, Codex, or Cursor agents to pre-review your PRs before a human sees them. Exact prompt, loop, and tool pricing for June 2026.
Run an AI pre-review against the exact buckets Google AdSense rejects on — thin content, missing policy pages, broken navigation, edge-policy topics — before you burn a reapply window.
Use a reasoning-grade AI as a structured devil's advocate to catch 3-5 real architecture flaws per design doc before you commit weeks of code.
A reproducible AI audit for Astro 5/6 content sites: catch duplicate slugs, missing translations, dead internal links, and draft leakage with one script wired into prebuild.
Astro-specific AI audit prompts for routing, sitemap, hreflang, output mode and RSS — verified against Astro 6 (June 2026).
A reproducible AI audit for React Native: re-renders, navigation memory, New Architecture native-module compat, list virtualization — a ranked hotspot list with file paths.
A 30-minute monthly workflow: lychee or linkinator finds the dead URLs, AI clusters them by root cause and proposes fixes in priority order. Exact commands and flags included.
Category and tag pages eat crawl budget but rarely rank. This AI workflow finds duplicate intros, weak internal links, missing descriptions, and JS-only pagination — then ships fixes.
A five-question workflow for Claude Code, Cursor, or ChatGPT that maps an unfamiliar repo in an afternoon — with verification steps so you don't ship a tour built on hallucinations.
AI coding quality is mostly a context problem. Here is how to feed Claude, Cursor, and Codex the right context — and cut the rest — as of June 2026.
Use AI to pick pillars, generate clusters, verify demand, and build a 90-day calendar with an internal-link map.
A reproducible 7-step workflow for debugging with AI that finds root cause fast instead of spiraling into 20 wrong guesses. Includes a copy-ready prompt and tool picks for June 2026.
Upgrade a dependency that is several majors behind using Claude Code or Cursor, without subtle build breaks. CHANGELOG-mapped diffs, exact commands, June 2026.
A 10-minute AI audit of firebase.json before you ship: rewrite order, function regions, cache headers, and preview-channel testing.
An AI-assisted playbook for content sites: information architecture, drafting, internal links, schema, and an AdSense-safe quality bar (June 2026).
Use an LLM to audit hreflang on a multi-locale site: missing return tags, wrong codes, slug mismatches. Real prompt, real tools, June 2026.
Draft meta descriptions in batches of 10 with AI, spot-check 30% for hallucinations, ship in one PR. Realistic CTR lift on thin pages: 10-20% as of June 2026.
A reproducible prompt workflow for framework and language migrations — reference file, pattern propagation, codemod, official-checklist review. Tools and model picks for June 2026.
AI agents in monorepos either ship clean PRs or melt down across 6 packages. Here is the AGENTS.md + scoping + two-phase commit workflow that keeps them contained, as of June 2026.
Wire an AI agent into your git workflow to scan the staged diff before you commit. Catches leftover debug code, leaked secrets, and null bugs in under a minute.
A safe AI refactoring workflow: green tests, scoped goal, plan mode, per-step git diff, and clean rollback — with the exact Claude Code and Cursor steps.
Cursor, Claude Code, and Copilot all ship checkpoints now — but they're local-only and miss bash edits. Here's the four-step git discipline that actually keeps every AI change reversible.
A weekly 30-minute AI workflow for Search Console: Page Indexing, Core Web Vitals (with 2026 thresholds), HTTPS, and Manual Actions — sort blocker vs. noise fast.
Turn a one-page spec into shipped code with Spec Kit, Kiro, or Claude Code plan mode — and skip the half-built-feature trap. Updated June 2026.
Skip the generic 80-point list. Have AI build a 30-60 item technical SEO checklist for your stack (Astro / Next / Hugo / WordPress), each item with a verification command, in 20 minutes.
AI-written tests often pass while testing nothing. This adversarial workflow plus mutation testing gives you real coverage, with the 2026 tooling that proves it.
A 3-pass AI workflow that scores every page for thin-content risk, surfaces the worst offenders, and assigns one action each: expand, merge, noindex, or delete.
A 30-minute AI audit before launch: run three focused prompts (security, performance, UX) against the OWASP Top 10:2025 and get a triaged, diff-ready fix list.
A 20-minute AI bug-audit habit that beats 'review this code': category-grouped findings, a failing test per bug, and likelihood × blast-radius triage. Models and tools current to June 2026.
ChatGPT is not Claude Code, but used right it still ships real features. A GPT-5.5 workflow with Projects, code blocks, and review steps that hold up on actual files.
Install Claude Code, write a CLAUDE.md, run Plan Mode, and ship your first reviewed refactor. Exact commands, plan/cost details, and the beginner mistakes to skip.
CLAUDE.md is the instruction file Claude Code loads every session. What to put in it, where to place it, and how it loads — verified against the June 2026 docs.
A reusable Claude Code plan-mode prompt and a two-hour workflow that ships three reviewed SEO fixes on your content site.
How OpenAI Codex runs sandboxed cloud and CLI coding tasks in 2026: which ChatGPT plan you need, the GPT-5.5 default, the task-spec format that produces reviewable PRs, and the mistakes that bite first-time users.
Set up OpenAI Codex as a pre-reviewer with the /review command, @codex review on GitHub, and AGENTS.md guidelines that produce P0/P1 findings.
Use Codex CLI to spot-check sitemap correctness, freshness, and hreflang coverage against your real build output.
Goal + constraints + acceptance + hand-off. Skip a block and the AI guesses. The four-part template, with 2026 plan-mode and AGENTS.md specifics.
Cursor's real learning curve isn't install — it's knowing when to use Tab, Inline edit (Cmd-K), Composer (Cmd-I), Chat (Cmd-L), or Agent mode. Five surfaces, four real edits, with June 2026 pricing and models.
How Cursor's codebase index actually works, the .cursorignore vs .cursorindexingignore split, and the tuning loop that stops wrong-file references — verified June 2026.
A 30-page audit dumped into chat produces 'did some refactoring.' Use this chunk-summarize-prioritize pattern to turn long reports into a brief Claude Code, Codex, or Cursor can actually execute.
Gemini 3.1 Pro is a real coding tool now. Honest guide to its 4 genuine wins, the Antigravity CLI migration on June 18, and when to switch to Claude or ChatGPT.
How to set commit conventions, draw commit boundaries, and what NOT to let Claude Code, Cursor, or Codex commit. With real config.
A 200-line AI diff that compiles isn't safe. Here's the exact reading order, git commands, and tooling a senior engineer uses to catch silent renames, lost branches, and fake test fixes.
Run Cursor, Claude Code, and Codex in one repo using git worktrees, AGENTS.md, and PR-based merging — the 2026 playbook that prevents collisions.
Polite CLAUDE.md rules don't stop an agent from touching .env or prod config. The enforced layers that do: deny rules, ignore files, sandboxing, hooks, branch protection.
A repeatable AI prompt chain that audits titles, descriptions, schema, and internal links page by page - with the verification step that stops AI from lying about tags it can't see.
12 copy-ready prompts that walk a page as a keyboard-only and screen-reader user — semantics, focus, ARIA widgets, contrast, modal stacks, live regions — each finding mapped to a WCAG 2.2 criterion.
15 prompts that pressure-test REST and GraphQL contracts before they ship: naming, status codes, RFC 9457 errors, breaking changes, pagination, N+1, field-level auth.
13 copy-ready prompts that hunt specific bug families — race, null, off-by-one, leaks — before they ship. Tuned for Claude Opus 4.7, Cursor, and Codex (June 2026).
12 copy-ready prompts to brief Claude Code (or Codex) on real engineering work — scoped features, surgical bug fixes, migrations, refactors, TDD, perf, CI debugging — mapped to Plan Mode and /rewind.
13 copy-ready AI code review prompts that surface real bugs, security holes, perf issues, and test gaps — plus which 2026 review bots to pair them with.
12 copy-ready prompts that walk a schema like a future migrator: normalization, indexes, FK cascades, nullability, soft-delete, JSON columns, lock-safe migrations, ORM diff. Updated June 2026.
12 copy-ready prompts to pre-flight a deploy: env-var diff, DNS cutover, cache invalidation, smoke test, rollback drill, 24h watch, security headers, incident comms.
14 measure-first performance prompts for AI coding tools: LCP / INP / CLS / N+1 / TTFB / bundle / cache fixes, before-after Web Vitals diffs, and a premature-optimization detector. Current Core Web Vitals thresholds (June 2026) included.
13 copy-ready prompts to refactor React components in 2026: extract hooks, lift state, split server/client, audit memo in the React Compiler era, and kill prop-drilling.
12 copy-paste prompts for READMEs that move a new reader from git clone to a working install fast: skeleton, quickstart, install troubleshooting, examples, API table, and audit.
18 copy-ready prompts to plan, execute, and verify AI refactors without breaking behavior — for Claude Code, Cursor, and Codex. Module extraction, renames, async migrations, god-function splits.
12 AI prompts to audit your code against the OWASP Top 10:2025 — access control, auth, secrets, supply chain, file uploads, CORS, PII logging — and ship a finding-plus-fix list without hiring a pentester.
12 copy-ready prompts to AI-audit a content site — metadata, internal links, hreflang, thin pages, canonical, schema, cannibalization, Core Web Vitals — with exact thresholds and a fix per finding.
13 prompts for integration, E2E, snapshot, and contract tests with Vitest 3, pytest 9, and Playwright. Tests that catch real bugs, not coverage noise (June 2026).
14 copy-paste prompts to diagnose TypeScript errors fast: generics, conditional types, narrowing, module resolution, and .d.ts files. Updated for TS 6.0/7.0, June 2026.
Your agent keeps trying the same fix or oscillates between two states. How to spot the loop in 30 seconds and kill it with one prompt.
AI added a dependency without committing the lockfile, or used a Node feature your CI image doesn't have. Reproduce it in 5 minutes and pin the gap shut.
After an AI run, npm run build fails. Locate the bad change in 10 minutes with diff triage, tsc --noEmit, and targeted git restore — no full reset.
An AI coding agent rewrote .env with placeholders or deleted it. Recover the real values, then hard-lock the file so it never happens again.
Agent imports `src/utils/superhelper.ts` or a package that was never created. Find every bad import, then fix or replace it.
Your branch plus AI edits conflict with main. Resolve it without losing the AI's real improvements, and stop mistaking format noise for logic conflicts.
An agent ran an install or removed deps and now your lockfile is at war with the team's. Throw it away and regenerate — here's the exact path per package manager.
Your agent wrote `UserList2.tsx` next to the original instead of editing in place. Diff, merge, delete, and fix imports without breaking the build.
An AI agent "simplified" your code and quietly deleted a branch real users depend on. Bisect to the commit, cross-check prod logs, restore just the deleted hunks, and add a regression test.
Undo bad AI edits without losing the good ones: pick the smallest git undo, and recover lost commits with reflog before the 30-day clock runs out.
AI code won't type-check (TS2322, TS2339, TS2554)? The exact tsc loop, error-code table, and agent rules that fix it in one pass.
Claude Code editing the wrong files, duplicating functions that exist, or missing key code? It's almost never the model — it's missing project context. Seven concrete ways to make Claude Code read your repo, verified for June 2026.
Codex puts files in the wrong place or ignores your conventions. Constrain it with AGENTS.md, a sibling-file reference, and plan-first prompting.
Cursor shows a diff but Apply does nothing, fails silently, or says the apply model made no changes. Fastest fix: save all files, close other editor windows, then Reapply.
Cursor only edits files it can see. Fix indexing scope, open the right workspace root, and pin files with @ references.
Cursor pulls old, vendored, or generated files into context and produces wrong patches. Fix the index, .cursorignore, and prompt pinning.
You committed over code you needed, or reset --hard the wrong commit. The fix: most of the time the objects are still in your repo. Start with `git log -p --follow -- <file>`, or `git reflog` if a whole HEAD vanished.
A 200-line Claude Code or Cursor diff isn't safe just because it compiles. Read it deletions-first, in the right order.
Cursor and Claude Code clobbered the same file. Stop both, recover each intent, merge by hunk, and isolate agents with worktrees so it never repeats.
Claude Code is a terminal agent; Cursor is an in-editor copilot. Compare pricing, models, rollback, and task fit with current 2026 numbers and a decision sheet.
Install Cursor and ship your first useful edit in 30 minutes: Inline (Cmd+K), Composer Agent/Ask/Plan, codebase indexing, @ context, Apply, and rollback. Updated June 2026.
Cursor stuck on Indexing or re-indexing in a loop? It's usually a build/cache directory your file watcher keeps touching. Here's the .cursorignore template, the watcherExclude fix, and how to confirm the index is healthy.
OpenAI Codex and Anthropic Claude Code are both agentic coding tools, but they run in different places and bill differently. A specific, up-to-date comparison with prices, models, and benchmarks.
Claude Code is Anthropic's command-line coding agent. What it does, how it differs from ChatGPT and Cursor, what plan you need, and how to ship your first task in ten minutes.