Skip to main content

DedrooM

Loop detection + context compression for AI coding agents.

PyPI version License

DedrooM sits between your AI agent and the LLM provider to:

  • Detect and block infinite loops — saves wasted API calls when tools repeat
  • Compress context — reduces token usage by 60–95% without changing behavior
  • Redact sensitive data — strip API keys, tokens, and secrets from tool outputs
  • Track savings — attribution engine shows per-tool token usage

Quick Start

pip install dedroom

# Start the proxy daemon and route your agent through it
dedroom init
eval "$(dedroom init)"       # Sets ANTHROPIC_BASE_URL and OPENAI_BASE_URL

# Use your agent as normal
claude          # now routed through DedrooM
codex           # works immediately

# Check status and stop
dedroom status  # Running state, PID, uptime, tokens saved
dedroom stop    # Stop the daemon

One-shot alternative (no daemon)

dedroom wrap claude   # Starts proxy, launches agent, cleans up on exit

Commands

Command Description
init Start proxy daemon and print shell exports
status Show proxy status, PID, uptime, savings
stop Stop the daemon
wrap <agent> Start proxy + launch agent
unwrap <agent> Restore config to pre-wrap state
doctor Run health checks
report Show per-tool compression report
proxy Start standalone proxy server

Use any LLM provider (not just OpenAI/Anthropic)

# DeepSeek API
dedroom wrap claude \
  --upstream-url https://api.deepseek.com \
  --api-key "sk-your-key"

# Local Ollama
dedroom wrap aider \
  --upstream-url http://localhost:11434/v1

Python API

from dedroom import DedrooM

pipeline = DedrooM("""
loop_detection:
  max_repeats: 3
""")

# Check for loops (0 = Allow)
verdict = pipeline.verify("write_file", '{"path": "/tmp/x.txt"}')

# Full pipeline
result = pipeline.process_tool("write_file", '{}', tool_result)
print(f"Blocked: {result['is_blocked']}")
print(f"Saved {result['original_tokens'] - result['compressed_tokens']} tokens")

Benchmarks

Payload Raw Tokens With DedrooM Reduction
Repeated directory listing (1MB) 483,672 177,245 63.4%
Large source file 18,331 14,167 22.7%
Build log 284 284 0% (no redundancy)
  • Loop detection latency: ~1.3ms per tool call (negligible vs 2-10s LLM roundtrip)
  • Pipeline throughput: 5.4µs (in-memory) / 260µs (SQLite)

Development

git clone https://github.com/Devaretanmay/dedroom
cd dedroom

# Build Rust binaries
cargo build -p dedroom-cli -p dedroom-proxy

# Install Python package in dev mode
pip install -e .

# Run tests
pytest python/tests/

Release files for dedroom 0.5.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dedroom 0.5.1
File Size Uploaded
dedroom-0.5.1.tar.gz 3.2 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for dedroom 0.5.1
File Interpreter ABI Platform
dedroom-0.5.1-cp312-abi3-macosx_11_0_arm64.whl CPython 3.12 abi3 macOS 11.0+ ARM64 Details

Total release size: 7.3 MB

Release files / dedroom-0.5.1.tar.gz

Download URL dedroom-0.5.1.tar.gz
Size 3.2 MB
Tags Source
SHA-256 checksum
How to use checksums
f68c46989a6fb572f5985c7c2157c88352e2e7ca6bba03b1ffb2069b3f0ffb53
BLAKE2b-256 checksum
How to use checksums
d4d671ee519a44cbe4646eef8a464fd3e2ea35eb0e11f7fa2d545dc79033da4f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.14.1

Release files / dedroom-0.5.1-cp312-abi3-macosx_11_0_arm64.whl

Download URL dedroom-0.5.1-cp312-abi3-macosx_11_0_arm64.whl
Size 4.1 MB
Tags CPython 3.12 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
da83f710743d7ba626e00fbed35331d8fe2a6f2bfc1bddb14a0d8d4250ebf520
BLAKE2b-256 checksum
How to use checksums
e1b06dcaaec2671eb936d45db4f198295325db4e6975b436b6bff4922bf8e3d3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.14.1

Release history Release notifications | RSS feed

This release

0.5.1 This release

2 release files

0.5.0

1 release file

0.4.0

2 release files

0.3.5

1 release file

0.3.4

1 release file

0.3.3

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3.0

1 release file

0.2.1

1 release file

0.2.0

1 release file

0.1.2

1 release file

0.1.1

1 release file

0.1.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page