Stable tool-contract APIs
The released tool surface supports copied schema normalization, deterministic canonical JSON, SHA-256 fingerprints, exact contract checks, and safe catalog optimization.
LLMSlim releases document what shipped, what changed, and where the boundary remains. Phase 2 is an engineering and benchmark milestone—not an invented package version.
This Python release adds stable, conservative tool-schema infrastructure while keeping retrieval and selective exposure research-only.
The released tool surface supports copied schema normalization, deterministic canonical JSON, SHA-256 fingerprints, exact contract checks, and safe catalog optimization.
Lexical, dense, hybrid retrieval, selective exposure, and lazy hydration are explicit experiments. They do not authorize or execute tools, and compress() keeps its established behavior.
The v0.4.0 release gate records 489 passing tests, 90.93% coverage, and 375 generated tool schemas in 18 catalogs. The compact baseline produced 0.00% lossless reduction.
This security-focused Python release strengthens caller-declared trust boundaries and makes token-counter provenance visible in the public result.
ContextRole distinguishes system, developer, user, assistant, tool, RAG, and general content. Untrusted RAG, tool, and assistant text cannot become hard-locked priority from imperative wording, safety patterns, or preserve patterns.
User text containing a template-fence-like delimiter remains byte-for-byte unchanged while the template uses a content-preserving nonce fence, preventing fence breakout.
The public Python API exports ContextRole and records token_counter_used so callers can distinguish tiktoken from the documented heuristic fallback.
Inline backtick code spans no longer create false sentence boundaries, and the CJK ideographic stops 。, !, and ? are recognized by the sentence-splitting paths.
Document compression defaults retrieved context to RAG, while chat compression propagates supplied system, developer, user, assistant, and tool roles instead of flattening them.
The release runner collects actual pass/fail reports rather than replaying stale tuples. The checked-in release record reports 432 passing tests, zero failures, 92.57% branch coverage, and Ruff passing.
v0.3.0 expanded the package from its offline extractive default into an extensible rewrite and hybrid framework without bundling an LLM provider.
compress() gained extractive, rewrite, and hybrid strategies. Rewrite-capable paths require a caller-supplied provider; the default extractive path remains offline and deterministic.
BaseRewriteProvider, CallableProvider, RewriteRequest, RewriteMetadata, versioned templates, and structural, instruction, entity, and similarity validation were added as public building blocks.
Prompt construction, execution, and validation were separated into llmslim.rewrite modules, with strategy benchmarking and a CLI strategy flag added alongside them.
v0.2.0 deepened the original extractive engine with instruction and entity protection, chunking improvements, cost tooling, and a fuller command-line and benchmark surface.
The release added explicit instruction prioritization plus regex and heuristic preservation for names, dates, financial metrics, technical identifiers, and URLs.
It introduced semantic and hybrid chunking, optional sentence-transformers support, model cost estimation, an interactive/file-based CLI, and comprehensive benchmark tooling.
TF-IDF plus PageRank-style sentence centrality, optional tiktoken accounting, and a standardized CompressionResult with detailed telemetry became part of the release.
The first LLMSlim release established the installable Python package and its simple offline compression entry point.
v0.1.0 published the llmslim package for Python 3.8+ with the public compress(), ContextCompressor, CompressionResult, token, pipeline, and cost utility exports.
The initial engine provided ratio-driven prompt compression using TF-IDF sentence scoring and thresholding, with optional semantic, fast-token, and NLTK extras.
Important: LLMSlim mitigates compression-induced instruction elevation. It does not claim to solve prompt injection completely, authenticate caller-provided roles, or ship an npm, Rust, or WASM runtime.