원클릭으로
safehouse-worktrees
// Use when starting feature work that needs isolation from the current workspace — sets up a secure safehouse with git worktrees for clean operational bases
// Use when starting feature work that needs isolation from the current workspace — sets up a secure safehouse with git worktrees for clean operational bases
Use when receiving code review feedback — processes orders with technical rigor, not blind obedience or performative agreement
Use when beginning a new heist — deploys associates to survey the target codebase, existing tests, dependencies, documentation, and the ledger to produce a reconnaissance dossier for the don's review
Use when the execution plan is approved and it is time for parallel execution — dispatches workers through crew leads to implement work packages with TDD enforcement, report collection, and escalation protocols
Use when starting any conversation — establishes how to find and use Gangsta skills, enforces the 1% invocation rule, maps platform tools, and routes the Don's intent through the Gangsta Agents Family hierarchy
Use when all territories report completion after the hit — handles integration, verification, consigliere final review, cleanup, and ledger updates to produce clean production-ready code
Use when the contract is signed and work packages need to be created — decomposes the contract into bite-sized tasks, sets up git isolation, allocates territories and token budgets, producing the execution plan
| name | safehouse-worktrees |
| description | Use when starting feature work that needs isolation from the current workspace — sets up a secure safehouse with git worktrees for clean operational bases |
Git worktrees create isolated operational bases sharing the same repository. Work on multiple branches simultaneously without compromising the main workspace.
Core principle: Systematic directory selection + safety verification = reliable isolation.
Announce at start: "Setting up a safehouse for isolated operations."
Follow this priority order:
# Check in priority order
ls -d .worktrees 2>/dev/null # Preferred (hidden)
ls -d worktrees 2>/dev/null # Alternative
If found: Use that directory. If both exist, .worktrees/ wins.
grep -i "worktree.*director" AGENTS.md 2>/dev/null
If preference specified: Use it without asking.
If no directory exists and no config preference:
No safehouse directory found. Where should I set up?
1. .worktrees/ (project-local, hidden)
2. ~/.config/gangsta/worktrees/<project-name>/ (global location)
Which would you prefer?
MUST verify directory is gitignored before creating safehouse:
# Check if directory is ignored (respects local, global, and system gitignore)
git check-ignore -q .worktrees 2>/dev/null || git check-ignore -q worktrees 2>/dev/null
If NOT ignored:
.gitignoreWhy critical: Prevents accidentally committing safehouse contents to repository.
No .gitignore verification needed — outside project entirely.
project=$(basename "$(git rev-parse --show-toplevel)")
# Determine full path
case $LOCATION in
.worktrees|worktrees)
path="$LOCATION/$BRANCH_NAME"
;;
~/.config/gangsta/worktrees/*)
path="~/.config/gangsta/worktrees/$project/$BRANCH_NAME"
;;
esac
# Create worktree with new branch
git worktree add "$path" -b "$BRANCH_NAME"
cd "$path"
Supply chain note: Package manager installs fetch untrusted third-party code. Where a lockfile exists, prefer lockfile-bound installs (
npm ciovernpm install,pip installwith hash checking, etc.) to reduce supply chain risk.
Auto-detect and run appropriate setup:
# Node.js
if [ -f package.json ]; then npm install; fi
# Rust
if [ -f Cargo.toml ]; then cargo build; fi
# Python
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
if [ -f pyproject.toml ]; then poetry install; fi
# Go
if [ -f go.mod ]; then go mod download; fi
Run tests to ensure safehouse starts clean:
# Use project-appropriate command
npm test / cargo test / pytest / go test ./...
If tests fail: Report failures, ask the Don whether to proceed or investigate.
If tests pass: Report ready.
Safehouse ready at <full-path>
Tests passing (<N> tests, 0 failures)
Ready for operations.
| Situation | Action |
|---|---|
.worktrees/ exists | Use it (verify ignored) |
worktrees/ exists | Use it (verify ignored) |
| Both exist | Use .worktrees/ |
| Neither exists | Check AGENTS.md → Ask the Don |
| Directory not ignored | Add to .gitignore + commit |
| Tests fail during baseline | Report failures + ask the Don |
| No package.json/Cargo.toml | Skip dependency install |
git check-ignore before creating project-local safehouseNever:
Always:
Called by:
Pairs with: