Machine policy: connector notes
Read connector notes for machine policy: the managed OpenCode plugin, Claude Cowork, Copilot in VS Code, the Claude Code version floor and vendor limits.
This page adds the connector-specific parts of Machine policy. Read that page first for routes, files and ownership modes.
Managed OpenCode plugin
The standalone payload ships a managed OpenCode plugin at <InstallRoot>/share/opencode/index.js:
| OS | Plugin | Written by |
|---|---|---|
| Linux | /opt/defenseclaw/share/opencode/index.js | The lifecycle, with the deployment's files |
| macOS | /opt/cisco/defenseclaw/share/opencode/index.js | The lifecycle, with the deployment's files |
| Windows | C:\Program Files\Cisco\DefenseClaw\share\opencode\index.js | The guardian |
DefenseClaw adds the plugin's directory to the plugins list, or the compatible plugin list, of OpenCode's managed config, so it runs in every user's OpenCode and users cannot edit or delete it.
- What it runs. The plugin is the same file on every host and holds no credential. Each event runs the administrator-owned
defenseclaw-hookbeside it, which reaches the gateway the same way the other machine-policy hooks do and applies the foreign-plugin guard. - Outages. With the default fail mode
closedit blocks a tool call when the hook binary cannot run, answers with an error, or the gateway is unreachable. With the administrator'shook_fail_mode: open, a stopped gateway service depends onforeign_hooks. Withremove(the default),openapplies only on Linux and macOS, to an agent process with a current clean-session note, and every other call blocks. Withreportorallowit always applies. A restarting gateway, or one that gives no answer in time, blocks the call in every mode. See the gateway outage table. After uninstall it allows calls again. - When the route applies. Only while the file is administrator-owned (root on Linux and macOS; Administrators, LocalSystem or TrustedInstaller on Windows), no other user can change it, and OpenCode's managed config names it. Otherwise DefenseClaw keeps the per-user plugin and
policy showsays why. The payload installs the file even withownership: "off"; that alone does not change the route. - Drift.
verifyandpolicy showreport a plugin whose content differs from the installed release.ensure(Linux and macOS) or the next guardian pass (Windows) restores it. - Windows reparse points. OpenCode opens every module with the write-attributes right, so the plugin grants that right to Users. A standard account can then set a reparse point on the plugin and stop OpenCode loading it. The guardian watches the plugin's folder, restores it within about a second, and logs a tamper in
hook-guardian.log. After 12 restores in a minute it slows to one every 5 seconds. A read-only or hidden attribute does not stop the load, so the guardian leaves those alone. - Old per-user plugin. A per-user DefenseClaw plugin left from the per-user route counts as a foreign plugin once the managed plugin is in place; the guardian removes it with
foreign_hooks: remove(the default). - Unenrolled users. On Linux and macOS an unenrolled user's OpenCode calls are inspected (
unenrolled_users: inspect). On Windows each enrolled user gets a protected per-user runtime for OpenCode, and calls from a user without an OpenCode enrollment are blocked.
Claude Cowork
Claude Cowork runs its agent loop on the device, as the signed-in user, with the Claude Code engine that Claude Desktop bundles. That engine reads Claude Code machine policy, so DefenseClaw's Claude Code drop-in (90-defenseclaw.json) covers Cowork as well. There is nothing to configure for Cowork itself. On Linux, Cowork is Preview: Claude Desktop for Linux is a beta.
What Cowork does with DefenseClaw's hooks, what it blocks and what it does not, is on the Claude Cowork connector page.
Your own Cowork plugin hooks. managed_hooks_only for claudecode decides whether they run. DefenseClaw's own hooks run under both values. On Windows this behavior is Preview.
managed_hooks_only | Hooks in Cowork plugins (uploaded, marketplace and organization org-plugins/) |
|---|---|
enforce (default) | Do not run: allowManagedHooksOnly: true makes Claude Code run only the hooks in managed settings, in Cowork as in the terminal. The plugins' skills, commands and MCP servers are not affected |
preserve | Run too. A plugin hook can then change a tool call's input after DefenseClaw inspected it, and the foreign-hook guard does not read Cowork plugins |
To let your users' Cowork plugin hooks run, set preserve for Claude Code only, then apply the config (ensure on Linux and macOS, Setup /ensure on Windows):
enterprise:
machine_policy:
connectors:
claudecode:
managed_hooks_only: preserveThe engine build. Claude Desktop keeps that engine in the user's own data folder, under claude-code/<version>/. Each deployment has its own folder, and DefenseClaw looks in all of them:
| OS | Signed in to Claude | Third-party inference (Bedrock, Vertex AI, Foundry) |
|---|---|---|
| macOS | ~/Library/Application Support/Claude | ~/Library/Application Support/Claude-3p |
| Windows | %APPDATA%\Claude, or for the Microsoft Store (MSIX) app %LOCALAPPDATA%\Claude-Data\claude_<id> | %LOCALAPPDATA%\Claude-3p |
| Linux | ~/.config/Claude | ~/.config/Claude-3p |
DefenseClaw trusts the engine by its code signature, not by its folder, and in each data folder takes the newest build that verifies; the signature checks are listed under The engine build. Each data folder counts on its own, and the user's row follows the oldest admitted engine. On Windows, when more Claude-Data\claude_<id> folders exist than DefenseClaw reads (four), the installed MSIX package's folder is read first and the scan reports the app inventory as incomplete. On Windows an account that has only Claude Desktop is enrolled.
Status. status and verify print a cowork line and a cowork JSON member:
- whether DefenseClaw's side is
configured(claudecode enabled, its machine policy hooks in place, and the Claude Desktop surface not refused byenterprise.enrollment.unverified_versions: refuse), and the lock; - the hook calls that reported themselves as Cowork since the gateway started, and the last one per enrolled account, or
never. The hook names its own surface (any local process can send it), so this is not proof that the DefenseClaw hook ran in Cowork; - run as root (Linux, macOS) or elevated (Windows), each enrolled account's Claude Desktop data folders (
1pand3p), the newest engine build in each and its trust:trusted,untrusted,unsigned(every Linux build) ornot_found(JSONclaude_desktop). For examplecowork alice: Claude Desktop 3p (...), engine 2.1.317 trusted. It is read from disk, so no Cowork session has to be open, and the engine is never run. A Windows status run as LocalSystem (an MDM run) lists an account with no signed-in session asnot checked; accounts_truncatedwhen more accounts exist than are listed.
Account names are in this administrator view only; the forward schema keeps only the counts. On Linux and macOS these accounts have no enrollment row, because Claude Code is a machine-policy connector. The TUI shows only the gateway's Cowork event count on the Claude Code connector.
The Cowork VM sensor, which watches inside the Cowork VM, is not machine policy. It has its own settings, enterprise.cowork_vm_sensor. On Windows its two Claude Desktop values go into HKLM\SOFTWARE\Policies\Claude, the key that windows_wsl.claude_desktop_key governs.
Copilot in VS Code
Two keys, valid only under connectors.copilot, control VS Code's Copilot harnesses:
enterprise:
machine_policy:
connectors:
copilot:
harness_preference: sdk # or unmanaged
local_harness: govern # or retire| Key and value | What DefenseClaw does |
|---|---|
harness_preference: sdk (default) | Enables ChatEditorPreferCopilotHarness, so new editor chats use the SDK harness, which reads Copilot's policy.d |
harness_preference: unmanaged | Does not set that policy, and removes a value DefenseClaw set |
local_harness: govern (default) | Places a per-user Local hook file, ~/.copilot/hooks/defenseclaw-vscode.json. With managed_hooks_only: enforce it also places a per-user plugin, which it enables in Copilot's managed settings |
local_harness: retire | Places neither file and sets sandbox.enabled in Copilot's managed settings |
The Local harness lock. On Linux, DefenseClaw also sets allowManagedHooksOnly in /etc/github-copilot/managed-settings.json, but only once every enrolled user has the plugin and every VS Code found is 1.139.x. On macOS it reports the keys for you to deploy; on Windows it does not write the lock.
The harnesses, events and duplicate delivery are described in GitHub Copilot in VS Code.
Claude Code version floor
DefenseClaw sets Claude Code's managed requiredMinimumVersion to 2.1.154, the lowest version it has a verified hook contract for. That floor stops no Claude Code build today: Claude Code reads the setting only from 2.1.163, and every build below 2.1.154 is older than that, so it ignores the floor and starts. To keep older builds off a host, use application control (Known vendor limits, tracked in #920). A floor of 2.1.163 or later, such as one you set yourself, does stop builds from 2.1.163 that are below it.
DefenseClaw's value is in its own drop-in, 00-defenseclaw-version-floor.json, next to 90-defenseclaw.json.
On standalone Windows the floor follows the machine-wide hook drop-in. When every enrolled account runs Claude Code 2.1.219 or later, 90-defenseclaw.json uses the claudecode-hooks-v2 contract, which adds the DirectoryAdded event, and the floor rises to 2.1.219; enterprise policy show and verify name the reason. Claude Code 2.1.163 to 2.1.218 then refuses to start until it is updated. Claude Code 2.1.154 to 2.1.162 still starts and shows a Settings Warning that DirectoryAdded is an unknown hook event and was skipped. The rest of the file stays in effect, so DefenseClaw's hooks still block and audit; choose Continue and update that copy of Claude Code.
enterprise:
machine_policy:
connectors:
claudecode:
version_floor: enforce # enforce (default), report or "off"version_floor is set only under connectors.claudecode. Naming claudecode there makes the Linux and macOS lifecycle publish DefenseClaw's Claude Code machine policy.
version_floor | What DefenseClaw does |
|---|---|
enforce (default) | Writes the floor drop-in while no other source sets requiredMinimumVersion to a version, and removes it once one does |
report | Writes nothing; policy show reports that older builds can start |
off | Writes nothing and does not manage the setting |
- Your value wins. When
managed-settings.json, another drop-in,HKLM\SOFTWARE\Policies\ClaudeCode\Settingsor the macOS managed preferences setrequiredMinimumVersionto a version, DefenseClaw leaves that file alone and withdraws its own drop-in, even when the value is below 2.1.154.policy shownames the source. On Windows the guardian withdraws the drop-in on its next cycle; on Linux and macOS the next lifecycle run that applies changes (ensure,reconcileorrepair) does. Until then, a value inmanaged-settings.jsonor in a drop-in that sorts before00-defenseclaw-version-floor.jsonis overridden by DefenseClaw's drop-in;policy showandpolicy verifyreport that, and underownership: mergeverifyreports drift. - A file at the drop-in's name is yours unless DefenseClaw wrote it. The file counts as DefenseClaw's only while its ownership record names it and its hash matches. Any other file there (for example the
version-floorexport you deploy yourself) is never rewritten or removed, andpolicy showreports its value as the administrator's. If that file sets no version,policy verifyfails underenforceuntil you add the key or remove the file. - A value that is not a version does not count. Claude Code ignores it. In a file that merges before DefenseClaw's drop-in, DefenseClaw keeps its drop-in, whose later value applies. In one that merges after it, no floor applies and
policy verifyfails until you fix the value. - When it applies. Only in the standalone profile, while
claudecodeis enabled underguardrail.connectorsor named underenterprise.machine_policy.connectors, withownership: merge. To stop it, remove the name from both maps or setenabled: falseorownership: "off". A Windows config that namesclaudecodewrites the floor even when no Claude Code user is enrolled. Linux and macOS write it at install and at every lifecycle run that applies changes; on Windows the guardian writes it every cycle. Uninstall removes it. - Ownership.
mergewrites and repairs it.verify_onlyneither writes nor removes it: deploypolicy export --connector claudecode --format version-flooryourself.offremoves DefenseClaw's floor. - Coverage. With
version_floor: enforceandownership: merge, a floor that is missing or cannot apply is a conflict:policy showlists Claude Code as not covered andpolicy verifyexits 1. The hook drop-in stays in place and hook calls are still inspected. On Linux and macOS, when DefenseClaw's own drop-in is missing,statusandverifyalso warn withclaude_version_floor_missing,verifyfails, and the nextensure,repairorreconcilewrites it back. The guardian does not watch this drop-in. - Higher-precedence sources. Claude Code builds older than 2.1.242 ignore
"managedSourcesBehavior": "merge"and read only the higher-precedence source (HKLM\SOFTWARE\Policies\ClaudeCode\Settings, the macOS managed preferences) while one is in force. The floor in the managed settings files does not reach them, even when that source carries DefenseClaw's hooks. Add"requiredMinimumVersion": "2.1.154"to that source. Until thenpolicy showmarks the floornot appliedandpolicy verifyfails (a warning withhigher_precedence_sources: warn). - Limits. The check runs when a session starts; running sessions go on. Builds before 2.1.163 ignore the setting, and builds that do not read
managed-settings.dignore the drop-in altogether.
Known vendor limits
Two limits apply to every hook-based agent:
- A stopped pre-tool hook can let the tool run. Setup configures a 30-second
PreToolUsetimeout, but several agents treat a hook process failure or timeout as non-blocking. If the user stops their hook before it contacts the gateway, there is no request to deny and no pre-tool audit row; a laterPostToolUsecannot undo the command and may be absent. A request that reaches the gateway but loses its answer is recorded asblock/no_answer.statusandverifyreporthook_process_fail_openfor each affected enabled connector and setsecurity_complete: false;coverage_completestill means the hook registration is installed. To prevent this, use application control or EDR that stops standard users from signaling hook processes. Restart agents after hook registration changes. - Malformed hook input is refused while the hook runs. The gateway validates the whole JSON event before it selects a connector event. A wrong-type, missing or conflicting field, a truncated body or ambiguous non-tool JSON gets a 400 and a connector-hook audit rejection; the standalone hook turns that into a closed native failure. A pre-tool call with duplicate JSON keys, conflicting tool-input aliases or unreadable tool fields gets a native block with
HOOK-TOOL-CALL-UNPARSED. Oversized input is blocked by the hook itself. These checks need the hook process to run, so they do not close the limit above.
| Agent | Limit | What to do |
|---|---|---|
| Codex | A killed PreToolUse hook or a timeout is non-blocking, and Codex has no on-timeout deny setting (hook_process_fail_open) | Application control or EDR |
| Claude Code | A killed PreToolUse hook or a timeout is non-blocking (hook_process_fail_open). claude --bare and CLAUDE_CODE_SIMPLE=1 skip the managed SessionStart hook and may skip UserPromptSubmit; tool calls stay inspected, so prompt inspection is best effort | Application control or EDR |
| Claude Code before 2.1.163 | Does not read requiredMinimumVersion, so no floor stops it. Builds that read managed-settings.d still run DefenseClaw's hooks (with a Settings Warning about DirectoryAdded where the Windows drop-in uses the v2 contract) | Application control that allows only the versions you support |
Claude Code without managed-settings.d support (Linux and macOS) | Ignores both DefenseClaw drop-ins. A standard user can run one from a private npm --prefix install without a hook decision or audit. The enumerator reports copies it finds (below) | Allow only approved Claude Code versions at or above 2.1.154 (#920) |
| Copilot CLI | A timed-out preToolUse hook is non-blocking, including policy hooks; a later PermissionRequest hook may still deny, depending on the release (hook_process_fail_open). On Windows, Copilot also loads policy hooks from HKLM\Software\Policies\GitHub\Copilot, which run beside DefenseClaw's drop-in | Application control or EDR; re-check each Copilot release |
| Copilot CLI below 1.0.21 | Can skip machine policy and run tool calls with no audit record | Application control |
| OpenCode | The order in which OpenCode runs plugins is not a documented contract, so the foreign-hook guard stays on. On Windows, OpenCode uses %ProgramData%\opencode as the process environment names ProgramData, so a session started with another ProgramData runs without DefenseClaw's hooks. status and verify scan running OpenCode processes and mark coverage incomplete for a moved ProgramData, an OPENCODE_PURE or OPENCODE_TEST_MANAGED_CONFIG_DIR launch, or a launch environment they cannot read | Application control that prevents launches with a moved ProgramData |
| Cursor | Applies the enterprise hooks.json only on plans that support enterprise hooks | Confirm on a real client |
| Devin | A killed pre-tool hook is non-blocking (hook_process_fail_open) | Application control or EDR |
| Hermes | Hermes 0.21 and later support fail_closed: true on pre_tool_call, which Setup and the guardian write and verify requires; restart Hermes sessions to load a repaired registration. Hermes 0.19 and 0.20 can run a tool after a hook process failure, and 0.21 still treats a killed hook (non-2 exit, empty output) as no decision (hook_process_fail_open) | Application control or EDR |
| Kiro, Antigravity | Kiro CLI 2.x runs a tool after a slow pre-tool hook times out. Antigravity documents a hook timeout but no on-timeout deny setting (hook_process_fail_open) | Application control or EDR |
| OpenCode, Amp | Their pre-tool plugins block while loaded; the launch and plugin-load bypasses above and below still apply | See the rows above and below |
| Per-user connectors | Amp has no machine-wide plugin location. A changed HOME, USERPROFILE or XDG_CONFIG_HOME can move Amp, Devin, Antigravity or Hermes away from the config the guardian repairs; on Windows, redirected APPDATA (Devin) or LOCALAPPDATA (Hermes) does too. devin --config selects another file. Hermes --safe-mode or HERMES_SAFE_MODE skips its user hooks, and HERMES_HOME or HERMES_MANAGED_DIR can move them. Kiro CLI can select another agent (--agent), start a cloud session (--cloud), resume a session (--resume-id), or move its agent files (KIRO_HOME, KIRO_AGENT_CONFIG_DIR, KIRO_TEST_AGENTS_DIR) | status and verify inspect these launch variables and report bypasses as incomplete coverage; use application control where those launches must be prohibited |
More on the OpenCode and per-user scans:
OPENCODE_CONFIG_DIRadds another config directory and does not remove the managed plugin;OPENCODE_CONFIG_CONTENTandOPENCODE_DISABLE_DEFAULT_PLUGINSdo not remove it either.- The OpenCode observation is written to the gateway audit; Windows also records the coverage code in the enterprise event log and the process detail in its protected lifecycle log.
policy showdescribes the installed registration; it cannot prove how a running client was launched. - On Windows, the elevated CLI reads launch variables from the process and resolves its profile through the owner SID; a process it cannot read stays unverified.
- A session that ends before a process scan, or a value Hermes reads from a
.envfile after it starts, may not be visible to the scan.
Agent copies outside machine policy
For an enrolled account, the enumerator checks every five minutes for separate Claude Code, Codex and Copilot CLI copies:
- the per-user npm roots and the immediate child folders of the home;
- every installed Node of nvm, fnm, asdf, mise and pnpm (up to 64 per manager), and Volta's per-package images;
- Claude Code's local installer at
~/.claude/localand its native versions folder; - the machine npm prefixes (
/usr/local,/usr,/opt/homebrewandagent_prefixes; Node's own folder on Windows); - Homebrew cask releases on macOS, and WinGet installs on Windows.
A Claude Code npm copy counts whether it runs cli.js or the native bin/claude.exe. Each copy is identified by its real path, so a copy reached through a link is listed once. A copy in a location another account can change is listed as unverified whatever version it claims. A folder the account's own discovery cannot read, such as a macOS privacy-protected folder, is not inspected.
A runnable copy below a verified hook contract, or one whose version cannot be read, is listed by path in status and verify as not protected. Both completeness fields become false, and each finding goes to the managed audit. This is detection, not an execution block: an old Claude Code that ignores the managed drop-in can still run a tool call until it is removed or application control blocks it.
The enumerator publishes its protected unprotected-agents.json record even when it finds nothing. If the record is missing or more than 16 minutes old, status and verify report agent_install_scan_incomplete, set both completeness fields to false, and verify treats it as a scan-pending warning, not a failure. An unreadable record fails verify. On Windows a standard token cannot read the record, so status and verify ask for an elevated prompt.
- Manifest enrollment. With
enterprise.enrollment.mode: manifest, the enumerator scans the accounts of the enabled administrator-authored targets, including accounts outside the automatic filters, and no one else. A target it cannot inspect is reportedagent_install_scan_incomplete.exclude_usersandexempt_usersstill win. - Running processes (Linux and macOS).
statusandverifyidentify each running Claude Code from the executable the kernel recorded, not its process title. They read the release from the native installer'sversionsfolder, a Homebrew cask's version folder, or the npm package of the native binary. An older release, a copied, renamed or self-built binary, and a build replaced on disk while it runs are reported until that session restarts. A Node-hosted script is checked by its package version while its path is in the process arguments.
The scan cannot prove that every executable is approved. Deeper custom prefixes, links to unscanned locations, renamed or copied binaries, self-built clients, user-controlled version metadata and a launch between scans stay outside it. To require complete enforcement, restrict agents to approved builds and install paths with application control (WDAC or AppLocker on Windows, fapolicyd on Linux, Santa on macOS), and test the exact private-prefix launch, including package runners and user-writable prefixes. An allow rule for the Node executable alone does not stop it loading an unapproved @anthropic-ai/claude-code/cli.js. DefenseClaw does not install or configure those controls.
See Residual risks for the full list.
Machine policy
See how the standalone profile protects each AI agent with machine-wide policy files on Windows, Linux and macOS, and how to inspect and verify them.
Policy changes on a managed host
Learn what refuses a local policy change on a managed standalone host on Windows, Linux and macOS, what stays allowed, and how the environment is handled.