A sandboxed AI workspace running Claude Code on Windows. One script to install, PowerShell commands to control it.
graph TB
subgraph win [Your Windows PC]
terminal[Windows Terminal]
workspace["%USERPROFILE%\claudecode-workspace\ Your files live here"]
explorer[Windows Explorer]
end
subgraph wsl [Sandbox WSL2 Distro - Ubuntu]
claude[Claude Code AI assistant]
sandbox[Filesystem sandbox]
end
terminal -->|connects to| claude
sandbox -->|shared folders| workspace
explorer -->|browse files| workspace
The key idea: Your AI runs in a sandbox (a mini Linux computer inside your Windows PC). Your files stay on your Windows machine in your user profile at %USERPROFILE%\claudecode-workspace\ (e.g., C:\Users\YourName\claudecode-workspace\). The AI can read and write to those files, but it can't touch anything else on your PC.
- Windows 10 (build 19041 or later) or Windows 11
- WSL2 enabled (the installer will enable it if needed)
- An Anthropic account (free to create)
- About 10 minutes for the first install
Open PowerShell as Administrator (right-click the Start button, choose "Terminal (Admin)" or "PowerShell (Admin)") and paste these three lines:
git clone https://github.com/jaredstanko/claudecode-wsl2.git
cd claudecode-wsl2
powershell -ExecutionPolicy Bypass -File install.ps1The installer will download and set up everything automatically. You'll see a lot of output scrolling by -- ignore it all until you see the final instructions.
Note: If WSL2 wasn't already enabled, the installer will enable it and ask you to restart your PC. After restarting, run
install.ps1again and it will pick up where it left off.
When the install finishes, open Windows Terminal and run:
.\scripts\launch.ps1A new tab will open connected to your AI workspace.
Claude Code will ask you to sign in. It opens a browser -- log in with your Anthropic account.
When it asks "Do you trust /home/claude/.claude?" say yes.
Look for the ClaudeCode-Status icon in your system tray (bottom right, near the clock). From now on, just click New Claude Code Session in the tray menu, or run .\scripts\launch.ps1 in PowerShell.
- Sandboxed AI -- Claude Code runs inside an isolated WSL2 distro, not directly on your Windows machine
- System tray app -- start sessions, stop the distro, open the web portal from one icon
- Session resume -- pick up previous conversations where you left off
- Shared folders --
%USERPROFILE%\claudecode-workspace\on Windows is shared with the AI - Health check -- run
doctor.ps1or use the tray menu to check system health - Audio -- WSLg passthrough on Windows 11 (automatic, no config needed)
After install, ClaudeCode-Status lives in your system tray (bottom right, near the clock). It shows a small icon with a colored dot (green = running, red = stopped).
ClaudeCode-Status tray menu:
Distro: Running
Start Distro / Stop Distro
------------------
New Claude Code Session <- opens a new AI workspace
Resume Session <- pick up where you left off
------------------
Open Portal <- opens the web portal
Open a Terminal <- plain shell (no AI)
------------------
Health Check <- runs doctor.ps1
Launch at Login
Quit ClaudeCode-Status
The tray app is compiled from C# source at install time using the .NET Framework compiler (csc.exe) that ships with every Windows 10/11 machine. No build tools or SDKs needed.
Your Windows PC and the AI share files through %USERPROFILE%\claudecode-workspace\:
%USERPROFILE%\claudecode-workspace\
exchange\ Drop files here -- the AI can read them
work\ AI outputs and projects
data\ Datasets and databases
portal\ Web portal content
upstream\ Reference repos
AI settings and memory live inside the WSL2 distro at /home/claude/.claude (on the fast ext4 filesystem). Your workspace files live on Windows. You can browse them in Explorer like any other folder on your PC.
The quickest way to get files into the distro is the exchange\ folder -- just drop files there.
To give the AI permanent access to a project folder on your Windows machine:
.\scripts\mount.ps1 C:\Projects\my-repoThis adds the folder to the distro's mount table and restarts the distro briefly (~2 seconds). Your directory then appears at /home/claude/my-repo inside the distro with live two-way access.
.\scripts\mount.ps1 -List # See what's shared
.\scripts\mount.ps1 C:\Projects\my-repo -WslMountPath /home/claude/code # Choose where it appearsTo copy individual files in or out, just use the shared claudecode-workspace folder. Drop files into %USERPROFILE%\claudecode-workspace\exchange\ on Windows and they appear at /home/claude/exchange/ inside the distro (and vice versa). There's a "Claude Code Workspace" shortcut on your Desktop for quick access.
You can also copy from the Windows side using the \\wsl$\ path:
# Copy a file from the distro to your Desktop
copy \\wsl$\claudecode\home\claude\work\output.pdf $env:USERPROFILE\Desktop\By default, WSL2 mounts the Windows C: drive at /mnt/c/ and allows running Windows executables from Linux. This project blocks both with three layers:
Layer 1: Disable automount (/etc/wsl.conf)
[automount]
enabled=falseWindows drives are never mounted. Claude Code cannot see your files.
Layer 2: Disable interop (/etc/wsl.conf)
[interop]
enabled=false
appendWindowsPath=falseWindows executables (like cmd.exe, powershell.exe) cannot be called from inside the sandbox.
Layer 3: Claude Code sandbox (~/.claude/settings.json)
{
"permissions": { "deny": ["Read(//mnt/**)", "Edit(//mnt/**)"] },
"sandbox": {
"enabled": true,
"filesystem": {
"allowWrite": ["~", "//tmp"],
"denyRead": ["//mnt"],
"denyWrite": ["//mnt"]
}
}
}Even if the other layers were bypassed, Claude Code's own sandbox rules deny access to /mnt/.
Note: All three layers live inside the VM. An agent with root shell access could theoretically modify these configs. These are defense-in-depth measures against accidental access, not a hard boundary against a compromised agent.
Everything below is for power users who want to customize or troubleshoot.
.\install.ps1 # Normal install
.\install.ps1 -Name v2 # Parallel install as a separate instance
.\install.ps1 -Name v2 -Port 8082 # Parallel install with specific portal portUse -Name to run multiple instances side by side. Each gets its own WSL2 distro, workspace, and portal port:
.\install.ps1 -Name v2
# Creates:
# Distro: claudecode-v2
# Workspace: %USERPROFILE%\claudecode-workspace-v2\
# Portal: http://localhost:8081 (auto-assigned)All scripts accept -Name to target a specific instance:
.\scripts\launch.ps1 -Name v2
.\scripts\verify.ps1 -Name v2
.\scripts\upgrade.ps1 -Name v2
.\scripts\uninstall.ps1 -Name v2.\scripts\launch.ps1 # New Claude Code session
.\scripts\launch.ps1 -Resume # Resume a previous session
.\scripts\launch.ps1 -Shell # Plain shell in the distro (no AI).\scripts\doctor.ps1 # Full diagnostic -- checks WSL2, distro, network,
# disk, services, and reports PASS/WARN/FAIL.\scripts\verify.ps1 # Check system health (PASS/FAIL for each component)cd claudecode-wsl2
git pull
.\scripts\upgrade.ps1Your workspace, authentication, and sessions are preserved.
.\scripts\backup-restore.ps1 backup # Back up distro + workspace
.\scripts\backup-restore.ps1 restore # Restore from a backup.\scripts\uninstall.ps1Removes the WSL2 distro and launch scripts. Asks before deleting workspace data.
| Setting | Default |
|---|---|
| Runtime | WSL2 (Hyper-V backed) |
| OS | Ubuntu 24.04 x86_64 |
| CPUs | 4 |
| Memory | 4 GB |
| Disk | 50 GB (virtual hard disk) |
| Audio | WSLg (Win 11, automatic) |
| Display | WSLg Wayland/X11 (Win 11 only) |
To resize, create or edit %UserProfile%\.wslconfig:
[wsl2]
processors=6
memory=6GB
swap=8GBThen restart the distro:
wsl.exe --shutdown
.\scripts\launch.ps1Audio works automatically via WSLg. No configuration needed.
# Inside the distro:
aplay -l
speaker-test -t sine -f 440 -l 1 -p 2Audio passthrough is not available on Windows 10 (requires WSLg on Windows 11). All text features work fully without audio.
Install fails at "Importing distro" -- Run wsl.exe --unregister claudecode then .\install.ps1 again.
WSL2 not available -- Make sure virtualization is enabled in your BIOS/UEFI settings. Run wsl.exe --install from an admin PowerShell to enable WSL2.
No audio -- On Windows 11, audio uses WSLg automatically. Run wsl.exe -d claudecode -- pactl info to check PulseAudio. If it fails, restart WSL with wsl.exe --shutdown and try again. On Windows 10, audio is not available.
Distro shows as "Stopped" -- Run wsl.exe -d claudecode to start it, or .\scripts\launch.ps1.
Slow file access in shared folders -- This is normal for cross-OS file access in WSL2. For best performance on large projects, clone repos inside the distro (/home/claude/) rather than in the shared workspace.
DNS resolution fails -- Add to /etc/wsl.conf:
[network]
generateResolvConf=falseThen: echo "nameserver 8.8.8.8" | sudo tee /etc/resolv.conf
| Feature | claudecode-lima (macOS) | claudecode-wsl2 (Windows) |
|---|---|---|
| VM layer | Lima + VZ framework | WSL2 + Hyper-V |
| Architecture | ARM64 (Apple Silicon) | x86_64 (typically) |
| Audio | VirtIO sound device | WSLg (Win 11) |
| Shared folder | Lima named mounts | fstab + drvfs |
| Port forwarding | Manual (VM IP) | Automatic (localhost) |
| VM config | claudecode.yaml |
.wslconfig |
| Host isolation | VM boundary only | automount + interop disabled + Claude sandbox |
- WSL2 -- Windows Subsystem for Linux
- WSLg -- GUI and audio support for WSL
- Claude Code -- Anthropic's CLI for Claude
- Windows Terminal -- Modern terminal for Windows
- claudecode-lima -- macOS version