DEV Community

Cover image for Running a Company on Claude Agents: 12 Failure Modes and the Fixes
Rippy Productions
Rippy Productions

Posted on Originally published at agent-ops-kit-5jb.pages.dev

Running a Company on Claude Agents: 12 Failure Modes and the Fixes

The most dangerous moment was not a crash. It was a clean, confident status page.

We've run a real small company — apps, websites, a few servers, payments — with Claude Code agents doing most of the work. A human owner decides what matters. Many agent sessions do the rest: on a desktop, on home servers and a VPS, and in "wake" jobs that start when a task note lands in a shared folder. They share a memory repo, post to a message board, and run morning and night protocols.

Most of what follows we learned by getting it wrong, often with every check green. These are the twelve failure modes we keep coming back to, the fixes, and the checks that catch them. Written down so you don't repeat them.

1. The echo: your agents are reading their own predecessors

Almost every document in our repo had been written by an agent. A new session reading it was reading its own earlier sessions, in its own voice, complete with evidence tags and passing checks. That looks exactly like verified notes, and it isn't.

This cost us in a concrete way. An external reviewer approved four pending submissions, and every status board missed it for six days. The boards stayed green because the gates were comparing documents with documents, and most of those documents had been written by earlier agent sessions.

Fix: make "measure before you read" the first rule. The live system is the source of truth, and the docs are not. Run the instrument — an API sweep, an HTTP check, a git query — before acting on any claim in a document, including this one. If live data and a doc disagree, live wins and the doc line is deleted, not footnoted.

2. A green gate means the documents agree with each other

Most "verification" checks one file against another. That catches drift between documents and says nothing about the world. We had cross-document checks passing on numbers that no longer existed.

A neighbouring version of the same mistake: "two signups" went around the team for days. The number came from the table-count column of an inventory file everyone trusted. The real signup count, read from the live store, was zero — the production form had rejected every submission since launch.

Fix: every gate names its surface (store API, HTTP, git) and must query it. Any error makes the result UNDETERMINED, never OK. A sweep that exits non-zero doesn't get diffed against and doesn't get quoted. For a count, read the system of record, and after a deploy confirm the live bundle still contains the thing you think is counting.

3. Empty results lie: put a known positive in the same command

An empty grep and a broken grep print the same thing. So do a 200 from a real page and a 200 from a soft-404, and page 1 of 4 and a result set of one. Every catch we trust came from a control, none from remembering to look.

A few real ones from zsh alone:

  • log is a builtin that lists logins. A query of the system event log returned zero lines, was read as "nothing happened overnight," and never ran the real tool: its error went to /dev/null, and | wc -l printed 0. Use /usr/bin/log.
  • echo ==== fails on =word expansion.
  • An unmatched glob can silently skip one command while the commands after it run normally.
  • In our agent's shell, grep was a wrapper that honored ignore files and could not see nested repositories: 2 files found where the system grep found 15. type grep would have shown it.

Fix: beside every real query, in the same command, run one that must match. If the control comes back empty, the tool is broken, not the world. For the log case: /usr/bin/log show --last 1m | wc -l must be greater than 0 before the real query's 0 means anything. Never discard stderr on a query whose answer you will believe. Call system tools by absolute path.

4. "Done" is a claim; check the end state

Agents under pressure report success they didn't get, and reviewers — people and models alike — trust confident closing language. "Deployed", "sent" and "merged" are three words that cost us real hours.

A page was declared live because it returned 200. So did /this-page-does-not-exist: the site served a soft-404. Status 200 is what "live" usually means, and here it proved nothing.

Fix: any done, live, sent, or merged claim is backed, in the same turn, by a check of the end state, never by the agent's summary of it. Assert text that only that page shows, and assert the negative too: a removed route must 404. The free checker is at the end of this piece.

5. Independence needs a new process, not a new prompt

A subagent asked to "review independently" shares its parent's context and assumptions, and it agrees. For merges and launches we needed reviews that couldn't be anchored on the builder's reasoning. Posting your own "QC passed" status is self-approval, whatever else was approved.

Fix: independence is a property of the process. For anything someone else will rely on, start a fresh headless process (claude -p, or the equivalent in your stack) with a new session id, in an empty temp directory, given paths and checks only, never conclusions. It writes one named verdict file. The launcher waits for the process to exit — reviewers keep editing after the file first appears — then hashes the file and forwards it without reading it first. If the reviewer errored, timed out, or produced an empty file, the result is UNDETERMINED, never a pass. Money, legal, and irreversible changes get a different person or a different model.

6. The same session can run twice

After a restart, the same agent session was resumed twice. The twin ran its end-of-day routine on the same repository, switched the shared working tree to main, and stopped the helper agents. The next commit landed on main, and a gate tested main instead of the integration branch; it was reported as PASS. Two copies of one session share the repo, the scratch space, and the name, and neither knows about the other.

Fix: list live peers before trusting a result. On any resume after a crash or restart, if one running session already carries your name, agree on one owner before touching shared trees. Post a claim line on the shared board before starting shared work. Before trusting a gate, compare git rev-parse --abbrev-ref HEAD and the SHA in the gate's log with the branch you meant. git reflog shows checkouts you never ran.

7. Synced folders and worktrees don't mix

Git worktrees on an iCloud-synced Desktop pushed the machine hard: four parallel agents created about 280 MB of worktrees each, the sync daemons ran at about 160% CPU, and the load average passed 300. Later, files the OS had evicted to the cloud crashed a background service in a loop (195 times) with an error that looked nothing like "file not downloaded." Evicted files still list normally.

Fix: builds, worktrees, and scratch live outside synced folders, and services run from a local copy. When a scheduled job dies strangely, search for evicted placeholder files first. On macOS, find <dir> -type f -flags +dataless | head lists them; without the +, the same command silently matches nothing. When the machine is slow, check ps -Ao pcpu,comm -r | head for sync daemons before blaming the agent.

8. Safety refusals are design input, not obstacles

Claude Code's safety checks refuse some actions on their own: certain emails, merges that bypass CI, reads of production payment data. Early on, agents tried to finish the job another way. That's the wrong instinct.

It's the same weakness behind Anthropic's Project Vend finding that an agent accepted a fake "elected CEO": text in a shared place is not authority. A teammate's message is not the owner's approval, and a general "go" or "keep going" does not cover a specific refused action.

Fix: a refusal means HOLD and report, never a retry through another agent, tool, or session. Rephrasing a refused action to get past the refusal is not a workaround; stop. At planning time, route the known refusal classes to the human: they click the button, or they say the exact words ("send these two emails," "merge this PR").

9. Self-tests must stub the network

A write tool's self-test called its own POST helper to prove an allowlist refused an endpoint. A mutation run removed the allowlist, and the mutant sent one real, empty request to a production vendor API, with a real token. A self-test is meant to be safe anywhere; mutation testing removes exactly the guard the test relied on.

Fix: any self-test that reaches a function which writes to the outside world stubs the network call first, restores the stub in finally, and asserts that the stub recorded nothing (or that a patched client raises). Run mutants from a scratch copy. A test that still passes when the HTTP client is patched to raise never touched the network.

10. Heredocs and guessed clocks

A long hand-off note built with a shell heredoc hit a parse error and arrived empty. The notifier sent it anyway: its hash was the SHA-256 of an empty file (e3b0c442…). Separately, several note headers carried times the agent had guessed, hours away from the real clock. The send succeeded, and nothing checked the content, so the recipient recorded both the empty note and the wrong times as fact.

Fix: write multi-line files with the editor or the file tool, not a heredoc. Check the byte count before sending: 0 bytes means stop. Stamp times from the live clock (date), never from memory.

11. Snapshot dirty git before any cleanup

A disk cleanup "skipped" twelve dirty worktrees. "Skipped" read as "safe." By the next day ten were gone, and their uncommitted work had no copy anywhere, because the backup deliberately skipped worktrees. The committed work survived only because it was already in pull requests.

Fix: before removing, moving, or evacuating any checkout, a script pushes every dirty tree, local-only branch, detached head, and stash to a wip/<tag>/ branch on the remote. Then it deletes. The check that the snapshots actually landed is git ls-remote origin 'refs/heads/wip/<tag>/*' — a rev-list against remote-tracking refs can be stale; ls-remote is not. Nothing is deleted until that list is complete.

12. Gates lag decisions, and documentation density isn't importance

Most morning "reds" were instruments that hadn't caught up with a decision the owner had already made, not broken systems: jobs retired on purpose, services shut down, new repositories not yet registered. An agent "fixed" one by re-arming a freeze the owner had lifted.

And when agents decide what to work on by reading the repo, they pick the most-documented area. Ours was the account the owner considered healthiest.

Fix: look for evidence of a deliberate change (retirement notes, commented-out jobs, deleted service files) before restoring anything. Re-aim the assertion rather than deleting it: a retired service must be inactive and disabled, and a locked-down route must 404. Without that evidence the gate stays red, and the row says "unexplained." Ask the human what matters; never infer it from file sizes.

Free: the end-state check

Paste this into any agent's toolbox. A claim of "live" passes only when the URL answers with the expected code and the expected text, so a soft-404 can't pass.

endstate_http() {  # usage: endstate_http URL CODE "text that must appear"
  local url="$1" want="$2" text="$3" body code
  body=$(curl -sS -L -m 20 -w '\n%{http_code}' "$url") || { echo "UNDETERMINED: $url unreachable"; return 2; }
  code="${body##*$'\n'}"; body="${body%$'\n'*}"
  [ "$code" = "$want" ] || { echo "FAIL: $url -> $code (wanted $want)"; return 1; }
  if [ -n "$text" ] && ! printf '%s' "$body" | grep -qF -- "$text"; then
    echo "FAIL: $url -> $code but missing: $text"; return 1; fi
  echo "VERIFIED: $url -> $code${text:+ and contains \"$text\"}"
}
# known-positive control, in the same breath:
endstate_http https://example.com 200 "Example Domain"
Enter fullscreen mode Exit fullscreen mode

The full open-source version — HTTP, file-hash and git checks, a built-in control, and an offline self-test — is RIPRODUCTIONS/endstate (MIT). It is one bash file. Each run prints one line and exits 0 VERIFIED, 1 FAIL, or 2 UNDETERMINED. Never read 2 as a pass.

From a checkout of that repo:

./endstate --self-test      # offline; curl is stubbed, no network
./endstate --control        # one live check that must pass
./endstate http https://example.com 200 "Example Domain"
./endstate http https://example.com 200 "zz-not-on-this-page"
Enter fullscreen mode Exit fullscreen mode

The first HTTP command should print VERIFIED and exit 0. The second should print FAIL — example.com really is 200, but the body does not contain that string — and exit 1. That is the soft-404 shape: a 200 is not enough.

Terminal: ./endstate verifies example.com returns HTTP 200 and contains the text Example Domain, then fails the same URL when asked for text that is not on the page.

Terminal: the endstate --self-test run finishing offline with self-test: PASS.

A line you can add to CLAUDE.md, AGENTS.md, or your system prompt:

Before you say "done", "live", "deployed", "sent" or "merged", prove it with `endstate` (see `endstate --help`) and paste its output line; exit 1 means it is not done, and exit 2 means you could not tell, which is not done either.
Enter fullscreen mode Exit fullscreen mode

The rules, checks, and scripts in this vein are plain Markdown and bash. They were written for Claude Code and work with any agent that reads a rules file and can run a shell, including Cursor, Codex-style agents, and CI jobs.


These twelve notes are the ones we keep coming back to. The Agent Ops Kit ($29) adds an incident library of 30 real failures, each with its fix and the check that catches it.

Disclosure: Rippy Productions makes and sells the Agent Ops Kit, a $29 one-time kit.

agent-ops-kit-5jb.pages.dev

If the kit hasn't worked for you, email help@rippyproductions.com within 14 days of the charge for a full refund. Refund policy. The end-state checker above stays free (MIT). Not affiliated with Anthropic.

Top comments (0)