# Priority system for policy rules:
# - Higher priority numbers win over lower priority numbers
# - When multiple rules match, the highest priority rule is applied
# - Rules are evaluated in order of priority (highest first)
#
# Priority bands (tiers):
# - Default policies (TOML): 1 + priority/1000 (e.g., priority 100 → 1.100)
# - Extension policies (TOML): 2 + priority/1000 (e.g., priority 100 → 2.100)
# - Workspace policies (TOML): 3 + priority/1000 (e.g., priority 100 → 3.100)
# - User policies (TOML): 4 + priority/1000 (e.g., priority 100 → 4.100)
# - Admin policies (TOML): 5 + priority/1000 (e.g., priority 100 → 5.100)
#
# This ensures Admin > User > Workspace > Extension > Default hierarchy is always preserved,
# while allowing user-specified priorities to work within each tier.
#
# Settings-based and dynamic rules (all in user tier 4.x):
#   4.95: Tools that the user has selected as "Always Allow" in the interactive UI
#   4.9:  MCP servers excluded list (security: persistent server blocks)
#   4.4:  Command line flag --exclude-tools (explicit temporary blocks)
#   4.3:  Command line flag --allowed-tools (explicit temporary allows)
#   4.2:  MCP servers with trust=true (persistent trusted servers)
#   4.1:  MCP servers allowed list (persistent general server allows)
#
# TOML policy priorities (before transformation):
#   10: Write tools default to ASK_USER (becomes 1.010 in default tier)
#   15: Auto-edit tool override (becomes 1.015 in default tier)
#   50: Read-only tools (becomes 1.050 in default tier)
#   998: YOLO mode allow-all (becomes 1.998 in default tier)
#   999: Ask-user tool (becomes 1.999 in default tier)

# Ask-user tool always requires user interaction, even in YOLO mode.
# This ensures the model can gather user preferences/decisions when needed.
# Note: In non-interactive mode, this decision is converted to DENY by the policy engine.
[[rule]]
toolName = "ask_user"
decision = "ask_user"
priority = 999
modes = ["yolo"]

# Plan mode transitions are blocked in YOLO mode to maintain state consistency
# and because planning currently requires human interaction (plan approval),
# which conflicts with YOLO's autonomous nature.
[[rule]]
toolName = ["enter_plan_mode", "exit_plan_mode"]
decision = "deny"
priority = 999
modes = ["yolo"]

# Allow everything else in YOLO mode
[[rule]]
decision = "allow"
priority = 998
modes = ["yolo"]
allow_redirection = true
