Skip to content

Windows and WSL2 ​

What runs natively on Windows, and what goes through WSL2:

ComponentNative WindowsThrough WSL2
Python SDK and framework adaptersSupportedSupported (it is Linux)
TypeScript SDK (@yilabs/guard)Supported; argument_path_under rules follow Windows paths from npm 0.3.1Supported
Command hook preworld-guard-hook (Claude Code, Codex)Supported from SDK 0.12.0Supported
MCP proxySupported without --sandbox; upstream OAuth (mcp-auth) is notSupported, with --sandbox and OAuth
srt sandbox (sandbox run, mcp-proxy --sandbox)Not available: srt supports macOS and Linux only, and Guard refuses it on Windows with a message pointing hereSupported, installed and checked as on Linux
Self-hosted control planeNot supportedUse Linux or the Docker image

Windows support is integration-tested only: a windows-latest CI job exists for the SDK, the hook, the MCP proxy and the TypeScript SDK, and it hasn't run yet. No end-to-end acceptance on a real Windows machine has been recorded.

The command hook on Windows ​

  • Claude Code runs hook commands with Git Bash, or PowerShell when Git Bash isn't installed. The || exit 2 in the settings needs Git Bash; keep "onFailure": "block" so that a hook that fails or times out blocks the call with either shell.
  • The credential file is checked without POSIX modes: it must be a regular file, not a symlink, junction or other reparse point, and the handle Guard opens must be that same file. Keep it in your profile, for example %USERPROFILE%\.config\yi-guard\guard-token, where only you and administrators can read it.
  • The cache, outbox and pending calls go to %LOCALAPPDATA%\preworld-guard\hook\, the approval principal to %APPDATA%\preworld-guard\approval-principal.json, unless XDG_CACHE_HOME, XDG_CONFIG_HOME, PREWORLD_GUARD_CACHE or PREWORLD_GUARD_APPROVAL_PRINCIPAL_FILE say otherwise.
  • The background sync runs detached from Claude Code (its own process group, no console window).
  • Claude Code's own sandbox doesn't run on native Windows either: commands run unsandboxed there. For an execution boundary, run Claude Code and Guard inside WSL2. A POC needs that sandbox (coding agents in a POC), so a Windows POC runs inside WSL2.

Running inside WSL2 ​

Install everything inside the WSL2 distribution (Ubuntu 24.04 is what Guard's Linux checks use): Python and the SDK, Node and srt, and the agent itself. Paths are Linux paths there (/home/<you>/...); a Windows path such as C:\Users\... appears as /mnt/c/Users/.... Write policies with the paths the agent will really use inside WSL2. Then follow the Linux steps of the sandbox guide.

Diagnosing ​

What you seeCauseFix
GUARD_HOOK_MISCONFIGUREDA variable is missing, or the credential file is a link, a directory or not readableSet the variables; point PREWORLD_GUARD_TOKEN_FILE at a regular file in your profile
GUARD_UNAVAILABLE on every callNo policy cache yet and the control plane can't be reached, or the credential was revokedRun preworld-guard-hook sync and preworld-guard-hook status with the same environment
"The srt sandbox is not available on native Windows"srt requested on WindowsRun the agent and the MCP upstreams inside WSL2
"OAuth upstreams of the MCP proxy are not supported on native Windows"An MCP upstream with oauthRun that proxy inside WSL2