pub struct SkillStats {Show 17 fields
pub schema_version: u32,
pub skill_name: String,
pub skill_version: String,
pub manifest_digest: String,
pub lifecycle_state: LifecycleState,
pub lifecycle_changed_at: DateTime<Utc>,
pub pinned: bool,
pub pinned_reason: String,
pub usage_count: u64,
pub success_count: u64,
pub failure_count: u64,
pub last_used_at: Option<DateTime<Utc>>,
pub last_success_at: Option<DateTime<Utc>>,
pub first_successful_use_at: Option<DateTime<Utc>>,
pub anchor_confidence: f64,
pub rebuilt_from_trace_through: Option<DateTime<Utc>>,
pub resolution_misses: u64,
}Expand description
Sidecar stats for an installed skill. Not part of the signed manifest.
Schema evolution policy: additive only. New fields MUST be marked
#[serde(default)] so older mur builds reading newer files (and newer
builds reading older files) parse cleanly without migration. Do not
pre-reserve fields without a producer — empty defaults create semantic
ambiguity (“never set” vs “set to empty”). Add fields when their
callers exist.
Fields§
§schema_version: u32§skill_name: String§skill_version: String§manifest_digest: StringSHA-256 of the manifest content at the time these stats were
(re)initialised. A mismatch on load tells us the skill was
reinstalled — see reset_on_manifest_change().
lifecycle_state: LifecycleState§lifecycle_changed_at: DateTime<Utc>§pinned: bool§pinned_reason: String§usage_count: u64§success_count: u64§failure_count: u64§last_used_at: Option<DateTime<Utc>>§last_success_at: Option<DateTime<Utc>>§first_successful_use_at: Option<DateTime<Utc>>§anchor_confidence: f64Confidence at the moment of the most recent successful use (or
most recent promotion — see lifecycle::on_promotion). Decay is
computed from this anchor, never incrementally — keeps the
value numerically stable and idempotent on read.
rebuilt_from_trace_through: Option<DateTime<Utc>>Watermark for incremental reindex — the trace timestamp that
these stats have already absorbed. mur skill reindex-stats
resumes from here.
resolution_misses: u64Count of inject-time Resolution::Unresolved outcomes for this skill.
A spike here means the skill declares intents that no longer match the
agent’s MCP inventory — doctor’s intent-resolvable check surfaces this.
Implementations§
Source§impl SkillStats
impl SkillStats
pub fn new( skill_name: &str, skill_version: &str, manifest_digest: &str, now: DateTime<Utc>, ) -> Self
pub fn path(mur_home: &Path, skill_name: &str) -> PathBuf
Sourcepub fn path_agent(mur_home: &Path, agent: &str, skill_name: &str) -> PathBuf
pub fn path_agent(mur_home: &Path, agent: &str, skill_name: &str) -> PathBuf
Per-agent stats path: <MUR_HOME>/agents/
Sourcepub fn load(path: &Path) -> Result<Option<Self>>
pub fn load(path: &Path) -> Result<Option<Self>>
Read the sidecar, or return None if absent. Lock-free — fine
for read-mostly callers (doctor, info, stats). Concurrent writers
going through merge_in_place will not corrupt the file because
they hold the exclusive lock during the write window.
Sourcepub fn merge_in_place(
path: &Path,
default: impl FnOnce() -> Self,
merge_fn: impl FnOnce(&mut Self) -> Result<()>,
) -> Result<()>
pub fn merge_in_place( path: &Path, default: impl FnOnce() -> Self, merge_fn: impl FnOnce(&mut Self) -> Result<()>, ) -> Result<()>
Read-merge-write under an exclusive fd-lock. merge_fn is
called with the loaded value (or the supplied default if none
exists) and is responsible for applying the delta. The lock
window is microseconds — counter increments only.
Sourcepub fn is_stale(&self, current_digest: &str) -> bool
pub fn is_stale(&self, current_digest: &str) -> bool
Returns true if the loaded stats refer to a different manifest
digest than the one currently installed. Callers (the aggregator
and reindex) should reset() in that case rather than carry
counters across an upgrade.
A version bump resets usage_count / success_count /
failure_count but preserves pinned,
first_successful_use_at, and lifecycle_state (a Canonical
skill bumping to 1.2.0 should not regress to Draft).
Trait Implementations§
Source§impl Clone for SkillStats
impl Clone for SkillStats
Source§fn clone(&self) -> SkillStats
fn clone(&self) -> SkillStats
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more