1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
// Source: ~/claudecode/openclaudecode/src/utils/permissions/classifierDecision.ts
#![allow(dead_code)]
//! Tools that are safe and don't need any classifier checking.
//! Used by the auto mode classifier to skip unnecessary API calls.
use lazy_static::lazy_static;
use std::collections::HashSet;
lazy_static! {
/// Tools that are safe and don't need any classifier checking.
/// Does NOT include write/edit tools — those are handled by the
/// accept_edits fast path (allowed in cwd, classified outside cwd).
static ref SAFE_YOLO_ALLOWLISTED_TOOLS: HashSet<&'static str> = {
let mut set = HashSet::new();
// Read-only file operations
set.insert("Read");
// Search / read-only
set.insert("Grep");
set.insert("Glob");
set.insert("LSP");
set.insert("ToolSearch");
set.insert("ListMcpResources");
set.insert("ReadMcpResource");
// Task management (metadata only)
set.insert("TodoWrite");
set.insert("TaskCreate");
set.insert("TaskGet");
set.insert("TaskUpdate");
set.insert("TaskList");
set.insert("TaskStop");
set.insert("TaskOutput");
// Plan mode / UI
set.insert("AskUserQuestion");
set.insert("EnterPlanMode");
set.insert("ExitPlanMode");
// Swarm coordination
set.insert("TeamCreate");
set.insert("TeamDelete");
set.insert("SendMessage");
// Workflow orchestration — subagents go through can_use_tool individually
// set.insert("Workflow"); // conditionally added
// Misc safe
set.insert("Sleep");
// Ant-only safe tools (conditionally added based on feature flags)
// set.insert("TerminalCapture");
// set.insert("OverflowTest");
// set.insert("VerifyPlanExecution");
// Internal classifier tool
set.insert("classify_result");
set
};
}
/// Returns whether a tool name is on the auto mode allowlist.
pub fn is_auto_mode_allowlisted_tool(tool_name: &str) -> bool {
SAFE_YOLO_ALLOWLISTED_TOOLS.contains(tool_name)
}