[BUG] Running File Read on Windows is really slow, almost unusable. Please optimize the cygpath logic!

Resolved 💬 29 comments Opened Dec 8, 2025 by caozhiyuan Closed Feb 11, 2026

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

Running File Read on Windows is really slow, almost unusable. Please optimize the cygpath logic! On Windows, each read operation takes about 3 seconds on average, while on Linux it's only a few hundred milliseconds! It's even slower in the VSCode extension, and there seems to be some hook script involved.

What Should Happen?

Each file read takes less than one second

Error Messages/Logs

Steps to Reproduce

  1. open claude --debug
  2. tell ai read file README
  3. see debug log

Claude Model

Sonnet (default)

Is this a regression?

No, this never worked

Last Working Version

_No response_

Claude Code Version

2.0.61 (Claude Code)

Platform

Anthropic API

Operating System

Windows

Terminal/Shell

VS Code integrated terminal

Additional Information

_No response_

View original on GitHub ↗

29 Comments

caozhiyuan · 7 months ago

this issue https://github.com/anthropics/claude-code/issues/12578 , also pointed out the problem with cygpath

MO-AI-2000 · 6 months ago

Yes, please fix currently Claude code is not usable due to this, tried all, the only way is to go to wsl

caozhiyuan · 6 months ago

@ashwin-ant Please optimize the cygpath logic in windows.

caozhiyuan · 6 months ago

One FileRead call invoked cygpath -u over 20 times, causing extremely slow file reading.

caozhiyuan · 6 months ago

@bcherny Please optimize the cygpath logic in windows.

caozhiyuan · 6 months ago

@fvolcic cc

caozhiyuan · 6 months ago

@MO-AI-2000 @honix seems can patch-execsync.

// setx NODE_OPTIONS "--import file://xxx\patch-execsync.mjs"

import { createRequire } from 'node:module';

const require = createRequire(import.meta.url);
const cp = require('node:child_process');

const orig = cp.execSync;
const uCache = new Map();
const wCache = new Map();
const MAX = Number(process.env.CLAUDE_CODE_CYGPATH_CACHE_MAX) || 1024;

const cacheSet = (m, k, v) => {
  m.set(k, v);
  if (m.size > MAX) {
    const o = m.keys().next().value;
    if (o !== undefined) m.delete(o);
  }
  return v;
};

const isSimpleCygpathCmd = (cmd, flag) => {
  const prefix = `cygpath -${flag} `;
  if (!cmd.startsWith(prefix)) return false;
  let inSingle = false;
  let inDouble = false;
  let escape = false;
  for (let i = prefix.length; i < cmd.length; i += 1) {
    const ch = cmd[i];
    if (escape) {
      escape = false;
      continue;
    }
    if (!inSingle && ch === '\\') {
      escape = true;
      continue;
    }
    if (!inDouble && ch === "'") {
      inSingle = !inSingle;
      continue;
    }
    if (!inSingle && ch === '"') {
      inDouble = !inDouble;
      continue;
    }
    if (!inSingle && !inDouble) {
      if (ch === '&' || ch === '|' || ch === ';' || ch === '<' || ch === '>' || ch === '\n') {
        return false;
      }
    }
  }
  return true;
};

cp.execSync = (cmd, opts) => {
  if (typeof cmd === 'string' && MAX > 0) {
    if (isSimpleCygpathCmd(cmd, 'u')) {
      const v = uCache.get(cmd);
      if (v !== undefined) return v;
      return cacheSet(uCache, cmd, orig(cmd, opts));
    }
    if (isSimpleCygpathCmd(cmd, 'w')) {
      const v = wCache.get(cmd);
      if (v !== undefined) return v;
      return cacheSet(wCache, cmd, orig(cmd, opts));
    }
  }
  return orig(cmd, opts);
};
caozhiyuan · 6 months ago

@MO-AI-2000 @honix https://github.com/caozhiyuan/claude-code-patch/blob/main/README.md , support claude.exe and npm app,

honix · 6 months ago

Interesting! Looks like a valid workaround. I hope this works for you while claude code team solving this performance issue on Windows. If it does, this is a strong signal for claude code team where to look. I'm using CC via WSL right now, as it works better and doesn't lag.

caozhiyuan · 6 months ago

@honix Yes, this issue has been bothering me for a long time. Today, I used Codex and added some logging output, and found that reading a file requires calling cygpath 20 times. Later, I tried adding caching to cygpath, and the performance became much smoother. However, packaging claude.exe was still somewhat troublesome, so I eventually opted to use USE_BUILTIN_RIPGREP=0. On Windows, I also experimented with WSL2, but there ripgrep was extremely slow every time it ran. I had to configure .ripgreprc to exclude some large directories, and the overall experience wasn't very good either. Do you experience slow rg issues on WSL2?

honix · 6 months ago

Search tool works OK on WSL. There is also added latency of windows<->linux filesystem abstraction, but for now it's much better performance than for native Windows.

caozhiyuan · 6 months ago

any feedback?

caozhiyuan · 6 months ago

I've been using https://github.com/caozhiyuan/claude-code-patch/blob/main/patch-execsync.mjs for a while without any issues. Can you officially add cygpath execSync caching functionality for Windows? @bcherny Or ask a colleague who has a Windows system to help check. Thank you for your assistance.

honix · 6 months ago

It seems it much better in recent versions of Claude Code. The 2.1.6 (Claude Code) doesnt hangs file reads or something, it feels smooth now.

caozhiyuan · 6 months ago

@honix I just tested 2.1.6 this afternoon, and six parallel reads took 18 seconds. and the issue with running the bash git command and the output temp file being created in the current directory has not yet been resolved.

caozhiyuan · 6 months ago

@honix you run via npm or vscode extension?

honix · 6 months ago

Claude Code CLI

> /doctor

 Diagnostics
 └ Currently running: native (2.1.6)
 └ Path: native
 └ Invoked: C:\Users\username\.local\bin\claude.exe
 └ Config install method: native
 └ Search: OK (bundled)

 Updates
 └ Auto-updates: enabled
 └ Auto-update channel: latest
 └ Stable version: 2.1.2
 └ Latest version: 2.1.6

Claude Code devs recommends install native build through claude install.

caozhiyuan · 6 months ago
Claude Code CLI `` > /doctor Diagnostics └ Currently running: native (2.1.6) └ Path: native └ Invoked: C:\Users\username\.local\bin\claude.exe └ Config install method: native └ Search: OK (bundled) Updates └ Auto-updates: enabled └ Auto-update channel: latest └ Stable version: 2.1.2 └ Latest version: 2.1.6 ` Claude Code devs recommends install native build through claude install`.

I installed it via npm, but it's not working yet @honix

honix · 6 months ago

Did you run claude install?

honix · 6 months ago

Make sure you have native build running

caozhiyuan · 5 months ago

in 2.1.12 , not fixed. install via npm and vscode extension

honix · 5 months ago

actually yes. i confirm its lags in powershell every prompt

<img width="745" height="192" alt="Image" src="https://github.com/user-attachments/assets/12520d83-b7e2-444c-a89b-2b2b2c09413b" />

caozhiyuan · 5 months ago

@honix you can use https://github.com/caozhiyuan/claude-code-patch. Current stable version: 2.1.7. There is a bug in the bash tool of version 2.1.12. https://github.com/caozhiyuan/claude-code-patch/tree/2.1.7 . just need run node .\patch-cli.mjs --backup and bun build .\cli-entry.mjs --compile --target=bun-windows-x64 --outfile claude.exe .

sataz-ehl · 5 months ago

Has someone referred CC dev team to the claude-code-patch? The Grep and Glob are still very slow in the VS Code plugin v2.1.37.

caozhiyuan · 5 months ago

@sataz-ehl Anthropic might not have anyone using Windows, so the issue has never been addressed, and even with patches, it's not as smooth as on macOS. Using OpenCode on Windows is the best option—it can seamlessly replace Claude Code and runs very smoothly (though you need to disable animations in VSCode, otherwise it will lag).

caozhiyuan · 5 months ago

Glob will be slow in node projects; this is an issue with ripgrep. Adding a .ripgreprc file under the user directory will help, with the following content:

# Fallback to exclude large directories (these globs will still take effect even if you use --no-ignore)  
--glob=!**/node_modules/**  
--glob=!**/.git/**  
--glob=!**/dist/**  
--glob=!**/build/**  
--glob=!**/target/**  
--glob=!**/.next/**  
--glob=!**/.cache/**  

# Prevent scanning extremely large files (adjust as needed)  
--max-filesize=2M  

# Limit directory recursion depth (adjust as needed)  
--max-depth=25  

# Common usability settings  
--smart-case 

@sataz-ehl

caozhiyuan · 5 months ago

@sataz-ehl @honix seems fixed in 2.1.39

sataz-ehl · 5 months ago

Thank you for your investigation and workaround solution before the official fix. @caozhiyuan

github-actions[bot] · 4 months ago

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.