Documentation
¶
Index ¶
- Constants
- func ConfiguredDiscoveryPaths(workDir string, extraPaths []string) []string
- func DiscoveryPaths(workDir string) []string
- func EstimateTokens(text string) int
- func MatchSkillToPrompt(metadata SkillMetadata, prompt string) bool
- type CLIToolSkill
- type ContextManager
- type Skill
- type SkillLevel
- type SkillManager
- func (m *SkillManager) EstimateTokens(text string) int
- func (m *SkillManager) EvictLRU()
- func (m *SkillManager) GetAllMetadata() []SkillMetadata
- func (m *SkillManager) GetInstructions(name string) (string, error)
- func (m *SkillManager) GetResource(name, resourcePath string) ([]byte, error)
- func (m *SkillManager) IsLoaded(name string) bool
- func (m *SkillManager) LoadAll(paths []string) error
- func (m *SkillManager) Recall(name string) error
- func (m *SkillManager) SetLoaded(name string, loaded bool) error
- type SkillMetadata
- type SkillResource
Constants ¶
const SkillFileName = "SKILL.md"
Variables ¶
This section is empty.
Functions ¶
func ConfiguredDiscoveryPaths ¶ added in v0.502.6
ConfiguredDiscoveryPaths returns the full ordered list of skill search paths (highest precedence first): the built-in discovery paths followed by any extra paths from configuration. Relative extra paths are resolved against workDir. This is the single source of truth shared by the agent's skill loader and the API/UI skill listing so they never diverge.
func DiscoveryPaths ¶
DiscoveryPaths returns the ordered list of skill search paths (highest precedence first).
func EstimateTokens ¶
EstimateTokens estimates token count (~4 chars per token).
func MatchSkillToPrompt ¶
func MatchSkillToPrompt(metadata SkillMetadata, prompt string) bool
MatchSkillToPrompt checks if a skill should activate based on its when-to-use field.
Types ¶
type CLIToolSkill ¶
type CLIToolSkill struct {
// contains filtered or unexported fields
}
CLIToolSkill wraps a CLI executable as a BaseTool.
func DiscoverCLITools ¶
func DiscoverCLITools(paths []string) []CLIToolSkill
DiscoverCLITools scans skill directories for CLI tool skills. A CLI tool skill is a directory containing an executable named "tool" and a README.md.
func (*CLIToolSkill) Info ¶
func (t *CLIToolSkill) Info() tools.ToolInfo
Info returns tool metadata.
func (*CLIToolSkill) Run ¶
func (t *CLIToolSkill) Run(ctx context.Context, params tools.ToolCall) (tools.ToolResponse, error)
Run executes the CLI tool with the given parameters as JSON stdin.
type ContextManager ¶
type ContextManager struct {
// contains filtered or unexported fields
}
ContextManager tracks token usage and manages skill loading levels.
func NewContextManager ¶
func NewContextManager(manager *SkillManager, maxContextTokens int) *ContextManager
func (*ContextManager) ActivateSkill ¶
func (cm *ContextManager) ActivateSkill(name string) (string, error)
ActivateSkill loads Level 2 instructions for a skill, evicting if needed.
func (*ContextManager) GetMetadataPrompt ¶
func (cm *ContextManager) GetMetadataPrompt() string
GetMetadataPrompt returns the always-loaded Level 1 metadata for all skills formatted for injection into the system prompt. ~50 tokens per skill.
func (*ContextManager) ShouldActivate ¶
func (cm *ContextManager) ShouldActivate(prompt string) []string
ShouldActivate checks if a skill should be auto-activated based on prompt.
func (*ContextManager) TokenUsage ¶
func (cm *ContextManager) TokenUsage() (used, max int)
TokenUsage returns current token usage stats.
type Skill ¶
type Skill struct {
Metadata SkillMetadata
Instructions string
Resources []SkillResource
SourcePath string
LoadedLevel SkillLevel
LastAccessed time.Time
}
func DiscoverSkills ¶
DiscoverSkills scans all paths for SKILL.md files and returns skills ordered by precedence. Skills from higher-precedence paths override same-named skills from lower paths.
func ParseSkillFile ¶
type SkillLevel ¶
type SkillLevel int
const ( LevelMetadata SkillLevel = 1 LevelInstructions SkillLevel = 2 LevelResources SkillLevel = 3 )
type SkillManager ¶
type SkillManager struct {
// contains filtered or unexported fields
}
func NewSkillManager ¶
func NewSkillManager(maxCache int) *SkillManager
func (*SkillManager) EstimateTokens ¶
func (m *SkillManager) EstimateTokens(text string) int
func (*SkillManager) EvictLRU ¶
func (m *SkillManager) EvictLRU()
func (*SkillManager) GetAllMetadata ¶
func (m *SkillManager) GetAllMetadata() []SkillMetadata
func (*SkillManager) GetInstructions ¶
func (m *SkillManager) GetInstructions(name string) (string, error)
func (*SkillManager) GetResource ¶
func (m *SkillManager) GetResource(name, resourcePath string) ([]byte, error)
func (*SkillManager) IsLoaded ¶
func (m *SkillManager) IsLoaded(name string) bool
func (*SkillManager) LoadAll ¶
func (m *SkillManager) LoadAll(paths []string) error
func (*SkillManager) Recall ¶
func (m *SkillManager) Recall(name string) error
type SkillMetadata ¶
type SkillMetadata struct {
Name string `yaml:"name"`
Description string `yaml:"description"`
Version string `yaml:"version"`
Author string `yaml:"author"`
License string `yaml:"license"`
Compatibility string `yaml:"compatibility"`
AllowedTools string `yaml:"allowed-tools"`
UserInvocable bool `yaml:"user-invocable"`
WhenToUse string `yaml:"when-to-use"`
WhenNotToUse string `yaml:"when-not-to-use"`
DisableModelInvocation bool `yaml:"disable-model-invocation"`
Context string `yaml:"context"`
}