skills

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const SkillsDirName = "skills"

SkillsDirName is the subdirectory under state dir where skills are stored

Variables

This section is empty.

Functions

func NewSkillsPrompt

func NewSkillsPrompt(listSkills func() ([]skilldomain.Skill, error), customTemplate string) agent.DynamicPrompt

NewSkillsPrompt returns a DynamicPrompt that renders the list of available skills. If customTemplate is non-empty, it is used as a template with {{.Skills}} slice. Otherwise, the default template is used (mimics current XML behavior).

Types

type Service

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

Service manages the skills directory (fixed at stateDir/skills), lazy SkillManager, dynamic prompt, and in-process MCP session

func NewService

func NewService(stateDir string) (*Service, error)

NewService creates a skills service. Skills are stored under stateDir/skills.

func (*Service) GetMCPSession

func (s *Service) GetMCPSession(ctx context.Context) (*mcp.ClientSession, error)

GetMCPSession returns a shared MCP client session connected to the in-process skillserver (starts on first use)

func (*Service) GetManager

func (s *Service) GetManager() (skilldomain.SkillManager, error)

GetManager returns the SkillManager if the skills dir is set, otherwise nil. Manager creation is serialized (createMu) so only one createManager() runs at a time, avoiding concurrent RebuildIndex and filesystem contention.

func (*Service) GetSkillsDir

func (s *Service) GetSkillsDir() string

GetSkillsDir returns the skills directory path (always stateDir/skills)

func (*Service) GetSkillsPrompt

func (s *Service) GetSkillsPrompt(config *state.AgentConfig) (agent.DynamicPrompt, error)

GetSkillsPrompt returns a DynamicPrompt that injects the available skills XML (or nil if no manager). When config is non-nil and config.SkillsPrompt is set, that text is used as the intro; otherwise the default intro is used.

func (*Service) RefreshManagerFromConfig

func (s *Service) RefreshManagerFromConfig()

RefreshManagerFromConfig updates the existing manager's git repo list and rebuilds the index (same as skillserver: UpdateGitRepos + RebuildIndex in place). Does nothing if no manager exists yet. Call this when git repo config changes instead of invalidating; avoids blocking ListSkills on full recreate.

type Skill

type Skill struct {
	Name        string
	Description string
	ID          string
}

Skill is a local representation of a skill for template rendering

Jump to

Keyboard shortcuts

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