We Gave Coding Agents the Keys to the Repo and None of the Ops
Think about what a coding agent actually is, mechanically. It's a process that edits your source, runs your shell, reads whatever files it can reach, and spends money — at machine speed, often unattended, sometimes several at once. If you described that to an SRE without saying "AI," they'd ask the obvious questions: how do you recover when it breaks something, what stops the destructive command, how do you see what it did, what's it costing, what can it read, who reviews the output?
For traditional automation we made answers to every one of those — backups, guardrails, logging, billing alarms, least-privilege, code review. For coding agents, most teams have none of it. We gave them the keys to the repo and skipped the operational layer entirely, because the agent feels like a chat window, not a production system. It is a production system. This post is the map of the layer it's missing — drawn from a series of small tools we made filling each gap, one real failure at a time.
There are seven stages, and they're just the operational lifecycle of any thing you let write to production, applied to an agent.
Set up
An agent's behavior is downstream of two files it reads every session: CLAUDE.md and .claude/settings.json. Both rot silently. A CLAUDE.md that's grown to 300 instructions is past what the model reliably follows; one that points at deleted files sends the agent chasing ghosts; one that omits the build command leaves it unable to check its own work. And the permission config quietly sets the ceiling on how bad an injection can get. The first stage is making the agent's standing context lean, correct, and least-privilege — and regenerating it from the repo when it drifts, instead of hand-writing it from a blank page.
Recover
Agents fail in ways that lose work. A cycle gets interrupted and leaves a session permanently wedged on a malformed thinking block. A worktree gets switched and orphans a branch's commits. An uncommitted change gets clobbered. The difference between "annoying" and "lost an afternoon" is whether you can get the work back — orphaned commits are still in the object database, wedged sessions are recoverable by surgery on the transcript, and uncommitted work is recoverable only if something snapshotted it. Recovery is the stage everyone discovers the day they need it and don't have it.
Prevent
Cheaper than recovery is the command that never runs. git reset --hard, rm -rf, push --force — at machine speed, unattended, one of these is a bad afternoon. A PreToolUse hook that vetoes the destructive command before it executes is the agent equivalent of a guardrail on a deploy. Prevention also means catching the input that would hijack the agent in the first place — invisible Unicode instructions hidden in a file it's about to read.
Observe
You can't operate what you can't see. With one agent you read along; with five running unattended you need the equivalent of ps and a log: which sessions are alive, on what branch, how old, healthy or wedged — and, per session, what did it actually do and is the work sound. Observability for agents isn't dashboards; it's being able to answer "what is happening across my fleet right now" without opening five terminals.
Spend less
Agents bill by the token, and the single biggest lever is prompt caching — but only if you understand the economics (cache writes cost more, reads cost a tenth, the prefix has to stay byte-stable). The spend stage is knowing what a session costs and what caching is actually saving you, instead of being surprised by the invoice.
Secure it
An agent can read every file it can reach — including the .env and the SSH keys — and it has a network egress path. The blast radius of a hijacked agent is "every secret it could read, sent anywhere it could POST." Securing it means measuring that blast radius (which secrets are reachable, are any committed), tightening the permission floor with deny rules, and treating every file and tool description it ingests as untrusted input.
Verify
The work isn't done when the diff is written — it's done when someone trusts it. The 2026 data is blunt: most developers don't fully trust AI-generated code, and reviewing it costs more than reviewing a human's, because the reviewer gets a finished diff with none of the implementation journey. The verify stage is closing that gap — surfacing what the agent was asked, what it ran, which files it changed informed vs blind, and whether it checked its own work — so review is fast and grounded instead of slow and suspicious.
The layer, at a glance
Put the seven stages together and you have the operational layer a coding agent needs — the same scaffolding you'd demand of any unattended process with write access, just pointed at an agent:
RECOVER rescue orphaned commits · un-wedge a stuck session
PREVENT block destructive commands · frisk inputs for injection
OBSERVE ps the fleet · audit a session · brief a worktree
SPEND price prompt caching
SECURE measure the secret blast radius · audit permissions
SET UP scaffold + lint CLAUDE.md · audit skills · wire the hooks
VERIFY a reviewer brief from the transcript
We made each piece as we hit the failure it prevents, and consolidated them into one tool — but the point isn't the tool. The point is the shape: if you're running coding agents on anything that matters, you need an answer at each of these stages, whether you build it, buy it, or borrow ours. The teams that get burned are the ones who noticed only the stage they were missing, the day it cost them.
The real lesson
The capability conversation around coding agents is mostly settled — they're good and getting better. The conversation that isn't settled, and the one that actually determines whether they're safe to run unattended, is operational. Treat your agent like what it is: a process with write access to your code, your shell, your secrets, and your wallet. Give it the ops layer you'd give anything else with that much reach.
We build and run autonomous agent fleets on Claude Code in production, and open-sourced the operational layer we use. If you're putting agents to work on code that matters, talk to us.
Found this useful?
In this series
The seven operational stages a coding agent needs — and the small tools that fill each one.
You're Running Five Agents on One Repo. Who Stops Them Overwriting Each Other?
Sometime in the last year the default way to use a coding agent quietly changed. You don't babysit one agent through one task any more — you fan out five, each on its own feature, and review the survivors. We run a fleet…
Your Agent Did the Work, Then It Vanished. Here's How to Get It Back.
There is a specific kind of dread that only exists in 2026. You set an agent loose in a worktree, go make coffee, come back — and the work is gone. Not "needs review" gone. *Gone* gone. The branch isn't there. `git log`…
Your Claude Code Session Is Permanently Stuck on a 400. Don't /clear — Do This.
You hit Esc, you typed "continue," and Claude Code answered with this:
The One Kind of Agent Work You Can't Recover — and How to Stop Losing It
Every recovery post we've written ends on the same line: *commit early.* There's a reason it keeps coming up. Committed work survives almost anything — a removed worktree, a `reset --hard`, a deleted branch — because the…
Your Agent Will Eventually Run git reset --hard. Stop It at the Door.
Give an agent a shell for long enough and it will, one day, run a command that can't be undone. The canonical case is anthropics/claude-code#34327: an agent ran `git reset --hard origin/main` **within the first second of…
Your Agent Reads Text You Can't See. Frisk It First.
Indirect prompt injection is now the [top security risk](https://www.truefoundry.com/blog/claude-code-prompt-injection) for AI coding agents: malicious instructions hidden in a file, a dependency, a fetched web page, or…
You're Running a Dozen Agents. Which One Is Stuck?
Once you're past one or two Claude Code sessions, you lose the thread. Five terminals, a few worktrees, an agent on the laptop and two on a server — and no single answer to "what's actually running right now, and is any…
What's Actually In Your Claude Code Session File (and a Tool to Read It)
Every Claude Code session you've ever run is sitting on your disk as a plain text file. Not a database, not an opaque blob — newline-delimited JSON you can `cat`, `grep`, and parse. Once you know the shape, you can answe…
Your Agent Fleet's Worktrees Are a Minefield. Here's How to See It.
The standard way to run coding agents in parallel is one git worktree each: every agent gets its own directory and branch, they don't trip over each other, and you fan out five, ten, twenty of them. It works great — righ…
The Agent Wrote the Code in Minutes. Reviewing It Takes Hours. Here's Why.
The numbers on AI code review in 2026 are blunt. Sonar's survey found **96% of developers don't fully trust AI-generated code — and only 48% verify it.** DORA tied AI adoption to **91% more time in code review.** LinearB…
Your Claude Agent Re-Reads Its Whole Prompt Every Turn. Here's the 10× You're Leaving On the Table.
Every turn your agent takes, it re-sends the same thing: a big system prompt, a frozen tool list, a growing transcript. A 10,000-token system prompt that doesn't change between turns gets re-processed, at full price, on…
Your Agent Can Read Everything Your Shell Can. Have You Looked?
[Last time](/insights/your-agent-reads-text-you-cant-see-frisk-it-first) we frisked the *inputs* — the invisible Unicode that smuggles instructions into a coding agent. But injection only matters because of what the agen…
The Loosest Line in Your Repo Is in .claude/settings.json
We've spent the last few posts on the *acute* side of agent security — [frisking inputs](/insights/your-agent-reads-text-you-cant-see-frisk-it-first) for hidden instructions, [measuring the blast radius](/insights/your-a…
The Most Expensive File in Your Repo Runs on Every Single Turn
The consensus that formed over 2026 is that **context engineering replaced prompt engineering as the real leverage point** — the model is rarely the bottleneck, the context almost always is. And the most-loaded piece of…
Your Skill's Description Is the Whole Ballgame
Agent skills run on **progressive disclosure**: at the start of a session the model sees only each skill's *name and description* — not its body. From that one sentence it decides whether your skill is relevant. Only if…
Your Repo Already Knows How To Build Itself. Put That In the CLAUDE.md.
The most useful line in a `CLAUDE.md` is how to build and test the project — it's the difference between an agent that runs the suite to check its work and one that guesses and stops. It's also the line people most often…
Related posts
Sample report: Agent secrets audit of deemwar's own setup
A sample of our agent secrets audit, run on our own agent setup: seven leak paths ranked by severity, the fixes, and what risk remains.
Sample agent-security review: Veilpipe's own repo
A free sample of our Claude Code agent-security review, run on our own public repository, Veilpipe, at release v0.2.6: what an agent session could reach, what was hidden from the model, and what had to be fixed.
Know what your agent CLI leaves behind
Before you roll a coding agent out to a team, find out what it writes to disk and what it leaves running. Here is what that looked like for three of them.
Veilpipe is open source. Your coding assistant never sees the value it replaced.
When you debug a payment or a login with a coding assistant, the key tends to end up in the conversation. You paste it into a prompt, or the assistant runs `cat .env`, or a tool prints a connection string. Whatever reach…