Windows and WSL2
What runs natively on Windows, and what goes through WSL2:
| Component | Native Windows | Through WSL2 |
|---|---|---|
| Python SDK and framework adapters | Supported | Supported (it is Linux) |
TypeScript SDK (@yilabs/guard) | Supported; argument_path_under rules follow Windows paths from npm 0.3.1 | Supported |
Command hook preworld-guard-hook (Claude Code, Codex) | Supported from SDK 0.12.0 | Supported |
| MCP proxy | Supported without --sandbox; upstream OAuth (mcp-auth) is not | Supported, 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 here | Supported, installed and checked as on Linux |
| Self-hosted control plane | Not supported | Use 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 2in 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, unlessXDG_CACHE_HOME,XDG_CONFIG_HOME,PREWORLD_GUARD_CACHEorPREWORLD_GUARD_APPROVAL_PRINCIPAL_FILEsay 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 see | Cause | Fix |
|---|---|---|
GUARD_HOOK_MISCONFIGURED | A variable is missing, or the credential file is a link, a directory or not readable | Set the variables; point PREWORLD_GUARD_TOKEN_FILE at a regular file in your profile |
GUARD_UNAVAILABLE on every call | No policy cache yet and the control plane can't be reached, or the credential was revoked | Run 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 Windows | Run the agent and the MCP upstreams inside WSL2 |
| "OAuth upstreams of the MCP proxy are not supported on native Windows" | An MCP upstream with oauth | Run that proxy inside WSL2 |