Versions in this module Expand all Collapse all v1 v1.1.0 Oct 12, 2026 v1.0.0 Sep 19, 2026 Changes in this version + const DefaultStoreName + const HalfLifeDays + const MaxInsights + const MaxOplogEntries + const PruneBatchSize + const ServerDefaultMaxInsights + func ActiveFile(baseDir string) string + func ComputeEffectiveImportance(importance int, accessCount int, daysSinceAccess float64, edgeCount int) float64 + func DefaultDataDir() string + func IsImmune(importance int, accessCount int) bool + func ListStores(baseDir string) ([]string, error) + func MaxInsightsFromEnv(fallback int) int + func MigrateIfNeeded(baseDir string) error + func ReadActive(baseDir string) string + func StoreDir(baseDir, name string) string + func StoreExists(baseDir, name string) bool + func ValidStoreName(name string) bool + func WriteActive(baseDir, name string) error + type DB struct + func Open(dataDir string) (*DB, error) + func OpenReadOnly(dataDir string) (*DB, error) + func OpenWithOptions(opts Options) (*DB, error) + func (db *DB) AutoPrune(maxInsights int, excludeIDs []string) (int, error) + func (db *DB) AutoPruneOwned(owner string, maxInsights int, excludeIDs []string) (int, error) + func (db *DB) BoostRetention(id string) error + func (db *DB) Close() error + func (db *DB) Conn() *sql.DB + func (db *DB) DeleteEdge(sourceID string, targetID string, edgeType model.EdgeType) error + func (db *DB) DeleteEdgesByNode(nodeID string) error + func (db *DB) Dialect() Dialect + func (db *DB) DisplayPath() string + func (db *DB) EmbeddingStats() (total int, embedded int, err error) + func (db *DB) FindInsightsWithEntity(entity string, excludeID string, limit int) ([]string, error) + func (db *DB) GetActiveInsightsBySourceOrdered(source string) ([]*model.Insight, error) + func (db *DB) GetActiveInsightsForDiff(owner, layer string) ([]*model.Insight, error) + func (db *DB) GetAllActiveInsights() ([]*model.Insight, error) + func (db *DB) GetAllEdges() ([]*model.Edge, error) + func (db *DB) GetAllEmbeddings() ([]EmbeddedInsight, error) + func (db *DB) GetEdgesByNode(nodeID string) ([]*model.Edge, error) + func (db *DB) GetEdgesByNodeAndType(nodeID string, edgeType model.EdgeType) ([]*model.Edge, error) + func (db *DB) GetEdgesBySourceAndType(sourceID string, edgeType model.EdgeType) ([]*model.Edge, error) + func (db *DB) GetEmbedding(id string) ([]byte, error) + func (db *DB) GetInsightByID(id string) (*model.Insight, error) + func (db *DB) GetInsightByIDIncludeDeleted(id string) (*model.Insight, error) + func (db *DB) GetInsightsWithoutEmbedding(limit int) ([]*model.Insight, error) + func (db *DB) GetLatestInsightBySource(source string, excludeID string) (*model.Insight, error) + func (db *DB) GetOplog(limit int) ([]OplogEntry, error) + func (db *DB) GetPrincipal(principal string) (*Principal, error) + func (db *DB) GetRecentInsightsBySource(source string, excludeID string, limit int) ([]*model.Insight, error) + func (db *DB) GetRecentInsightsInWindow(excludeID string, windowHours float64, limit int) ([]*model.Insight, error) + func (db *DB) GetRetentionCandidates(threshold float64, limit int) ([]RetentionCandidate, int, error) + func (db *DB) GetRetentionCandidatesOwned(threshold float64, limit int, owner string) ([]RetentionCandidate, int, error) + func (db *DB) GetStats() (*InsightStats, error) + func (db *DB) InTransaction(fn func(*DB) error) error + func (db *DB) IncrementAccessCount(id string) error + func (db *DB) InsertEdge(e *model.Edge) error + func (db *DB) InsertInsight(i *model.Insight) error + func (db *DB) InsertIssuedToken(jti, principal string, expiresAt time.Time) error + func (db *DB) IsReadOnly() bool + func (db *DB) LoadKnownEntities() (map[string]bool, error) + func (db *DB) LogOp(operation, insightID, detail string) + func (db *DB) LookupIssuedToken(jti string) (*IssuedToken, error) + func (db *DB) Path() string + func (db *DB) Ping() error + func (db *DB) QueryInsights(f QueryFilter) ([]*model.Insight, error) + func (db *DB) RefreshEffectiveImportance(id string) (float64, error) + func (db *DB) RevokeIssuedToken(jti string) error + func (db *DB) RevokePrincipalTokens(principal string) error + func (db *DB) ScanEmbeddings(fn func(id string, blob []byte) bool) error + func (db *DB) SetPrincipalDisabled(principal string, disabled bool) error + func (db *DB) SoftDeleteInsight(id string) error + func (db *DB) UpdateEmbedding(id string, blob []byte) error + func (db *DB) UpdateEntities(id string, entities []string) error + func (db *DB) UpsertPrincipal(principal, role string) error + type Dialect int + const DialectPostgres + const DialectSQLite + func (d Dialect) String() string + type EmbeddedInsight struct + Content string + Embedding []byte + ID string + type EntityStat struct + Count int + Entity string + type InsightStats struct + ByCategory map[string]int + DeletedCount int + EdgeCount int + OplogCount int + TopEntities []EntityStat + Total int + type IssuedToken struct + CreatedAt time.Time + ExpiresAt time.Time + JTI string + Principal string + Revoked bool + type OplogEntry struct + CreatedAt string + Detail string + ID int + InsightID string + Operation string + type Options struct + DataDir string + DatabaseURL string + ReadOnly bool + type OrgDocument struct + Category string + Content string + Entities []string + ExternalRef string + Importance int + SourceURI string + Tags []string + type OrgSource interface + List func(ctx context.Context) ([]OrgDocument, error) + type Principal struct + CreatedAt time.Time + Disabled bool + Principal string + Role string + type QueryFilter struct + Category string + Keyword string + Limit int + MinImportance int + Source string + type RetentionCandidate struct + DaysSinceAccess float64 + EdgeCount int + EffectiveImportance float64 + Immune bool + Insight *model.Insight