memory

package
v0.4.10 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package memory defines orb's root-level durable memory SDK seam. It is a orb-original addition with no upstream mirror and is importable standalone.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FileStore

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

func NewFileStore

func NewFileStore(dir string) (*FileStore, error)

func (*FileStore) Append

func (store *FileStore) Append(ctx context.Context, item Item) (string, error)

func (*FileStore) Delete

func (store *FileStore) Delete(ctx context.Context, id string) error

func (*FileStore) Get

func (store *FileStore) Get(ctx context.Context, id string) (Item, error)

func (*FileStore) Query

func (store *FileStore) Query(ctx context.Context, filter Filter) ([]Item, error)

func (*FileStore) Transact

func (store *FileStore) Transact(ctx context.Context, fn func(Store) error) error

type Filter

type Filter struct {
	Tags     []string
	Since    time.Time
	Until    time.Time
	Contains string
	Limit    int
}

type Item

type Item struct {
	ID      string            `json:"id"`
	Time    time.Time         `json:"time"`
	Content string            `json:"content"`
	Tags    []string          `json:"tags,omitempty"`
	Meta    map[string]string `json:"meta,omitempty"`
}

type Scored

type Scored struct {
	Item
	Score float64
}

type SemanticSearcher

type SemanticSearcher interface {
	Search(context.Context, string, int) ([]Scored, error)
}

SemanticSearcher returns highest-scoring items first and honors positive limit values.

type Store

type Store interface {
	Append(context.Context, Item) (string, error)
	Get(context.Context, string) (Item, error)
	Query(context.Context, Filter) ([]Item, error)
	Delete(context.Context, string) error
}

Store is a tenant-scoped durable memory backend. Implementations must accept concurrent calls. Query returns newest items first, treats Tags as an AND filter, matches Contains case-insensitively, and honors positive Limit values.

type TransactionalStore

type TransactionalStore interface {
	Store
	Transact(context.Context, func(Store) error) error
}

TransactionalStore makes compound profile mutations atomic across runtime instances and processes. The callback must use only the supplied Store.

Directories

Path Synopsis
Package agentmemory attaches Orb's bounded persistent memory to a plain agent.Agent.
Package agentmemory attaches Orb's bounded persistent memory to a plain agent.Agent.

Jump to

Keyboard shortcuts

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