learning

package
v0.1.21 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultMemoryRoot is the workspace-relative directory for memory.md (tenant local root).
	DefaultMemoryRoot     = "."
	DefaultMemoryFile     = "memory.md"
	DefaultCharLimit      = 2200
	DefaultDreamsFile     = "DREAMS.md"
	DefaultDreamingSubdir = "memory/dreaming"
)

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 NewDreamSweep added in v0.1.17

func NewDreamSweep(cfg DreamSweepConfig, deps DreamSweepDeps) (capschedule.Runtime, error)

NewDreamSweep registers learning/dream-sweep: background grounded dreaming sweeps.

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"`
	SessionsDir string          `json:"sessionsDir"`
	Dreaming    dreaming.Config `json:"dreaming"`
	Workshop    workshop.Config `json:"workshop"`
}

type Deps

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

type DreamSweep added in v0.1.17

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

DreamSweep runs scheduled dreaming sweeps without agent turns.

func (*DreamSweep) Start added in v0.1.17

func (*DreamSweep) Stop added in v0.1.17

func (d *DreamSweep) Stop(context.Context) error

type DreamSweepConfig added in v0.1.17

type DreamSweepConfig struct {
	PollSeconds int `json:"pollSeconds"`
}

type DreamSweepDeps added in v0.1.17

type DreamSweepDeps struct {
	Learning *Service `json:"learning"`
}

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, dreaming, workshop, and /learn commands.

func New

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

New registers learning/default: personal memory, dreaming, workshop, and /learn.

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.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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