Skip to main content

Module features

Module features 

Source
Expand description

The request feature vector (SPEC §9.2) — deterministic, versioned, privacy-preserving.

Features are the input to routing policy. They are extracted deterministically from a request so that the same request always produces the same vector (a precondition for a re-derivable audit trail), and they are privacy-preserving by construction: no raw prompt text, only coarse buckets and salted hashes. The vector is versioned (FEATURE_VERSION); a change to how any feature is computed bumps the version so old traces remain interpretable.

Structs§

Features
The per-request feature vector (§9.2).

Enums§

TaskKind
Coarse task classification. Other is the safe default when classification is uncertain.

Constants§

FEATURE_VERSION
Version of the feature-extraction contract. Bump on any change to how a feature is computed. Recorded per trace as features@vN.

Functions§

hour_bucket
Hour-of-day bucket in UTC (0..=23) for a timestamp — a routing feature (traffic varies by hour) that leaks nothing finer than the hour.
repo_fingerprint
Salted, truncated fingerprint of a repository identity: the first 16 hex chars of SHA-256(salt || 0x00 || repo).
token_bucket
Bucket a token count into a coarse, privacy-preserving band: floor(log2(n)), with 0 and 1 both mapping to bucket 0.