Skip to main content

Module lifecycle

Module lifecycle 

Source
Expand description

Pure-function lifecycle + decay layer. Functions take inputs, return outputs, never touch disk. M5b’s sweep calls these to decide transitions and persist; M5a’s doctor calls them for read-only display.

Constants§

AUTO_ARCHIVE_AGE_DAYS
AUTO_ARCHIVE_CONFIDENCE
DEMOTE_EMERGING_SUCCESS_RATE
DEMOTE_EMERGING_USES
Demotion thresholds — values that MUST drop BELOW. Hysteresis: lower than the symmetric promotion threshold to prevent flap.
DEMOTE_STABLE_SUCCESS_RATE
DEMOTE_STABLE_USES
DEPRECATED_NO_SUCCESS_DAYS
DEPRECATED_SUCCESS_RATE
MIN_CONFIDENCE
MIN_DWELL_HOURS
PROMOTE_DRAFT_USES
Promotion thresholds — values that MUST be exceeded.
PROMOTE_EMERGING_AGE_DAYS
PROMOTE_EMERGING_SUCCESS_RATE
PROMOTE_EMERGING_USES
PROMOTE_STABLE_AGE_DAYS
PROMOTE_STABLE_SUCCESS_RATE
PROMOTE_STABLE_USES

Functions§

calculate_decay
Compute decayed confidence given an anchor, last success time, and the half-life for the current lifecycle state.
cap_for_provenance
Cap a proposed lifecycle state for LLM-authored, uncurated skills.
half_life_days
Half-life (days) for confidence decay, indexed by current state.
next_state
Compute what state the skill should be in given its current stats and the current time. PURE — does not mutate. Idempotent: calling this twice with the same inputs returns the same output.
on_promotion
Called by the M5b sweep AFTER persisting a promotion. Resets the confidence anchor so the new half-life applies from current, not stale, confidence. Without this, a skill promoted from Draft to Emerging would carry its already-decayed anchor under the longer Emerging half-life and appear artificially fresh forever.
transition_allowed
Returns true if the transition from from to to may be persisted right now. Even when next_state says a transition is warranted, this guard prevents: