---
name: eck:sandbox
version: "0.7.4"
description: "Show or set the sandbox default in ~/.claude/settings.json. Config-only — changes apply next session."
disable-model-invocation: false
---

# Sandbox

Show or set the sandbox default configuration in `~/.claude/settings.json`.

**Important:** This sets the _default_ for new sessions. To toggle sandbox in your _current_ session, use Claude Code's built-in `/sandbox` command.

---

## Visual Framework

Reference: `output:visual-framework` primitive

### Color Setup

```bash
source $ECK_HOME/colors.sh
# Provides: ORANGE, CYAN, GREEN, RED, YELLOW, BOLD, DIM, RESET
```

### Status Symbols

- `[x]` — Success / applied
- `[-]` — Unchanged

### Summary Box

Use clean label-value format for summary output.

---

## Usage

```
/eck:sandbox              # Show current sandbox config
/eck:sandbox on           # Enable sandbox by default (next session)
/eck:sandbox off          # Disable sandbox by default (next session)
```

---

## Behavior

This is a config-only skill — no stages, no statusline updates.

### Show (no argument)

1. Read `~/.claude/settings.json`
2. Check `sandbox.enabled` value
3. Display current state:

```bash
source $ECK_HOME/colors.sh

# Read current state
SETTINGS="$HOME/.claude/settings.json"
if [ -f "$SETTINGS" ]; then
  ENABLED=$(cat "$SETTINGS" | grep -o '"enabled":[^,}]*' | head -1 | grep -o '[^:]*$' | tr -d ' ')
fi

echo ""
printf '%b\n' "${ORANGE}${BOLD}Sandbox Config${RESET}"
echo ""
printf '%b\n' "Default: {On/Off}"
printf '%b\n' "Scope: Next session"
printf '%b\n' "Current session: Use /sandbox to toggle"
echo ""
```

### Set (on/off argument)

1. Read `~/.claude/settings.json`
2. Set `sandbox.enabled` to `true` or `false`
3. Preserve all other sandbox settings (`autoAllowBashIfSandboxed`, `network`, etc.)
4. Write back to `~/.claude/settings.json`
5. Display confirmation:

```bash
source $ECK_HOME/colors.sh

printf '%b\n' "${GREEN}[x]${RESET} Sandbox default set to {on/off}"
printf '%b\n' "    ${DIM}Takes effect next session. Use /sandbox to change current session.${RESET}"
```

### Key behavior notes

- **Never removes** existing sandbox sub-keys (`network.allowedDomains`, `autoAllowBashIfSandboxed`, etc.) — only toggles `enabled`
- If `sandbox` key doesn't exist yet, creates it with `enabled` + `autoAllowBashIfSandboxed: true`
- If argument is not `on` or `off`, show usage help

---

## Error Handling

| Error                               | Recovery                   |
| ----------------------------------- | -------------------------- |
| `~/.claude/settings.json` not found | Create with sandbox config |
| Invalid JSON                        | Warn user, do not modify   |
| Unknown argument                    | Show usage help            |

---

## Related Documents

- `/sandbox` — Claude Code built-in command for current-session toggle
- `/eck:enable-protections` — Toggle safety hook enforcement
- `/eck:disable-protections` — Toggle safety hook enforcement
