Create or harden a devcontainer-based development sandbox so coding agents run inside an isolated container with least privilege and strong guardrails (no destructive host access, controlled...
You are running inside an isolated devcontainer. This container IS your sandbox - it provides stronger isolation than Claude Code's built-in sandbox. Understand these rules to work effectively.
--dangerously-skip-permissions or the permissive settings are already appliedIn multi-agent mode only (when $AGENT_ID is set):
AGENT_ID and assigned packages. Only modify files in your owned directoriesagent-{N}/ to avoid conflictsFirst, determine if you're in a devcontainer:
# If this file exists, you're in a container
[ -f /.dockerenv ] && echo "In devcontainer" || echo "On host"
Multi-agent mode (environment variables set):
echo $AGENT_ID # Your agent number (1-20)
echo $BRANCH_PREFIX # Your branch prefix (e.g., "agent-3")
echo $OWNED_PACKAGES # Directories you may modify
Single-agent mode (environment variables NOT set):
Check which mode you're in:
if [ -n "$AGENT_ID" ]; then
echo "Multi-agent mode: Agent $AGENT_ID"
else
echo "Single-agent mode: Full repo access"
fi
/workspacegh CLImain branch - Always create a feature branch with your prefix# 1. Create your branch
git checkout -b $BRANCH_PREFIX/feat-my-improvement
# 2. Make changes (only in your owned packages)
# ...
# 3. Commit and push
git add -A
git commit -m "feat(package): description"
git push -u origin HEAD
# 4. Create PR
gh pr create --title "..." --body "..."
If you see Git lock errors (Unable to create '.git/index.lock'):
Before creating a PR, verify your devcontainer config passes security checks:
./verify.sh --stage=devcontainer
This checks:
If you see: can't create temp file for here document: operation not permitted
Cause: Claude Code's sandbox is conflicting with devcontainer isolation.
Fix: You should already be running with sandbox disabled. If not, ensure ~/.claude/settings.json has:
{
"sandbox": { "enabled": false }
}
Your container has limited resources (typically 1-2 GB RAM, 1-2 CPU cores). Avoid:
npm install operations in parallel with buildsYou share the repository with other agents. To avoid conflicts:
git pull --rebase origin main before final pushSee SECURITY-FOOTGUNS.md for the full checklist. Key points:
.env filesVerify your devcontainer is properly hardened:
# Check you're not root
whoami # Should NOT be "root"
# Check capabilities are dropped
cat /proc/self/status | grep Cap # CapEff should be minimal
# Check memory limit
cat /sys/fs/cgroup/memory.max # Should show limit, not "max"