feat: 添加 prompt 缓存命中率检测与警告功能

每次 API 请求后自动计算缓存命中率,低于阈值(默认 80%)时在对话流中显示黄色警告消息。
同时更新 /context 命令输出中显示缓存命中率。

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
claude-code-best
2026-05-07 10:49:06 +08:00
parent e8759f3402
commit e3c0699f5b
5 changed files with 191 additions and 0 deletions

View File

@@ -1072,6 +1072,15 @@ export const SettingsSchema = lazySchema(() =>
'Only applies to User, Project, and Local memory types (Managed/policy files cannot be excluded). ' +
'Examples: "/home/user/monorepo/CLAUDE.md", "**/code/CLAUDE.md", "**/some-dir/.claude/rules/**"',
),
cacheThreshold: z
.number()
.int()
.min(0)
.max(100)
.optional()
.describe(
'Prompt cache hit rate threshold (0-100). Warnings shown when cache hit rate falls below this percentage. Default: 80.',
),
pluginTrustMessage: z
.string()
.optional()