skill

package
v0.1.9 Latest Latest
Warning

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

Go to latest
Published: May 27, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ActivationNameKey     = "skillActivationName"
	ActivationBodyKey     = "skillActivationBody"
	ActivationModeKey     = "skillActivationMode"
	ActivationArgsKey     = "skillActivationArgs"
	ActivationEmbeddedKey = "skillActivationEmbedded"
)
View Source
const (
	ServiceName      = "llm/skills"
	ListToolName     = ServiceName + ":list"
	ActivateToolName = ServiceName + ":activate"
)
View Source
const DefaultPromptBudgetChars = 4000

Variables

View Source
var (
	ListToolNameCanonical     = mcpname.Canonical(ListToolName)
	ActivateToolNameCanonical = mcpname.Canonical(ActivateToolName)
)

Functions

func BuildActivationContext

func BuildActivationContext(value ActivationContext) map[string]interface{}

func NormalizeContextMode

func NormalizeContextMode(value string) string

NormalizeContextMode resolves a skill's `context:` value to one of the canonical execution modes:

"inline"  — body injected into the current turn (default)
"fork"    — child agent in its own conversation; runtime awaits result
"detach"  — child agent in its own conversation; fire-and-forget

Unset or unrecognized values default to "inline" — the safest cross-runtime behavior, matching how Claude / Codex parsers treat unknown execution-mode hints (the body just runs in the current context). Authors who want fork/detach must opt in explicitly via metadata.agently-context.

func Parse

func Parse(path, root, source, content string) (*Skill, []Diagnostic, error)

func RenderPrompt

func RenderPrompt(skills []Metadata, budgetChars int) string

Types

type ActivationContext

type ActivationContext struct {
	Name     string
	Body     string
	Mode     string
	Args     string
	Embedded bool
}

func ReadActivationContext

func ReadActivationContext(values map[string]interface{}) (ActivationContext, bool)

type AgentlyMetadata

type AgentlyMetadata struct {
	Context              string
	AgentID              string
	Model                string
	Effort               string
	Temperature          *float64
	MaxTokens            *int
	Preprocess           *bool
	PreprocessTimeoutSec *int
	AsyncNarratorPrompt  string
	ModelPreferences     *llm.ModelPreferences
}

type AllowedTool

type AllowedTool struct {
	Raw         string
	ToolPattern string
	BashCommand string
}

func ParseAllowedTools

func ParseAllowedTools(raw string) []AllowedTool

type Diagnostic

type Diagnostic struct {
	Level   string `json:"level,omitempty"`
	Message string `json:"message,omitempty"`
	Path    string `json:"path,omitempty"`
}

type Frontmatter

type Frontmatter struct {
	Name         string           `yaml:"name"`
	Description  string           `yaml:"description"`
	License      string           `yaml:"license,omitempty"`
	Metadata     map[string]any   `yaml:"metadata,omitempty"`
	Agently      *AgentlyMetadata `yaml:"-"`
	AllowedTools string           `yaml:"allowed-tools,omitempty"`
	Raw          map[string]any   `yaml:"-"`
}

func (Frontmatter) AgentIDValue

func (f Frontmatter) AgentIDValue() string

AgentIDValue returns the skill's canonical preferred child-agent identity for fork/detach runs. Legacy top-level fields are normalized in parser.go.

func (Frontmatter) AsyncNarratorPromptValue

func (f Frontmatter) AsyncNarratorPromptValue() string

AsyncNarratorPromptValue returns the canonical async narrator override.

func (Frontmatter) ContextMode

func (f Frontmatter) ContextMode() string

ContextMode returns the canonical execution-mode hint (inline / fork / detach). Legacy top-level fields are normalized in parser.go; runtime code only reads canonical Agently metadata from Frontmatter.

func (Frontmatter) EffortValue

func (f Frontmatter) EffortValue() string

EffortValue returns the canonical reasoning-effort hint.

func (Frontmatter) MaxTokensValue

func (f Frontmatter) MaxTokensValue() int

MaxTokensValue returns the canonical per-skill max-output-tokens cap.

func (Frontmatter) ModelPreferencesValue

func (f Frontmatter) ModelPreferencesValue() *llm.ModelPreferences

ModelPreferencesValue returns the canonical MCP-aligned model preferences.

func (Frontmatter) ModelValue

func (f Frontmatter) ModelValue() string

ModelValue returns the canonical exact-name model override for this skill.

func (Frontmatter) PreprocessEnabled

func (f Frontmatter) PreprocessEnabled() bool

PreprocessEnabled reports the canonical preprocess flag.

func (Frontmatter) PreprocessTimeoutValue

func (f Frontmatter) PreprocessTimeoutValue() int

PreprocessTimeoutValue returns the canonical preprocess timeout.

func (Frontmatter) TemperatureValue

func (f Frontmatter) TemperatureValue() *float64

TemperatureValue returns the canonical per-skill sampling temperature.

type LegacyAgentlyFields

type LegacyAgentlyFields struct {
	Context              string
	AgentID              string
	Model                string
	Effort               string
	Temperature          *float64
	MaxTokens            *int
	Preprocess           *bool
	PreprocessTimeoutSec *int
	AsyncNarratorPrompt  string
}

type Metadata

type Metadata struct {
	Name          string `json:"name,omitempty"`
	Description   string `json:"description,omitempty"`
	ExecutionMode string `json:"executionMode,omitempty"`
}

type Registry

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

func NewRegistry

func NewRegistry() *Registry

func (*Registry) Add

func (r *Registry) Add(s *Skill, diags []Diagnostic)

func (*Registry) Diagnostics

func (r *Registry) Diagnostics() []Diagnostic

func (*Registry) Get

func (r *Registry) Get(name string) (*Skill, bool)

func (*Registry) List

func (r *Registry) List() []*Skill

type Skill

type Skill struct {
	Frontmatter Frontmatter
	Body        string
	Root        string
	Path        string
	Source      string
}

Jump to

Keyboard shortcuts

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