Registry / devops / claude-code-cache-fix

claude-code-cache-fix

JSON →
library4.0.0jsnpmunverified

Cache optimization proxy and interceptor for Claude Code that fixes prompt cache bugs, stabilizes request prefixes, and reduces quota burn. Current stable version v4.0.0, released monthly with patch releases as needed. Standalone HTTP proxy (localhost:9801) with 7 hot-reloadable extensions, no wrapper scripts or NODE_OPTIONS needed. Works with all CC versions including Bun binaries v2.1.113+. A/B tested on v2.1.117 showing 95.5% cache hit rate via proxy vs 82.3% direct. Includes Opus 4.7 advisory documenting ~2.4x Q5h consumption and ~3.3x mitigation via CLAUDE_CODE_DISABLE_ADAPTIVE_THINKING=1. Competes with manual cache workarounds and wrapper scripts.

npm install claude-code-cache-fix
INSTALL
IMPORT
SIG · CLAUDE-CODE-CACHE-
C
claude-code-cache-fix
devopsjavascriptv4.0.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

proxy
node proxy/server.mjs
npx claude-code-cache-fix
The package is a CLI tool/library, not a typical npm module. Use the bundled proxy server via node.
extensions
import { extensions } from 'claude-code-cache-fix/extensions/index.mjs'
const { extensions } = require('claude-code-cache-fix')
Extensions are ESM-only; no CJS support. Import from the extensions subpath.
cacheTelemetry
import { cacheTelemetry } from 'claude-code-cache-fix/extensions/cache-telemetry.mjs'
import cacheTelemetry from 'claude-code-cache-fix'
Individual extensions must be imported from their specific file, not the package root.

Install the package globally, start the proxy on port 9801, and launch Claude Code pointed at the proxy.

npm install -g claude-code-cache-fix node "$(npm root -g)/claude-code-cache-fix/proxy/server.mjs" & ANTHROPIC_BASE_URL=http://127.0.0.1:9801 claude
Debug
Known issues
breakingv4.0.0 dropped support for Node.js <18; requires Node.js >=18 or Bun v2.1.113+.
fix
Upgrade Node.js to v18+ or use the Bun binary version of Claude Code.
affects: >=4.0.0
breakingThe proxy now uses ESM-only modules; CommonJS require() will not work.
fix
Use dynamic import() or switch to ESM for your scripts.
affects: >=3.0.0
deprecatedThe --no-cache flag has been deprecated in favor of environment variable CACHE_FIX_DISABLE=1.
fix
Set CACHE_FIX_DISABLE=1 instead of passing --no-cache.
affects: >=3.5.0
gotchaOpus 4.7 models consume ~2.4x Q5h quota for same visible tokens due to new tokenizer and adaptive thinking overhead.
fix
Set CLAUDE_CODE_DISABLE_ADAPTIVE_THINKING=1 to reduce consumption ~3.3x, though complex tasks may degrade.
affects: >=1.0.0
gotchaThe thinking-block-sanitize extension is opt-in via CACHE_FIX_THINKING_SANITIZE=on and may cause silent truncation of thinking blocks.
fix
Enable with CACHE_FIX_THINKING_SANITIZE=on and verify no unintended drops.
affects: >=3.0.0
Errors
Common errors & fixes
Error: Cannot find module 'claude-code-cache-fix'
Global install not found or path issue
fix
Use npm root -g to locate the global node_modules and run node with absolute path.
TypeError: require() of ES Module not supported
Attempting to use CommonJS require on ESM-only module
fix
Use import() or rename file to .mjs and use import syntax.
Error [ERR_MODULE_NOT_FOUND]: Cannot find package '...' imported from proxy/server.mjs
Missing dependency after incomplete install
fix
Run npm install -g claude-code-cache-fix@latest to reinstall with all deps.
Upgrade
Version history
4.0.0latest on npm
Audit
Dependencies
noderequiredRuntime requirement; engines.node >=18
Agent activity
2 hits · last 30 days
node
2
Resources
claude-code-cache-fix — npm install claude-code-cache-fix · libregistry