Skip to content

congmnguyen/claude-code-wsl2-setup

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

115 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Claude Code WSL2 Setup

My active Claude Code setup for WSL2 + Windows Terminal, built around one idea: keep Claude focused on orchestration and hand implementation churn to Codex.

The repo only tracks the pieces I actually use: Codex delegation, LangSmith tracing, LSP navigation, screenshot paste, Windows notifications, statusline, and token/context hygiene hooks.

Who this is for

Use this if you run Claude Code from WSL2 and want the Windows side to stop feeling bolted on: screenshots paste as WSL paths, notifications land in Windows, browser links open in your normal browser, and long implementation loops can move to Codex without filling Claude's main conversation.

Start with codex-delegate if your main pain is context burn. Start with image-paste and claude-notify if your main pain is day-to-day Windows/WSL friction.

Delegate implementation without filling Claude's main context

Large implementation tasks are expensive twice: Claude spends tokens doing the work, then keeps every file read, edit, test run, and retry in the main conversation. That history competes with the architecture and product context Claude needs to orchestrate well.

codex-delegate sends a well-specified implementation task to Codex through an isolated Claude subagent. Codex does the read/edit/test loop; the main session gets back a short result and keeps its context for planning, steering, and review.

In the real run below, two Codex delegates handled tens of thousands of worker tokens in parallel while the main Claude session still showed 8% context and 6% five-hour usage.

Claude Code running two Codex delegate subagents while the main context and five-hour usage stay low
Codex does the implementation; the main Claude context receives only a compact summary.

Set up Codex delegation →


Featured fixes

Start with these — they are the highest-leverage pieces in the repo:

  • Codex delegate — routes large mechanical implementation to Codex through an isolated low-effort Sonnet wrapper, keeping the premium Claude orchestrator context clean.
  • LSP setup — lets Claude use real Go-to-Definition / reference navigation instead of burning tokens on broad file search.
  • LangSmith tracing — trace selected Claude Code projects without enabling telemetry for every local session.
  • Image paste — paste a Windows screenshot into Claude Code or Codex as a usable WSL file path.
  • Notifications (Claude Code · Codex) — get a Windows notification when either agent finishes, while suppressing alerts when Windows Terminal is already focused.
  • Secrets hygiene hook — blocks credential-file reads before secrets can land in the transcript.
  • Bash output truncation hook — trims huge command output to head+tail so one verbose test/build log does not bloat the rest of the context.

Preview

Custom statusline showing project, context bar, 5h and weekly usage
claude-code-wsl2-setup | main | [░░░░░░░░░░] 6% | 5h:10% | W:95%

Windows balloon tip notification — Claude Code Done!
Balloon tip fires on Claude Code Notification events, skipped when Windows Terminal is focused

Windows balloon tip notification showing Codex's last reply
Codex's top-level notify command shows the completed turn's last reply

What it fixes

  • Image paste — copy a screenshot on Windows and paste the file path straight into Claude Code or Codex. A small Go daemon (wsl-screenshot-cli) polls the Windows clipboard, saves new screenshots under /tmp/.wsl-screenshot-cli/, and rewrites the clipboard so paste returns the WSL path.
  • Shift+Enter newline — insert a newline without submitting, in both the VSCode integrated terminal and Windows Terminal.
  • CapsLock → Escape — remap CapsLock to Escape system-wide via SharpKeys (registry-level, works in WSL2, Vim, games, and elevated processes).
  • "Needs your input" Windows notification — fires on Claude Code Notification events when Claude finishes, asks for permission, or a background agent completes; suppressed automatically when Windows Terminal is already focused. WSL2 variant uses a balloon tip; the native PowerShell variant uses a modern Windows toast.
  • Status line — project directory, git branch, context-window fill bar, and 5-hour / 7-day usage, color-coded by severity.
  • LangSmith tracing — send selected Claude Code project turns, tool calls, subagent runs, and compaction events to project-specific LangSmith traces.
  • Secrets hygiene hook — blocks Claude from reading credential files into the transcript with Read, Grep, or content-printing shell commands.
  • Bash output truncation hook — cuts huge command output (test runs, build logs, JSON dumps) down to head+tail with an omission marker, so one verbose command doesn't eat the context window for the rest of the session.
  • Settings tweaks — disable the Co-authored-by: Claude git attribution and pre-accept the project trust dialog.
  • Windows browser — open links and OAuth flows in your existing Windows browser instead of Chromium inside WSL2.

Setup

git clone https://github.com/congmnguyen/claude-code-wsl2-setup.git
cd claude-code-wsl2-setup
claude

Then prompt:

Set this up

Claude will read the docs and configure everything.

For a manual install, copy the relevant files from agents/, skills/, hooks/, and scripts/ into the matching ~/.claude/ directories, then read the linked setup page for the feature you want.

What's included

Claude Code core

File Fix
lsp-setup.md Official LSP plugins + language servers for TypeScript, Python, Go, Rust
statusline.md Project dir, git branch, context bar, 5h / 7d usage
langsmith-tracing.md Project-level LangSmith traces for Claude Code turns, tools, subagents, and compaction
settings.md Disable git attribution, skip trust dialog

Agent workflows

File Fix
codex-delegate.md Codex delegation with token isolation via a low-effort Sonnet wrapper instead of direct MCP/plugin foreground output
mcp-setup.md DeepWiki MCP; Figma Desktop is project-specific
playwright-cli.md Token-efficient browser automation; preferred over Playwright MCP for coding agents

Safety and context hygiene

File Fix
secrets-hygiene-hook.md + hooks/block-secret-reads.sh PreToolUse hook — block credential-file reads before they hit the transcript
truncate-bash-output.md + hooks/truncate-bash-output.sh PostToolUse hook — truncate huge Bash output to head+tail before it eats context

WSL / Windows bridge

File Fix
image-paste.md Screenshot paste — wsl-screenshot-cli daemon + optional Alt+V keybinding
claude-notify.md Windows balloon tip for Claude Code Notification hooks
codex-notify.md Reuse the same balloon script through Codex's top-level notify command
shift-enter.md Shift+Enter newline in VSCode terminal and Windows Terminal
browser.md Open links in your Windows browser via BROWSER env var
capslock-esc.md CapsLock → Escape registry remap via SharpKeys

Custom agents and skills

Path Contents
agents/ code-architect, codex-delegate
skills/ Active local skills: codex-delegate, commit-push-pr, deep-teach, pytorch-training
hooks/ block-secret-reads.sh PreToolUse hook, truncate-bash-output.sh PostToolUse hook
scripts/ codex-run.sh wrapper used by the codex-delegate Claude agent

Copy the matching files from agents/, skills/, hooks/, and scripts/ to ~/.claude/agents/, ~/.claude/skills/, ~/.claude/hooks/, and ~/.claude/scripts/ for Claude Code.

After adding or updating a skill, run /reload-skills to make it available without restarting the session. Custom agents still require a restart.

Codex skills and the rest of my Codex setup live in the companion repo congmnguyen/codex-wsl2-setup.

Troubleshooting

If a hook, plugin, or other customization breaks Claude Code, start a clean diagnostic session with claude --safe-mode. Use /doctor, /hooks, and /mcp to inspect the installation and loaded integrations.

Pruned notes

Native Windows PowerShell notifications, WSLg voice-mode audio, and uninstalled Claude skills were removed from the main repo because they are not part of the active local setup.

Recommended third-party skills

Skills not authored here but worth installing alongside the setup:

  • liteparse (LlamaIndex, MIT) — parse PDF, DOCX, PPTX, XLSX, and images locally with no cloud calls. Useful for feeding unstructured documents into Claude or Codex without uploading them. Try it in the browser first: simonw.github.io/liteparse. Then install the npm package globally and copy the upstream SKILL.md into ~/.claude/skills/liteparse/:

    npm i -g @llamaindex/liteparse
    sudo apt-get install -y libreoffice   # required for DOCX/PPTX/XLSX

License

MIT — feel free to copy, fork, or adapt for your own setup.

About

Claude Code WSL2 setup with image paste, notifications, LSP, context-saving hooks, and Codex delegation.

Topics

Resources

License

Stars

40 stars

Watchers

0 watching

Forks

Packages

 
 
 

Contributors

Languages