Documentation
¶
Overview ¶
Package squoze is the library facade for the universal, deterministic LLM context optimizer ("your context, squoze.").
Typical gateway embedding:
eng := squoze.NewEngine(squoze.DefaultMemoCapacity) out, res := eng.Apply(requestBody)
One Engine instance per process keeps the decision memo warm: identical original bytes always produce byte-identical output, which keeps provider prompt caches stable across turns. See README.md for the quality contracts (fail-open, never-elide, cache-safe, reversible).
Index ¶
Constants ¶
const DefaultMemoCapacity = engine.DefaultMemoCapacity
DefaultMemoCapacity bounds the per-process decision memo (~4k blobs).
const SkipBodyTooLarge = engine.SkipBodyTooLarge
SkipBodyTooLarge is the Result.SkipReason set when MaxBodyBytes rejected a body before its format was even sniffed.
const Version = engine.Version
Version mirrors the CLI version.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Engine ¶
Engine runs the optimization pipeline with its cache-guard state.
func NewEngineWithLimits ¶ added in v0.4.0
NewEngineWithLimits is NewEngine with explicit bounds. Engines with different Limits must not be shared: the bounds decide what a body turns into, so the decision memo is only sound within one set of them.
type Limits ¶ added in v0.4.0
Limits bounds the work one Apply may do, in bytes. The zero value is v0.3.0 behaviour exactly: no bound is applied unless it is configured.
Bounds are sizes and never durations on purpose. A wall-clock deadline would make the output depend on how loaded the host was, and the cache-safe contract requires that identical original bytes always produce byte-identical output — a request that compresses on an idle box and passes through on a busy one breaks every provider prompt cache downstream of it.
Directories
¶
| Path | Synopsis |
|---|---|
|
cmd
|
|
|
squoze
command
Command squoze is the universal, deterministic LLM context optimizer.
|
Command squoze is the universal, deterministic LLM context optimizer. |
|
internal
|
|
|
compress
Package compress implements the first real transform: head/tail elision of verbose machine output, under the quality contracts.
|
Package compress implements the first real transform: head/tail elision of verbose machine output, under the quality contracts. |
|
engine
Package engine hosts the squoze optimization pipeline.
|
Package engine hosts the squoze optimization pipeline. |
|
eval
Package eval hosts the deterministic quality-fixture harness: realistic tool-output classes with must-survive facts and minimum savings floors.
|
Package eval hosts the deterministic quality-fixture harness: realistic tool-output classes with must-survive facts and minimum savings floors. |
|
harness
Agent-level presets: the coding agents themselves (as opposed to raw providers).
|
Agent-level presets: the coding agents themselves (as opposed to raw providers). |
|
profile
Package profile adapts compression aggressiveness to the target model family.
|
Package profile adapts compression aggressiveness to the target model family. |
|
proxy
Package proxy implements the drop-in HTTP proxy mode:
|
Package proxy implements the drop-in HTTP proxy mode: |
|
router
Package router classifies text blobs so the engine can decide WHO gets squeezed and who must pass through untouched.
|
Package router classifies text blobs so the engine can decide WHO gets squeezed and who must pass through untouched. |
|
store
Package store provides the content-addressed decision memo behind the cache-guard contract.
|
Package store provides the content-addressed decision memo behind the cache-guard contract. |
|
wire
Package wire detects the wire format of an LLM request body.
|
Package wire detects the wire format of an LLM request body. |
|
wrap
Package wrap implements `squoze wrap CMD`: run an agent command with its provider base URLs pointed at an in-process squoze proxy.
|
Package wrap implements `squoze wrap CMD`: run an agent command with its provider base URLs pointed at an in-process squoze proxy. |