Skip to main content

Module interfaces

Module interfaces 

Source
Expand description

Pithy interface contracts — FROZEN at Phase 0.

This module defines the trait and type contracts that every other crate in the workspace depends on. Semver commitment: any breaking change to these types or traits requires a major-version bump and coordinated release across all consumers.

Copyright (c) 2026 Mikko Parkkola. All rights reserved. Licensed under PolyForm Noncommercial 1.0 + Pithy Attribution Rider.

Structs§

Compressed
Output of a single compression operation.
CostEntry
Cost translation for a single record.
Integrity
Cryptographic fields of a signed record. Phase 1 must populate BOTH ed25519 and ML-DSA signatures (Day-1 PQC).
QualityScore
Optional quality measurement attached to a Record when the proxy ran a shadow comparison between the compressed and the prose arm at sample rate.
Record
A single signed measurement record. Wire format frozen at v0.1.
RecordId
Opaque id for a stored record.
StreamDelta
Per-stream delta between uncompressed and compressed.

Enums§

FallbackReason
Reason the encoder fell back to a less aggressive format.
Format
One of the four compression formats defined by the Pithy specification.
LogError
Error type for the measurement log.
Model
The upstream LLM whose tokenizer rules the measurement.
SignerError
Error type from the signer.
TokenizerError
Error from the measurer path. Kept narrow so downstream code can fall back.

Traits§

Encoder
A pass-through encoder interface. Implementors MUST preserve semantic fidelity of the compressed output at or above the Phase-0 kill-switch threshold (≥0.90 cosine similarity under the target LLM’s response).
MeasurementLog
Log of signed measurement records. Append-only; tampering detectable via merkle.
Measurer
Count real tokens for the target model. No estimation, no synthetic fallback.
Signer
Dual-signing facade. Implementations sign with BOTH ed25519 and ML-DSA.