Expand description
Phase 19.1 – compliance scoring on top of ComplianceReport.
Productizes the existing crate::operator_report::ComplianceReport
into a user-facing 0..=1000 score with weighted factors:
| Factor | Max points | Signal |
|---|---|---|
| Deny rate | 300 | denies / total_observed |
| Revocation rate | 300 | revoked_caps / observed_caps (or flag) |
| Velocity anomaly rate | 150 | anomaly_windows / total_windows |
| Policy coverage | 150 | lineage + checkpoint rates (averaged) |
| Attestation freshness | 100 | age of latest attestation vs. staleness |
Weights sum to 1000. Each factor produces a 0..=max deduction; the
final score is 1000 - total_deductions, clamped to [0, 1000].
This module is additive: it consumes a ComplianceReport without
modifying its fields. Callers who already materialize a compliance
report reuse its figures verbatim.
Structs§
- Compliance
Factor - Per-factor deduction detail (0..=max points).
- Compliance
Factor Breakdown - Full factor breakdown for a compliance score.
- Compliance
Score - Final compliance score for an agent over a window.
- Compliance
Score Config - Options controlling scoring thresholds. Defaults match the roadmap’s 19.1 acceptance targets (zero denies in 1000 calls -> >900; any revoked cap -> <500).
- Compliance
Score Inputs - Observed compliance inputs that are not carried by
ComplianceReport.
Constants§
- COMPLIANCE_
SCORE_ MAX - Maximum possible compliance score.
- DEFAULT_
ATTESTATION_ STALENESS_ SECS - Default staleness threshold (seconds) beyond which the attestation
freshness factor is fully deducted. Ninety days mirrors the default
receipt-retention window in
crate::receipt_store::RetentionConfig. - WEIGHT_
ATTESTATION_ FRESHNESS - Weight for the attestation-freshness factor.
- WEIGHT_
DENY_ RATE - Weight (maximum-deducted points) for the deny-rate factor.
- WEIGHT_
POLICY_ COVERAGE - Weight for the policy-coverage factor.
- WEIGHT_
REVOCATION - Weight for the revocation factor.
- WEIGHT_
VELOCITY_ ANOMALY - Weight for the velocity-anomaly factor.
Functions§
- compliance_
factor_ breakdown - Build the per-factor breakdown without wrapping it in a score.
- compliance_
score - Compute the weighted compliance score for an agent.