Documentation
¶
Index ¶
- Constants
- func InitSchema(db *sql.DB) error
- type SQLiteStore
- func (s *SQLiteStore) ActivateAssociation(ctx context.Context, sourceID, targetID string) error
- func (s *SQLiteStore) AddRuntimeExclusion(ctx context.Context, pattern string) error
- func (s *SQLiteStore) AmendMemory(ctx context.Context, id string, newContent string, newSummary string, ...) error
- func (s *SQLiteStore) ArchiveAbstraction(ctx context.Context, id string) error
- func (s *SQLiteStore) ArchiveAllAbstractions(ctx context.Context) (int, error)
- func (s *SQLiteStore) ArchiveAllPatterns(ctx context.Context) (int, error)
- func (s *SQLiteStore) ArchiveMemoriesByRawPathPatterns(ctx context.Context, patterns []string) (int, error)
- func (s *SQLiteStore) ArchivePattern(ctx context.Context, id string) error
- func (s *SQLiteStore) BackfillEpisodeMemoryLinks(ctx context.Context) (int, error)
- func (s *SQLiteStore) BatchMergeMemories(ctx context.Context, sourceIDs []string, gist store.Memory) error
- func (s *SQLiteStore) BatchUpdateSalience(ctx context.Context, updates map[string]float32) error
- func (s *SQLiteStore) BatchWriteRaw(ctx context.Context, raws []store.RawMemory) error
- func (s *SQLiteStore) BulkMarkRawProcessedByPathPatterns(ctx context.Context, patterns []string) (int, error)
- func (s *SQLiteStore) CheckIntegrity(ctx context.Context) error
- func (s *SQLiteStore) ClaimRawForEncoding(ctx context.Context, id string) error
- func (s *SQLiteStore) Close() error
- func (s *SQLiteStore) CloseEpisode(ctx context.Context, id string) error
- func (s *SQLiteStore) CountForumPosts(ctx context.Context) (int, error)
- func (s *SQLiteStore) CountMemories(ctx context.Context) (int, error)
- func (s *SQLiteStore) CountRawUnprocessedByPathPatterns(ctx context.Context, patterns []string) (int, error)
- func (s *SQLiteStore) CreateAssociation(ctx context.Context, assoc store.Association) error
- func (s *SQLiteStore) CreateEpisode(ctx context.Context, ep store.Episode) error
- func (s *SQLiteStore) DB() *sql.DB
- func (s *SQLiteStore) DeleteOldArchived(ctx context.Context, olderThan time.Time) (int, error)
- func (s *SQLiteStore) DeleteOldMetaObservations(ctx context.Context, olderThan time.Time) (int, error)
- func (s *SQLiteStore) EmbeddingIndexStats() (count int, loadTime time.Duration)
- func (s *SQLiteStore) GetAbstraction(ctx context.Context, id string) (store.Abstraction, error)
- func (s *SQLiteStore) GetAnalytics(ctx context.Context) (store.AnalyticsData, error)
- func (s *SQLiteStore) GetAssociations(ctx context.Context, memoryID string) ([]store.Association, error)
- func (s *SQLiteStore) GetAssociationsForMemoryIDs(ctx context.Context, memoryIDs []string) ([]store.Association, error)
- func (s *SQLiteStore) GetConceptSet(ctx context.Context, memoryID string) (store.ConceptSet, error)
- func (s *SQLiteStore) GetDailyDigestThread(ctx context.Context, categoryID string, date time.Time) (store.ForumPost, error)
- func (s *SQLiteStore) GetDeadMemories(ctx context.Context, cutoffDate time.Time) ([]store.Memory, error)
- func (s *SQLiteStore) GetEpisode(ctx context.Context, id string) (store.Episode, error)
- func (s *SQLiteStore) GetForumCategory(ctx context.Context, id string) (store.ForumCategory, error)
- func (s *SQLiteStore) GetForumPost(ctx context.Context, id string) (store.ForumPost, error)
- func (s *SQLiteStore) GetLLMUsageChart(ctx context.Context, since time.Time, bucketSecs int) ([]store.LLMChartBucket, error)
- func (s *SQLiteStore) GetLLMUsageLog(ctx context.Context, since time.Time, limit int) ([]llm.LLMUsageRecord, error)
- func (s *SQLiteStore) GetLLMUsageSummary(ctx context.Context, since time.Time) (store.LLMUsageSummary, error)
- func (s *SQLiteStore) GetLastConsolidation(ctx context.Context) (store.ConsolidationRecord, error)
- func (s *SQLiteStore) GetMemory(ctx context.Context, id string) (store.Memory, error)
- func (s *SQLiteStore) GetMemoryAttributes(ctx context.Context, memoryID string) (store.MemoryAttributes, error)
- func (s *SQLiteStore) GetMemoryByRawID(ctx context.Context, rawID string) (store.Memory, error)
- func (s *SQLiteStore) GetMemoryFeedbackScores(ctx context.Context, memoryIDs []string) (map[string]float32, error)
- func (s *SQLiteStore) GetMemoryResolution(ctx context.Context, memoryID string) (store.MemoryResolution, error)
- func (s *SQLiteStore) GetMeta(ctx context.Context, key string) (string, error)
- func (s *SQLiteStore) GetOpenEpisode(ctx context.Context) (store.Episode, error)
- func (s *SQLiteStore) GetPattern(ctx context.Context, id string) (store.Pattern, error)
- func (s *SQLiteStore) GetProjectSummary(ctx context.Context, project string) (map[string]interface{}, error)
- func (s *SQLiteStore) GetRaw(ctx context.Context, id string) (store.RawMemory, error)
- func (s *SQLiteStore) GetRetrievalFeedback(ctx context.Context, queryID string) (store.RetrievalFeedback, error)
- func (s *SQLiteStore) GetSessionMemories(ctx context.Context, sessionID string, limit int) ([]store.Memory, error)
- func (s *SQLiteStore) GetSourceDistribution(ctx context.Context) (map[string]int, error)
- func (s *SQLiteStore) GetStatistics(ctx context.Context) (store.StoreStatistics, error)
- func (s *SQLiteStore) GetToolUsageChart(ctx context.Context, since time.Time, bucketSecs int) ([]store.ToolChartBucket, error)
- func (s *SQLiteStore) GetToolUsageLog(ctx context.Context, since time.Time, limit int) ([]store.ToolUsageRecord, error)
- func (s *SQLiteStore) GetToolUsageSummary(ctx context.Context, since time.Time) (store.ToolUsageSummary, error)
- func (s *SQLiteStore) IncrementAccess(ctx context.Context, id string) error
- func (s *SQLiteStore) ListAbstractions(ctx context.Context, level int, limit int) ([]store.Abstraction, error)
- func (s *SQLiteStore) ListAbstractionsByState(ctx context.Context, state string, limit int) ([]store.Abstraction, error)
- func (s *SQLiteStore) ListAllAssociations(ctx context.Context) ([]store.Association, error)
- func (s *SQLiteStore) ListAllRawMemories(ctx context.Context) ([]store.RawMemory, error)
- func (s *SQLiteStore) ListEpisodes(ctx context.Context, state string, limit, offset int) ([]store.Episode, error)
- func (s *SQLiteStore) ListForumCategories(ctx context.Context) ([]store.ForumCategory, error)
- func (s *SQLiteStore) ListForumCategorySummaries(ctx context.Context) ([]store.ForumCategorySummary, error)
- func (s *SQLiteStore) ListForumPostsByThread(ctx context.Context, threadID string, limit int) ([]store.ForumPost, error)
- func (s *SQLiteStore) ListForumThreads(ctx context.Context, limit, offset int) ([]store.ForumThread, error)
- func (s *SQLiteStore) ListForumThreadsByCategory(ctx context.Context, categoryID string, limit, offset int) ([]store.ForumThread, error)
- func (s *SQLiteStore) ListMemories(ctx context.Context, state string, limit, offset int) ([]store.Memory, error)
- func (s *SQLiteStore) ListMemoriesBySession(ctx context.Context, sessionID string) ([]store.Memory, error)
- func (s *SQLiteStore) ListMemoriesByTimeRange(ctx context.Context, from, to time.Time, limit int) ([]store.Memory, error)
- func (s *SQLiteStore) ListMetaObservations(ctx context.Context, observationType string, limit int) ([]store.MetaObservation, error)
- func (s *SQLiteStore) ListPatterns(ctx context.Context, project string, limit int) ([]store.Pattern, error)
- func (s *SQLiteStore) ListProjects(ctx context.Context) ([]string, error)
- func (s *SQLiteStore) ListRawMemoriesAfter(ctx context.Context, after time.Time, limit int) ([]store.RawMemory, error)
- func (s *SQLiteStore) ListRawUnprocessed(ctx context.Context, limit int) ([]store.RawMemory, error)
- func (s *SQLiteStore) ListRecentRetrievalFeedback(ctx context.Context, since time.Time, limit int) ([]store.RetrievalFeedback, error)
- func (s *SQLiteStore) ListRuntimeExclusions(ctx context.Context) ([]string, error)
- func (s *SQLiteStore) ListSessions(ctx context.Context, since time.Time, limit int) ([]store.SessionSummary, error)
- func (s *SQLiteStore) MarkRawProcessed(ctx context.Context, id string) error
- func (s *SQLiteStore) PruneOldFeedback(ctx context.Context, olderThan time.Duration) (int, error)
- func (s *SQLiteStore) PruneOrphanedAssociations(ctx context.Context) (int, error)
- func (s *SQLiteStore) PruneWeakAssociations(ctx context.Context, strengthThreshold float32) (int, error)
- func (s *SQLiteStore) RawMemoryExistsByHash(ctx context.Context, contentHash string) (bool, error)
- func (s *SQLiteStore) RawMemoryExistsByPath(ctx context.Context, source string, project string, filePath string) (bool, error)
- func (s *SQLiteStore) RecordLLMUsage(ctx context.Context, record llm.LLMUsageRecord) error
- func (s *SQLiteStore) RecordToolUsage(ctx context.Context, record store.ToolUsageRecord) error
- func (s *SQLiteStore) RemoveRuntimeExclusion(ctx context.Context, pattern string) error
- func (s *SQLiteStore) SearchAbstractionsByEmbedding(ctx context.Context, embedding []float32, limit int) ([]store.Abstraction, error)
- func (s *SQLiteStore) SearchByConcepts(ctx context.Context, concepts []string, limit int) ([]store.Memory, error)
- func (s *SQLiteStore) SearchByConceptsInProject(ctx context.Context, concepts []string, project string, limit int) ([]store.Memory, error)
- func (s *SQLiteStore) SearchByEmbedding(ctx context.Context, embedding []float32, limit int) ([]store.RetrievalResult, error)
- func (s *SQLiteStore) SearchByEntity(ctx context.Context, name string, entityType string, limit int) ([]store.Memory, error)
- func (s *SQLiteStore) SearchByFullText(ctx context.Context, query string, limit int) ([]store.Memory, error)
- func (s *SQLiteStore) SearchByProject(ctx context.Context, project string, query string, limit int) ([]store.Memory, error)
- func (s *SQLiteStore) SearchPatternsByEmbedding(ctx context.Context, embedding []float32, limit int) ([]store.Pattern, error)
- func (s *SQLiteStore) SearchPatternsByEmbeddingInProject(ctx context.Context, embedding []float32, project string, limit int) ([]store.Pattern, error)
- func (s *SQLiteStore) SetMeta(ctx context.Context, key, value string) error
- func (s *SQLiteStore) SyncProjectCategories(ctx context.Context) (int, error)
- func (s *SQLiteStore) UnclaimRawMemory(ctx context.Context, id string) error
- func (s *SQLiteStore) UpdateAbstraction(ctx context.Context, a store.Abstraction) error
- func (s *SQLiteStore) UpdateAssociationStrength(ctx context.Context, sourceID, targetID string, strength float32) error
- func (s *SQLiteStore) UpdateAssociationType(ctx context.Context, sourceID, targetID string, relationType string) error
- func (s *SQLiteStore) UpdateEmbedding(ctx context.Context, id string, embedding []float32) error
- func (s *SQLiteStore) UpdateEpisode(ctx context.Context, ep store.Episode) error
- func (s *SQLiteStore) UpdateForumPostState(ctx context.Context, id string, state string) error
- func (s *SQLiteStore) UpdateMemory(ctx context.Context, mem store.Memory) error
- func (s *SQLiteStore) UpdatePattern(ctx context.Context, p store.Pattern) error
- func (s *SQLiteStore) UpdateSalience(ctx context.Context, id string, salience float32) error
- func (s *SQLiteStore) UpdateState(ctx context.Context, id string, state string) error
- func (s *SQLiteStore) WriteAbstraction(ctx context.Context, a store.Abstraction) error
- func (s *SQLiteStore) WriteConceptSet(ctx context.Context, cs store.ConceptSet) error
- func (s *SQLiteStore) WriteConsolidation(ctx context.Context, record store.ConsolidationRecord) error
- func (s *SQLiteStore) WriteForumCategory(ctx context.Context, cat store.ForumCategory) error
- func (s *SQLiteStore) WriteForumPost(ctx context.Context, post store.ForumPost) error
- func (s *SQLiteStore) WriteMemory(ctx context.Context, mem store.Memory) error
- func (s *SQLiteStore) WriteMemoryAttributes(ctx context.Context, attrs store.MemoryAttributes) error
- func (s *SQLiteStore) WriteMemoryResolution(ctx context.Context, res store.MemoryResolution) error
- func (s *SQLiteStore) WriteMetaObservation(ctx context.Context, obs store.MetaObservation) error
- func (s *SQLiteStore) WritePattern(ctx context.Context, p store.Pattern) error
- func (s *SQLiteStore) WriteRaw(ctx context.Context, raw store.RawMemory) error
- func (s *SQLiteStore) WriteRetrievalFeedback(ctx context.Context, fb store.RetrievalFeedback) error
Constants ¶
const SchemaVersion = 15
SchemaVersion is the current target schema version. Bump this whenever a new migration is added. It is written to PRAGMA user_version after InitSchema completes, and read by the pre-migration backup logic to skip backups when the schema is already current.
Variables ¶
This section is empty.
Functions ¶
func InitSchema ¶
InitSchema initializes the SQLite database schema by creating all tables, indexes, and triggers if they don't already exist. It also configures important PRAGMA settings for performance and safety.
Types ¶
type SQLiteStore ¶
type SQLiteStore struct {
// contains filtered or unexported fields
}
SQLiteStore implements the Store interface using SQLite as the backend.
func NewSQLiteStore ¶
func NewSQLiteStore(dbPath string, busyTimeoutMs int) (*SQLiteStore, error)
NewSQLiteStore opens a SQLite database and initializes the schema. busyTimeoutMs sets the SQLite busy timeout in milliseconds (use 0 for default 5000).
func (*SQLiteStore) ActivateAssociation ¶
func (s *SQLiteStore) ActivateAssociation(ctx context.Context, sourceID, targetID string) error
ActivateAssociation activates an association, updating last_activated and incrementing activation_count.
func (*SQLiteStore) AddRuntimeExclusion ¶ added in v0.23.0
func (s *SQLiteStore) AddRuntimeExclusion(ctx context.Context, pattern string) error
AddRuntimeExclusion adds a watcher exclusion pattern to the DB.
func (*SQLiteStore) AmendMemory ¶ added in v0.22.0
func (s *SQLiteStore) AmendMemory(ctx context.Context, id string, newContent string, newSummary string, newConcepts []string, newEmbedding []float32) error
AmendMemory updates a memory's content, summary, concepts, and embedding in place, preserving its ID, associations, and lifecycle metadata. Records the amendment for audit.
func (*SQLiteStore) ArchiveAbstraction ¶ added in v0.34.0
func (s *SQLiteStore) ArchiveAbstraction(ctx context.Context, id string) error
ArchiveAbstraction archives a single abstraction by ID.
func (*SQLiteStore) ArchiveAllAbstractions ¶
func (s *SQLiteStore) ArchiveAllAbstractions(ctx context.Context) (int, error)
ArchiveAllAbstractions transitions all active abstractions to archived state.
func (*SQLiteStore) ArchiveAllPatterns ¶
func (s *SQLiteStore) ArchiveAllPatterns(ctx context.Context) (int, error)
ArchiveAllPatterns transitions all active patterns to archived state.
func (*SQLiteStore) ArchiveMemoriesByRawPathPatterns ¶
func (s *SQLiteStore) ArchiveMemoriesByRawPathPatterns(ctx context.Context, patterns []string) (int, error)
ArchiveMemoriesByRawPathPatterns archives encoded memories whose raw_id references a raw memory with a path matching any of the given patterns.
func (*SQLiteStore) ArchivePattern ¶ added in v0.30.0
func (s *SQLiteStore) ArchivePattern(ctx context.Context, id string) error
ArchivePattern archives a single pattern by ID.
func (*SQLiteStore) BackfillEpisodeMemoryLinks ¶ added in v0.34.0
func (s *SQLiteStore) BackfillEpisodeMemoryLinks(ctx context.Context) (int, error)
BackfillEpisodeMemoryLinks fixes the race condition where memories were encoded before their raw observations were assigned to episodes. Iterates episodes (small set) and links any encoded memories found via raw_id lookup.
func (*SQLiteStore) BatchMergeMemories ¶
func (s *SQLiteStore) BatchMergeMemories(ctx context.Context, sourceIDs []string, gist store.Memory) error
BatchMergeMemories merges multiple source memories into a gist memory.
func (*SQLiteStore) BatchUpdateSalience ¶
BatchUpdateSalience updates salience for multiple memories.
func (*SQLiteStore) BatchWriteRaw ¶
BatchWriteRaw writes multiple raw memories in a single transaction.
func (*SQLiteStore) BulkMarkRawProcessedByPathPatterns ¶
func (s *SQLiteStore) BulkMarkRawProcessedByPathPatterns(ctx context.Context, patterns []string) (int, error)
BulkMarkRawProcessedByPathPatterns marks unprocessed raw memories as processed where the metadata path contains any of the given substring patterns.
func (*SQLiteStore) CheckIntegrity ¶
func (s *SQLiteStore) CheckIntegrity(ctx context.Context) error
CheckIntegrity runs PRAGMA integrity_check and returns any problems found. Returns nil if the database is healthy.
func (*SQLiteStore) ClaimRawForEncoding ¶ added in v0.22.0
func (s *SQLiteStore) ClaimRawForEncoding(ctx context.Context, id string) error
ClaimRawForEncoding atomically claims a raw memory for encoding. It sets processed=1 only if the current value is 0 (unclaimed). Returns store.ErrAlreadyClaimed if another process already claimed it.
func (*SQLiteStore) Close ¶
func (s *SQLiteStore) Close() error
Close closes the database connection.
func (*SQLiteStore) CloseEpisode ¶
func (s *SQLiteStore) CloseEpisode(ctx context.Context, id string) error
CloseEpisode sets an episode's state to "closed".
func (*SQLiteStore) CountForumPosts ¶ added in v0.34.0
func (s *SQLiteStore) CountForumPosts(ctx context.Context) (int, error)
CountForumPosts returns the total number of active forum posts.
func (*SQLiteStore) CountMemories ¶
func (s *SQLiteStore) CountMemories(ctx context.Context) (int, error)
CountMemories returns the total count of memories.
func (*SQLiteStore) CountRawUnprocessedByPathPatterns ¶
func (s *SQLiteStore) CountRawUnprocessedByPathPatterns(ctx context.Context, patterns []string) (int, error)
CountRawUnprocessedByPathPatterns counts unprocessed raw memories whose metadata path contains any of the given substring patterns.
func (*SQLiteStore) CreateAssociation ¶
func (s *SQLiteStore) CreateAssociation(ctx context.Context, assoc store.Association) error
CreateAssociation creates a new association between two memories.
func (*SQLiteStore) CreateEpisode ¶
CreateEpisode inserts a new episode.
func (*SQLiteStore) DB ¶
func (s *SQLiteStore) DB() *sql.DB
DB returns the underlying *sql.DB for direct queries (e.g., PRAGMA checks).
func (*SQLiteStore) DeleteOldArchived ¶
DeleteOldArchived deletes archived memories older than the specified time.
func (*SQLiteStore) DeleteOldMetaObservations ¶
func (s *SQLiteStore) DeleteOldMetaObservations(ctx context.Context, olderThan time.Time) (int, error)
DeleteOldMetaObservations removes meta observations older than the given time.
func (*SQLiteStore) EmbeddingIndexStats ¶
func (s *SQLiteStore) EmbeddingIndexStats() (count int, loadTime time.Duration)
EmbeddingIndexStats returns the number of embeddings in the in-memory index and how long it took to load.
func (*SQLiteStore) GetAbstraction ¶
func (s *SQLiteStore) GetAbstraction(ctx context.Context, id string) (store.Abstraction, error)
GetAbstraction retrieves an abstraction by ID.
func (*SQLiteStore) GetAnalytics ¶ added in v0.28.0
func (s *SQLiteStore) GetAnalytics(ctx context.Context) (store.AnalyticsData, error)
GetAnalytics returns research-grade metrics about the memory system.
func (*SQLiteStore) GetAssociations ¶
func (s *SQLiteStore) GetAssociations(ctx context.Context, memoryID string) ([]store.Association, error)
GetAssociations retrieves all associations for a memory.
func (*SQLiteStore) GetAssociationsForMemoryIDs ¶
func (s *SQLiteStore) GetAssociationsForMemoryIDs(ctx context.Context, memoryIDs []string) ([]store.Association, error)
GetAssociationsForMemoryIDs returns associations where both source and target are in the provided set of memory IDs. Processes in chunks to avoid SQLite parameter limits.
func (*SQLiteStore) GetConceptSet ¶
func (s *SQLiteStore) GetConceptSet(ctx context.Context, memoryID string) (store.ConceptSet, error)
func (*SQLiteStore) GetDailyDigestThread ¶ added in v0.34.0
func (s *SQLiteStore) GetDailyDigestThread(ctx context.Context, categoryID string, date time.Time) (store.ForumPost, error)
GetDailyDigestThread returns today's digest root post for a category, or ErrNotFound if none exists.
func (*SQLiteStore) GetDeadMemories ¶
func (s *SQLiteStore) GetDeadMemories(ctx context.Context, cutoffDate time.Time) ([]store.Memory, error)
GetDeadMemories returns active memories that haven't been accessed since cutoffDate.
func (*SQLiteStore) GetEpisode ¶
GetEpisode retrieves an episode by ID.
func (*SQLiteStore) GetForumCategory ¶ added in v0.34.0
func (s *SQLiteStore) GetForumCategory(ctx context.Context, id string) (store.ForumCategory, error)
GetForumCategory retrieves a forum category by ID.
func (*SQLiteStore) GetForumPost ¶ added in v0.34.0
GetForumPost retrieves a forum post by ID.
func (*SQLiteStore) GetLLMUsageChart ¶ added in v0.15.0
func (s *SQLiteStore) GetLLMUsageChart(ctx context.Context, since time.Time, bucketSecs int) ([]store.LLMChartBucket, error)
GetLLMUsageChart returns pre-aggregated token counts bucketed by the given interval.
func (*SQLiteStore) GetLLMUsageLog ¶
func (s *SQLiteStore) GetLLMUsageLog(ctx context.Context, since time.Time, limit int) ([]llm.LLMUsageRecord, error)
GetLLMUsageLog returns the most recent LLM usage records within the given time range.
func (*SQLiteStore) GetLLMUsageSummary ¶
func (s *SQLiteStore) GetLLMUsageSummary(ctx context.Context, since time.Time) (store.LLMUsageSummary, error)
GetLLMUsageSummary returns aggregated LLM usage since the given time.
func (*SQLiteStore) GetLastConsolidation ¶
func (s *SQLiteStore) GetLastConsolidation(ctx context.Context) (store.ConsolidationRecord, error)
GetLastConsolidation retrieves the most recent consolidation record.
func (*SQLiteStore) GetMemoryAttributes ¶
func (s *SQLiteStore) GetMemoryAttributes(ctx context.Context, memoryID string) (store.MemoryAttributes, error)
func (*SQLiteStore) GetMemoryByRawID ¶
GetMemoryByRawID retrieves the encoded memory for a given raw memory ID.
func (*SQLiteStore) GetMemoryFeedbackScores ¶ added in v0.22.0
func (s *SQLiteStore) GetMemoryFeedbackScores(ctx context.Context, memoryIDs []string) (map[string]float32, error)
GetMemoryFeedbackScores computes a normalized feedback score for each memory ID by scanning retrieval_feedback rows where the memory appears in retrieved_memory_ids. "helpful" = +1, "irrelevant" = -1, "partial" = 0. Returns sum/count per memory.
func (*SQLiteStore) GetMemoryResolution ¶
func (s *SQLiteStore) GetMemoryResolution(ctx context.Context, memoryID string) (store.MemoryResolution, error)
func (*SQLiteStore) GetMeta ¶
GetMeta retrieves a value from the system_meta key-value store. Returns empty string and no error if the key does not exist.
func (*SQLiteStore) GetOpenEpisode ¶
GetOpenEpisode returns the latest episode with state "open".
func (*SQLiteStore) GetPattern ¶
GetPattern retrieves a pattern by ID.
func (*SQLiteStore) GetProjectSummary ¶
func (s *SQLiteStore) GetProjectSummary(ctx context.Context, project string) (map[string]interface{}, error)
GetProjectSummary returns aggregate stats for a specific project.
func (*SQLiteStore) GetRetrievalFeedback ¶
func (s *SQLiteStore) GetRetrievalFeedback(ctx context.Context, queryID string) (store.RetrievalFeedback, error)
GetRetrievalFeedback retrieves a feedback record by query ID.
func (*SQLiteStore) GetSessionMemories ¶ added in v0.22.0
func (s *SQLiteStore) GetSessionMemories(ctx context.Context, sessionID string, limit int) ([]store.Memory, error)
GetSessionMemories returns memories for a specific session, ordered by creation time.
func (*SQLiteStore) GetSourceDistribution ¶
GetSourceDistribution returns a count of raw memories grouped by source.
func (*SQLiteStore) GetStatistics ¶
func (s *SQLiteStore) GetStatistics(ctx context.Context) (store.StoreStatistics, error)
GetStatistics computes and returns store statistics.
func (*SQLiteStore) GetToolUsageChart ¶ added in v0.21.0
func (s *SQLiteStore) GetToolUsageChart(ctx context.Context, since time.Time, bucketSecs int) ([]store.ToolChartBucket, error)
GetToolUsageChart returns pre-aggregated tool call counts for charting.
func (*SQLiteStore) GetToolUsageLog ¶ added in v0.21.0
func (s *SQLiteStore) GetToolUsageLog(ctx context.Context, since time.Time, limit int) ([]store.ToolUsageRecord, error)
GetToolUsageLog returns recent tool usage records.
func (*SQLiteStore) GetToolUsageSummary ¶ added in v0.21.0
func (s *SQLiteStore) GetToolUsageSummary(ctx context.Context, since time.Time) (store.ToolUsageSummary, error)
GetToolUsageSummary returns aggregated tool usage metrics since the given time.
func (*SQLiteStore) IncrementAccess ¶
func (s *SQLiteStore) IncrementAccess(ctx context.Context, id string) error
IncrementAccess increments the access count and updates last_accessed.
func (*SQLiteStore) ListAbstractions ¶
func (s *SQLiteStore) ListAbstractions(ctx context.Context, level int, limit int) ([]store.Abstraction, error)
ListAbstractions lists abstractions, optionally filtered by level. Pass level=0 to list all levels.
func (*SQLiteStore) ListAbstractionsByState ¶ added in v0.14.2
func (s *SQLiteStore) ListAbstractionsByState(ctx context.Context, state string, limit int) ([]store.Abstraction, error)
ListAbstractionsByState lists abstractions filtered by state (e.g. "active", "fading", "archived"). Pass level=0 equivalent: returns all levels for the given state.
func (*SQLiteStore) ListAllAssociations ¶
func (s *SQLiteStore) ListAllAssociations(ctx context.Context) ([]store.Association, error)
ListAllAssociations returns all associations in the system.
func (*SQLiteStore) ListAllRawMemories ¶
ListAllRawMemories returns all raw memories in the system.
func (*SQLiteStore) ListEpisodes ¶
func (s *SQLiteStore) ListEpisodes(ctx context.Context, state string, limit, offset int) ([]store.Episode, error)
ListEpisodes returns episodes filtered by state.
func (*SQLiteStore) ListForumCategories ¶ added in v0.34.0
func (s *SQLiteStore) ListForumCategories(ctx context.Context) ([]store.ForumCategory, error)
ListForumCategories returns all categories ordered by sort_order.
func (*SQLiteStore) ListForumCategorySummaries ¶ added in v0.34.0
func (s *SQLiteStore) ListForumCategorySummaries(ctx context.Context) ([]store.ForumCategorySummary, error)
ListForumCategorySummaries returns all categories with thread/post counts and last post.
func (*SQLiteStore) ListForumPostsByThread ¶ added in v0.34.0
func (s *SQLiteStore) ListForumPostsByThread(ctx context.Context, threadID string, limit int) ([]store.ForumPost, error)
ListForumPostsByThread returns all posts in a thread ordered by creation time.
func (*SQLiteStore) ListForumThreads ¶ added in v0.34.0
func (s *SQLiteStore) ListForumThreads(ctx context.Context, limit, offset int) ([]store.ForumThread, error)
ListForumThreads returns root-level posts (threads) with reply counts.
func (*SQLiteStore) ListForumThreadsByCategory ¶ added in v0.34.0
func (s *SQLiteStore) ListForumThreadsByCategory(ctx context.Context, categoryID string, limit, offset int) ([]store.ForumThread, error)
ListForumThreadsByCategory returns threads in a specific category.
func (*SQLiteStore) ListMemories ¶
func (s *SQLiteStore) ListMemories(ctx context.Context, state string, limit, offset int) ([]store.Memory, error)
ListMemories lists memories with pagination.
func (*SQLiteStore) ListMemoriesBySession ¶ added in v0.19.0
func (s *SQLiteStore) ListMemoriesBySession(ctx context.Context, sessionID string) ([]store.Memory, error)
ListMemoriesBySession returns all memories created during a given session.
func (*SQLiteStore) ListMemoriesByTimeRange ¶
func (s *SQLiteStore) ListMemoriesByTimeRange(ctx context.Context, from, to time.Time, limit int) ([]store.Memory, error)
ListMemoriesByTimeRange lists memories within a time range.
func (*SQLiteStore) ListMetaObservations ¶
func (s *SQLiteStore) ListMetaObservations(ctx context.Context, observationType string, limit int) ([]store.MetaObservation, error)
ListMetaObservations retrieves observations, optionally filtered by type.
func (*SQLiteStore) ListPatterns ¶
func (s *SQLiteStore) ListPatterns(ctx context.Context, project string, limit int) ([]store.Pattern, error)
ListPatterns lists patterns, optionally filtered by project. Returns active and fading patterns (fading are needed by decay logic).
func (*SQLiteStore) ListProjects ¶
func (s *SQLiteStore) ListProjects(ctx context.Context) ([]string, error)
ListProjects returns all distinct project names.
func (*SQLiteStore) ListRawMemoriesAfter ¶
func (s *SQLiteStore) ListRawMemoriesAfter(ctx context.Context, after time.Time, limit int) ([]store.RawMemory, error)
ListRawMemoriesAfter lists all raw memories created after a given time, regardless of processed flag. This is used by the episoding agent to find raw memories that need episode assignment.
func (*SQLiteStore) ListRawUnprocessed ¶
ListRawUnprocessed lists raw memories that haven't been processed yet.
func (*SQLiteStore) ListRecentRetrievalFeedback ¶ added in v0.21.0
func (s *SQLiteStore) ListRecentRetrievalFeedback(ctx context.Context, since time.Time, limit int) ([]store.RetrievalFeedback, error)
ListRecentRetrievalFeedback returns feedback records created after the given time.
func (*SQLiteStore) ListRuntimeExclusions ¶ added in v0.23.0
func (s *SQLiteStore) ListRuntimeExclusions(ctx context.Context) ([]string, error)
ListRuntimeExclusions returns all runtime exclusion patterns.
func (*SQLiteStore) ListSessions ¶ added in v0.22.0
func (s *SQLiteStore) ListSessions(ctx context.Context, since time.Time, limit int) ([]store.SessionSummary, error)
ListSessions returns recent sessions with metadata.
func (*SQLiteStore) MarkRawProcessed ¶
func (s *SQLiteStore) MarkRawProcessed(ctx context.Context, id string) error
MarkRawProcessed marks a raw memory as processed.
func (*SQLiteStore) PruneOldFeedback ¶ added in v0.33.0
PruneOldFeedback deletes retrieval_feedback records older than the given duration.
func (*SQLiteStore) PruneOrphanedAssociations ¶ added in v0.20.0
func (s *SQLiteStore) PruneOrphanedAssociations(ctx context.Context) (int, error)
PruneOrphanedAssociations removes associations where either end points to a non-active memory.
func (*SQLiteStore) PruneWeakAssociations ¶
func (s *SQLiteStore) PruneWeakAssociations(ctx context.Context, strengthThreshold float32) (int, error)
PruneWeakAssociations deletes associations with strength below threshold.
func (*SQLiteStore) RawMemoryExistsByHash ¶ added in v0.28.0
RawMemoryExistsByHash checks if a raw memory with the given content hash exists in the last 24 hours. Used for early dedup before LLM calls.
func (*SQLiteStore) RawMemoryExistsByPath ¶
func (s *SQLiteStore) RawMemoryExistsByPath(ctx context.Context, source string, project string, filePath string) (bool, error)
RawMemoryExistsByPath checks if a raw memory with the given source, project, and file path already exists.
func (*SQLiteStore) RecordLLMUsage ¶
func (s *SQLiteStore) RecordLLMUsage(ctx context.Context, record llm.LLMUsageRecord) error
RecordLLMUsage inserts an LLM usage record.
func (*SQLiteStore) RecordToolUsage ¶ added in v0.21.0
func (s *SQLiteStore) RecordToolUsage(ctx context.Context, record store.ToolUsageRecord) error
RecordToolUsage inserts a tool usage record.
func (*SQLiteStore) RemoveRuntimeExclusion ¶ added in v0.23.0
func (s *SQLiteStore) RemoveRuntimeExclusion(ctx context.Context, pattern string) error
RemoveRuntimeExclusion removes a watcher exclusion pattern from the DB.
func (*SQLiteStore) SearchAbstractionsByEmbedding ¶
func (s *SQLiteStore) SearchAbstractionsByEmbedding(ctx context.Context, embedding []float32, limit int) ([]store.Abstraction, error)
SearchAbstractionsByEmbedding finds active abstractions most similar to the given embedding.
func (*SQLiteStore) SearchByConcepts ¶
func (s *SQLiteStore) SearchByConcepts(ctx context.Context, concepts []string, limit int) ([]store.Memory, error)
SearchByConcepts searches for memories by concepts using FTS5.
func (*SQLiteStore) SearchByConceptsInProject ¶ added in v0.27.0
func (s *SQLiteStore) SearchByConceptsInProject(ctx context.Context, concepts []string, project string, limit int) ([]store.Memory, error)
SearchByConceptsInProject searches for memories matching concepts within a specific project.
func (*SQLiteStore) SearchByEmbedding ¶
func (s *SQLiteStore) SearchByEmbedding(ctx context.Context, embedding []float32, limit int) ([]store.RetrievalResult, error)
SearchByEmbedding searches for memories using embedding similarity. Uses an in-memory embedding index for fast cosine similarity search, then fetches only the top-K full memory rows from the database.
func (*SQLiteStore) SearchByEntity ¶
func (s *SQLiteStore) SearchByEntity(ctx context.Context, name string, entityType string, limit int) ([]store.Memory, error)
SearchByEntity finds memories that reference a specific entity.
func (*SQLiteStore) SearchByFullText ¶
func (s *SQLiteStore) SearchByFullText(ctx context.Context, query string, limit int) ([]store.Memory, error)
SearchByFullText searches for memories using full-text search.
func (*SQLiteStore) SearchByProject ¶
func (s *SQLiteStore) SearchByProject(ctx context.Context, project string, query string, limit int) ([]store.Memory, error)
SearchByProject searches memories within a specific project using FTS.
func (*SQLiteStore) SearchPatternsByEmbedding ¶
func (s *SQLiteStore) SearchPatternsByEmbedding(ctx context.Context, embedding []float32, limit int) ([]store.Pattern, error)
SearchPatternsByEmbedding searches patterns using embedding similarity.
func (*SQLiteStore) SearchPatternsByEmbeddingInProject ¶ added in v0.30.0
func (s *SQLiteStore) SearchPatternsByEmbeddingInProject(ctx context.Context, embedding []float32, project string, limit int) ([]store.Pattern, error)
SearchPatternsByEmbeddingInProject searches patterns scoped to a project. When project is non-empty, only patterns belonging to that project are returned.
func (*SQLiteStore) SetMeta ¶
func (s *SQLiteStore) SetMeta(ctx context.Context, key, value string) error
SetMeta upserts a value in the system_meta key-value store.
func (*SQLiteStore) SyncProjectCategories ¶ added in v0.34.0
func (s *SQLiteStore) SyncProjectCategories(ctx context.Context) (int, error)
SyncProjectCategories creates forum categories for any projects that don't have one yet.
func (*SQLiteStore) UnclaimRawMemory ¶ added in v0.22.0
func (s *SQLiteStore) UnclaimRawMemory(ctx context.Context, id string) error
UnclaimRawMemory resets a raw memory to unprocessed so it can be retried.
func (*SQLiteStore) UpdateAbstraction ¶
func (s *SQLiteStore) UpdateAbstraction(ctx context.Context, a store.Abstraction) error
UpdateAbstraction updates an existing abstraction.
func (*SQLiteStore) UpdateAssociationStrength ¶
func (s *SQLiteStore) UpdateAssociationStrength(ctx context.Context, sourceID, targetID string, strength float32) error
UpdateAssociationStrength updates the strength of an association.
func (*SQLiteStore) UpdateAssociationType ¶
func (s *SQLiteStore) UpdateAssociationType(ctx context.Context, sourceID, targetID string, relationType string) error
UpdateAssociationType updates the relation type of an existing association.
func (*SQLiteStore) UpdateEmbedding ¶ added in v0.33.0
UpdateSalience updates the salience of a memory.
func (*SQLiteStore) UpdateEpisode ¶
UpdateEpisode updates an existing episode.
func (*SQLiteStore) UpdateForumPostState ¶ added in v0.34.0
UpdateForumPostState updates the state of a forum post.
func (*SQLiteStore) UpdateMemory ¶
UpdateMemory updates an existing memory.
func (*SQLiteStore) UpdatePattern ¶
UpdatePattern updates an existing pattern.
func (*SQLiteStore) UpdateSalience ¶
func (*SQLiteStore) UpdateState ¶
UpdateState updates the state of a memory.
func (*SQLiteStore) WriteAbstraction ¶
func (s *SQLiteStore) WriteAbstraction(ctx context.Context, a store.Abstraction) error
WriteAbstraction inserts a new abstraction.
func (*SQLiteStore) WriteConceptSet ¶
func (s *SQLiteStore) WriteConceptSet(ctx context.Context, cs store.ConceptSet) error
func (*SQLiteStore) WriteConsolidation ¶
func (s *SQLiteStore) WriteConsolidation(ctx context.Context, record store.ConsolidationRecord) error
WriteConsolidation writes a consolidation record.
func (*SQLiteStore) WriteForumCategory ¶ added in v0.34.0
func (s *SQLiteStore) WriteForumCategory(ctx context.Context, cat store.ForumCategory) error
WriteForumCategory inserts a new forum category.
func (*SQLiteStore) WriteForumPost ¶ added in v0.34.0
WriteForumPost inserts a new forum post.
func (*SQLiteStore) WriteMemory ¶
WriteMemory writes a memory to the database.
func (*SQLiteStore) WriteMemoryAttributes ¶
func (s *SQLiteStore) WriteMemoryAttributes(ctx context.Context, attrs store.MemoryAttributes) error
func (*SQLiteStore) WriteMemoryResolution ¶
func (s *SQLiteStore) WriteMemoryResolution(ctx context.Context, res store.MemoryResolution) error
func (*SQLiteStore) WriteMetaObservation ¶
func (s *SQLiteStore) WriteMetaObservation(ctx context.Context, obs store.MetaObservation) error
WriteMetaObservation stores a meta-observation.
func (*SQLiteStore) WritePattern ¶
WritePattern inserts a new pattern.
func (*SQLiteStore) WriteRetrievalFeedback ¶
func (s *SQLiteStore) WriteRetrievalFeedback(ctx context.Context, fb store.RetrievalFeedback) error
WriteRetrievalFeedback stores a retrieval traversal record for later feedback processing.