cursor-destructive-shell-guard

Block critical destructive shell commands in Cursor.

hook PreToolUse cursor mode: enforce

Block critical destructive shell commands in Cursor.

FieldValue
idcursor-destructive-shell-guard
status_messageChecking shell safety
modeenforce
logical_eventPreToolUse
matcherBash|bash|run_shell_command|shell|terminal
commandpython3 {repo_root}/hooks/wagents-hook.py cursor-destructive-shell-guard --harness {harness}
timeout5
harnesses["cursor"]
Full hook config + command reference
config/hook-registry.json (entry)
{
"id": "cursor-destructive-shell-guard",
"description": "Block critical destructive shell commands in Cursor.",
"status_message": "Checking shell safety",
"mode": "enforce",
"logical_event": "PreToolUse",
"matcher": "Bash|bash|run_shell_command|shell|terminal",
"command": "python3 {repo_root}/hooks/wagents-hook.py cursor-destructive-shell-guard --harness {harness}",
"timeout": 5,
"harnesses": [
"cursor"
]
}
hooks/wagents-hook.py (policy)
def _policy_codex_destructive_shell_guard(payload: NormalizedPayload) -> int:
if _tool_name(payload) not in SHELL_TOOL_NAMES and not payload.command:
return 0
reason = _destructive_shell_reason(payload.command)
if reason:
return _deny(payload, reason, policy_id="cursor-destructive-shell-guard")
return 0

Command: python3 .../wagents-hook.py cursor-destructive-shell-guard --harness cursor


View source on GitHub