/writing/my-ai-agent-ran-for-two-months-with-its-guardrails-off

My AI Agent Ran for Two Months With Its Guardrails Off

I run a coding agent in two places at home: in a terminal on my main server, and as an always-on pod in the small Kubernetes cluster on that same machine, which I talk to remotely. Both are supposed to share one configuration: the same instructions, the same skills, and the same safety hooks. One hook blocks destructive shell commands. Another stops the agent from putting AI attribution into commits and pull requests.

While tidying that configuration I found the pod had been running with none of it. No hooks, no instructions, no skills. Not since some recent change, but since the day it was deployed, about two months earlier. Nothing had ever complained.

How it broke without breaking

The shared configuration lives in a git repo. A setup script links its pieces into the agent’s config directory: instruction files and skills are symlinked, and the settings file (which holds the hooks) is merged in.

The pod got that configuration through two hostPath mounts: one for the repo, and one for my dotfiles. Its settings file, on a persistent volume, was a symlink into the repo mount.

The problem was timing. A few weeks before the pod existed, I’d moved the repo from my home directory into ~/projects/. The pod’s manifest still mounted the old path. A hostPath volume with no type: set performs no checks at all, and an empty directory sat at the old location. So the pod started fine, the mount succeeded, and the settings symlink pointed at a file inside an empty directory.

From there everything failed in the quietest way available:

  • The agent found a dangling symlink where its settings should be, treated it as no settings, and started normally.
  • With no settings there were no hooks, so nothing ran on any command, so nothing failed.
  • The instruction files and skills had never been linked in that environment at all, so their absence didn’t produce an error either. They just weren’t there.

Every piece of this is reasonable on its own. Together they produced an agent that looked healthy, answered questions, ran commands, and had none of the guardrails I believed it had.

It wasn’t the only copy that had drifted

Finding that sent me through the rest of the setup, and the same failure kept turning up in other forms. In each case, a copy or a link quietly stopped being what I thought it was.

Two clones of one repo. My dotfiles existed twice, in ~/dotfiles and ~/projects/dotfiles. All the live symlinks pointed at the first. The second was the one a setup note said was canonical, and it was locked: the repo uses git-crypt for secrets, and that clone had never been unlocked. Running the install script from the “canonical” clone would have pointed my agent’s memory files at encrypted ciphertext and replaced newer local files with older committed ones.

A merge target that was a symlink. The setup script deliberately merges a portable base settings file into the live one, so each machine can keep its own additions. On my main machine, the live file had at some point been made a symlink to the base file in the repo. The merge reads the file, sorts and de-duplicates it, and writes it back. Through the symlink, that write would have gone into the repo, putting machine-specific state into a file meant to be portable. The script’s check mode reported this as fine.

Memory files split across copies. The agent’s memory index listed six files that didn’t exist where the agent reads them. They only existed in the repo. Four others existed in both places with different content, and the live copy was newer. I’d also broken one link myself that morning: sed -i on a symlinked file replaces the link with a regular file.

None of these raised an error. Each one was a link or copy that had stopped matching its source, discovered only because I went looking.

What I changed

For the pod:

  • Dropped the separate mounts. The pod already mounts ~/projects, and both repos now live there, so one mount covers everything. Fewer paths means fewer paths that can go stale.
  • Made the settings file a real file. It’s merged from the base by the setup script, not symlinked to it, the same as everywhere else.
  • Added Python to the image so the same setup script runs inside the pod, instead of me linking things by hand and forgetting some.
  • Tested the guardrails where they run. Inside the pod, I fed the destructive-command hook a rm -rf / and the attribution hook a commit message with an AI co-author trailer, and checked that both exited with the blocking status. A hook you haven’t seen block something is a hook you only believe in.

For the configuration in general:

  • One clone per repo, in one place. I moved the live dotfiles clone into ~/projects, deleted the locked duplicate, and repointed every symlink. A tool that pulls all repos in that directory now keeps them current.
  • Merge targets are real files. If a setup script merges into a file, it checks that the target isn’t a symlink first. Otherwise the merge writes through the link into its own source.
  • All memory files live in the repo and are linked out. No real files left in the live directory, so nothing exists in only one place.

If you mount host paths into pods, set type: Directory on the hostPath. Then a missing path fails the pod at start-up instead of quietly mounting an empty directory. I’d have found this two months earlier.

Takeaways

  • A guardrail that fails closed when missing is worth more than a clever one. My hooks failed open: their absence looked exactly like their success. If the safety layer can be silently absent, assume at some point it will be.
  • Verify the guardrail in the runtime that uses it. “The config is linked” is a claim. “This hook just blocked rm -rf / in this container” is evidence.
  • Every extra copy is another place to drift. Two clones, a symlink and a merged file, a mount at an old path: each worked when it was set up, and each drifted later without telling anyone.
  • Check modes should check what can go wrong. My setup script’s check mode looked at whether things were linked, not whether the links pointed anywhere useful or whether a merge target was a symlink. The checks covered the setup path, not the ways it can rot.

The uncomfortable part is how ordinary the agent looked the whole time. It did useful work for two months. I only know it did that work without its guardrails because I happened to read a symlink.