memory

package
v0.1.7 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2026 License: MIT Imports: 19 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(configDir string) (*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"`
	Confidence float64   `json:"confidence"`
	Embedding  []float32 `json:"-"`
	CreatedAt  time.Time `json:"created_at"`
	UpdatedAt  time.Time `json:"updated_at"`
}

type MemoryEntry

type MemoryEntry struct {
	Content    string
	Confidence float64
	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) Close

func (mi *MemoryIndex) Close() error

func (*MemoryIndex) Delete

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

func (*MemoryIndex) ListIndexMeta added in v0.1.3

func (mi *MemoryIndex) ListIndexMeta(scope Scope, project string) (map[string]time.Time, 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, maxIngest int, confidenceThreshold 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

func (*MemoryService) Reconcile added in v0.1.3

func (s *MemoryService) Reconcile(ctx context.Context) (added int, removed int, updated int, err error)

func (*MemoryService) WaitReconcile added in v0.1.5

func (s *MemoryService) WaitReconcile()

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) ListProjectHashes added in v0.1.3

func (s *MemoryStore) ListProjectHashes() ([]string, error)

func (*MemoryStore) ModTime added in v0.1.3

func (s *MemoryStore) ModTime(scope Scope, project string, id string) (time.Time, 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