Documentation
¶
Overview ¶
Package selection implements deterministic online Memory selection. Scores are transient retrieval facts and never leave this package.
Index ¶
- Constants
- Variables
- func ValidEpisodeEvidenceMaxBytes(value int) bool
- type Activation
- type Anchor
- type ApplicationScope
- type Candidate
- type CandidateKind
- type Constitution
- type Disposition
- type EpisodeEvidence
- type IndexMatch
- type MemoryContext
- type Policy
- type Query
- type Ranker
- type Recollection
- type SelectRequest
Constants ¶
const ( MaxEpisodeEvidenceBytes = 16 * 1024 MaxEpisodeEvidenceEntries = 8 )
Variables ¶
var ( ErrInvalidSelectRequest = errors.New("invalid SelectMemory request") ErrRunConflict = errors.New("run ref already identifies a different MemoryContext request") ErrAmbiguousMemoryRef = errors.New("memory ref resolves to multiple semantic kinds") )
var ErrInvalidConfiguration = errors.New("invalid selection configuration")
Functions ¶
Types ¶
type Activation ¶
type Activation struct {
Kind CandidateKind
VersionRef string
Scope ApplicationScope
QuerySourceRef string
MatchedRef string
EvidenceEpisodeRef string
EvidenceSourceRef string
}
type ApplicationScope ¶
type ApplicationScope string
const ( ApplicationScopeSelf ApplicationScope = "self" ApplicationScopeOther ApplicationScope = "other" ApplicationScopeRelation ApplicationScope = "relation" ApplicationScopeSituation ApplicationScope = "situation" )
type Candidate ¶
type Candidate struct {
Kind CandidateKind
VersionRef string
Text string
Scope ApplicationScope
OwnerOrder int
Support []Anchor
Inhibition []Anchor
Reenactments int
IndexMatches []IndexMatch
}
type CandidateKind ¶
type CandidateKind string
const ( CandidateRecollection CandidateKind = "recollection" CandidateDisposition CandidateKind = "disposition" )
type Constitution ¶
type Constitution = ledger.Constitution
Constitution is an external normative baseline, not writable Memory.
type Disposition ¶
type Disposition struct {
MemoryRef string
Text string
Application ApplicationScope
}
type EpisodeEvidence ¶
EpisodeEvidence is frozen canonical historical source text, not learned Memory.
func BoundEpisodeEvidence ¶
func BoundEpisodeEvidence(items []EpisodeEvidence, maxBytes int) []EpisodeEvidence
BoundEpisodeEvidence preserves semantic order, skips entries that do not fit whole, and caps the public lane independently of learned Memory selection.
type IndexMatch ¶
IndexMatch is one transient semantic association returned by MemoryIndex. SupportEpisodeRef is non-empty only when an indexed Episode is canonical support for this exact Disposition. Rank is meaningful only inside its query/owner lane; LaneOrder deterministically interleaves those lanes.
type MemoryContext ¶
type MemoryContext struct {
Ref string
RunRef string
Scope ledger.Scope
Constitution Constitution
Recollections []Recollection
Dispositions []Disposition
EpisodeEvidence []EpisodeEvidence
}
type Policy ¶
type Policy struct {
Ref string
MinimumScore float64
MaxRecollections int
MaxDispositions int
AvailabilityCap int
CanonicalCandidatesPerOwnerKind int
}
func DefaultPolicy ¶
func DefaultPolicy() Policy
DefaultPolicy returns a value so callers cannot mutate shared policy state.
type Ranker ¶
func DefaultRanker ¶
func DefaultRanker() Ranker
DefaultRanker uses topic-term overlap for Latin word-boundary text and keeps character n-grams as the boundary-free fallback for scripts such as Chinese.
type Recollection ¶
type Recollection struct {
MemoryRef string
Text string
Application ApplicationScope
}