Cwd safety

From jleechanorg/claude-commands · View interactive version

Cwd safety is an AI agent skill from the GitHub repository jleechanorg/claude-commands. Use BEFORE `mv`/`rm -rf` on any directory. Verifies pwd does not match target; session cwd cannot recover once its directory is gone.

How to use this skill

Skill file

Directory replacement safety — never move your own cwd

Before mv or rm -rf on any directory, run pwd and verify it does not match the target path. The Bash tool's cwd persists across all calls in a session — moving your own cwd breaks every subsequent command with "path does not exist."

Protocol for replacing the working directory (e.g. recloning ~/.hermes/):

  1. Do NOT use the Bash tool for this operation at all
  2. Give the user all commands as ! <cmd> blocks to run in their terminal
  3. The session cwd cannot recover once its directory is gone — hand off immediately

Broken cwd recovery: If Bash commands start failing with "path does not exist" after a directory move, the shell cwd is gone. Stop retrying. Instruct the user to run remaining steps via ! <cmd> in the prompt. Do not attempt further Bash tool calls.

Destructive-path guard & `cc-safety-net` (`standard`) idioms

Canonical rule: ~/.codex/AGENTS.md § "Destructive-path guard". Never aim rm -r, rsync --delete*/--del, find -delete, or mv onto an unvalidated computed path:

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.