#[non_exhaustive]pub struct PolicyHelper {
pub path: Option<String>,
pub timeout_ms: Option<u64>,
pub refresh_interval_ms: Option<u64>,
pub extra: Extra,
}Expand description
policyHelper: a program that computes managed settings.
Run an executable you deploy that computes managed settings at startup, so you can derive policy from device posture, identity, or a remote service instead of a static file. Claude Code runs the helper before it accepts the first prompt and treats the settings it emits as the managed settings for the session.
Docs: policyHelper.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.path: Option<String>Name the helper executable Claude Code runs. For what happens when the path breaks the rules below, see Helper failures.
- Values: string, an absolute path in normalized form, without
.or..segments; on Windows, a drive-letter or UNC path that ends in.exe - Default: none; required when
policyHelperis set - Scope: managed. Read from the macOS plist, the Windows HKLM registry, or the managed settings file, wherever policyhelper is read.
Docs: path.
timeout_ms: Option<u64>Set how long Claude Code waits for the helper before treating the run as failed. A timed-out run fails the same way as a non-zero exit, so at startup Claude Code refuses to start.
- Values: integer, milliseconds, minimum
1000 - Default:
10000 - Scope: managed. Read from the macOS plist, the Windows HKLM registry, or the managed settings file, wherever policyhelper is read.
Docs: timeoutMs.
refresh_interval_ms: Option<u64>Have Claude Code re-run the helper in the background on an interval so policy changes reach a running session. When a refresh succeeds, its output replaces the previous managed settings without a restart; when a refresh fails, Claude Code keeps the policy it already has.
- Values: integer, milliseconds:
0to disable refresh, otherwise at least60000 - Default: unset, so Claude Code runs the helper once at startup
- Scope: managed. Read from the macOS plist, the Windows HKLM registry, or the managed settings file, wherever policyhelper is read.
Docs: refreshIntervalMs.
extra: ExtraKeys Claude Code accepts here that this crate doesn’t model (newer or undocumented ones), kept as written so the document round-trips.