learning

package
v0.1.8-rc.10 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2026 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Overview

Package learning provides autonomous skill distillation from completed agent sessions. After a task is completed successfully, the Learner reviews what happened and, if the task is novel enough, synthesises a reusable skill following the agentskills.io standard.

Learned skills are persisted in two places:

  1. MutableRepository — filesystem-backed, used by the skills framework.
  2. Vector store — used for semantic search so the orchestrator can discover relevant skills via memory_search before starting new tasks.

Design influences:

  • SkillRL (2026): hierarchical skill bank, failure lessons as first-class data
  • ExpeL: cross-task experiential learning with insight extraction
  • Self-RAG: relevance-scored retrieval with reflection

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// MinimumNoveltyScore is the LLM-assigned novelty score (1-10) above
	// which a completed task is considered novel enough to distill into a
	// reusable skill. Lower values create more skills; higher values are
	// more selective. Default is 7.
	MinimumNoveltyScore int `yaml:"minimum_novelty_score,omitempty" toml:"minimum_novelty_score,omitempty"`
}

Config tunes the post-session skill distillation pipeline.

func DefaultConfig

func DefaultConfig() Config

DefaultConfig returns a Config with sensible defaults.

type ILearner

type ILearner interface {
	Learn(ctx context.Context, req LearnRequest) error
}

ILearner is the interface for the skill distillation pipeline. The orchestrator depends on this interface so background learning can be faked in unit tests.

type LearnRequest

type LearnRequest struct {
	// Goal is the original user question / task.
	Goal string

	// Output is the final answer / result from the agent.
	Output string

	// ToolsUsed lists the names of tools that were called during execution.
	ToolsUsed []string

	// ToolTrace is a compressed summary of tool calls and their outcomes.
	// Unlike ToolsUsed (which only has names), this captures what each tool
	// returned, enabling the distillation LLM to accurately describe what
	// worked and what didn't. Inspired by SkillRL's failure lesson extraction.
	ToolTrace string
}

LearnRequest contains the context needed for a learning attempt.

type Learner

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

Learner reviews completed sessions and distills reusable skills.

func NewLearner

func NewLearner(
	exp expert.Expert,
	skillRepo skills.ISkillWriter,
	vectorStore vector.IStore,
	auditor audit.Auditor,
	cfg Config,
) *Learner

NewLearner creates a Learner backed by the given expert, skill repository, vector store (for discoverability), and auditor. cfg.MinimumNoveltyScore controls novelty filtering; zero-value fields fall back to DefaultConfig.

func (*Learner) Learn

func (l *Learner) Learn(ctx context.Context, req LearnRequest) error

Learn evaluates a completed task and, if worthy, synthesises a skill. It is designed to be called asynchronously (fire-and-forget) so it never blocks the user-facing response.

Directories

Path Synopsis
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

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