Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ Unsure whether a command will trip? Write it to a file and dry-run the hook: `py
**`cd` before `sbx`, never inside it.** The writable project root is resolved by running `git rev-parse --show-toplevel` in the OUTER shell, before the sandbox starts. So `cd <dir> && __WORKSPACE__/scripts/claude/bin/sbx <cmd>` gets a writable `<dir>`; `sbx bash -lc 'cd <dir> && <cmd>'` gets a read-only one. This also fixes `npx` binary resolution, which depends on cwd.

- **Inline eval** (`python3 -c`, `node -e`, `perl -e`, `ruby -e`, `php -r`, `bun -e`, `Rscript -e`, `deno eval`) — must be `sbx`-prefixed. A PreToolUse hook denies the bare form, so reach for `sbx` first.
- **An interpreter reading its program from stdin** is inline eval by another spelling, and is denied the same way: `python3 - <<'EOF'`, `python3 <<'EOF'`, `cat x.py | node`, `deno run -`. Heredocs are still fine as *data* (`git commit -F - <<'EOF'`) — it is the interpreter, not the heredoc, that triggers the deny. Prefix with `sbx`, or write the program to a file and run the file.
- **`rm` / `mv` / `ln` / `dd` / `chmod` inside the project or `/tmp`** — prefix with `sbx` to auto-approve. Bare forms are the escape hatch for paths OUTSIDE the project, which the sandbox blocks; they prompt.
- **Project-local tools** (`npx tsx`, `npx vitest`, and anything already in `node_modules/.bin`) — an `sbx` candidate, and the preferred way to run them: no allowlist rule needed. `npx` walks up the tree to find the binary, so a git worktree with no `node_modules` of its own still resolves from the parent repo. If the package is genuinely absent, `npx` falls through to the registry and dies with `EAI_AGAIN` — read that as "not installed locally", not as a sandbox fault. (`--no-install` and `--no` do NOT suppress the registry lookup on npm 9, and `--no` swallows a following `--version`.) To bypass `npx` entirely, call the binary by path: `node_modules/.bin/tsx`, or `../../node_modules/.bin/tsx` from a worktree.
- **Not an `sbx` candidate** — anything needing network: `git fetch`/`push`, `gh`, dep installs, and `npx` that must *install* the package (not merely run an installed one). Also writes outside the project and `/tmp`.
Expand Down
11 changes: 7 additions & 4 deletions examples/cursor-workspace/.claude/settings.template.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,7 @@
"Bash(git describe *)",
"Bash(git blame *)",
"Bash(git reflog *)",
"Bash(git rebase --abort *)",
"Bash(git rebase --continue *)",
"Bash(git rebase --quit *)",
"Bash(git rebase --skip *)",
"Bash(git rebase *)",
"Bash(git remote *)",
"Bash(git reset HEAD *)",
"Bash(git reset -q HEAD *)",
Expand All @@ -82,6 +79,9 @@
"Bash(git status *)",
"Bash(git submodule *)",
"Bash(git symbolic-ref *)",
"Bash(git tag)",
"Bash(git tag --list *)",
"Bash(git tag -l *)",
"Bash(git verify-commit *)",
"Bash(git verify-tag *)",
"Bash(git worktree add *)",
Expand Down Expand Up @@ -130,6 +130,8 @@
"Bash(git -C /tmp/* rebase *)",
"Bash(git -C * worktree remove /tmp/*)",
"Bash(git -C * worktree remove --force /tmp/*)",
"Bash(git -C * worktree remove __HOME__/projects/*/.worktrees/*)",
"Bash(git -C * worktree remove --force __HOME__/projects/*/.worktrees/*)",
"Bash(git push *)",
"Bash(git pull *)",
"Bash(npx gitnexus *)",
Expand All @@ -156,6 +158,7 @@
"WebFetch(domain:github.com)",
"WebFetch(domain:docs.claude.com)",
"WebFetch(domain:docs.anthropic.com)",
"WebFetch(domain:docs.rs)",
"WebSearch",
"Write(__HOME__/projects/**)",
"Write(/tmp/**)",
Expand Down
Loading