Library calls
Four operations form the stable core API:Simulate is an auxiliary operation that evaluates a transform without committing normal runtime effects.
Callers should treat original-byte output as a valid result. It means no eligible transform passed all gates.
Compression pipeline
No compressor, parse error, larger result, or recovery-store failure returns original bytes. Unknown modes also return original bytes.record mode always passes input through.
Automatic detection
Automatic detection recognizes:- JSON
- test reports (a JUnit XML root element, or top-level pytest-json-report or Jest JSON keys, that parse with at least one test)
- terminal output
- diffs
- HTML
- tabular data
- source code
- logs
- search results
- configuration text
- general text
Compressor registry
Default registry contains 16 compressors:- JSON
- log
- code
- diff
- search result
- text
- HTML
- tabular
- configuration
- tool schema
- tool-schema annotations
- TOON
- accessibility tree
- repetition
- terminal output
- test report (JUnit, pytest, Jest): keeps the counts and every failure
caveman-proxy and caveman-engine are cgo builds on all six targets, cross-compiled with a pinned zig (scripts/build-release-binaries.mjs); releases up to bin-v2.0.2 were pure-Go, so their code compression covered Go only. The other four release binaries, the container image, and any CGO_ENABLED=0 source build are still pure-Go. GDScript is elided by a line scanner in both builds: the language is indentation-scoped and has no grammar in either.
Each compressor declares a safety class and implements its own parse and output rules. Current compressors belong to lossy class S4, even when a particular input can round-trip structurally. Callers must not infer byte safety from a compressor name.
Recovery requirement
A lossy result may be emitted only when exact original bytes are recoverable. Native callers supply a recovery store. Browser builds use an in-memory store; host runtimes normally use SQLite. If no recovery store exists, Engine keeps original input. See Context recovery for handles, limits, and object pointers.Token accounting
Engine uses an offlineo200k_base counter where available. A character-based estimate is the fallback. Local counts therefore use an inferred basis unless a provider supplies its own usage. They are useful for comparison and capacity planning, not provider billing reconciliation.
Input limits
CLI compression accepts input up to 64 MiB. Recovery storage has a separate configured capacity and a default payload ceiling of 512 MiB. Inputs exceeding limits are rejected or passed through according to caller contract; they are never silently truncated.Native and WebAssembly builds
Engine can run as:- a Go library
- a native CLI used by the JavaScript launcher
- a WebAssembly module for browser-compatible consumers
Engine CLI
cave_input_too_large above it. Caller-supplied eval fixtures are confined to DIR; traversal and escaping symlinks fail closed.
Persistent CCR storage retains at most 512 MiB of payloads by default. Set CAVEMAN_CCR_MAX_BYTES to a positive byte count before startup to choose a different cap. At cap, new lossy transforms fail closed to original-byte pass-through; existing handles are never evicted and remain recoverable.
Adding a compressor
A new compressor needs:- an unambiguous name and declared safety class
- bounded parsing and deterministic output
- original-byte fallback on invalid input
- recovery integration for lossy output
- fixtures covering valid, invalid, larger-output, and boundary cases
- registration in the default registry only when automatic or explicit selection behavior is clear
LICENSING.md.