memory

package
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2026 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadInstructions

func LoadInstructions(workDir string) string

LoadInstructions loads and concatenates instructions from multiple sources:

  1. Repo-level: .polycode/instructions.md in workDir
  2. User-level: ~/.config/polycode/instructions.md
  3. Built-in default

All sources that exist are concatenated, separated by "\n\n".

Types

type MemoryStore

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

MemoryStore manages persistent memory files stored as markdown.

func NewMemoryStore

func NewMemoryStore(memDir string) *MemoryStore

NewMemoryStore creates a MemoryStore that reads from and writes to memDir.

func (*MemoryStore) FormatForPrompt

func (s *MemoryStore) FormatForPrompt() string

FormatForPrompt formats all loaded memory files into a single string suitable for inclusion in a system prompt.

func (*MemoryStore) Get

func (s *MemoryStore) Get(name string) (string, error)

Get reads a single memory file by name (without the .md extension).

func (*MemoryStore) Load

func (s *MemoryStore) Load() map[string]string

Load reads all .md files from the memory directory and returns a map of name (without extension) to file content. Returns an empty map if the directory does not exist.

func (*MemoryStore) Save

func (s *MemoryStore) Save(name, content string) error

Save writes content to a memory file with the given name (the .md extension is appended automatically). It creates the memory directory if it does not exist.

Jump to

Keyboard shortcuts

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