Run Cursor agent mode safely with containers and hooks
The poster runs Cursor agent mode on a real project, including a Twilio voice agent, using containers, hooks and safeguards to protect the environment.
Done withCursor
- What they did
- The poster runs Cursor agent mode inside a per-feature devcontainer with Docker Compose services for the app, Postgres, Redis, and a Cloudflared sidecar, plus forwarded ports for a Twilio voice agent’s web UI and websocket endpoint. Secrets are injected from a dedicated 1Password vault, while destructive actions stay behind host SSH agent biometric approval, so the agent can use CLI commands and work autonomously but can’t safely touch main or the host environment.
- How it went
- The result was a setup where they could leave Cursor running on real tasks and either return to finished work or delete a broken container with no damage outside that isolated stack. It still needed extra safeguards beyond Cursor’s built-in protections, and Cloudflare Bot Fight Mode had to be disabled for some ChatGPT-facing use cases.
- Worth knowing
- Their main practical catch is that each feature gets its own isolated containerized environment, and if the agent breaks it, they simply throw the container away and start fresh.
Try it yourself with Cursor
Help me run Cursor agent mode safely on my project [project name]. Set up a dev container so the agent works in isolation, add hooks that block risky commands like [rm -rf, force push, or access to .env secrets], and keep secrets such as [API keys] out of its reach. Finish when I can run a test task inside the container and see a risky command get blocked. Show me each config change before you apply it.
Want help getting this working? Join the Vibe Coding Academy ↗ Run by Alex Finn, who also runs this site.
Source: Reddit · Undated
Related use cases
Keep coding agents running autonomously for long stretches
Cursor's write-up on scaling long-running autonomous coding.
Draft articles quoting Kindle highlights and notes
The author saves Kindle highlights and event notes in Obsidian and has Cursor reference them to quote past reading when drafting articles.
Manage an inbox and book jobs as an office manager
Users run Grok Bot as an inbox manager and as an office manager that takes work orders, plans capacity and books jobs across Gmail, Slack, and ServiceTitan.
Build a C compiler with a team of parallel agents
Anthropic's engineering write-up on tasking Opus 4.6 agent teams with building a C compiler.
Build and deploy an app over a weekend
The author had Devin build and deploy an app, finding it quick on PR feedback but weak on legacy monorepos and costly on broad requests.
Build an anonymous wall of hopes and fears about AI
A poster built a site with Claude Code where Haiku moderates and places posts and Opus regroups and names themes.
Get 5 like this every morning
The best things people got an AI agent to do, each with the prompt to try it.