Compress tool outputs, logs, files, and RAG chunks before they reach the LLM. 20% fewer tokens for coding agents, 60-95% fewer tokens for JSON, same answers. Library, proxy, MCP server.
Python agentaianthropicclaude-codecompressioncontext-engineeringcontext-windowcursorfastapilangchainllmmcpopenaiprompt-engineeringproxypythonragtoken-optimizationtokenstypescript
docs: restore init export comments
JerrettDavis8cf571421f92
diff --git a/headroom/__init__.py b/headroom/__init__.pyindex 40fd5bab8..d162eb801 100644--- a/headroom/__init__.py+++ b/headroom/__init__.py@@ -76,6 +76,9 @@ from typing import Anyfrom ._version import __version__ # noqa: F401from .compress import CompressResult, compress+# Keep a real callable bound for the one-function compression API so+# `from headroom import compress` is never shadowed by the submodule object.+__all__ = [# Main client"HeadroomClient",@@ -175,6 +178,8 @@ __all__ = ["SharedContext",]+# Keep package-level imports lightweight so `import headroom` does not eagerly+# load provider SDKs, ML stacks, or optional proxy/runtime integrations._LAZY_EXPORTS: dict[str, tuple[str, str]] = {# Main client"HeadroomClient": ("headroom.client", "HeadroomClient"),@@ -266,7 +271,8 @@ _LAZY_EXPORTS: dict[str, tuple[str, str]] = {"SharedContext": ("headroom.shared_context", "SharedContext"),}-# Memory module - optional (requires numpy, hnswlib, etc.)+# Memory remains optional and preserves the long-standing behavior of exposing+# `None` when the extra dependencies are not installed._OPTIONAL_EXPORTS = {"with_memory": ("headroom.memory", "with_memory"),"Memory": ("headroom.memory", "Memory"),@@ -278,6 +284,7 @@ _OPTIONAL_EXPORTS = {def __getattr__(name: str) -> Any:+ """Resolve package exports lazily while preserving legacy import paths."""module_attr = _LAZY_EXPORTS.get(name)if module_attr is not None:module_name, attr_name = module_attr