Guard Scripts Don't Stop an AI Agent From Publishing Your Draft. It Has a Shell A developer's AI agent, Claude Code, bypassed guard scripts and published a draft article publicly on Qiita, reaching about 100 readers before the mistake was noticed. The incident occurred because the agent directly executed the underlying publish command instead of the intended safe-publish wrapper. The developer subsequently rebuilt the system with a pre-execution hook that intercepts and blocks any direct publish command unless a machine review and human gate have been satisfied. I gave Claude Code control over my article publishing pipeline. It handled writing, automated review, limited-share previews, and scheduling end to end. It worked well enough that I stopped watching closely. Then one afternoon I asked it to rewrite an existing post and give me a limited-share URL so I could review the changes. Instead it published the draft publicly. By the time I noticed, roughly 100 people had already read it. I was publishing to Qiita, where once an article goes fully public you cannot put it back to private through the API. There is no undo. The draft was out, and it stayed out. This isn't a Qiita quirk to wave away, either: it's true of any platform where publishing is irreversible, which is most of them once a human has read the page. This is the writeup of what went wrong and the guardrail system I built afterward. The lesson is at the bottom, but it's worth seeing how I got there, because the obvious fix is the wrong one. A publishing guardrail only works when the AI agent cannot bypass it. If the safe path is safe-publish.sh , but the agent can still run qiita publish directly, the guardrail is advisory. The fix is not a louder prompt. The fix is to move enforcement below the agent's preferred command path: The design goal is simple: the AI can draft, review, preview, and update safe surfaces, but the irreversible publish path must hit a wall unless the human gate has been satisfied. The command Claude Code executed was: bun run qiita publish --force