Help us shape the future of Go! Take the 2026 Go Developer Survey

memory

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Entry

type Entry struct {
	ID        string    `json:"id"`
	Key       string    `json:"key"`
	Content   string    `json:"content"`
	Category  string    `json:"category,omitempty"` // "project", "architecture", "preference", "rule"
	Scope     string    `json:"scope,omitempty"`    // "workspace", "global"
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
}

Entry represents a single memory item persisted across agent turns.

type Manager

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

Manager manages workspace and global persistent memory for agents.

func New

func New(workspaceDir string) *Manager

New creates a new memory Manager. Global memories default to <store root>/memory.json; hosts with their own layout override it via SetGlobalDir before use.

func (*Manager) Delete

func (m *Manager) Delete(idOrKey string) error

Delete removes a memory entry by ID or Key.

func (*Manager) FormatPrompt

func (m *Manager) FormatPrompt() string

FormatPrompt constructs the <project_memory> block for the agent system prompt.

func (*Manager) List

func (m *Manager) List() []Entry

List returns all registered memory entries.

func (*Manager) Reload

func (m *Manager) Reload()

Reload loads all memories from workspace (.forge/memory.json) and global (~/.forge-ade/memory.json).

func (*Manager) Save

func (m *Manager) Save(e Entry) error

Save stores or updates a memory entry and persists it to disk.

func (*Manager) Search

func (m *Manager) Search(query string) []Entry

Search returns entries matching the given query string.

func (*Manager) SetGlobalDir

func (m *Manager) SetGlobalDir(dir string)

SetGlobalDir points the global memory scope at dir and reloads.

func (*Manager) SetWorkspace

func (m *Manager) SetWorkspace(dir string)

SetWorkspace updates the active workspace directory and reloads memories.

Jump to

Keyboard shortcuts

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