A Claude Code plugin that integrates the try tool to provide sandboxed execution of Bash commands with commit/rollback capabilities. All file-modifying commands run in an isolated overlay filesystem, with changes reviewable before committing to your live system.
- Automatic Sandboxing: All state-modifying Bash commands automatically run through
try - Session-Based: Single persistent sandbox per Claude Code session
- Safe Experimentation: Inspect, commit, or rollback changes at session end
- Manual Controls:
/try-commitand/try-statusskills for mid-session management - Transparent: Minimal changes to your workflow - Claude handles the wrapping
The plugin uses Claude Code's hook system and agent configuration to:
- SessionStart Hook: Creates a unique sandbox directory when your session begins
- System Prompt: Instructs Claude to wrap state-modifying commands with
try -n -D <sandbox> - SessionEnd Hook: Prompts you to commit, discard, or inspect accumulated changes
All file modifications are isolated in an overlay filesystem using Linux namespaces and overlayfs. Nothing touches your live system until you explicitly commit.
- Linux: Kernel 5.11+ (for overlayfs in user namespaces)
- Claude Code: Version 2.0.0 or later
- try tool: Must be installed first
mkdir -p ~/.local/bin
curl -o ~/.local/bin/try https://raw.githubusercontent.com/binpash/try/main/try
chmod +x ~/.local/bin/try
# Verify installation
try -vFor other installation methods, see the try installation guide.
# Clone the repository
git clone https://github.com/binpash/try-claude-plugin.git
cd try-claude-plugin
# Run the installer
./install.sh-
Clone the repository:
git clone https://github.com/binpash/try-claude-plugin.git
-
Copy hooks:
mkdir -p ~/.claude/hooks/try-integration cp try-claude-plugin/hooks/* ~/.claude/hooks/try-integration/ chmod +x ~/.claude/hooks/try-integration/*.sh
-
Copy skills:
mkdir -p ~/.claude/skills/try-commit ~/.claude/skills/try-status cp -r try-claude-plugin/skills/try-commit/* ~/.claude/skills/try-commit/ cp -r try-claude-plugin/skills/try-status/* ~/.claude/skills/try-status/ chmod +x ~/.claude/skills/try-commit/*.sh ~/.claude/skills/try-status/*.sh
-
Update settings:
# Merge the content from settings.template.json into ~/.claude/settings.json # Replace {{PLUGIN_PATH}} with the actual path to hooks
Start a new Claude Code session. You should see:
Try sandbox initialized at: ~/.claude/try-sessions/<session-id>
Claude automatically wraps state-modifying commands:
User: "Create a test file with 'Hello World'"
Claude runs:
try -n -D "~/.claude/try-sessions/<session-id>" "echo 'Hello World' > test.txt"The file is created in the sandbox overlay, not your live filesystem.
/try-status
Shows:
- Sandbox location
- Pending changes (files added, modified, deleted)
/try-commit
Prompts to commit accumulated changes and reinitializes a fresh sandbox.
When you end your Claude Code session, you'll see:
============================================
Try Sandbox Session Summary
============================================
Changes detected in the following files:
/home/user/test.txt (added)
/home/user/.config/app/config.json (modified)
============================================
What would you like to do with these changes?
1) Commit to live filesystem
2) Discard all changes
3) Keep sandbox for later inspection
Choice [1/2/3]:
- Option 1: Apply all changes to your live system
- Option 2: Discard everything, sandbox is deleted
- Option 3: Preserve sandbox for manual inspection/commit later
Session Start
↓
[SessionStart Hook]
↓
Initialize Sandbox: ~/.claude/try-sessions/<session-id>
↓
[System Prompt Active]
Claude wraps commands: try -n -D <sandbox> "<command>"
↓
All changes accumulate in overlay
↓
[SessionEnd Hook]
↓
Prompt: Commit / Discard / Keep
↓
Session End
The plugin can be configured in ~/.claude/settings.json:
{
"agents": {
"main": {
"systemPromptAppend": "...change ~/.claude/try-sessions to your preferred path..."
}
}
}{
"hooks": {
"SessionEnd": [
{
"hooks": [
{
"timeout": 300
}
]
}
]
}
}- Automatic sandboxing of Bash commands
- Session-scoped change tracking
- User control over commits
- Mid-session status checks and commits
- Not enforced at system level: Relies on Claude following system prompt instructions (very high compliance but not guaranteed)
- Other tools bypass sandbox:
Write,Edit,NotebookEdittools don't use Bash, so they bypasstry - Network not sandboxed:
trylimitation - network calls are not isolated - UID/GID restrictions: Commands requiring different user permissions will fail (
trylimitation) - Not security-focused: Primary benefit is safety (undo mistakes), not security (prevent attacks)
- Check if SessionStart hook executed: Look for "Initializing try sandbox..." message
- Verify hook is executable:
ls -l ~/.claude/hooks/try-integration/session-start.sh - Check Claude Code logs for errors
- Verify
~/.claude/settings.jsonhas thesystemPromptAppendconfiguration - Start a fresh session (system prompt applies at session start)
- Manually remind Claude: "Remember to use try for this command"
- If session crashes, hook won't run - check for orphaned sandboxes in
~/.claude/try-sessions/ - Verify timeout is sufficient (default: 120 seconds)
If sessions crash, sandboxes may remain:
# List orphaned sandboxes
ls -lah ~/.claude/try-sessions/
# Manually commit a specific sandbox
try commit ~/.claude/try-sessions/<session-id>
# Or delete old sandboxes
rm -rf ~/.claude/try-sessions/<old-session-id>Shows current sandbox status and pending changes.
Output:
=== Try Sandbox Status ===
Sandbox Location: /home/user/.claude/try-sessions/abc123
Changes detected in the following files:
/home/user/test.txt (added)
/home/user/config.json (modified)
Manually commits accumulated changes from the sandbox.
Flow:
- Shows summary of pending changes
- Prompts for confirmation
- Applies changes to live system
- Clears sandbox and initializes fresh one
try-claude-plugin/
├── .claude-plugin/
│ └── marketplace.json # Plugin metadata
├── hooks/
│ ├── session-start.sh # Initialize sandbox
│ └── session-end.sh # Handle commit/discard
├── skills/
│ ├── try-commit/
│ │ ├── SKILL.md
│ │ └── try-commit.sh
│ └── try-status/
│ ├── SKILL.md
│ └── try-status.sh
├── README.md
├── LICENSE
├── CHANGELOG.md
├── settings.template.json # Settings template
└── install.sh # Installation script
- Install the plugin
- Start a new Claude Code session
- Ask Claude to create/modify files
- Verify files don't exist in live filesystem
- Run
/try-status- should show pending changes - End session and test commit/discard options
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
MIT License - see LICENSE file for details.
Copyright (c) 2025 The PaSh Authors.
- Built on the excellent
trytool from the PaSh project - Designed for Claude Code by Anthropic
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- try Documentation: try README