Contained Autonomy Mode All Tiers
Safely run Claude Code with autonomous capabilities while protecting critical infrastructure
What is Contained Autonomy?
Contained Autonomy Mode lets you run Claude Code autonomously while preventing it from modifying its own enforcement infrastructure. This solves a fundamental challenge: how do you let an agent work autonomously without risking it modifying the rules that govern its behavior?
The Problem It Solves
When running Claude Code in autonomous mode, there's risk the AI might:
- Modify skill definitions to bypass workflow requirements
- Edit CLAUDE.md to remove constraints
- Change security enforcement code
- Access credentials or secrets
How It Works
- Git checkpoint created - Automatic rollback point before entering containment
- Filesystem access enforced - Three-tier protection based on configuration
- Network restricted - Only allowed domains can be accessed
- Claude works autonomously - Full capability within the allowed scope
- Safe exit - Can rollback if anything goes wrong
Quick Start
# Start Claude Code in contained autonomy mode
bpsai-pair contained-auto
# Check containment status
bpsai-pair containment status
# Rollback to last checkpoint
bpsai-pair containment rollback
Configuration
containment:
enabled: true
mode: strict # strict | permissive
auto_checkpoint: true # Create checkpoint on entry
# Tier 1: Blocked (no read, no write)
blocked_files:
- .env
- .env.local
- credentials.json
- secrets.yaml
# Tier 2: Read-only (can read, cannot write)
readonly_directories:
- .claude/agents
- .claude/skills
readonly_files:
- CLAUDE.md
- .paircoder/config.yaml
# Network domains allowed
allow_network:
- api.anthropic.com
- api.trello.com
- github.com
Checkpoints and Rollback
Containment mode automatically creates git checkpoints for safe rollback.
# List checkpoints
bpsai-pair containment checkpoints
# Rollback to most recent
bpsai-pair containment rollback
# Rollback to specific checkpoint
bpsai-pair containment rollback --checkpoint containment-20260113-140000
# Preview what would be reverted
bpsai-pair containment rollback --preview
When to Use Contained Mode
- Running Claude Code autonomously for extended periods
- Executing implementation tasks without constant supervision
- Working on tasks that don't require modifying enforcement code
- You need to modify skills, agents, or commands
- Updating CLAUDE.md or AGENTS.md
- Working on security or core infrastructure
Docker Requirement
Strict mode (requires Docker) = OS-level read-only mounts that Claude cannot bypass
Advisory mode (no Docker) = Python-level warnings only, no actual enforcement
Without Docker, containment falls back to advisory mode which logs warnings but cannot prevent writes.