Versions in this module Expand all Collapse all v0 v0.3.0 Nov 3, 2026 v0.2.0 Nov 3, 2026 Changes in this version + var ErrConflict = errors.New("memory version conflict") + var ErrInvalidMemory = errors.New("invalid memory") + var ErrInvalidRecallResult = errors.New("invalid memory recall result") + var ErrInvalidScope = errors.New("invalid memory scope") + var ErrNoExtractionJob = errors.New("no claimable extraction job") + var ErrNotFound = errors.New("memory not found") + var ErrRecallDependency = errors.New("memory recall dependency failure") + func CountSearchTermHits(key, content string, words, grams []string) int + func ExtractionCandidateID(jobID string, draft CandidateDraft) (string, error) + func IsRecoverable(err error) bool + func SearchTerms(text string) (words, grams []string) + func ValidateCandidateDraft(draft CandidateDraft, limits Limits) error + func ValidateCandidateQuery(query CandidateQuery, limits Limits) error + func ValidateCommand(command VersionedCommand, limits Limits) error + func ValidateCorrectRequest(request CorrectRequest, limits Limits) error + func ValidateCreateRequest(request CreateRequest, limits Limits) error + func ValidateListQuery(query ListQuery, limits Limits) error + func ValidateMemoryID(id string) error + func ValidatePendingEmbeddingQuery(query PendingEmbeddingQuery, limits Limits) error + func ValidatePutEmbeddingRequest(request PutEmbeddingRequest, limits Limits) error + func ValidateRevisionQuery(query RevisionQuery, limits Limits) error + func ValidateSources(sources []Source, limits Limits) error + type BackendError struct + Err error + Op string + Recoverable bool + func (e *BackendError) Error() string + func (e *BackendError) Unwrap() error + type Candidate struct + Channel Channel + Memory Memory + Rank int + Similarity float64 + Sources []Source + type CandidateDraft struct + Confidence float64 + Content string + Importance int + Key string + Kind Kind + ValidFrom time.Time + ValidUntil time.Time + type CandidateExtractor interface + Extract func(context.Context, ExtractionRequest) ([]CandidateDraft, error) + type CandidateQuery struct + EmbeddingDimensions int + EmbeddingProfileID string + ExactLimit int + FullTextLimit int + Keys []string + Kinds []Kind + MinVectorSimilarity float64 + Now time.Time + QueryVector []float32 + Scope Scope + Text string + VectorLimit int + type CandidateSet struct + Exact []Candidate + FullText []Candidate + Vector []Candidate + type Channel string + const ChannelExact + const ChannelFullText + const ChannelVector + type ChannelError struct + Channel Channel + Err error + func (e *ChannelError) Error() string + func (e *ChannelError) Unwrap() error + type ContentValidator interface + ValidateMemoryContent func(context.Context, string) error + type CorrectRequest struct + Command VersionedCommand + Confidence float64 + Content string + Importance int + Sources []Source + ValidFrom time.Time + ValidUntil time.Time + type CreateRequest struct + Actor string + Confidence float64 + Content string + ID string + IdempotencyKey string + Importance int + Key string + Kind Kind + Now time.Time + Reason string + Scope Scope + SourceAgentID string + Sources []Source + Status Status + ValidFrom time.Time + ValidUntil time.Time + type EmbedRequest struct + ProfileID string + Texts []string + type Embedder interface + Embed func(context.Context, EmbedRequest) ([][]float32, error) + type EmbeddingInput struct + Content string + ContentHash string + MemoryID string + Scope Scope + Version int64 + type EmbeddingStore interface + PendingEmbeddings func(context.Context, PendingEmbeddingQuery) ([]EmbeddingInput, error) + PutEmbedding func(context.Context, PutEmbeddingRequest) error + type EmbeddingWorker struct + func NewEmbeddingWorker(config EmbeddingWorkerConfig) (*EmbeddingWorker, error) + func (w *EmbeddingWorker) RunOnce(ctx context.Context) (int, error) + type EmbeddingWorkerConfig struct + BatchSize int + Dimensions int + Embedder Embedder + ProfileID string + Store EmbeddingStore + func (c EmbeddingWorkerConfig) Validate() error + type EvalCase struct + ExpectedIDs []string + ForbiddenIDs []string + ID string + Query string + type EvalCorpus struct + Cases []EvalCase + Memories []EvalMemory + Version string + type EvalMemory struct + Content string + ID string + Key string + Kind string + ProjectID string + Status string + Vector []float32 + type EvalReport struct + Cases int + ExpectedFound int + ExpectedTotal int + FalseInjectionRate float64 + ForbiddenInjected int + ForbiddenTotal int + RecallAtBudget float64 + func Evaluate(results map[string][]string, cases []EvalCase) (EvalReport, error) + type ExtractionJob struct + Attempts int + CreatedAt time.Time + ExtractorID string + ID string + LeaseOwner string + LeaseUntil time.Time + Scope Scope + Source Source + SourceAgentID string + Status ExtractionJobStatus + UpdatedAt time.Time + type ExtractionJobStatus string + const ExtractionCompleted + const ExtractionFailed + const ExtractionLeased + const ExtractionPending + type ExtractionJobStore interface + ClaimExtraction func(context.Context, string, time.Duration, int, time.Time) (ExtractionJob, error) + CompleteExtraction func(context.Context, string, string, int, time.Time) error + EnqueueExtraction func(context.Context, ExtractionJob) error + FailExtraction func(context.Context, string, string, int, string, int, time.Time) error + type ExtractionRequest struct + ExtractorID string + Now time.Time + Scope Scope + Source Source + SourceAgentID string + Text string + type ExtractionWorker struct + func NewExtractionWorker(config ExtractionWorkerConfig) (*ExtractionWorker, error) + func (w *ExtractionWorker) RunOnce(ctx context.Context) (bool, error) + type ExtractionWorkerConfig struct + Extractor CandidateExtractor + Jobs ExtractionJobStore + LeaseDuration time.Duration + Limits Limits + MaxAttempts int + Memories LifecycleStore + Now func() time.Time + Reader SourceReader + ValidateContent ContentValidator + WorkerID string + func (c ExtractionWorkerConfig) Validate() error + type Kind string + const KindConstraint + const KindDecision + const KindFact + const KindLesson + func (k Kind) IsValid() bool + type LifecycleStore interface + Activate func(context.Context, VersionedCommand) (Memory, error) + Correct func(context.Context, CorrectRequest) (Memory, error) + Create func(context.Context, CreateRequest) (Memory, error) + Dismiss func(context.Context, VersionedCommand) (Memory, error) + Erase func(context.Context, VersionedCommand) error + Forget func(context.Context, VersionedCommand) (Memory, error) + Get func(context.Context, Scope, string) (Memory, error) + List func(context.Context, ListQuery) ([]Memory, error) + Revisions func(context.Context, RevisionQuery) ([]Revision, error) + Sources func(context.Context, Scope, string) ([]Source, error) + type Limits struct + MaxContentRunes int + MaxKeyRunes int + MaxListItems int + MaxMetadataRunes int + MaxSourcesPerMemory int + Version string + func (l Limits) Validate() error + type ListQuery struct + Key string + Kind Kind + Limit int + Scope Scope + Status Status + type Memory struct + Confidence float64 + Content string + CreatedAt time.Time + CreatedBy string + ID string + IdempotencyKey string + Importance int + Key string + Kind Kind + Scope Scope + SourceAgentID string + Status Status + UpdatedAt time.Time + ValidFrom time.Time + ValidUntil time.Time + Version int64 + func ProjectTrusted(ctx context.Context, store LifecycleStore, validator ContentValidator, ...) (Memory, error) + type PendingEmbeddingQuery struct + Limit int + ProfileID string + type PutEmbeddingRequest struct + ContentHash string + Dimensions int + EmbeddedAt time.Time + MemoryID string + ProfileID string + Scope Scope + Vector []float32 + type RecallConfig struct + CountTokens TokenCounter + Embedder Embedder + Policy RecallPolicy + Store RecallStore + type RecallItem struct + Memory Memory + Sources []Source + type RecallPolicy struct + Deadline time.Duration + EmbeddingDimensions int + EmbeddingProfileID string + ExactLimit int + FullTextLimit int + MaxItems int + MaxKeys int + MaxQueryRunes int + MaxTokens int + MinVectorSimilarity float64 + RRFK float64 + VectorLimit int + Version string + func (p RecallPolicy) Validate() error + type RecallRequest struct + Keys []string + Kinds []Kind + Now time.Time + Scope Scope + Text string + type RecallResult struct + DegradedChannels []Channel + Items []RecallItem + PolicyVersion string + type RecallStore interface + SearchCandidates func(context.Context, CandidateQuery) (CandidateSet, error) + type Recaller struct + func NewRecaller(config RecallConfig) (*Recaller, error) + func (r *Recaller) MaxQueryRunes() int + func (r *Recaller) Recall(ctx context.Context, request RecallRequest) (RecallResult, error) + type Revision struct + Action RevisionAction + Actor string + ContentErased bool + CreatedAt time.Time + MemoryID string + Reason string + Snapshot Memory + Version int64 + type RevisionAction string + const RevisionActivate + const RevisionCorrect + const RevisionCreate + const RevisionDismiss + const RevisionErase + const RevisionForget + const RevisionSupersede + type RevisionQuery struct + BeforeVersion int64 + Limit int + MemoryID string + Scope Scope + type Scope struct + SubjectID string + SubjectType SubjectType + TenantID string + func (s Scope) Validate() error + type Source struct + EvidenceHash string + Kind string + Ref string + type SourceReader interface + ReadSource func(context.Context, Source) (string, error) + type Status string + const StatusActive + const StatusCandidate + const StatusInactive + func (s Status) IsValid() bool + type Store interface + type SubjectType string + const SubjectProject + const SubjectUser + type TokenCounter func(string) int + type TrustedProjection struct + Create CreateRequest + EventID string + type VersionedCommand struct + Actor string + ExpectedVersion int64 + ID string + Now time.Time + Reason string + Scope Scope