Expand description
Heuristic compression primitives for AINL hosts.
This crate currently exposes the ArmaraOS “Ultra Cost-Efficient Mode” input compressor. It is intentionally embedding-free and dependency-light so it can be reused across hosts without shipping local ML models.
Companion modules (no I/O; host wiring stays out-of-crate):
profiles— built-in compression profiles and project→profile hintsadaptive— content-shapedEfficientModerecommendationscache— TTL hysteresis for cache-aware coordination
Set RUST_LOG=ainl_compression=debug to enable full before/after text
logging per call (useful for tuning preserve lists and retention ratios).
Re-exports§
pub use adaptive::recommend_mode_for_content;pub use adaptive::AdaptiveRecommendation;pub use cache::cache_policy_summary;pub use cache::effective_ttl_with_hysteresis;pub use cache::CacheTtlResult;pub use profiles::list_builtin_profiles;pub use profiles::resolve_builtin_profile;pub use profiles::suggest_profile_id_for_project;pub use profiles::CompressionProfile;pub use profiles::BUILTIN_PROFILES;
Modules§
- adaptive
- Embedding-free content classifier for adaptive eco mode selection.
- cache
- Cache-aware TTL coordination hints for compression-related caches.
- profiles
- Built-in compression profiles (policy vocabulary for hosts).
Structs§
- Compressed
- Result of a compression pass.
- Compression
Metrics - Structured telemetry emitted for each compression operation.
- Prompt
Compressor - Standalone input prompt compressor.
Enums§
- Efficient
Mode - Input compression aggressiveness.
Traits§
- Compression
Telemetry Sink - Optional telemetry sink for compression metrics.
Functions§
- compress
- Compress
texttowardmode.retain()of its original token budget. - compress_
with_ metrics - Compress and return structured telemetry metrics in one call.
- estimate_
semantic_ preservation_ score - Lightweight lexical semantic-preservation heuristic in range 0.0..1.0.
- tokenize_
estimate - Heuristic token estimate (~4 chars per token, +1 minimum).