DEV Community

Cover image for DedrooM: loop detection + context compression for Claude Code (open source)
Tanmay Devare
Tanmay Devare

Posted on

DedrooM: loop detection + context compression for Claude Code (open source)

I kept running into the same two problems with Claude Code on longer sessions: it'd get stuck retrying a failing command in a near-identical loop, and tool output (file listings, logs, diffs) would pile up in context even after it stopped being useful. Both quietly ran up the token bill.

So I built DedrooM — a small proxy that sits in front of Claude Code (and a few other agents: Codex, Aider, Cursor, Cline, OpenCode) and does two things:

Stops loops before they compound. Tracks repeated tool calls with an adaptive window, tightens up automatically once error rate climbs, and blocks a call outright if it's clearly stuck.
Compresses redundant tool output before it hits the model — truncates repetitive stuff like long file listings, dedupes logs, keeps the parts that actually matter.

It's one command to try:

bashpip install dedroom
dedroom wrap claude

dedroom unwrap claude puts things back to normal. It's Apache 2.0, source is here: https://github.com/Devaretanmay/dedroom

Being upfront about the numbers: the compression/savings figures in the README are from a handful of internal test scenarios, not a big benchmark suite — real savings depend a lot on your workload (loop-prone sessions and repetitive tool output benefit a lot more than a clean session does). I'd rather you try it and tell me it doesn't do much for your setup than oversell it here.

Would genuinely like feedback from people running long Claude Code sessions — especially if it either catches something useful or gets in your way. Happy to answer questions about how the loop detection or compression actually works under the hood.

Top comments (0)