GC

glommer/cachebro

Developer tools

Эта страница переведена автоматически. Технические детали смотрите в оригинале. Открыть оригинал

220 stars 19 forks Качество 70 Тренд 0MIT

glommer/cachebro — это кандидат для MCP-сервера, импортированный из https://github.com/glommer/cachebro.

Обзор

glommer/cachebro — это кандидат для MCP-сервера, импортированный из https://github.com/glommer/cachebro.

Обзор (машинный перевод)

Кэш файлов с отслеживанием различий для агентов кодирования ИИ. Работает на базе 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

Эта страница переведена автоматически. Технические детали смотрите в оригинале.

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"]
    }
  }
}
Открыть полный README на GitHub

Установка

npx cachebro serve
Новичок в MCP? Начните с руководства на mcpskill.org →

Конфигурация

{ "mcpServers": { "cachebro": { "command": "npx", "args": ["cachebro", "serve"] } } }