Build new agent features inside a guarded Docker sandbox

A Claude-based agent updated its own code in Docker, with every edit checked, committed, or undone automatically.

Done with Claude· Advanced· Mar 2026

What they did
Miguel ran a Claude agent built with Agno inside Docker. The full project stayed mounted read-only, while only the agent’s own code folder could be changed. A host process captured the git state, fed the agent its files and the next capability to add, then inspected the result with AST, JSON schema, and import checks before deciding whether to commit or revert.
How it went
It made it through all 10 starter capabilities, then created its own checklist and expanded to 21+ capabilities. A later cleanup pass cut the codebase size by 10% and reduced the system prompt length by 63%. Even after that, it still sometimes made poor choices.
Tips
Keep the writable surface small and verify every edit before saving it. Watch context use closely, because reading six or more of its own files can leave the agent out of room before it writes anything.

Try it yourself with Claude Code

Help me create a Docker setup for [repo path] where an agent can improve its own source code. Leave the main project mounted read-only, and allow writes only in [writable code directory]. Give the agent its current files and a single new capability to implement, such as [first capability]. After each change, run AST checks, JSON schema checks, and import checks; if they succeed, commit the change, and if they fail, restore the previous version. Show the commit hash and test output, and pause for my approval before any step that would send data, delete files, make payments, or modify anything outside the sandbox.

Fill in the [brackets]. Agents can make mistakes, so review anything before it is sent, paid or deleted.

Get 3 agent uses like this every morning

With the day's top AI news. Free, and one click to unsubscribe.