Spaces:
Build error
Build error
Commit History
-
Slim core dependencies: 2.5GB → 195MB install size
Move heavy deps to optional extras: sentence-transformers, torch, numpy, pillow, datasets, accelerate out of core. Remove unused deps entirely (semantic-router, protobuf, sentencepiece). New extras: [ml] for Kompress, [image] for image compression, [langchain] for LangChain integration. Guard memory/image imports so core install works without numpy/torch. Core (tiktoken, pydantic, litellm, click, rich) gives full compression: SmartCrusher, ContentRouter, CCR, TOIN, CLI.050d435 -
fix(wrap): route through proxy, prevent pipe deadlock, bump to 0.4.2
- Fix ANTHROPIC_API_URL → ANTHROPIC_BASE_URL (SDK uses BASE_URL) - Write proxy logs to ~/.headroom/logs/proxy.log instead of PIPE (macOS 64KB pipe buffer fills up, blocking the proxy process) - Add --auto-patch to rtk init to avoid interactive prompt timeout - Bump version to 0.4.2 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>a96b1bb -
Fix proxy backend bugs: env vars, tool forwarding, and provider support
- CLI now reads OPENAI_TARGET_API_URL, GEMINI_TARGET_API_URL, and HEADROOM_ANYLLM_PROVIDER environment variables - Add --openai-api-url and --gemini-api-url CLI flags - Remove --backend choices restriction so litellm-* backends work - Forward tools/tool_choice through LiteLLM and any-llm backends - Parse tool call arguments from JSON string to dict (Anthropic format) - Forward top_p, stop_sequences, tools in streaming paths - Update Vertex AI model map with Claude 3 through 4.6 (from official docs) - Bump version to 0.4.15a87378
-
Add Kompress: ModernBERT token compressor replacing LLMLingua-2
Adds kompress_compressor.py — a self-contained ModernBERT-based token compressor that auto-downloads from chopratejas/kompress-base on HuggingFace. Trained on 330K structured tool outputs (JSON, diffs, logs, code, SQL, agentic traces), achieving 82% entity preservation vs LLMLingua-2's 36%. Changes: - New: kompress_compressor.py — dual-head ModernBERT (token + span CNN) with HuggingFace auto-download, no extra pip install needed - ContentRouter: Kompress is primary ML compressor, LLMLingua-2 is fallback - fallback_strategy changed from PASSTHROUGH to KOMPRESS — unknown/mixed content now gets compressed instead of ignored - No hardcoded compression ratios — model decides per-token importance, optional target_ratio only when user explicitly sets it via API - Version bump: 0.3.8 → 0.4.0001364f
-
Bump version to 0.3.7
f5eea12 -
Add one-function compress() API, ASGI middleware, LiteLLM callback
Three new integration paths — no proxy needed: 1. headroom.compress(messages, model) → CompressResult One function, auto-detects tokenizer per model, works with any client. 2. headroom.integrations.asgi.CompressionMiddleware Drop-in ASGI middleware for LiteLLM proxy, FastAPI, or any ASGI app. 3. headroom.integrations.litellm_callback.HeadroomCallback LiteLLM callback: litellm.callbacks = [HeadroomCallback()] Fix: TransformPipeline._get_tokenizer() no longer requires a Provider. Falls back to tokenizer registry which auto-detects per model: - OpenAI → tiktoken (exact) - Anthropic → calibrated estimation (3.5 chars/token) - Open models → HuggingFace (if installed) 15 tests covering compress(), ASGI middleware, LiteLLM callback.6505c43 -
Bump version to 0.3.6
4a263c2 -
Add compression summaries, multi-provider headers, Dockerfile fix
Compression Summaries: - New: headroom/transforms/compression_summary.py - summarize_dropped_items(): categorizes compressed JSON items by field values (status, type, level, etc.), highlights errors/failures - summarize_compressed_code(): extracts function names from AST signatures (language-agnostic: Python, JS, Go, Rust, Java) - Newline-safe: strips \n from field values to keep markers single-line - SmartCrusher: CCR markers include categorical summary of dropped items e.g. "[500 items compressed to 20. Omitted: 87 passed, 2 failed. Retrieve more: hash=abc123. Expires in 5m.]" - CodeCompressor: CCR markers list compressed function names from AST e.g. "[180 tokens compressed. 5 bodies compressed: authenticate(). Retrieve more: hash=abc123. Expires in 5m.]" - Markers include TTL so LLM knows retrieval window - Summary escapes { } to prevent .format() crashes - Uses index-based dropped detection (not id()) for .copy() correctness Proxy Response Headers: - Anthropi…4d7e460
-
Fixing the DockerFile to have hnswlib working
3a888ea
-
Fix streaming crashes under concurrent sessions
- Cache LiteLLM model resolution to avoid synchronous cost_per_token() calls blocking the async event loop on every request (3.28ms → 0.12ms) - Add proper error handling in streaming generate() for httpx connection errors, timeouts, and pool exhaustion — previously crashed ASGI app - Bump version to 0.3.33b0b075 -
Bump version to 0.3.2
419f040
-
Bump version to 0.3.1
6196b9f
-
Add hierarchical memory system with graph + vector storage
Implement comprehensive memory system supporting: - Local backend (SQLite + FTS5 + HNSW) for zero-dependency operation - Mem0 backends (Neo4j + Qdrant) for production graph memory - DirectMem0Adapter for optimized pre-extracted data (bypasses LLM) - Memory extraction with facts, entities, and relationships - Proxy integration with --memory flag for automatic memory injection Key components: - headroom/memory/backends/: LocalBackend, Mem0Backend, DirectMem0Adapter - headroom/memory/system.py: MemorySystem with tool-based interface - headroom/memory/extraction.py: Entity and relationship extraction - headroom/proxy/memory_handler.py: Proxy integration layer - headroom/prediction/feature_extractor.py: Content analysis features Testing: - 217 new memory system tests covering all backends - LoCoMo evaluation framework for memory quality assessment - Integration tests for proxy memory functionality Also removes deprecated example files in favor of focused test coverage.eb1c19a
-
Replace legacy memory system with HierarchicalMemory
Major refactor of the memory module: - Add hierarchical scoping (user → session → agent → turn) - Add temporal versioning with supersession support - Add pluggable adapters (SQLite store, HNSW vectors, FTS5 text search) - Add protocol interfaces (ports) for all memory components - Update LRUMemoryCache to implement async MemoryCache protocol - Update wrapper.py to use HierarchicalMemory backend - Preserve with_memory() one-liner API with zero-latency inline extraction New files: - adapters/: sqlite.py, hnsw.py, fts5.py, cache.py, embedders.py - core.py: HierarchicalMemory orchestrator - models.py: Memory, MemoryCategory, ScopeLevel - ports.py: Protocol interfaces (MemoryStore, VectorIndex, etc.) - config.py: MemoryConfig with backend selection - factory.py: Component creation from config Removed legacy files: - store.py, fast_store.py, extractor.py, worker.py, fast_wrapper.py Breaking change: Removes legacy memory API (pre-0.3.0)04a98a0
-
Bump version to 0.2.15
4e944db
-
Add persistent memory system with zero-latency inline extraction
Features: - with_fast_memory(): Zero-latency inline extraction (Letta-style) - Memory extracted as part of LLM response, no extra API calls - Semantic retrieval with local embeddings (sub-50ms) - with_memory(): Background extraction for non-blocking memory - SQLite + FTS5 storage with vector similarity search - Multi-user isolation by user_id Memory enables temporal compression - extract key facts instead of carrying full conversation history (4000 tokens → 50 tokens). Includes: - Comprehensive test suite (71 new tests) - Documentation (docs/memory.md) - Benchmark examples comparing approaches - E2E test with LLM-as-judge evaluation9c9bb30
-
Publish headroom-ai v0.2.0 to PyPI with DevEx fixes
- Renamed package from 'headroom' to 'headroom-ai' (PyPI name conflict) - Fixed numpy/jinja2 imports to be lazy (core install no longer crashes) - Fixed SQLite default path (now uses temp directory) - Fixed f-string {tool} crash in proxy server - Updated README with correct package name and examples - Added quickstart and troubleshooting docs 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>90d3aea -
feat: Add CCR architecture, TOIN telemetry, and DevEx improvements
## Core Features ### Compress-Cache-Retrieve (CCR) Architecture - Implement reversible compression with automatic retrieval support - Add CompressionStore for caching original content with TTL-based eviction - Add CompressionFeedback for learning from retrieval patterns - Implement tool injection for LLM retrieval capability - Add MCP server support for CCR operations - Track retrieval rates to dynamically adjust compression aggressiveness ### Tool Output Intelligence Network (TOIN) - Implement cross-session pattern learning for tool compression - Add ToolSignature for structural hashing of tool outputs - Track compression success rates per strategy (top_n, sample, truncate, etc.) - Implement privacy-preserving telemetry with SHA256 hashing - Add persistent storage with JSON file backend - Support network-effect learning across tool types ### SmartCrusher Enhancements - Add crushability analysis with variance/uniqueness detection - Implement statistical anomaly detection for outlier…c1feb60
-
Add cache optimization module with scalable dynamic content detection
Implements a comprehensive cache optimization layer for LLM providers: - Provider-specific optimizers (Anthropic, OpenAI, Google) with distinct caching strategies: explicit breakpoints, prefix stabilization, and CachedContent API respectively - Scalable dynamic content detector using three strategies: 1. Structural detection: "Label: value" patterns (language-agnostic) 2. Entropy-based detection: high-entropy strings (IDs, tokens, hashes) 3. Universal patterns: ISO 8601, UUIDs, JWTs, hex hashes - NO hardcoded locale-specific patterns (no month names, etc.) - Semantic caching layer with LRU eviction and TTL support - Plugin registry for provider selection and custom optimizers - 131 tests, real-world benchmarks showing 20-55% compression at <0.3ms7a05808 -
Prepare for OSS release v0.2.0
This commit prepares Headroom for public open source release with comprehensive documentation, licensing, and community infrastructure. License & Legal: - Add Apache 2.0 LICENSE file - Add NOTICE file with third-party attributions - Add SECURITY.md for vulnerability reporting Community: - Add CONTRIBUTING.md with contribution guidelines - Add CODE_OF_CONDUCT.md (Contributor Covenant) - Add GitHub issue templates (bug report, feature request) - Add pull request template Documentation: - Update README.md with compelling value proposition - Add docs/getting-started.md - Add docs/proxy.md for proxy server documentation - Add docs/transforms.md for transform reference - Add docs/api.md for API reference - Add examples/README.md Package Infrastructure: - Add headroom/py.typed for PEP 561 compliance - Add headroom/cli.py for CLI entry point - Add .github/workflows/ci.yml for CI pipeline - Add .github/workflows/publish.yml for PyPI publishing - Update pyproject.toml with proper metadata N…175746c -
Initial commit: Headroom SDK - LLM context optimization toolkit
A comprehensive SDK for optimizing LLM context windows, reducing token usage while preserving critical information for AI agents. Core Features: - SmartCrusher: Statistical compression of tool outputs (70-85% reduction) - CacheAligner: Prefix optimization for prompt cache hits - RollingWindow: Intelligent context window management - BM25/Hybrid relevance scoring for smart item selection Integrations: - OpenAI and Anthropic provider support - LangChain integration (ChatModel, Callbacks, Runnable) - MCP (Model Context Protocol) integration for tool compression Test Coverage: - 372 tests passing across all modules - 35 performance benchmarks - Real-world agent evaluations with 88% token savings Key Components: - headroom/transforms/: Core compression transforms - headroom/providers/: OpenAI and Anthropic support - headroom/integrations/: LangChain and MCP integrations - headroom/relevance/: BM25 and hybrid scoring - headroom/pricing/: Model pricing registry - benchmarks/: Performance …9c7d451