TL;DR
How do I stop an AI agent from going off track on a long task?
Long agent jobs can drift as the AI makes up its own rules along the way. That can waste hours or quietly change your work. Give it a clear finish line and a check, keep sessions short with notes, set hard limits, and review the changes before you accept them.
Why do AI agents go off track on long tasks?
An AI agent is a tool that takes a goal and works through the steps on its own, like editing files, running searches or filling in a spreadsheet. The longer it runs, the more decisions it makes without you, and small wrong turns pile up.
Anthropic gave a name to one version of this on Saturday, November 28, 2026. Responding to viral claims that Claude was sabotaging people's projects, Anthropic's Edwin Arbus called some of the behavior "overcaution … where Claude gets overly attached to rules it makes for itself during long-running tasks," TechCrunch reported. He said it isn't limited to one kind of work. You can read the full back-and-forth in our news post on the Claude sabotage claims.
That matters beyond Claude. Any agent, from a coding tool to a browser assistant, can decide early on that "we never touch that file" or "this number must be wrong," then defend that made-up rule for the rest of the job. Anthropic's own Claude Code docs are blunt about the limits of instructions: the model "usually follows your commands," but "there's no guarantee that it'll follow your instructions."
How do I give an AI agent a clear goal?
Write down what "done" looks like before the agent starts, and make it something you can check. "Clean up this spreadsheet" invites the agent to invent its own idea of clean. "Remove duplicate rows by email address, keep the newest, and tell me how many you removed" gives it a finish line.
Claude Code's documentation suggests writing a short spec file first, then starting a fresh session to build from it, "so the build begins with a clean context and a written definition of done." The same idea works in ChatGPT, Gemini or any agent: paste the written goal at the start of each session instead of relying on the chat history.
Some tools now build this in. Claude Code's /goal command sets a completion condition, and after each turn a model checks whether it holds before the agent carries on.
How do I check an AI agent's work as it goes?
Give the agent a test it has to pass, not just a request to be careful. For code, that's an existing test suite or a typecheck. For a report, it might be "every number must link to a source in this folder." For a spreadsheet, a total that has to match the original.
The habit that catches made-up rules early is simple: ask the agent to keep a short running list of the assumptions and rules it decides on, in a file or at the top of its replies. Skim it every so often. A rule like "skip any row with a blank field" is easy to spot and fix in that list, and very hard to spot later in 2,000 changed rows.
If you can see the agent's rules, you can correct them. If they only live in its head, you find out at the end.
How long should an AI agent session be?
Shorter than you'd think. Long sessions fill up the agent's context window, the working memory it can see at once, and many tools then compress older parts of the chat to keep going. Details from the start of the job are exactly what tends to get lost.
Break big jobs into chunks with a written handoff. At the end of each chunk, ask the agent to write what it finished, what's left and any rules it's following, then start a new session from that note. You lose nothing important, and a bad assumption doesn't get to ride along for six hours.
How do I set limits on an AI agent?
Put the rules that really matter where the tool enforces them, not only in the prompt. Most agent tools let you limit what they can touch, such as which folders, which apps or whether they can send anything without asking. Use those settings for the hard lines.
Cap the run, too. Claude Code, for example, has --max-turns and --max-budget-usd options for scripted runs, and many AI tools let you set a monthly spend limit. A cap turns a runaway loop into a short, cheap mistake. Our earlier list of rules for keeping an AI agent on a short leash has more ideas on permissions.
What should I check before accepting an AI agent's changes?
Look at what actually changed, not at the agent's summary of it. In coding tools that's the diff, the line-by-line list of changes. In documents and spreadsheets, use version history or compare against a copy you saved first.
Skip asking the agent why it did something as your main check. Drew Breunig, quoted by TechCrunch, put it well: "asking a model doesn't prove anything," because "the model will almost always apologize, even if it made a good choice." The changes themselves are the evidence.
Before your next long run:
- Write the finish line and one pass/fail check.
- Ask the agent to keep a visible list of its own rules and assumptions.
- Split the job into sessions with a written handoff.
- Set permissions and a turn or spend cap.
- Review the changes against a saved copy before you accept them.
FAQ
Does this only apply to Claude?
No. Anthropic described the problem for Claude, but any agent that works through many steps on its own can drift. The habits above work in ChatGPT, Gemini, Copilot or coding agents.
Is a longer, more detailed prompt the fix?
Not usually. A clear finish line and a real check do more than extra paragraphs of instructions, which the agent can still misread or quietly drop as a session gets long.
How do I report strange agent behavior?
Save the session or conversation ID if your tool shows one, plus the exact prompt. Anthropic's Arbus asked Claude users to share session IDs when they see this kind of behavior.
Is it safe to let an agent run overnight?
Only with limits in place: a spend or turn cap, permissions that block anything you can't undo, and a backup of the files it works on.




