Skip to main content

Unified agent runtime: loop detection + context compression for AI coding agents

Project description

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 ROI — attribution engine shows exactly how much each tool saves

Quick Start

pip install dedroom

Note: The CLI commands (wrap, proxy, doctor) require the Rust binary. Install it from source or use a pre-built release:

cargo install dedroom-cli
# or build from repo: cargo build -p dedroom-cli -p dedroom-proxy

Commands

Wrap any AI agent through the proxy

dedroom wrap claude          # Claude Code (Anthropic)
dedroom wrap codex           # OpenAI Codex CLI
dedroom wrap aider           # Aider
dedroom wrap cursor          # Cursor Editor
dedroom wrap cline           # Cline (VS Code extension)
dedroom wrap opencode        # OpenCode

Use any LLM provider (not just OpenAI/Anthropic)

# OpenCode Zen free models
dedroom wrap opencode \
  --upstream-url https://opencode.ai/zen \
  --api-key "sk-your-key" \
  -- run -m headroom/deepseek-v4-flash-free "your task"

# 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

Diagnostics & control

dedroom doctor                # Run health checks
dedroom doctor --json         # JSON output for scripting
dedroom proxy                 # Start standalone proxy
dedroom unwrap <agent>        # Restore config to pre-wrap state
dedroom dash                  # Launch TUI dashboard

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/

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dedroom-0.3.2.tar.gz (2.9 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dedroom-0.3.2-cp312-abi3-macosx_11_0_arm64.whl (3.7 MB view details)

Uploaded CPython 3.12+macOS 11.0+ ARM64

File details

Details for the file dedroom-0.3.2.tar.gz.

File metadata

  • Download URL: dedroom-0.3.2.tar.gz
  • Upload date:
  • Size: 2.9 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.14.1

File hashes

Hashes for dedroom-0.3.2.tar.gz
Algorithm Hash digest
SHA256 f1e4623e461aba74272c670401ee1ee7b5326b29f8d48b0baecf7bd78fc05c53
MD5 afe4dceaf1a2fadd101d27f2ec03d23d
BLAKE2b-256 892a25f0b783bad899c42562ab66b9e6cb5cc2132b22ebfa8a3b1f0aa7cc6af8

See more details on using hashes here.

File details

Details for the file dedroom-0.3.2-cp312-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for dedroom-0.3.2-cp312-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 8e03c977b52669daa75af41ae70a8689e36a9e6fe219033c4e003ea8bba958f3
MD5 5cf7648083524c4cd9ff755610531c92
BLAKE2b-256 2329f1e35b89615ed0198ed161ddfdc4d51eceaf3ccc8eb51ce038cd1ee7cf4c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page