claude-code-cache-fix 1.4.0 → 1.4.1
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 +5 -0
- package/package.json +1 -1
- package/preload.mjs +15 -0
package/README.md
CHANGED
|
@@ -114,6 +114,10 @@ On the first API call, the interceptor reads `~/.claude.json` and logs the curre
|
|
|
114
114
|
|
|
115
115
|
Response headers are parsed for `anthropic-ratelimit-unified-5h-utilization` and `7d-utilization`, saved to `~/.claude/quota-status.json` for consumption by status line hooks or other tools.
|
|
116
116
|
|
|
117
|
+
### Peak hour detection
|
|
118
|
+
|
|
119
|
+
Anthropic applies elevated quota drain rates during weekday peak hours (13:00–19:00 UTC, Mon–Fri). The interceptor detects peak windows and writes `peak_hour: true/false` to `quota-status.json`. See `docs/peak-hours-reference.md` for sources and details.
|
|
120
|
+
|
|
117
121
|
## Debug mode
|
|
118
122
|
|
|
119
123
|
Enable debug logging to verify the fix is working:
|
|
@@ -133,6 +137,7 @@ Logs are written to `~/.claude/cache-fix-debug.log`. Look for:
|
|
|
133
137
|
- `GROWTHBOOK FLAGS: {...}` — server-controlled feature flags on first call
|
|
134
138
|
- `PROMPT SIZE: system=N tools=N injected=N (skills=N mcp=N ...)` — per-call prompt size breakdown
|
|
135
139
|
- `CACHE TTL: tier=1h create=N read=N hit=N% (1h=N 5m=N)` — TTL tier and cache hit rate per call
|
|
140
|
+
- `PEAK HOUR: weekday 13:00-19:00 UTC` — Anthropic peak hour throttling active
|
|
136
141
|
- `SKIPPED: resume relocation (not a resume or already correct)` — no fix needed
|
|
137
142
|
|
|
138
143
|
### Prefix diff mode
|
package/package.json
CHANGED
package/preload.mjs
CHANGED
|
@@ -792,7 +792,22 @@ globalThis.fetch = async function (url, options) {
|
|
|
792
792
|
quota.seven_day = h7d ? { utilization: parseFloat(h7d), pct: Math.round(parseFloat(h7d) * 100), resets_at: reset7d ? parseInt(reset7d) : null } : quota.seven_day;
|
|
793
793
|
quota.status = status || null;
|
|
794
794
|
quota.overage_status = overage || null;
|
|
795
|
+
|
|
796
|
+
// Peak hour detection — Anthropic applies higher quota drain rate during
|
|
797
|
+
// weekday peak hours: 13:00–19:00 UTC (Mon–Fri).
|
|
798
|
+
// Source: Thariq (Anthropic) via X, 2026-03-26; confirmed by The Register,
|
|
799
|
+
// PCWorld, Piunikaweb. No specific multiplier disclosed.
|
|
800
|
+
const now = new Date();
|
|
801
|
+
const utcHour = now.getUTCHours();
|
|
802
|
+
const utcDay = now.getUTCDay(); // 0=Sun, 6=Sat
|
|
803
|
+
const isPeak = utcDay >= 1 && utcDay <= 5 && utcHour >= 13 && utcHour < 19;
|
|
804
|
+
quota.peak_hour = isPeak;
|
|
805
|
+
|
|
795
806
|
writeFileSync(quotaFile, JSON.stringify(quota, null, 2));
|
|
807
|
+
|
|
808
|
+
if (DEBUG && isPeak) {
|
|
809
|
+
debugLog("PEAK HOUR: weekday 13:00-19:00 UTC — quota drains at elevated rate");
|
|
810
|
+
}
|
|
796
811
|
}
|
|
797
812
|
} catch {
|
|
798
813
|
// Non-critical — don't break the response
|