AI Assistant Directory Safety Protocol
AI assistants (including GitHub Copilot) frequently lose track of their working directory when using terminal commands, leading to:
- Commands executed in wrong directories
- Build artifacts created in incorrect locations
- Failed operations due to missing context
- Potential data corruption or misplaced files
Mandatory Safety Protocol
Section titled “Mandatory Safety Protocol”Every AI assistant session MUST follow this protocol for ALL terminal operations:
1. Always Verify Location First
Section titled “1. Always Verify Location First”pwd && echo "=== CURRENT LOCATION VERIFIED ==="2. State Intentions Explicitly
Section titled “2. State Intentions Explicitly”Before any terminal command, explicitly state:
- Need to be at: [target directory]
- Current status: [what you know about current location]
- Action: [what you’re about to do]
3. Use Absolute Paths for Navigation
Section titled “3. Use Absolute Paths for Navigation”# BAD - relies on assumptionscd packages/ui && yarn build
# GOOD - explicit absolute navigationcd /Users/work-station/company/cloudalt-frontend/packages/ui && yarn build4. Return to Workspace Root After Operations
Section titled “4. Return to Workspace Root After Operations”cd /Users/work-station/company/cloudalt-frontend && pwd && echo "=== BACK AT WORKSPACE ROOT ==="5. Combine Verification with Commands
Section titled “5. Combine Verification with Commands”# Pattern: verify → navigate → confirm → executepwd && echo "=== VERIFYING LOCATION ===" && cd /path/to/target && pwd && echo "=== CONFIRMED LOCATION ===" && [command]Example Safe Command Pattern
Section titled “Example Safe Command Pattern”# Step 1: State intentionecho "Need to build UI package - navigating from workspace root"
# Step 2: Safe navigation with verificationpwd && echo "=== STARTING FROM ===" && cd /Users/work-station/company/cloudalt-frontend/packages/ui && pwd && echo "=== NOW IN UI PACKAGE ===" && yarn build
# Step 3: Return to rootcd /Users/work-station/company/cloudalt-frontend && pwd && echo "=== BACK AT WORKSPACE ROOT ==="Critical Rules
Section titled “Critical Rules”- NEVER assume where you are
- ALWAYS verify with
pwdbefore operations - ALWAYS use absolute paths for directory changes
- ALWAYS return to workspace root after subdirectory work
- ALWAYS state your intentions before terminal commands
Enforcement
Section titled “Enforcement”- Every new AI chat session MUST implement this protocol
- No exceptions for “simple” or “quick” operations
- Protocol must be followed even for read-only operations
This is a systematic workaround for a fundamental GitHub Copilot limitation that should be fixed at the platform level.