Versions in this module Expand all Collapse all v0 v0.5.0 May 11, 2026 v0.4.0 May 5, 2026 v0.3.0 May 3, 2026 v0.2.0 May 16, 2026 Changes in this version type BehaviorTracker + Behaviors []Behavior v0.1.3 Jul 4, 2026 v0.1.1 Jun 25, 2026 Changes in this version + var ErrBatchTooLarge = errors.New("batch size exceeds database limit") + var ErrContentTooLong = errors.New("content exceeds maximum length") + var ErrCycleDetected = errors.New("cycle detected") + var ErrDatabaseLocked = errors.New("database is locked") + var ErrDuplicateEdge = errors.New("duplicate edge") + var ErrDuplicateNode = errors.New("duplicate node") + var ErrEdgeNotFound = errors.New("edge not found") + var ErrEmbeddingNotFound = errors.New("embedding not found") + var ErrEmptyContent = errors.New("content cannot be empty") + var ErrInvalidEdgeType = errors.New("invalid edge type") + var ErrInvalidNodeType = errors.New("invalid node type") + var ErrNodeNotFound = errors.New("node not found") + var ErrSessionNotFound = errors.New("session not found") + var ErrVersionNotFound = errors.New("version not found") + func ComputeSchemaFingerprint(chunkerVersion, embeddingModel string) string + func ComputeSchemaVersion(chunkerVersion, modelName string) string + func DecodeVector(b []byte) []float32 + func EncodeVector(v []float32) []byte + func FormatPredictions(predictions []Behavior) string + func IsAcyclic(edgeType string) bool + type Behavior struct + Confidence float64 + Context string + Frequency int + ID string + LastSeen time.Time + Pattern string + type BehaviorTracker struct + func NewBehaviorTracker() *BehaviorTracker + func (bt *BehaviorTracker) GetBehaviors() []Behavior + func (bt *BehaviorTracker) GetTopPatterns(limit int) []Behavior + func (bt *BehaviorTracker) Predict(context string) []Behavior + func (bt *BehaviorTracker) Track(action, context string) + type CodeChunkRecord struct + Content string + EndLine int + FileHash string + ID string + Language string + Path string + SchemaVersion string + StartLine int + Symbol string + Tokens int + Vector []byte + type DoctorStatsResult struct + LowConfidence int + Orphans int + Pinned int + TotalNodes int + type Edge struct + Acyclic bool + CreatedAt time.Time + FromID string + ID string + InvalidAt time.Time + Metadata string + ToID string + Type string + ValidAt time.Time + Weight float64 + type MockStorage struct + func NewMockStorage() *MockStorage + func (m *MockStorage) AddFileWatch(_ context.Context, filePath, nodeID, gitHash string) error + func (m *MockStorage) AddReplayEvent(_ context.Context, sessionID, data string) error + func (m *MockStorage) AllEmbeddings(_ context.Context, model string) (map[string][]float32, error) + func (m *MockStorage) CheckCycle(_ context.Context, fromID, toID string) (bool, error) + func (m *MockStorage) Close() error + func (m *MockStorage) CountAllEdges(_ context.Context) (int, error) + func (m *MockStorage) CountEdges(_ context.Context, nodeID string) (int, int, error) + func (m *MockStorage) CountEdgesBatch(_ context.Context, nodeIDs []string) (map[string][2]int, error) + func (m *MockStorage) CreateEdge(_ context.Context, e *Edge) error + func (m *MockStorage) CreateNode(_ context.Context, n *Node) error + func (m *MockStorage) CreateSession(_ context.Context, sess *Session) error + func (m *MockStorage) DeleteEdge(_ context.Context, id string) error + func (m *MockStorage) DeleteEmbedding(_ context.Context, nodeID string) error + func (m *MockStorage) DeleteNode(_ context.Context, id string) error + func (m *MockStorage) DoctorStats(_ context.Context) (DoctorStatsResult, error) + func (m *MockStorage) EdgeCount() int + func (m *MockStorage) EndSession(_ context.Context, id string, summary string) error + func (m *MockStorage) FlushAccessLog(_ context.Context) (int, error) + func (m *MockStorage) GetAllEdgesFor(_ context.Context, nodeIDs []string) ([]*Edge, error) + func (m *MockStorage) GetAllSignatures(_ context.Context) (map[string]string, error) + func (m *MockStorage) GetEdge(_ context.Context, id string) (*Edge, error) + func (m *MockStorage) GetEdgesBetween(_ context.Context, nodeIDs []string) ([]*Edge, error) + func (m *MockStorage) GetEdgesFrom(_ context.Context, nodeID string) ([]*Edge, error) + func (m *MockStorage) GetEdgesTo(_ context.Context, nodeID string) ([]*Edge, error) + func (m *MockStorage) GetEmbedding(_ context.Context, nodeID string) ([]float32, string, error) + func (m *MockStorage) GetEmbeddingsBatch(_ context.Context, model string, offset, limit int) (map[string][]float32, error) + func (m *MockStorage) GetNeighbors(_ context.Context, nodeID string) ([]*Node, error) + func (m *MockStorage) GetNode(_ context.Context, id string) (*Node, error) + func (m *MockStorage) GetNodeByKey(_ context.Context, key, project string) (*Node, error) + func (m *MockStorage) GetNodesBatch(_ context.Context, ids []string) ([]*Node, error) + func (m *MockStorage) GetReplayEvents(_ context.Context, sessionID string) ([]*ReplayEvent, error) + func (m *MockStorage) GetValidEdgesFrom(_ context.Context, nodeID string, at time.Time) ([]*Edge, error) + func (m *MockStorage) GetValidEdgesTo(_ context.Context, nodeID string, at time.Time) ([]*Edge, error) + func (m *MockStorage) GetVersions(_ context.Context, nodeID string) ([]*NodeVersion, error) + func (m *MockStorage) InjectEdges(edges ...*Edge) + func (m *MockStorage) InjectNodes(nodes ...*Node) + func (m *MockStorage) InvalidateEdge(_ context.Context, id string) error + func (m *MockStorage) LastUpdated(_ context.Context) (time.Time, error) + func (m *MockStorage) ListNodes(_ context.Context, f NodeFilter) ([]*Node, error) + func (m *MockStorage) ListSessions(_ context.Context, project string, limit int) ([]*Session, error) + func (m *MockStorage) LoadNodeMetadata(_ context.Context, nodeIDs []string) (map[string]map[string]string, error) + func (m *MockStorage) LogAccess(_ context.Context, nodeID string) error + func (m *MockStorage) NodeCount() int + func (m *MockStorage) NodeStats(_ context.Context) (map[string]int, int, error) + func (m *MockStorage) SaveEmbedding(_ context.Context, nodeID, model string, vector []float32) error + func (m *MockStorage) SaveNodeMetadata(_ context.Context, nodeID string, meta map[string]string) error + func (m *MockStorage) SaveSignature(_ context.Context, nodeID, signature string) error + func (m *MockStorage) SaveVersion(_ context.Context, nodeID string, content, changedBy, reason string) error + func (m *MockStorage) SearchNodeByHash(_ context.Context, hash, scope, project string) (*Node, error) + func (m *MockStorage) SearchNodes(_ context.Context, query string, limit int) ([]*Node, error) + func (m *MockStorage) SetError(err error) + func (m *MockStorage) String() string + func (m *MockStorage) TopConnected(_ context.Context, limit int) ([]string, error) + func (m *MockStorage) UpdateNode(_ context.Context, n *Node) error + func (m *MockStorage) UpdateNodeContent(_ context.Context, id, newContent string) error + func (m *MockStorage) WithTx(_ context.Context, fn func(Storage) error) error + type Node struct + AccessCount int + AccessedAt time.Time + Confidence float64 + Content string + ContentHash string + CreatedAt time.Time + ID string + Key string + Metadata map[string]string + Pinned bool + Project string + Scope string + SourceAgent string + SourceSession string + Summary string + Tags string + Tier int + Type string + UpdatedAt time.Time + Version int + type NodeFilter struct + Limit int + MetadataFilters map[string]string + MinConfidence float64 + Offset int + Pinned *bool + Project string + Scope string + SourceSession string + Tag string + Tier int + Type string + type NodeVersion struct + ChangedAt time.Time + ChangedBy string + Content string + NodeID string + Reason string + Version int + type ReplayEvent struct + CreatedAt time.Time + Data string + ID int64 + SessionID string + type Session struct + Agent string + EndedAt time.Time + ID string + Project string + StartedAt time.Time + Summary string + type Storage interface + AddFileWatch func(ctx context.Context, filePath, nodeID, gitHash string) error + AddReplayEvent func(ctx context.Context, sessionID, data string) error + AllEmbeddings func(ctx context.Context, model string) (map[string][]float32, error) + CheckCycle func(ctx context.Context, fromID, toID string) (bool, error) + Close func() error + CountAllEdges func(ctx context.Context) (int, error) + CountEdges func(ctx context.Context, nodeID string) (inbound int, outbound int, err error) + CountEdgesBatch func(ctx context.Context, nodeIDs []string) (map[string][2]int, error) + CreateEdge func(ctx context.Context, e *Edge) error + CreateNode func(ctx context.Context, n *Node) error + CreateSession func(ctx context.Context, sess *Session) error + DeleteEdge func(ctx context.Context, id string) error + DeleteEmbedding func(ctx context.Context, nodeID string) error + DeleteNode func(ctx context.Context, id string) error + DoctorStats func(ctx context.Context) (DoctorStatsResult, error) + EndSession func(ctx context.Context, id string, summary string) error + FlushAccessLog func(ctx context.Context) (int, error) + GetAllEdgesFor func(ctx context.Context, nodeIDs []string) ([]*Edge, error) + GetAllSignatures func(ctx context.Context) (map[string]string, error) + GetEdge func(ctx context.Context, id string) (*Edge, error) + GetEdgesBetween func(ctx context.Context, nodeIDs []string) ([]*Edge, error) + GetEdgesFrom func(ctx context.Context, nodeID string) ([]*Edge, error) + GetEdgesTo func(ctx context.Context, nodeID string) ([]*Edge, error) + GetEmbedding func(ctx context.Context, nodeID string) ([]float32, string, error) + GetEmbeddingsBatch func(ctx context.Context, model string, offset, limit int) (map[string][]float32, error) + GetNeighbors func(ctx context.Context, nodeID string) ([]*Node, error) + GetNode func(ctx context.Context, id string) (*Node, error) + GetNodeByKey func(ctx context.Context, key, project string) (*Node, error) + GetNodesBatch func(ctx context.Context, ids []string) ([]*Node, error) + GetReplayEvents func(ctx context.Context, sessionID string) ([]*ReplayEvent, error) + GetValidEdgesFrom func(ctx context.Context, nodeID string, at time.Time) ([]*Edge, error) + GetValidEdgesTo func(ctx context.Context, nodeID string, at time.Time) ([]*Edge, error) + GetVersions func(ctx context.Context, nodeID string) ([]*NodeVersion, error) + InvalidateEdge func(ctx context.Context, id string) error + LastUpdated func(ctx context.Context) (time.Time, error) + ListNodes func(ctx context.Context, f NodeFilter) ([]*Node, error) + ListSessions func(ctx context.Context, project string, limit int) ([]*Session, error) + LoadNodeMetadata func(ctx context.Context, nodeIDs []string) (map[string]map[string]string, error) + LogAccess func(ctx context.Context, nodeID string) error + NodeStats func(ctx context.Context) (map[string]int, int, error) + SaveEmbedding func(ctx context.Context, nodeID, model string, vector []float32) error + SaveNodeMetadata func(ctx context.Context, nodeID string, meta map[string]string) error + SaveSignature func(ctx context.Context, nodeID, signature string) error + SaveVersion func(ctx context.Context, nodeID string, content, changedBy, reason string) error + SearchNodeByHash func(ctx context.Context, hash, scope, project string) (*Node, error) + SearchNodes func(ctx context.Context, query string, limit int) ([]*Node, error) + TopConnected func(ctx context.Context, limit int) ([]string, error) + UpdateNode func(ctx context.Context, n *Node) error + UpdateNodeContent func(ctx context.Context, id, newContent string) error + WithTx func(ctx context.Context, fn func(Storage) error) error + type Store struct + func NewStore(dbPath string) (*Store, error) + func (s *Store) AddFileWatch(ctx context.Context, filePath, nodeID, gitHash string) error + func (s *Store) AddReplayEvent(ctx context.Context, sessionID, data string) error + func (s *Store) AllEmbeddings(ctx context.Context, model string) (map[string][]float32, error) + func (s *Store) CheckCycle(ctx context.Context, fromID, toID string) (bool, error) + func (s *Store) Close() error + func (s *Store) CountAllEdges(ctx context.Context) (int, error) + func (s *Store) CountEdges(ctx context.Context, nodeID string) (inbound int, outbound int, err error) + func (s *Store) CountEdgesBatch(ctx context.Context, nodeIDs []string) (map[string][2]int, error) + func (s *Store) CreateCodeIndex(ctx context.Context) error + func (s *Store) CreateEdge(ctx context.Context, e *Edge) error + func (s *Store) CreateNode(ctx context.Context, n *Node) error + func (s *Store) CreateSession(ctx context.Context, sess *Session) error + func (s *Store) DB() *sql.DB + func (s *Store) DeleteChunksByPath(ctx context.Context, path string) error + func (s *Store) DeleteEdge(ctx context.Context, id string) error + func (s *Store) DeleteEmbedding(ctx context.Context, nodeID string) error + func (s *Store) DeleteNode(ctx context.Context, id string) error + func (s *Store) DiffVersions(ctx context.Context, nodeID string, v1, v2 int) (content1, content2 string, err error) + func (s *Store) DoctorStats(ctx context.Context) (DoctorStatsResult, error) + func (s *Store) EndSession(ctx context.Context, id string, summary string) error + func (s *Store) FillNodeMetadata(ctx context.Context, nodes []*Node) error + func (s *Store) FindByPrefix(ctx context.Context, prefix string) ([]*Node, error) + func (s *Store) FlushAccessLog(ctx context.Context) (int, error) + func (s *Store) GetAllEdgesFor(ctx context.Context, nodeIDs []string) ([]*Edge, error) + func (s *Store) GetAllSignatures(ctx context.Context) (map[string]string, error) + func (s *Store) GetEdge(ctx context.Context, id string) (*Edge, error) + func (s *Store) GetEdgesBetween(ctx context.Context, nodeIDs []string) ([]*Edge, error) + func (s *Store) GetEdgesFrom(ctx context.Context, nodeID string) ([]*Edge, error) + func (s *Store) GetEdgesTo(ctx context.Context, nodeID string) ([]*Edge, error) + func (s *Store) GetEmbedding(ctx context.Context, nodeID string) ([]float32, string, error) + func (s *Store) GetEmbeddingsBatch(ctx context.Context, model string, offset, limit int) (map[string][]float32, error) + func (s *Store) GetFileHash(ctx context.Context, path string) (string, error) + func (s *Store) GetNeighbors(ctx context.Context, nodeID string) ([]*Node, error) + func (s *Store) GetNode(ctx context.Context, id string) (*Node, error) + func (s *Store) GetNodeByKey(ctx context.Context, key, project string) (*Node, error) + func (s *Store) GetNodesBatch(ctx context.Context, ids []string) ([]*Node, error) + func (s *Store) GetNodesByFile(ctx context.Context, filePath string) ([]*Node, error) + func (s *Store) GetReplayEvents(ctx context.Context, sessionID string) ([]*ReplayEvent, error) + func (s *Store) GetValidEdgesFrom(ctx context.Context, nodeID string, at time.Time) ([]*Edge, error) + func (s *Store) GetValidEdgesTo(ctx context.Context, nodeID string, at time.Time) ([]*Edge, error) + func (s *Store) GetVersions(ctx context.Context, nodeID string) ([]*NodeVersion, error) + func (s *Store) InvalidateEdge(ctx context.Context, id string) error + func (s *Store) InvalidateStaleChunks(ctx context.Context, currentVersion string) (int, error) + func (s *Store) LastUpdated(ctx context.Context) (time.Time, error) + func (s *Store) ListIndexedPaths(ctx context.Context) ([]string, error) + func (s *Store) ListNodes(ctx context.Context, f NodeFilter) ([]*Node, error) + func (s *Store) ListSessions(ctx context.Context, project string, limit int) ([]*Session, error) + func (s *Store) LoadNodeMetadata(ctx context.Context, nodeIDs []string) (map[string]map[string]string, error) + func (s *Store) LogAccess(ctx context.Context, nodeID string) error + func (s *Store) NodeStats(ctx context.Context) (map[string]int, int, error) + func (s *Store) RefreshCodeIndex(ctx context.Context, paths []string, hashFn func(string) string) (int, error) + func (s *Store) RollbackToVersion(ctx context.Context, nodeID string, version int) error + func (s *Store) SaveEmbedding(ctx context.Context, nodeID, model string, vector []float32) error + func (s *Store) SaveNodeMetadata(ctx context.Context, nodeID string, meta map[string]string) error + func (s *Store) SaveSignature(ctx context.Context, nodeID, signature string) error + func (s *Store) SaveVersion(ctx context.Context, nodeID string, content, changedBy, reason string) error + func (s *Store) SearchCodeChunksByLanguage(ctx context.Context, query string, languages []string, limit int) ([]*CodeChunkRecord, error) + func (s *Store) SearchCodeChunksFTS(ctx context.Context, query string, limit int) ([]*CodeChunkRecord, error) + func (s *Store) SearchCodeChunksHybrid(ctx context.Context, query string, queryVec []float32, limit int, ...) ([]*CodeChunkRecord, error) + func (s *Store) SearchNodeByHash(ctx context.Context, hash, scope, project string) (*Node, error) + func (s *Store) SearchNodes(ctx context.Context, query string, limit int) ([]*Node, error) + func (s *Store) StoreVector(ctx context.Context, chunkID string, vec []float32) error + func (s *Store) TopConnected(ctx context.Context, limit int) ([]string, error) + func (s *Store) UpdateNode(ctx context.Context, n *Node) error + func (s *Store) UpdateNodeContent(ctx context.Context, id, newContent string) error + func (s *Store) UpsertByTopic(ctx context.Context, n *Node, topicKey string) (*Node, bool, error) + func (s *Store) UpsertCodeChunk(ctx context.Context, chunk *CodeChunkRecord) error + func (s *Store) WithTx(ctx context.Context, fn func(Storage) error) error