learning

package
v0.3.13 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2026 License: MIT Imports: 24 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"
	DefaultStagedSubdir   = "memory/.staged"
)

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 NewBackgroundReview added in v0.3.13

func NewBackgroundReview(cfg BackgroundReviewConfig, deps backgroundReviewDeps) (agentkit.HookProvider, error)

NewBackgroundReview registers hook/background-review: spawn an LLM review fork after each successful turn.

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 NewLearnCapture added in v0.3.13

func NewLearnCapture(_ struct{}, deps struct {
	Learning *Service `json:"learning"`
}) (agentkit.Tool, error)

NewLearnCapture registers tool/learn-capture for background review and /learn tooling.

func RenderMemory

func RenderMemory(entries []MemoryEntry) string

RenderMemory serializes entries into a memory.md file body.

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 BackgroundReviewConfig added in v0.3.13

type BackgroundReviewConfig struct {
	Enabled           *bool  `json:"enabled"`
	Model             string `json:"model"`
	MaxSteps          int    `json:"maxSteps"`
	MaxDigestMessages int    `json:"maxDigestMessages"`
	SkipSlashOnly     *bool  `json:"skipSlashOnly"`
	MinTurnTokens     int    `json:"minTurnTokens"`
	MaxReviewsPerDay  int    `json:"maxReviewsPerDay"`
	MinIdleSeconds    int    `json:"minIdleSeconds"`
	Notify            bool   `json:"notify"`
}

BackgroundReviewConfig controls post-turn LLM review (Hermes-style learning fork).

type Config

type Config struct {
	Disabled  bool `json:"disabled"`
	CharLimit int  `json:"charLimit"`
	// MemoryRoot is where memory.md, dreaming, and staged review files live.
	// Default "." resolves under each tenant local root; use "global:." for shared ~/.agentkit (or L1 global root).
	MemoryRoot  string              `json:"memoryRoot"`
	MemoryFile  string              `json:"memoryFile"`
	SessionsDir string              `json:"sessionsDir"`
	Dreaming    dreaming.Config     `json:"dreaming"`
	Workshop    workshop.Config     `json:"workshop"`
	Review      ReviewServiceConfig `json:"review"`
}

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 = rtlearning.MemoryEntry

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

func ParseMemory

func ParseMemory(raw string) []MemoryEntry

ParseMemory splits a memory.md body into entries.

type MemoryStore

type MemoryStore struct {
	Path      string
	CharLimit int
	// DocName is the file title in the on-disk header (default memory.md).
	DocName string
}

MemoryStore reads and writes a §-delimited 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 ReviewServiceConfig added in v0.3.13

type ReviewServiceConfig struct {
	// WriteApproval when true, background-review memory writes are staged until /learn approve (default false = auto).
	WriteApproval *bool `json:"writeApproval"`
}

ReviewServiceConfig controls background-review writes (learning/default).

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) CaptureMemoryAdd added in v0.3.13

func (s *Service) CaptureMemoryAdd(ctx context.Context, text, source string) (string, error)

CaptureMemoryAdd implements rtlearning.CaptureApplier.

func (*Service) CaptureMemoryRemove added in v0.3.13

func (s *Service) CaptureMemoryRemove(ctx context.Context, oldText string) (string, error)

CaptureMemoryRemove implements rtlearning.CaptureApplier.

func (*Service) CaptureSkillPropose added in v0.3.13

func (s *Service) CaptureSkillPropose(ctx context.Context, name, body, sessionID, focus, source string) (string, error)

CaptureSkillPropose implements rtlearning.CaptureApplier.

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