feat(gen2): add experience skill reflex lifecycle

This commit is contained in:
m
2026-08-30 21:56:33 +03:00
parent a07aba056d
commit 8ec7c7419f
17 changed files with 523 additions and 32 deletions
+18 -3
View File
@@ -27,15 +27,30 @@ type StrategyDecision struct {
Escalate bool
}
// StrategyEligibility is supplied by Capability lifecycle resolution. It keeps
// a requested cheap route from becoming an entitlement to use stale evidence.
type StrategyEligibility struct {
RuleEligible bool
ReflexEligible bool
SkillEligible bool
}
func (r StrategyRequest) Select() StrategyDecision {
return r.SelectEligible(StrategyEligibility{RuleEligible: true, ReflexEligible: true, SkillEligible: true})
}
func (r StrategyRequest) SelectEligible(eligible StrategyEligibility) StrategyDecision {
if r.RiskClass == "HIGH" || r.CostOfError >= 800 {
return StrategyDecision{Path: PathStrongLocal, Reason: "high consequence requires deeper reasoning", Escalate: true}
}
if r.RequiredQuality <= 500 && r.CostBudgetMicros > 0 {
if eligible.RuleEligible && r.RequiredQuality <= 500 && r.CostBudgetMicros > 0 {
return StrategyDecision{Path: PathRule, Reason: "bounded low-risk path"}
}
if r.PreferLowLatency {
if eligible.ReflexEligible && r.PreferLowLatency {
return StrategyDecision{Path: PathReflex, Reason: "latency preference with later escalation"}
}
return StrategyDecision{Path: PathSkill, Reason: "validated reusable strategy"}
if eligible.SkillEligible {
return StrategyDecision{Path: PathSkill, Reason: "validated reusable strategy"}
}
return StrategyDecision{Path: PathSmallLocal, Reason: "no eligible reflex or skill; escalate to reasoning", Escalate: true}
}
+16
View File
@@ -10,6 +10,7 @@ const (
ReflexActive ReflexLifecycle = "ACTIVE"
ReflexDegraded ReflexLifecycle = "DEGRADED"
ReflexStale ReflexLifecycle = "STALE"
ReflexRevalidating ReflexLifecycle = "REVALIDATING"
ReflexSuspended ReflexLifecycle = "SUSPENDED"
ReflexRetired ReflexLifecycle = "RETIRED"
ReflexDeterministicCode ReflexKind = "DETERMINISTIC_CODE"
@@ -58,4 +59,19 @@ type ReflexRevision struct {
LastValidatedAt int64
Lifecycle ReflexLifecycle
RecordedAt int64
SupersedesRevision int64
ExecutionCount int64
FailureCount int64
DivergenceCount int64
}
// ShadowComparison is evidence produced by a bounded shadow sample. It is not
// permission to rewrite a Reflex; SELF/governed evaluation decide next steps.
type ShadowComparison struct {
ReflexID ReflexID
ReflexRevision int64
EvidenceRefs []SkillEvidenceRef
VerifierPassed bool
Diverged bool
ObservedAt int64
}
+10
View File
@@ -70,6 +70,7 @@ const (
SkillCandidate SkillLifecycleStatus = "CANDIDATE"
SkillEvaluating SkillLifecycleStatus = "EVALUATING"
SkillValidated SkillLifecycleStatus = "VALIDATED"
SkillActive SkillLifecycleStatus = "ACTIVE"
SkillDegraded SkillLifecycleStatus = "DEGRADED"
SkillSuspended SkillLifecycleStatus = "SUSPENDED"
SkillRetired SkillLifecycleStatus = "RETIRED"
@@ -202,6 +203,15 @@ type SkillProfile struct {
ObservedFailureCount int64
ObservedCorrectionCount int64
RecordedAtUnixMillis int64
// The fields below are the additive Gen2 lifecycle view. The older fields
// remain a compatibility projection; they are not another Skill registry.
Applicability ApplicabilitySpec
DependencyRefs []string
ValidationEvidenceRefs []SkillEvidenceRef
IndependentEvaluationRefs []SkillEvidenceRef
KnownFailureConditions []string
VerifiedOutcomeCount int64
MustNotWorsenSatisfied bool
}
type SkillOutcomeObservation struct {