curator

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package curator is the file-time learning gate: it dedups a finding against the catalog and open PRs, gates on quality, and drafts a merge-ready PR for novel, quality findings. Uncertain/low-quality findings produce NO repo artifact (the chat delivery already informed the human). It never opens issues — the only issues are knowledge-gap issues, opened by the curate agent (Phase 2).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DupFingerprint

func DupFingerprint(inv providers.Investigation) string

DupFingerprint is a deterministic identity for "the same incident", used to dedupe curated PRs across re-investigations. It prefers the trigger key stamped at trigger time (a structured K8s signal — the alert fingerprint, or the failing resource + condition reason): re-investigations of one ongoing incident reword the LLM's prose cause but share the same trigger, so keying on the trigger is what coalesces them to a single open PR (#137). When no trigger key is present (e.g. a human `lore investigate "<symptom>"`), it falls back to the affected- resource ref plus the significant-token set of the top root cause. Unlike Fingerprint (a fuzzy BM25 query) it is an exact hash. It returns "" when there is nothing to key on — an empty fingerprint must never match another.

func Fingerprint

func Fingerprint(inv providers.Investigation) string

Fingerprint builds the dedup query string for a finding: the alert/title, the top root-cause signature, and the affected workload. It is a BM25 query (fuzzy), not a hash — matched against the catalog index and open-PR titles.

func IncidentKey added in v0.3.0

func IncidentKey(alertname, namespace, kind, name, cluster string) string

IncidentKey builds a host-invariant, per-class dedup key for an alert: the alert class + affected workload family + cluster, with the volatile pod-hash suffix stripped. The same alert on a different pod/node yields the same key (so it dedupes to one KB entry), while a different cluster stays distinct. Returned as the alert TriggerKey and folded into DupFingerprint. "" when there is no signal.

Types

type Curator

type Curator struct {
	Forge         providers.CurationForge
	Catalog       catalog.ScoredSearcher // nil ⇒ no catalog dedup
	Metrics       *telemetry.Metrics     // optional; nil-safe — dedup score unrecorded when unset
	DupScore      float64                // catalog BM25 dup threshold
	MinConfidence float64                // quality gate: minimum overall confidence
	// SkipVerdicts holds verdicts that must NOT draft a KB PR (e.g. no_action).
	// A nil/empty map draws no distinction — every verdict is eligible, preserving
	// pre-gate behaviour.
	SkipVerdicts map[providers.Verdict]bool
	Log          *slog.Logger
}

Curator is the file-time learning gate. It dedups, quality-gates, and drafts a merge-ready PR for novel quality findings; everything else produces no repo artifact.

func (*Curator) Curate

Curate applies the three-step gate. It returns the created PR ref, or an empty ref when the finding was coalesced (duplicate) or dropped (below the bar).

type Novelty

type Novelty struct {
	Catalog  catalog.ScoredSearcher // nil → everything is novel (no catalog configured)
	DupScore float64                // top-hit BM25 score ≥ this ⇒ duplicate
}

Novelty decides whether a finding duplicates an existing catalog entry, by scoring its fingerprint against the BM25 catalog index.

func (Novelty) Hits added in v0.7.0

Hits returns up to k catalog entries scored against the finding's fingerprint — hits[0] drives the duplicate decision, the full slice feeds the PR's related-knowledge section (one search, two consumers).

func (Novelty) TopHit

TopHit returns the highest-scoring catalog entry for a finding's fingerprint. ok is false when no catalog is configured or there are no hits. It surfaces the score regardless of any threshold, so callers can both observe it and decide.

Jump to

Keyboard shortcuts

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