agent

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2026 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Skill

type Skill struct {
	Name         string
	Description  string
	AllowedTools []string // nil means all tools
	Model        string   // empty means inherit
	Body         string   // raw markdown body (template)
	Source       string   // "project" or "user"
	Dir          string   // absolute path to the skill directory (contains SKILL.md)
}

Skill represents a loaded skill parsed from a SKILL.md file.

func (*Skill) BundledFiles added in v0.4.1

func (s *Skill) BundledFiles() []string

BundledFiles returns the relative paths of supporting files in the skill directory (everything except SKILL.md), sorted. These are the third level of progressive disclosure: the agent reads them on demand via read_file/bash using the absolute paths formed by joining Dir with each entry.

func (*Skill) LoadForTool added in v0.4.1

func (s *Skill) LoadForTool(rawArgs string) string

LoadForTool renders the skill body with the given arguments and appends a listing of bundled supporting files (with absolute paths) so the agent can choose to read them next. This is the payload returned by the `skill` tool — the second level of progressive disclosure, with pointers to the third.

func (*Skill) RenderPrompt

func (s *Skill) RenderPrompt(rawArgs string) string

RenderPrompt processes the skill body template with the given arguments. It replaces $ARGUMENTS, $1/$2/etc., and executes !`command` substitutions.

type SkillRegistry

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

SkillRegistry holds all loaded skills keyed by name.

func LoadSkills

func LoadSkills(dirs ...string) *SkillRegistry

LoadSkills scans the given directories for skill definitions. Each subdirectory containing a SKILL.md file is parsed as a skill. Directories earlier in the list take precedence on name collisions. Callers should pass directories in precedence order (highest first).

func NewSkillRegistry

func NewSkillRegistry() *SkillRegistry

NewSkillRegistry creates an empty registry.

func (*SkillRegistry) All

func (r *SkillRegistry) All() map[string]*Skill

All returns all loaded skills.

func (*SkillRegistry) Count

func (r *SkillRegistry) Count() int

Count returns the number of loaded skills.

func (*SkillRegistry) FormatForSystemPrompt

func (r *SkillRegistry) FormatForSystemPrompt() string

FormatForSystemPrompt returns a system-prompt block describing available skills so the LLM can suggest them to the user when relevant.

func (*SkillRegistry) FormatSkillsList

func (r *SkillRegistry) FormatSkillsList() string

FormatSkillsList returns a formatted string listing all skills for display.

func (*SkillRegistry) Get

func (r *SkillRegistry) Get(name string) *Skill

Get returns a skill by name, or nil if not found.

Jump to

Keyboard shortcuts

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