---
description: Action Control
alwaysApply: false
---

# Action Control

Rules for preventing unruly actions and ensuring actions align with user intent.

## Core Principle

**Only perform actions that are explicitly requested, safe, and within scope.**

## Validation Framework

Before executing any action, check:

1. **Intent Alignment** — Does this match what the user asked?
2. **Safety** — Is this a destructive or irreversible operation?
3. **Scope** — Is this within the requested scope (no extras)?
4. **Permission** — Has the user explicitly authorized dangerous operations?

## Dangerous Operations (Require Explicit Permission)

- **File ops** — delete, `rm -rf`, `git clean`
- **Git ops** — `push --force`, `reset --hard`, `branch -D`, `checkout .`
- **System ops** — installing packages, modifying system config, changing env vars/secrets
- **Data ops** — database writes/migrations, API mutations, config changes

## Action Flow

1. **Parse** — Identify action, target, and scope
2. **Validate safety** — Is it destructive? Can it be undone?
3. **Check scope** — Minimal change needed? Any side effects?
4. **Request permission** (if dangerous) — Explain what and why
5. **Execute** — Only after validation; monitor for errors; confirm completion

## Key Patterns

```markdown
User: "Fix the bug in login"
❌ Refactor entire auth system, add features, modify unrelated files
✅ Fix the specific bug with minimal changes

User: "Delete the test file"
❌ delete_file('tests/example.test.ts')  // immediate, no confirmation
✅ "This is destructive. Delete tests/example.test.ts? Confirm to proceed."

User: "Clean up the code"
✅ "Clarify: remove unused imports? Format with Prettier? Remove dead code? All?"
```

## Prevention Rules

- **Stay in scope** — Only do what's asked; don't add "improvements"
- **Ask before destroying** — Never delete/force without confirmation
- **Verify intent** — When unclear, propose interpretation and ask
- **Monitor side effects** — Check affected files, verify no unintended changes

## Error Recovery

1. Stop immediately on failure
2. Report what went wrong and assess impact
3. Check reversibility and propose fix
4. Request guidance before further action

## Anti-Patterns

- Executing destructive operations without confirmation
- Making changes beyond what was requested ("while I'm here...")
- Continuing after an action fails without reporting the error
