Merlin Community

arXiv 2605.09611 arXiv 2605.09990 License: MIT DOI

Local-first dedup for LLM context. Lite engine, MIT integrations, papers on arXiv.

We measured 22 % chunk-level dedup on a typical 5 MB agent session and up to 71 % on RAG pipelines. That's wasted input you're already paying for.

This repo is the community edition: a lite engine + integrations (MCP server, VSCode extension, Claude Code hook). The enterprise C++ engine (multi-threaded, lock-free, sustained GB/s on production hardware) is a separate proprietary product.

If this saves you time: ⭐ star this repo — stars are the only signal we get since we collect zero telemetry. Questions or interested in Pro? There's a contact form at corbenic.ai.

Quick start

curl -LO https://github.com/corbenicai/merlin-community/releases/latest/download/merlin-community.zip
unzip merlin-community.zip && cd merlin-community
python shared/install_helpers.py claude_desktop enable

Three commands. Restart your AI tool. Done. (Other supported: claude_code, openclaw, cursor, proxy. VSCode extension: code --install-extension vscode/merlin-savings-0.1.0.vsix.)

New in v0.2.0: proxy mode (transparent dedup for any IDE)

For Cursor / OpenWebUI / Cline / Aider / Continue / Hermes / any OpenAI- or Anthropic-compatible client, the MCP path requires explicit tool calls and doesn't intercept context automatically. Proxy mode does:

python shared/install_helpers.py proxy enable
python shared/merlin_proxy.py --upstream=https://api.anthropic.com

Then point your IDE's "Custom OpenAI endpoint" at http://127.0.0.1:8787/v1 and keep using your own API key. The proxy dedupes chunky text in every outgoing request before forwarding to upstream. Agnostic — works for Anthropic, OpenAI, Gemini, Cohere, and custom payload shapes alike. No MITM, no root CA, no telemetry. Same caps as the rest of the community tier.

Honest scope: proxy mode is opt-in. Existing MCP integrations (Claude Code hook auto-intercepts; Claude Desktop / OpenClaw / Cursor expose dedup as a tool the LLM can call) continue working unchanged.

New in v0.2.2: LangChain — pip install merlin-langchain

Drop-in MerlinBufferMemory that strips redundant chat-history bytes before they reach your LLM. Inherits from LangChain's BaseMemory, so it plugs into any chain that accepts a memory= kwarg.

from merlin_langchain import MerlinBufferMemory
from langchain.chains import ConversationChain

memory = MerlinBufferMemory(memory_key="chat_history")
chain = ConversationChain(llm=..., memory=memory)

Real-world demo: a 6-turn coding agent fed two real lock files (facebook/react/yarn.lock + vercel/next.js/pnpm-lock.yaml, ~2 MB / 1 M tokens per turn) crashes vanilla LangChain on turn 2 with Gemini's 400 INVALID_ARGUMENT "exceeds 1048576". With Merlin the same agent survives all 6 turns and the same call returns 200 OK — receipts in docs/benchmarks/langchain_2026-05-14.pdf.

Setup, caps, fallback behavior, configuration: see integrations/langchain/.

Why no automatic Copilot interception

Because Copilot uses a closed API and we refuse to install a root CA cert for HTTPS MITM on your machine. Other tools do. We don't. For Copilot users we ship a manual Merlin: Dedupe Selection command. Two extra clicks beats opaque interception.

What you get

  • Live $ saved statusbar in VSCode (auto-detects your model from each tool's own config — Claude Code's, Copilot's, etc.)
  • MCP tools (merlin_dedupe, merlin_savings_summary) for Claude Desktop / Claude Code / OpenClaw
  • Cross-platform install scripts with backup-before-edit and one-line rollback
  • One shared ledger (~/.merlin/savings_ledger.jsonl) aggregating savings from all integrations

What's in the Pro tier

The community edition ships a simpler dedup implementation that runs single-threaded — fast enough for most individual workloads. The Pro tier adds the multi-threaded C++ engine for sustained high-throughput workloads, plus server-side validation for teams that need it. Reach out via corbenic.ai if that fits your use case.

Community caps

50 MB per run · 200 MB per day · 2 GB per month. A hobbyist never hits these. A serious commercial pipeline hits them in 2–3 days — for Pro tier, reach out via corbenic.ai.

Status

v0.2.2 is live. Adds the merlin-langchain Python package (MerlinBufferMemory drop-in for langchain.memory.ConversationBufferMemory). Backwards-compatible — proxy mode, cache-aware dedup, and MCP integrations unchanged.

v0.2.1 introduced cache-aware dedup defaults to preserve upstream prompt caching. v0.2.0 added proxy mode for transparent dedup with any OpenAI-/Anthropic-compatible IDE.

The Windows x64 binary is attached to the latest release. Linux + macOS builds coming — CI cross-platform pipeline in flight; sign up at the issues tracker to get pinged when they land.

Integration code is unit-tested before each release.

Issues

File at github.com/corbenicai/merlin-community/issues. We respond within 48 h during European business hours; faster during the launch window.

If install broke something: python shared/merlin_restore_backup.py <integration>. Every install script makes a timestamped backup before touching configs.


Papers:

Zenodo DOI: 10.5281/zenodo.20090991. Contact: [email protected] · [email protected] · [email protected].