
glommer/cachebro 是从 https://github.com/glommer/cachebro. 导入的 MCP 服务器候选
概览
glommer/cachebro 是从 https://github.com/glommer/cachebro. 导入的 MCP 服务器候选
概述(AI 翻译)
为AI编码代理提供带有差分追踪的文件缓存。由Turso支持,一款高性能嵌入式数据库。
代理会浪费大部分令牌预算去重新阅读已经看过的文件。Cachebro 解决了这个问题:第一次读取时缓存文件,后续读取时返回“未更改”(一行文件而非整份文件)或显示一个紧凑的变动差异。替换代理自行采用的文件读取。
基准
我们进行了受控的A/B测试:在268个文件的TypeScript代码库(开放代码)上执行相同的重构任务,同一个代理(Claude Opus),同样的提示符。唯一的区别是:cachebro启用和禁用。
| 没有 cachebro | 带 cachebro | |
|---|---|---|
| 总代币 | 158,248 | 117,188 |
| 工具调用 | 60 | 58 |
| 触及的文件 | 12 | 12 |
令牌减少26%。任务相同,结果相同。 cachebro通过提供缓存读取和压缩差值而非完整文件内容,节省了~33,000个令牌。
相比于在同一代码库上的顺序任务,节省的收益会叠加:
| 任务 | 已使用令牌 | 缓存保存的令牌 | 累计节省 |
|---|---|---|---|
| 1. 添加会话导出命令 | 62,190 | 2,925 | 2,925 |
本页由 AI 翻译,技术细节请以原文为准。
README
以下为原文 README 节选,完整内容请查看原文。
cachebro
File cache with diff tracking for AI coding agents. Powered by Turso, a high-performance embedded database.
Agents waste most of their token budget re-reading files they’ve already seen. cachebro fixes this: on first read it caches the file, on subsequent reads it returns either “unchanged” (one line instead of the whole file) or a compact diff of what changed. Drop-in replacement for file reads that agents adopt on their own.
Benchmark
We ran a controlled A/B test: the same refactoring task on a 268-file TypeScript codebase (opencode), same agent (Claude Opus), same prompt. The only difference: cachebro enabled vs disabled.
| Without cachebro | With cachebro | |
|---|---|---|
| Total tokens | 158,248 | 117,188 |
| Tool calls | 60 | 58 |
| Files touched | 12 | 12 |
26% fewer tokens. Same task, same result. cachebro saved ~33,000 tokens by serving cached reads and compact diffs instead of full file contents.
The savings compound over sequential tasks on the same codebase:
| Task | Tokens Used | Tokens Saved by Cache | Cumulative Savings |
|---|---|---|---|
| 1. Add session export command | 62,190 | 2,925 | 2,925 |
| 2. Add --since flag to session list | 41,167 | 15,571 | 18,496 |
| 3. Add session stats subcommand | 63,169 | 35,355 | 53,851 |
By task 3, cachebro saved 35,355 tokens in a single task — a 36% reduction. Over the 3-task sequence, 53,851 tokens saved out of 166,526 consumed (~24%).
Agents adopt it without being told
We tested whether agents would use cachebro voluntarily. We launched a coding agent with cachebro configured as an MCP server but gave the agent no instructions about it. The agent chose cachebro.read_file over the built-in Read tool on its own. The tool descriptions alone were enough.
How it works
First read: agent reads src/auth.ts → cachebro caches content + hash → returns full file
Second read: agent reads src/auth.ts → hash unchanged → returns "[unchanged, 245 lines, 1,837 tokens saved]"
After edit: agent reads src/auth.ts → hash changed → returns unified diff (only changed lines)
Partial read: agent reads lines 50-60 → edit changed line 200 → returns "[unchanged in lines 50-60]"
The cache persists in a local Turso (SQLite-compatible) database. Content hashing (SHA-256) detects changes. No network, no external services, no configuration beyond a file path.
Installation
npx cachebro init # auto-configures Claude Code, Cursor, OpenCode
That’s it. Restart your editor and cachebro is active. Agents discover it automatically.
Or configure manually — add to your MCP config (.claude.json, .cursor/mcp.json, etc.):
{
"mcpServers": {
"cachebro": {
"command": "npx",
"args": ["cachebro", "serve"]
}
}
}
安装
npx cachebro serve配置
{
"mcpServers": {
"cachebro": {
"command": "npx",
"args": ["cachebro", "serve"]
}
}
}