A llama.cpp fork that targets a common agent-loop cost: the same large content sent over and over. A file gets re-read ten turns later, or a tool returns the same output again, and every copy sits in the context and gets prefilled. The fork adds a pass to llama-server's chat parser. When a later message is byte-identical to an earlier one from the same role and above a size threshold, the later copy becomes a one-line reference: [duplicate content omitted: byte-identical to tool result #3 (read_file), which begins "..."; unchanged since then] The first copy always stays in full. - Off by default. With it off, the rendered prompt is byte-identical to upstream. - Stateless and deterministic. Earlier turns render the same way every time, so the prompt cache keeps hitting. - Configurable. Enable it with --message-dedup and tune it with --message-dedup-min-bytes and --message-dedup-roles, or set a message_dedup field in a single request. - Measured. The response timings report dedup_n, dedup_bytes_saved and dedup_tokens_saved_est. It ships with an eval suite of 15 synthetic agentic scenarios, each run with dedup off and on, two runs per arm. Every scenario that passes with dedup off also passes with it on. Prompt size drops sharply on the heavier scenarios: 18,092 → 6,820 tokens in one, 108,197 → 71,697 in another. Limits: it only catches exact repeats, not near-duplicates, and end-to-end wall-clock speedup hasn't been benchmarked yet, only token counts. Repo: https://github.com/llopresto87   submitted by   /u/Odd_Cauliflower_8004 [link]   [comments]