learning

package
v0.1.14 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultMemoryRoot is the workspace-relative directory for memory.md, aligned with prompt/section/memory.
	DefaultMemoryRoot = "work"
	DefaultMemoryFile = "memory.md"
	DefaultCharLimit  = 2200
)

Variables

This section is empty.

Functions

func FormatHelp

func FormatHelp() string

FormatHelp returns /learn usage text.

func FormatMemory

func FormatMemory(entries []MemoryEntry, used, limit int) string

FormatMemory renders memory entries for display.

func MemoryRelPath

func MemoryRelPath(root, file string) string

MemoryRelPath returns workspace-relative path to memory.md.

func RenderMemory

func RenderMemory(entries []MemoryEntry) string

func SummarizeSessionUserMessages

func SummarizeSessionUserMessages(ctx context.Context, store agentkit.SessionStore, sessionID agentkit.SessionID, maxMessages int) (string, error)

SummarizeSessionUserMessages extracts recent user text from the current session.

Types

type Config

type Config struct {
	Disabled   bool   `json:"disabled"`
	CharLimit  int    `json:"charLimit"`
	MemoryRoot string `json:"memoryRoot"`
	MemoryFile string `json:"memoryFile"`
}

type Deps

type Deps struct {
	Workspace    workspace.Service     `json:"workspace"`
	SessionStore agentkit.SessionStore `json:"sessionStore"`
}

type MemoryEntry

type MemoryEntry struct {
	Content string
	Meta    string
}

MemoryEntry is one §-delimited block in memory.md.

func ParseMemory

func ParseMemory(raw string) []MemoryEntry

type MemoryStore

type MemoryStore struct {
	Path      string
	CharLimit int
}

MemoryStore reads and writes a single memory.md file with capacity limits.

func NewMemoryStore

func NewMemoryStore(path string, charLimit int) *MemoryStore

func (*MemoryStore) Add

func (s *MemoryStore) Add(content, source string) error

func (*MemoryStore) Load

func (s *MemoryStore) Load() ([]MemoryEntry, error)

func (*MemoryStore) Remove

func (s *MemoryStore) Remove(oldText string) error

func (*MemoryStore) Save

func (s *MemoryStore) Save(entries []MemoryEntry) error

func (*MemoryStore) TotalChars

func (s *MemoryStore) TotalChars(entries []MemoryEntry) int

type Service

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

Service owns tenant personal memory and /learn commands.

func New

func New(cfg Config, deps Deps) (*Service, error)

New registers learning/default: Personal memory storage and /learn slash commands.

func (*Service) Commands

func (s *Service) Commands() []agentkit.Command

func (*Service) LoadEntries

func (s *Service) LoadEntries(ctx context.Context) ([]MemoryEntry, int, int, error)

LoadEntries reads personal memory for the current tenant workspace.

Jump to

Keyboard shortcuts

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