safehouse-worktrees
Skill85 starsChanged 20 days agoMITView on GitHub
Use when starting feature work that needs isolation from the current workspace — sets up a secure safehouse with git worktrees for clean operational bases
- Installs packages
In this repository20 other files it gives its agents.
- AGENTS.mdAGENTS.md
- rules/AGENTS.mdAGENTS.md
- audit-reviewSkill
- drill-tddSkill
- exit-strategySkill
- interrogation-debuggingSkill
- launderingSkill
- omertaSkill
- receiving-ordersSkill
- reconnaissanceSkill
- resource-developmentSkill
- sweep-verificationSkill
- the-capoSkill
- the-consigliereSkill
- the-grillingSkill
- the-hitSkill
- the-ledgerSkill
- the-sit-downSkill
- the-underbossSkill
- using-gangstaSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
13 rules. About 0 are common, 11 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈11
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 18
Follow this priority order:
- Very specific: line 28
If found: Use that directory. If both exist, .worktrees/ wins.
- Distinctive: line 36
If preference specified: Use it without asking.
- Distinctive: line 40
If no directory exists and no config preference:
- Very specific: line 63
Add appropriate line to .gitignore
- Distinctive: line 64
Commit the change immediately
- Distinctive: line 122
Run tests to ensure safehouse starts clean:
- Distinctive: line 157
Fix: Always use git check-ignore before creating project-local safehouse
- Distinctive: line 161
Fix: Follow priority: existing > config > ask
- Distinctive: line 174
Create safehouse without verifying it's ignored (project-local)
- Distinctive: line 180
Follow directory priority: existing > config > ask
- Distinctive: line 181
Verify directory is ignored for project-local
- Distinctive: line 183
Verify clean test baseline
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
The Safehouse: Git Worktrees
Overview
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."
Directory Selection Process
Follow this priority order:
1. Check Existing Safehouses
# Check in priority order
ls -d .worktrees 2>/dev/null # Preferred (hidden)
ls -d worktrees 2>/dev/null # AlternativeIf found: Use that directory. If both exist, .worktrees/ wins.
2. Check Project Config
grep -i "worktree.*director" AGENTS.md 2>/dev/nullIf preference specified: Use it without asking.
3. Ask the Don
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?Safety Verification
For Project-Local Directories (.worktrees or worktrees)
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/nullIf NOT ignored:
- Add appropriate line to
.gitignore - Commit the change immediately
- Proceed with safehouse creation
Why critical: Prevents accidentally committing safehouse contents to repository.
For Global Directory (~/.config/gangsta/worktrees)
No .gitignore verification needed — outside project entirely.
Creation Steps
1. Detect Project Name
project=$(basename "$(git rev-parse --show-toplevel)")2. Create Safehouse
# 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"3. Run Project Setup
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; fi4. Verify Clean Baseline
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.
5. Report Location
Safehouse ready at <full-path>
Tests passing (<N> tests, 0 failures)
Ready for operations.Quick Reference
| 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 |
Common Mistakes
Skipping ignore verification
- Problem: Safehouse contents get tracked, pollute git status
- Fix: Always use
git check-ignorebefore creating project-local safehouse
Assuming directory location
- Problem: Creates inconsistency, violates project conventions
- Fix: Follow priority: existing > config > ask
Proceeding with failing tests
- Problem: Can't distinguish new bugs from pre-existing issues
- Fix: Report failures, get explicit permission from the Don
Hardcoding setup commands
- Problem: Breaks on projects using different tools
- Fix: Auto-detect from project files
Red Flags
Never:
- Create safehouse without verifying it's ignored (project-local)
- Skip baseline test verification
- Proceed with failing tests without asking the Don
- Assume directory location when ambiguous
Always:
- Follow directory priority: existing > config > ask
- Verify directory is ignored for project-local
- Auto-detect and run project setup
- Verify clean test baseline
Integration
Called by:
- Resource Development — When isolation is needed for implementation
- Any skill needing an isolated workspace
Pairs with:
- gangsta:exit-strategy — Cleans up the safehouse when the operation is complete
Omerta Compliance
- Rule of Availability: Safehouse location reported and checkpointed
- Rule of Truth: Baseline test results are actual output, not claims
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

