Skip to content

Commit df83ff5

Browse files
vincentkocsteipete
andauthored
fix(agents): apply tool policy to Anthropic native calls (#128805)
* fix(agents): enforce native policy in Anthropic SDK * fix(agents): enforce canonical native tool policies safely Co-authored-by: Vincent Koc <[email protected]> --------- Co-authored-by: Peter Steinberger <[email protected]>
1 parent b6df91f commit df83ff5

6 files changed

Lines changed: 578 additions & 14 deletions

File tree

‎docs/gateway/cli-backends.md‎

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -136,11 +136,14 @@ claude update
136136
The bundled `claude-cli` backend prefers Claude Code's native skill resolver. When the current skills snapshot has at least one selected skill with a materialized path, OpenClaw passes a temporary Claude Code plugin via `--plugin-dir` and omits the duplicate OpenClaw skills catalog from the appended system prompt. Without a materialized plugin skill, OpenClaw keeps the prompt catalog as a fallback. Skill env/API key overrides still apply to the child process environment for the run.
137137

138138
The Agent SDK always runs with Claude Code's default permission mode.
139-
OpenClaw's existing effective exec policy remains authoritative through SDK
140-
permission callbacks and a `PreToolUse` hook, including when user settings
141-
would otherwise preapprove a tool. Per-agent and session restrictions still
142-
override broader global policy. OpenClaw-owned MCP tools remain authorized by
143-
the Gateway rather than receiving a second Claude-native approval.
139+
OpenClaw's SDK permission callback and `PreToolUse` hook keep native tools under
140+
host control, including when user or enterprise settings would otherwise
141+
preapprove a call. Native requests pass through canonical `before_tool_call`
142+
policy before exec policy and approval, with native tool names and file
143+
arguments projected into their OpenClaw equivalents. Per-agent and session
144+
restrictions still override broader global policy. OpenClaw-owned MCP tools
145+
remain authorized by the Gateway rather than receiving duplicate native
146+
approval; other MCP tools stay host-permission controlled.
144147

145148
When the effective exec ask setting is `on-miss` or `always`, OpenClaw relays
146149
native or extension tool requests as interactive approvals to the session's

‎docs/providers/anthropic.md‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,9 +107,11 @@ OpenClaw release:
107107
OpenClaw detects the existing Claude CLI login. Normal agent turns use
108108
the official Agent SDK with the installed, authenticated Claude Code
109109
executable, including native-tool turns whose approvals remain under
110-
OpenClaw control. Imported native OAuth profiles reuse the verified
111-
Claude Code login; explicitly selected API-key or token credentials
112-
still use protected file-descriptor forwarding. Isolated side-question
110+
OpenClaw control. Schema-valid native calls pass through OpenClaw's
111+
canonical tool policy before native approval. Imported native OAuth
112+
profiles reuse the verified Claude Code login; explicitly selected
113+
API-key or token credentials still use protected file-descriptor
114+
forwarding. Isolated side-question
113115
completions and paired-node execution retain the supervised CLI path.
114116

115117
Consecutive agent turns reuse the same warm Agent SDK query and Claude

0 commit comments

Comments
 (0)