Skip to main content

SkillStats

Struct SkillStats 

Source
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: String

SHA-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: f64

Confidence 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: u64

Count 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

Source

pub fn new( skill_name: &str, skill_version: &str, manifest_digest: &str, now: DateTime<Utc>, ) -> Self

Source

pub fn path(mur_home: &Path, skill_name: &str) -> PathBuf

Source

pub fn path_agent(mur_home: &Path, agent: &str, skill_name: &str) -> PathBuf

Per-agent stats path: <MUR_HOME>/agents//skills//stats.json

Source

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.

Source

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.

Source

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).

Source

pub fn reset_for_new_manifest( &mut self, new_version: &str, new_digest: &str, now: DateTime<Utc>, )

Reset counters for a manifest change, preserving pinned state and first-success timestamp.

Trait Implementations§

Source§

impl Clone for SkillStats

Source§

fn clone(&self) -> SkillStats

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for SkillStats

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for SkillStats

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for SkillStats

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,