staleness

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: May 15, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package staleness detects rules/skills that are no longer actively used or that contradict observed user behavior.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatReport

func FormatReport(stale []StaleRule) string

FormatReport generates a human-readable staleness report.

func RecommendAction

func RecommendAction(sr StaleRule) string

RecommendAction suggests what to do with a stale rule.

Types

type Contradiction

type Contradiction struct {
	RuleID       string
	UserBehavior string
	Timestamp    time.Time
}

Contradiction records when a user consistently does the opposite of what a rule says.

type Detector

type Detector struct {
	// contains filtered or unexported fields
}

Detector tracks which rules have influenced agent behavior and identifies stale ones.

func NewDetector

func NewDetector() *Detector

NewDetector creates a new staleness detector.

func (*Detector) AllUsages

func (d *Detector) AllUsages() map[string]*RuleUsage

AllUsages returns all tracked rule usages.

func (*Detector) CheckStaleness

func (d *Detector) CheckStaleness(threshold time.Duration) []StaleRule

CheckStaleness returns rules that haven't been used within the threshold duration.

func (*Detector) RecordContradiction

func (d *Detector) RecordContradiction(ruleID string, userBehavior string)

RecordContradiction records when user behavior contradicts what a rule prescribes.

func (*Detector) RecordRulePath

func (d *Detector) RecordRulePath(ruleID, path string)

RecordRulePath associates a filesystem path with a rule ID.

func (*Detector) RecordRuleUsed

func (d *Detector) RecordRuleUsed(ruleID string, timestamp time.Time)

RecordRuleUsed marks a rule as having been used at the given time.

type RuleUsage

type RuleUsage struct {
	RuleID   string
	Path     string
	LastUsed time.Time
	UseCount int
}

RuleUsage tracks when a rule was last used.

type StaleRule

type StaleRule struct {
	ID                 string
	Path               string
	LastUsed           time.Time
	DaysSinceUsed      int
	ContradictionCount int
	Contradictions     []Contradiction
}

StaleRule represents a rule that may no longer be relevant.

Jump to

Keyboard shortcuts

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