memory

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GlobalDirName    = "global"
	ResourceDirName  = "resources"
	ScopeRootDirName = "scopes"
)
View Source
const (
	LongTermFileName = "MEMORY.md"
	ShortTermDirName = "daily"
)

Variables

This section is empty.

Functions

func ResolveScopedResourceRoot

func ResolveScopedResourceRoot(baseResourceDir, memoryScopeKey string) string

Types

type Manager

type Manager struct {
	Dir string

	MaxLongTermRunes  int
	MaxShortTermRunes int
	MaxEntryRunes     int
	// contains filtered or unexported fields
}

func NewManager

func NewManager(dir string, prompts *prompting.Loader) *Manager

func (*Manager) AppendDailySummary

func (m *Manager) AppendDailySummary(memoryScopeKey, sessionKey, summary string, at time.Time) error

func (*Manager) BuildPrompt

func (m *Manager) BuildPrompt(memoryScopeKey, userText string) (string, error)

func (*Manager) Init

func (m *Manager) Init() error

func (*Manager) SaveInteraction

func (m *Manager) SaveInteraction(memoryScopeKey, userText, assistantText string, failed bool) (bool, error)

func (*Manager) Snapshot

func (m *Manager) Snapshot(memoryScopeKey string, at time.Time) (ScopeSnapshot, error)

func (*Manager) WriteLongTerm

func (m *Manager) WriteLongTerm(memoryScopeKey, scopeType, content string) (string, error)

type ScopeSnapshot

type ScopeSnapshot struct {
	ScopeKey          string    `json:"scope_key"`
	GlobalLongPath    string    `json:"global_long_path"`
	GlobalLongText    string    `json:"global_long_text"`
	ScopeLongPath     string    `json:"scope_long_path"`
	ScopeLongText     string    `json:"scope_long_text"`
	ScopeShortTermDir string    `json:"scope_short_term_dir"`
	ShortTermName     string    `json:"short_term_name"`
	GeneratedAt       time.Time `json:"generated_at"`
}

Jump to

Keyboard shortcuts

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