memory

package
v0.1.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 7, 2026 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ProjectHash

func ProjectHash(cwd string) string

Types

type Embedder

type Embedder interface {
	Embed(text string) ([]float32, error)
	Dim() int
}

type LocalEmbedder

type LocalEmbedder struct {
	// contains filtered or unexported fields
}

func NewLocalEmbedder

func NewLocalEmbedder() (*LocalEmbedder, error)

func (*LocalEmbedder) Close

func (e *LocalEmbedder) Close()

func (*LocalEmbedder) Dim

func (e *LocalEmbedder) Dim() int

func (*LocalEmbedder) Embed

func (e *LocalEmbedder) Embed(text string) ([]float32, error)

type Memory

type Memory struct {
	ID        string    `json:"id"`
	Scope     Scope     `json:"scope"`
	Project   string    `json:"project"`
	Content   string    `json:"content"`
	Embedding []float32 `json:"-"`
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
}

type MemoryEntry

type MemoryEntry struct {
	Content string
	Scope   Scope
	Project string
}

type MemoryIndex

type MemoryIndex struct {
	// contains filtered or unexported fields
}

func OpenIndex

func OpenIndex(dir string, dim int) (*MemoryIndex, error)

func (*MemoryIndex) AllEmbeddings

func (mi *MemoryIndex) AllEmbeddings(scope Scope, project string) ([]struct {
	ID        string
	Embedding []float32
}, error)

func (*MemoryIndex) Close

func (mi *MemoryIndex) Close() error

func (*MemoryIndex) Delete

func (mi *MemoryIndex) Delete(id string) error

func (*MemoryIndex) Search

func (mi *MemoryIndex) Search(queryEmbedding []float32, queryText string, scope Scope, project string, threshold float64, limit int) ([]RecallResult, error)

func (*MemoryIndex) Upsert

func (mi *MemoryIndex) Upsert(m *Memory) error

type MemoryService

type MemoryService struct {
	// contains filtered or unexported fields
}

func NewMemoryService

func NewMemoryService(configDir string, embedder Embedder, cwd string, maxRecall int, recallThreshold float64, dedupThreshold float64, subClient provider.ChatClient) (*MemoryService, error)

func (*MemoryService) Close

func (s *MemoryService) Close() error

func (*MemoryService) Ingest

func (s *MemoryService) Ingest(ctx context.Context, turnMessages []message.Message)

func (*MemoryService) Recall

func (s *MemoryService) Recall(ctx context.Context, query string) []Memory

type MemoryStore

type MemoryStore struct {
	// contains filtered or unexported fields
}

func NewMemoryStore

func NewMemoryStore(dir string) (*MemoryStore, error)

func (*MemoryStore) Delete

func (s *MemoryStore) Delete(scope Scope, project string, id string) error

func (*MemoryStore) Dir

func (s *MemoryStore) Dir() string

func (*MemoryStore) List

func (s *MemoryStore) List(scope Scope, project string) ([]string, error)

func (*MemoryStore) Read

func (s *MemoryStore) Read(scope Scope, project string, id string) (*Memory, error)

func (*MemoryStore) Write

func (s *MemoryStore) Write(m *Memory) error

type RecallResult

type RecallResult struct {
	Memory Memory
	Score  float64
}

type Scope

type Scope string
const (
	ScopeGlobal  Scope = "global"
	ScopeProject Scope = "project"
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL