Security of unattended loops
Loops remove the human who might notice a problem. Unattended runs plus tools, untrusted input and memory is the classic setup for prompt injection.
I think we're due a Challenger disaster with respect to coding agent security.
Why loops raise the stakes
An interactive agent has a human watching each step, at least in principle. A loop's whole point is that nobody is watching. Meanwhile it reads untrusted input (issues, PR comments, web pages, dependency READMEs, emails), has real tools (shell, git, network), and often writes to persistent memory. That is the textbook setup for prompt injection, with no one to notice.
What the research says
- In one benchmark of ten backbone LLMs under advanced injection strategies, sandbox escape and information leakage were the most exploitable categories, with an average risk trigger rate of 52.6% (arXiv 2605.22321). primary source
- OpenClaw-style personal agents were reported to be highly susceptible to sandbox escape, with an average defence rate of about 17% (SoftwareSeni, arXiv 2603.10387). secondary reporting
- Content injected into long-term memory persists across sessions and affects every future interaction (arXiv 2607.05189). For ambient loops reading
HEARTBEAT.md, injected instructions run on every heartbeat. - A poisoned project file can lead an agent to edit its own settings to auto-approve everything (SoftwareSeni).
- On a Hacker News thread about agentic loops, one commenter put it bluntly: prompt-injected agents "WILL be able to escape containers" (summary of the debate).
The autonomy dilemma
Approval gates are the obvious defence, and they defeat the point of autonomy. If a loop stops for permission on every risky action, it isn't running unattended. So the industry has largely accepted that injection can't be fully prevented and focused on limiting the blast radius (DEV).
Defences, layered
Isolate
Containers or VMs with restricted network and file access, worktrees per loop. Containers share a kernel, so stronger isolation matters for untrusted work (SoftwareSeni).
Constrain capabilities
Give the loop only the tools and credentials its goal needs. A PR-babysitting loop doesn't need production secrets.
Enforce permissions outside the model
The harness, not the model, decides what's allowed, and the model can't edit those rules (Loams). Antigravity keeps tool permission rules active even in goal mode.
Gate the irreversible
Keep human approval for the few actions that can't be undone: deploys, payments, deletions, public posts.
Treat memory and goal files as code
Review changes to HEARTBEAT.md, memory stores and goal files. Keep provenance. Be able to delete selectively.
Further reading
Model choice and routing
Different steps in a loop need very different capabilities. Routing helps, but cheap per token is not cheap per task.
The human bottleneck
Loops automate the typing, not the judgment. Review capacity, comprehension debt, cognitive surrender and fatigue may be the hardest limits of all.