CCARF Practice Question
Correct answer: B
A: The prompt already fails 3% of the time. Strengthening it may reduce the failure rate but cannot eliminate it. Destructive operations require 100% prevention, which only deterministic enforcement can guarantee.
B: PreToolUse hooks intercept tool calls before execution. A hook can pattern-match against destructive commands like 'rm -rf' and validate that file paths fall within the project directory, blocking any violation with 100% reliability. This is deterministic enforcement for a safety-critical requirement.
C: PostToolUse hooks run after execution. By the time a PostToolUse hook detects 'rm -rf', the files are already deleted. Destructive commands cannot be reliably rolled back. Prevention via PreToolUse is required, not post- execution detection.
D: Removing shell execution eliminates the agent's ability to run any commands, including legitimate ones needed for its development workflow. The correct approach is surgical — block specific dangerous patterns while allowing legitimate usage.