Documentation
¶
Overview ¶
Package skills manages the agent's learned procedures: Markdown files with YAML front matter that are injected into the prompt when relevant.
Index ¶
- type Filter
- type Manager
- func (m *Manager) Categories() map[string]int
- func (m *Manager) Chains(name string) []Skill
- func (m *Manager) Count() int
- func (m *Manager) Delete(name string) error
- func (m *Manager) Everyday() []Skill
- func (m *Manager) Get(name string) (*Skill, bool)
- func (m *Manager) Library(category string, offset, limit int) ([]Skill, int)
- func (m *Manager) List() []Skill
- func (m *Manager) MarkUsed(name string)
- func (m *Manager) PackCount() int
- func (m *Manager) PromptBlock(limit int) string
- func (m *Manager) Reload() error
- func (m *Manager) Save(name, description, body string, tags []string) (*Skill, error)
- func (m *Manager) Search(query string, limit int) []Skill
- func (m *Manager) SearchFiltered(query string, f Filter, limit int) []Skill
- func (m *Manager) SetEnabled(name string, enabled bool) error
- func (m *Manager) SetPackDirs(dirs []string)
- type Skill
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Filter ¶
type Filter struct {
// CWE matches a CWE id, with or without the "CWE-" prefix (e.g. "89").
CWE string
// Tech matches a tech_stack entry (e.g. "web", "api", "cloud").
Tech string
// Category matches the skill category exactly.
Category string
}
Filter narrows a skill search by security metadata. Empty fields are ignored.
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager loads and caches skills from the configured directories.
func NewManager ¶
NewManager builds a manager over the given directories.
func (*Manager) Categories ¶
Categories lists the pack skill categories with their counts, for browsing.
func (*Manager) Chains ¶
Chains resolves a skill's chains_with entries to the skills that exist, so the agent can see which follow-on techniques compound with this one.
func (*Manager) Everyday ¶
Everyday returns the skills for the everyday catalogue — everything except the bundled library, which is thousands strong and reached by search.
func (*Manager) Library ¶
Library returns pack skills for browsing: filtered by category when given, sorted by name, and paged. It returns the page and the total in that filter.
func (*Manager) PromptBlock ¶
PromptBlock renders the enabled skills as a compact catalogue for the system prompt: name, description, and triggers only. Full bodies are fetched on demand with the skill tool so the prompt stays small.
func (*Manager) Search ¶
Search finds skills by keyword, ranked by relevance. It matches across the name, description, tags, triggers, and — for the security library — the CWE ids, tech stack, OWASP id, and category, so "CWE-89" or "graphql" find the right skills even when the words are not in the prose.
func (*Manager) SearchFiltered ¶
SearchFiltered is Search with an optional metadata filter applied first.
func (*Manager) SetEnabled ¶
SetEnabled toggles a skill by rewriting its front matter.
func (*Manager) SetPackDirs ¶
SetPackDirs marks directories whose skills are the bundled security library: searchable but not in the prompt catalogue.
type Skill ¶
type Skill struct {
Name string `json:"name"`
Description string `json:"description"`
Path string `json:"path"`
Enabled bool `json:"enabled"`
Source string `json:"source"`
Tags []string `json:"tags"`
Triggers []string `json:"triggers"`
Category string `json:"category,omitempty"`
Body string `json:"-"`
UpdatedAt time.Time `json:"updated_at"`
UsageCount int `json:"usage_count"`
// Security-library metadata, used for filtered search and chaining. Empty
// for everyday skills.
TechStack []string `json:"tech_stack,omitempty"`
CWEIDs []string `json:"cwe_ids,omitempty"`
OWASPID string `json:"owasp_id,omitempty"`
ChainsWith []string `json:"chains_with,omitempty"`
// Pack marks a skill from the bundled security library: searchable and
// loadable, but kept out of the prompt catalogue so thousands of them do
// not bury the conversation.
Pack bool `json:"pack,omitempty"`
}
Skill is one learned procedure loaded from disk.