src/claude/skills/run-in/SKILL.md
Run a command in a target directory without touching the parent shell's CWD. Use any time you would write "cd foo && bar" — that pattern is blocked by the block-compound-bash hookify rule.
npx skillsauth add the-agency-ai/the-agency src/claude/skills/run-inInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Run a command in a target directory via a subshell. The parent shell's CWD is never touched. Exit code is propagated. Standard Agency telemetry.
cd foo && bar && cd - — don't. Use run-in.agency verify on
a downstream installation).run-in <target-dir> -- <command> [args...]
The -- separator is required and distinguishes the target directory from
the command and its argv.
# Run a command on another repo without leaking CWD
./agency/tools/run-in ~/code/presence-detect -- ./agency/tools/agency verify
# Run a git command in a worktree from your captain shell
./agency/tools/run-in .claude/worktrees/devex -- git status
# Run a test suite in a sandbox dir
./agency/tools/run-in "$BATS_TEST_TMPDIR/mock" -- bats mock.bats
# ❌ BLOCKED by hookify.block-compound-bash
cd ~/code/presence-detect && agency verify
# ❌ BLOCKED (parent shell CWD leaks)
cd .claude/worktrees/devex && git status && cd -
# ✅ Use run-in instead
./agency/tools/run-in ~/code/presence-detect -- agency verify
./agency/tools/run-in .claude/worktrees/devex -- git status
Agent identity resolution uses the current working directory to determine
which agent is running (via agent-identity). If a worktree agent cds to
the main checkout and forgets to cd -, subsequent commands resolve the
wrong identity, handoffs write to the wrong file, and dispatches go to the
wrong agent. run-in runs the command in a subshell — the parent shell's
CWD is untouchable by construction, so identity resolution stays correct.
agency/hookify/hookify.block-compound-bash.mdagency/tools/run-inOFFENDERS WILL BE FED TO THE — CUTE — ATTACK KITTENS!
business
Sync worktree with master — merge, copy settings, run sandbox-sync, report changes
tools
List all git worktrees with status info (branch, clean/dirty, deps)
tools
Remove a git worktree and optionally delete its branch
development
Create a new git worktree with dedicated branch and bootstrapped dev environment