Skip to content

feat(agents): allow cd, sed, awk, xargs, cp, and mv under the sandbox - #165

Merged
furedea merged 1 commit into
mainfrom
feat/allow-sandbox-contained-shell-helpers
Oct 15, 2026
Merged

furedea merged 1 commit into
mainfrom
feat/allow-sandbox-contained-shell-helpers

Conversation

@furedea

@furedea furedea commented Oct 15, 2026

Copy link
Copy Markdown
Owner

Summary

Claude Code matches its allow rules against every command in a call, so cd repo && rg foo, a pipeline into sed, awk, or xargs, and plain cp/mv were never rule-matched: cd, sed (without -n or -i), awk, xargs, cp, and mv had no allow entry. In auto mode the classifier then decided and sometimes prompted; in every other mode the call always prompted. That is where the remaining rg/grep/jq prompts came from after #163.

All six are contained by the sandbox under ADR-0034:

  • cd: the verification scope check still asks for a target outside the worktree and temp directories, and for a run-time target.
  • sed, awk: writes stay inside the worktree, where Git restores tracked files; sed -i was already allowed.
  • xargs: the hooks already unwrap it and judge the wrapped command, so xargs git add -A is still forbidden.
  • cp, mv: replace the -n-only forms; the sandbox confines writes, and a glob or variable argument still asks.

Closes #164

Verification

  • uv run --frozen pytest tests/agents: 1502 passed.
  • ruff check, ruff format --check, and dprint are clean; lefthook pre-commit and commitlint passed.
  • Live check after home-manager switch, in a new session: cd agents && rg -n foo lib and find . -name '*.py' | xargs grep -l foo should run without a prompt; cp *.md backup/ should ask.

🤖 Generated with Claude Code

Compound calls such as cd repo && rg foo were never rule-matched, so they reached the classifier.

All six are confined by the sandbox; cd stays under the scope check and xargs under the hooks.

Closes #164

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Copilot AI balanced review requested due to automatic review settings October 15, 2026 07:11

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@furedea
furedea merged commit ec68f18 into main Oct 15, 2026
11 checks passed
@furedea
furedea deleted the feat/allow-sandbox-contained-shell-helpers branch October 15, 2026 07:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow cd, sed, awk, xargs, cp, and mv as sandbox-contained commands

2 participants