claude-code-cache-fix 1.9.2 → 1.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -1
- package/package.json +4 -2
- package/postinstall.js +17 -0
- package/preload.mjs +1 -0
package/README.md
CHANGED
|
@@ -2,7 +2,19 @@
|
|
|
2
2
|
|
|
3
3
|
English | [中文](./README.zh.md) | [Português](./docs/guia-pt-br.md)
|
|
4
4
|
|
|
5
|
-
Fixes prompt cache regressions in [Claude Code](https://github.com/anthropics/claude-code) that cause **up to 20x cost increase** on resumed sessions, plus monitoring for silent context degradation. Confirmed through v2.1.
|
|
5
|
+
Fixes prompt cache regressions in [Claude Code](https://github.com/anthropics/claude-code) that cause **up to 20x cost increase** on resumed sessions, plus monitoring for silent context degradation. Confirmed through v2.1.107.
|
|
6
|
+
|
|
7
|
+
## Security model
|
|
8
|
+
|
|
9
|
+
> **This interceptor patches `globalThis.fetch`.** By design, it has full read/write access to all API requests and responses in the Claude Code process. This is inherent to the approach — any fetch interceptor, proxy, or gateway has this position.
|
|
10
|
+
|
|
11
|
+
**What it does:** Modifies outgoing request structure (block order, fingerprint, TTL, git-status) to fix cache bugs. Reads response headers and SSE usage data for monitoring.
|
|
12
|
+
|
|
13
|
+
**What it does NOT do:** No network calls from the interceptor. All telemetry is written to local files under `~/.claude/`. No data leaves your machine unless you explicitly opt in to [claude-code-meter](https://github.com/cnighswonger/claude-code-meter) sharing (separate package, requires interactive consent).
|
|
14
|
+
|
|
15
|
+
**Supply chain:** Single unminified file (`preload.mjs`, ~1,700 lines). One dependency (`zod` for schema validation in tests only). Review before installing. npm provenance links each published version to its source commit.
|
|
16
|
+
|
|
17
|
+
**Independent audit:** [Assessed as "LEGITIMATE TOOL"](https://github.com/anthropics/claude-code/issues/38335#issuecomment-4244413605) by @TheAuditorTool (2026-04-14).
|
|
6
18
|
|
|
7
19
|
## The problem
|
|
8
20
|
|
|
@@ -266,6 +278,7 @@ Add to `~/.claude/settings.json`:
|
|
|
266
278
|
```json
|
|
267
279
|
{
|
|
268
280
|
"statusLine": {
|
|
281
|
+
"type": "command",
|
|
269
282
|
"command": "~/.claude/hooks/quota-statusline.sh"
|
|
270
283
|
}
|
|
271
284
|
}
|
package/package.json
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "claude-code-cache-fix",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.10.0",
|
|
4
4
|
"description": "Fixes prompt cache regression in Claude Code that causes up to 20x cost increase on resumed sessions",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": "./preload.mjs",
|
|
7
7
|
"main": "./preload.mjs",
|
|
8
8
|
"files": [
|
|
9
9
|
"preload.mjs",
|
|
10
|
+
"postinstall.js",
|
|
10
11
|
"tools/",
|
|
11
12
|
"claude-fixed.bat"
|
|
12
13
|
],
|
|
@@ -14,7 +15,8 @@
|
|
|
14
15
|
"node": ">=18"
|
|
15
16
|
},
|
|
16
17
|
"scripts": {
|
|
17
|
-
"test": "node --test"
|
|
18
|
+
"test": "node --test",
|
|
19
|
+
"postinstall": "node postinstall.js"
|
|
18
20
|
},
|
|
19
21
|
"keywords": [
|
|
20
22
|
"claude-code",
|
package/postinstall.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
console.log(`
|
|
3
|
+
┌─────────────────────────────────────────────────────────────────────┐
|
|
4
|
+
│ claude-code-cache-fix — SECURITY NOTICE │
|
|
5
|
+
│ │
|
|
6
|
+
│ This interceptor patches globalThis.fetch to fix prompt cache │
|
|
7
|
+
│ bugs in Claude Code. By design, it has full read/write access │
|
|
8
|
+
│ to all API requests and responses in the Claude Code process. │
|
|
9
|
+
│ │
|
|
10
|
+
│ • All telemetry is LOCAL ONLY (no network calls from interceptor) │
|
|
11
|
+
│ • Source is a single unminified file: preload.mjs (~1,700 lines) │
|
|
12
|
+
│ • Review before use: github.com/cnighswonger/claude-code-cache-fix │
|
|
13
|
+
│ │
|
|
14
|
+
│ Independent audit: github.com/anthropics/claude-code/issues/38335 │
|
|
15
|
+
│ (search "TheAuditorTool" — assessed as LEGITIMATE TOOL) │
|
|
16
|
+
└─────────────────────────────────────────────────────────────────────┘
|
|
17
|
+
`);
|
package/preload.mjs
CHANGED
|
@@ -870,6 +870,7 @@ function printHealthLine() {
|
|
|
870
870
|
if (FIXES_DISABLED) {
|
|
871
871
|
debugLog("HEALTH: all fixes disabled via CACHE_FIX_DISABLED=1 (monitoring active)");
|
|
872
872
|
}
|
|
873
|
+
debugLog("SECURITY: This interceptor has full read/write access to API requests. All telemetry is local only — no network calls. Source: github.com/cnighswonger/claude-code-cache-fix");
|
|
873
874
|
}
|
|
874
875
|
|
|
875
876
|
// --------------------------------------------------------------------------
|