memory

package
v0.95.1 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2026 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Overview

Package memory provides filesystem-backed persistent agent memory outside the chat workspace.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SanitizeScope

func SanitizeScope(scope string) string

SanitizeScope maps a raw scope label to a safe directory name.

Types

type FileStore

type FileStore struct {
	// Root is the absolute base directory for all scopes.
	Root string
	// DefaultFile is used when file is empty.
	DefaultFile string
	// MaxFileBytes caps write size.
	MaxFileBytes int
}

FileStore stores memory files under a single root directory.

func NewFileStore

func NewFileStore(root, defaultFile string, maxFileBytes int) (*FileStore, error)

NewFileStore creates a file-backed memory store.

func OpenFromConfig

func OpenFromConfig() (*FileStore, error)

OpenFromConfig opens the memory store under <workspace-parent>/agent-memories.

func (*FileStore) ListFiles

func (s *FileStore) ListFiles(scope string) ([]string, error)

ListFiles returns markdown filenames in one scope directory.

func (*FileStore) Read

func (s *FileStore) Read(scope, file string) (string, error)

Read returns the content of one memory file.

func (*FileStore) Write

func (s *FileStore) Write(scope, file, content string) error

Write persists content to one memory file.

type Store

type Store interface {
	ListFiles(scope string) ([]string, error)
	Read(scope, file string) (string, error)
	Write(scope, file, content string) error
}

Store reads and writes scoped memory markdown files.

Jump to

Keyboard shortcuts

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