scoring

package
v0.21.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 12, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AdherenceLevel

type AdherenceLevel string

AdherenceLevel represents a skill's compliance level.

const (
	AdherenceInvalid    AdherenceLevel = "Invalid"
	AdherenceLow        AdherenceLevel = "Low"
	AdherenceMedium     AdherenceLevel = "Medium"
	AdherenceMediumHigh AdherenceLevel = "Medium-High"
	AdherenceHigh       AdherenceLevel = "High"

	TokenSoftLimit = 500
	TokenHardLimit = 5000
)

func ParseAdherenceLevel

func ParseAdherenceLevel(s string) (AdherenceLevel, error)

ParseAdherenceLevel converts a string flag value to an AdherenceLevel.

func (AdherenceLevel) AtLeast

func (a AdherenceLevel) AtLeast(target AdherenceLevel) bool

AtLeast returns true if a is at or above the target level.

func (AdherenceLevel) String

func (a AdherenceLevel) String() string

type HeuristicScorer

type HeuristicScorer struct {
	// TokenSoftLimit overrides the default warning threshold when > 0.
	TokenSoftLimit int
	// TokenLimit overrides the default hard limit when > 0.
	TokenLimit int
	// SkillCount is the total number of skills in the catalog (for context-dependent scoring).
	// Optional; if 0, context-dependent checks are skipped.
	// TODO: Callers should plumb the catalog skill count from workspace detection
	// to enable context-dependent anti-trigger risk scaling in production runs.
	SkillCount int
}

HeuristicScorer scores skills using pattern-matching heuristics.

func (HeuristicScorer) Score

func (h HeuristicScorer) Score(sk *skill.Skill) *ScoreResult

type Issue

type Issue struct {
	Rule     string
	Message  string
	Severity string // "error" or "warning"
}

Issue represents a specific compliance problem found.

type ScoreResult

type ScoreResult struct {
	Level             AdherenceLevel
	Issues            []Issue
	DescriptionLen    int
	HasTriggers       bool
	HasAntiTriggers   bool
	HasRoutingClarity bool
	TriggerCount      int
	AntiTriggerCount  int
}

ScoreResult holds the complete scoring output.

type Scorer

type Scorer interface {
	Score(*skill.Skill) *ScoreResult
}

Scorer evaluates a skill and returns a score.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL