memory

package
v0.0.0-...-f56615f Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2026 License: MIT Imports: 24 Imported by: 0

Documentation

Overview

Package memory manages file-backed, cross-session long-term memory.

Index

Constants

View Source
const (
	ToolSearch = "memories_search"
	ToolRead   = "memories_read"
	ToolList   = "memories_list"
	ToolAdd    = "memories_add_ad_hoc_note"
)

Variables

This section is empty.

Functions

func StripCitations

func StripCitations(value string) (string, []string)

Types

type CitationParser

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

CitationParser removes hidden memory citations across arbitrary stream chunk boundaries while retaining their rollout IDs for usage feedback.

func (*CitationParser) Finish

func (p *CitationParser) Finish() (string, []string)

func (*CitationParser) Push

func (p *CitationParser) Push(value string) string

type Config

type Config struct {
	Generate                       bool
	Use                            bool
	DedicatedTools                 bool
	AutoCapture                    bool
	SummaryTokens                  int
	MaxRolloutsPerStartup          int
	MaxRolloutAgeDays              int
	MinRolloutIdleHours            int
	MaxRawMemoriesForConsolidation int
	MaxUnusedDays                  int
	ExtractModel                   string
	ConsolidationModel             string
}

Config controls generation and retrieval without coupling memory to one model provider. Empty model names use the active SuperCode model.

func DefaultConfig

func DefaultConfig() Config

type PipelineReport

type PipelineReport struct {
	Eligible             int
	Extracted            int
	NoOutput             int
	Failed               int
	Consolidated         bool
	ConsolidationSkipped bool
}

type Store

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

func NewStore

func NewStore(path string, legacyPaths ...string) (*Store, error)

NewStore creates a directory-backed memory store. A historical memory.md path may be supplied for one-time migration into an ad-hoc note.

func (*Store) AddAdHocNamed

func (s *Store) AddAdHocNamed(filename, note string) (string, error)

func (*Store) AddAdHocNote

func (s *Store) AddAdHocNote(slug, note string) (string, error)

func (*Store) AutoCapture

func (s *Store) AutoCapture(prompt string) (bool, error)

func (*Store) Clear

func (s *Store) Clear() error

Clear is an explicit hard reset retained for programmatic compatibility. It removes generated artifacts, source extracts, notes, generated Skills, metadata, and the private Git baseline. The TUI's /forget command uses Forget and therefore flows through Phase 2 instead.

func (*Store) Configuration

func (s *Store) Configuration() Config

func (*Store) Configure

func (s *Store) Configure(maxTokens int, autoCapture bool)

Configure retains the original API while mapping it onto summary injection and optional deterministic capture of explicit preference statements.

func (*Store) ConfigureAdvanced

func (s *Store) ConfigureAdvanced(configuration Config)

func (*Store) Forget

func (s *Store) Forget(value string) error

Forget queues a user-authorized deletion or update request for the next global consolidation pass instead of editing generated MEMORY.md directly.

func (*Store) Instructions

func (s *Store) Instructions() string

func (*Store) Read

func (s *Store) Read() (string, error)

func (*Store) RecordUsage

func (s *Store) RecordUsage(rolloutIDs []string)

func (*Store) Remember

func (s *Store) Remember(value string) error

func (*Store) RememberWithSource

func (s *Store) RememberWithSource(value, source string) error

func (*Store) Root

func (s *Store) Root() string

func (*Store) RunShutdown

func (s *Store) RunShutdown(ctx context.Context, modelProvider provider.Provider, sessions *session.Store, currentSessionID, activeModel string) (PipelineReport, error)

RunShutdown cancels and joins the background startup pass, then extracts the just-committed current root session without applying the startup idle cutoff. A redacted serialized-content hash provides the same idempotency guard used by startup passes, without treating a metadata-only session commit as new.

func (*Store) RunStartup

func (s *Store) RunStartup(ctx context.Context, modelProvider provider.Provider, sessions *session.Store, currentSessionID, activeModel string) (PipelineReport, error)

func (*Store) StartStartup

func (s *Store) StartStartup(ctx context.Context, modelProvider provider.Provider, sessions *session.Store, currentSessionID, activeModel string)

StartStartup launches the bounded pipeline for idle sessions. It intentionally does not block normal chat startup.

func (*Store) Status

func (s *Store) Status() string

func (*Store) StopStartup

func (s *Store) StopStartup(ctx context.Context) error

StopStartup cancels and joins the optional background startup pipeline without starting extraction for a current session.

func (*Store) Summary

func (s *Store) Summary() (string, error)

func (*Store) Tools

func (s *Store) Tools() []tool.Tool

Jump to

Keyboard shortcuts

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