Documentation
¶
Index ¶
- Constants
- func ActivateConditionalSkillsForPaths(filePaths []string, cwd string) []string
- func ClearBundledSkills()
- func ClearSkillCaches()
- func CoerceDescriptionToString(value interface{}, skillName string) *string
- func DiscoverSkillDirsForPaths(filePaths []string, cwd string) []string
- func ExtractDescriptionFromMarkdown(content string, fallbackLabel string) string
- func FormatSkillsList(skills []Skill) string
- func GetBuiltinSkillsPath() string
- func GetBundledSkillsRoot() string
- func GetMCPHealth() map[string]string
- func GetMCPServers() []string
- func GetManagedSkillsPath() string
- func GetProjectCommandsPath(projectDir string) string
- func GetProjectSkillsPath(projectDir string) string
- func GetPrompt() string
- func GetPromptWithSkills(skillsList string) string
- func GetSkillReposPath() string
- func GetSkillsRootPath() string
- func GetUserSkillsPath() string
- func GetUserSkillsPathForUser(userID string) string
- func InvalidateSkillCache()
- func IsMCPEnabled() bool
- func NotifySkillChange(added []string, removed []string)
- func OnSkillChange(callback SkillChangeCallback)
- func ParseArgumentNames(value interface{}) []string
- func ParseBooleanFrontmatter(value interface{}) bool
- func ParseEffortValue(value string) string
- func ParsePreambleTier(value interface{}) int
- func ParseStringList(value interface{}) []string
- func ReadSkillEnabled(path string) bool
- func RegisterBundledSkill(def BundledSkillDefinition)
- func RegisterMCPSkillBuilder(builder MCPSkillBuilder)
- func RegisterSkillAlias(alias string, target string)
- func ResolveSkillAlias(name string) string
- func SetMCPManager(manager *mcp.MCPClientManager)
- func SplitPathInFrontmatter(paths interface{}) []string
- func SubstituteArguments(content string, args string, argumentNames []string) string
- func SubstituteSeshatVariables(content string, skillDir string, sessionID string) string
- func ValidateSkillPath(skillPath string) error
- type BundledSkillDefinition
- type ContentBlock
- type ExecutionContext
- type FileSkillLoader
- type FrontmatterData
- type FrontmatterShell
- type HooksSettings
- type LoadedFrom
- type MCPSkillBuilder
- type SettingSource
- type Skill
- func CreateSkillFromFrontmatter(frontmatter FrontmatterData, markdownContent string, skillName string, ...) (Skill, error)
- func DiscoverMCPSkills(ctx context.Context) ([]Skill, error)
- func GetAllSkills(cwd string) ([]Skill, error)
- func GetAllSkillsForUser(cwd string, userID string) ([]Skill, error)
- func GetBundledSkills() []Skill
- func GetSkillsForContext(cwd string, filePaths []string, userID string) ([]Skill, error)
- func LoadMCPSkills(serverName string) ([]Skill, error)
- func MatchTrigger(userInput string, skills []Skill) *Skill
- type SkillAlias
- type SkillChangeCallback
- type SkillInput
- type SkillLoader
- type SkillOutput
- type SkillRequirement
- type SkillScope
- type SkillSource
- type SkillTool
- func (t *SkillTool) BackfillInput(ctx context.Context, input map[string]any) map[string]any
- func (t *SkillTool) Call(ctx context.Context, input contract.CallInput, ...) (contract.CallResult, error)
- func (t *SkillTool) CheckPermissions(ctx context.Context, input map[string]any, toolCtx contract.ToolUseContext) types.PermissionResult
- func (t *SkillTool) Definition() contract.Definition
- func (t *SkillTool) Description(ctx context.Context) (string, error)
- func (t *SkillTool) FormatResult(data any) string
- func (t *SkillTool) IsConcurrencySafe(input map[string]any) bool
- func (t *SkillTool) IsEnabled() bool
- func (t *SkillTool) IsReadOnly(input map[string]any) bool
- func (t *SkillTool) SetCwd(cwd string)
- func (t *SkillTool) SetUserID(userID string)
- func (t *SkillTool) ValidateInput(ctx context.Context, input map[string]any) (map[string]any, error)
- type SkillWithPath
Constants ¶
const ( DefaultSkillDirectory = ".seshat/skills" DefaultCommandsDirectory = ".seshat/commands" BundledSkillExtractDir = ".seshat/bundled-skills" )
const DefaultMaxSkills = 50
const SkillToolName = "skill"
Variables ¶
This section is empty.
Functions ¶
func ClearBundledSkills ¶
func ClearBundledSkills()
func ClearSkillCaches ¶
func ClearSkillCaches()
func FormatSkillsList ¶
func GetBuiltinSkillsPath ¶
func GetBuiltinSkillsPath() string
func GetBundledSkillsRoot ¶
func GetBundledSkillsRoot() string
func GetMCPHealth ¶
func GetMCPServers ¶
func GetMCPServers() []string
func GetManagedSkillsPath ¶
func GetManagedSkillsPath() string
GetManagedSkillsPath returns the directory for admin-managed (policy) skills. Respects SESHAT_RUNTIME_ROOT so the path moves with the deployment.
func GetProjectCommandsPath ¶
func GetProjectSkillsPath ¶
func GetPromptWithSkills ¶
func GetSkillReposPath ¶
func GetSkillReposPath() string
func GetSkillsRootPath ¶
func GetSkillsRootPath() string
func GetUserSkillsPath ¶
func GetUserSkillsPath() string
GetUserSkillsPath returns the default single-user skill path (legacy CLI mode).
func InvalidateSkillCache ¶
func InvalidateSkillCache()
func IsMCPEnabled ¶
func IsMCPEnabled() bool
func NotifySkillChange ¶
func OnSkillChange ¶
func OnSkillChange(callback SkillChangeCallback)
func ParseArgumentNames ¶
func ParseArgumentNames(value interface{}) []string
func ParseBooleanFrontmatter ¶
func ParseBooleanFrontmatter(value interface{}) bool
func ParseEffortValue ¶
func ParsePreambleTier ¶
func ParsePreambleTier(value interface{}) int
ParsePreambleTier converts a frontmatter preamble-tier value to an int.
0 = unset (backward-compatible default: inject base dir) 1 = basic — skill content only, no extra context 2 = standard — + working directory header 3 = full — + working directory + full context hint
func ParseStringList ¶
func ParseStringList(value interface{}) []string
func ReadSkillEnabled ¶
ReadSkillEnabled reads the user-invocable value from a skill.md file on disk. Returns true if the file cannot be read or the field is absent.
func RegisterBundledSkill ¶
func RegisterBundledSkill(def BundledSkillDefinition)
func RegisterMCPSkillBuilder ¶
func RegisterMCPSkillBuilder(builder MCPSkillBuilder)
func RegisterSkillAlias ¶
func ResolveSkillAlias ¶
func SetMCPManager ¶
func SetMCPManager(manager *mcp.MCPClientManager)
func SplitPathInFrontmatter ¶
func SplitPathInFrontmatter(paths interface{}) []string
func SubstituteArguments ¶
func ValidateSkillPath ¶
Types ¶
type BundledSkillDefinition ¶
type BundledSkillDefinition struct {
Name string
Description string
Aliases []string
WhenToUse string
ArgumentHint string
AllowedTools []string
Model string
DisableModelInvocation bool
UserInvocable bool
IsEnabled func() bool
Hooks *HooksSettings
Context ExecutionContext
Agent string
Effort string
Files map[string]string
Triggers []string
GetPromptForCommand func(args string, ctx context.Context) ([]ContentBlock, error)
}
type ContentBlock ¶
func ExecuteSkillPrompt ¶
type ExecutionContext ¶
type ExecutionContext string
const ( ExecutionContextInline ExecutionContext = "inline" ExecutionContextFork ExecutionContext = "fork" )
type FileSkillLoader ¶
type FileSkillLoader struct {
Directory string
Source SettingSource
// CollectionRoot, when non-empty, is the repo root that owns this skill
// collection. It is injected into skill prompts so the AI can resolve
// paths relative to the repo root (e.g. data/, scripts/).
CollectionRoot string
}
func NewCollectionSkillLoader ¶
func NewCollectionSkillLoader(repoRoot string, source SettingSource) *FileSkillLoader
NewCollectionSkillLoader creates a loader for a skill repo whose skills reference files relative to the repo root (e.g. data/, scripts/). directory must be the repo root — each subdirectory containing a SKILL.md becomes one skill, and the repo root is injected as the base path.
func NewFileSkillLoader ¶
func NewFileSkillLoader(directory string) *FileSkillLoader
func NewFileSkillLoaderWithSource ¶
func NewFileSkillLoaderWithSource(directory string, source SettingSource) *FileSkillLoader
func (*FileSkillLoader) GetSkillDirCommands ¶
func (l *FileSkillLoader) GetSkillDirCommands(cwd string) ([]Skill, error)
func (*FileSkillLoader) GetSkillDirCommandsForUser ¶
func (l *FileSkillLoader) GetSkillDirCommandsForUser(cwd string, userID string) ([]Skill, error)
func (*FileSkillLoader) LoadSkills ¶
func (l *FileSkillLoader) LoadSkills() ([]Skill, error)
type FrontmatterData ¶
type FrontmatterData struct {
Name interface{} `yaml:"name"`
Description interface{} `yaml:"description"`
WhenToUse string `yaml:"when_to_use"`
ArgumentHint string `yaml:"argument-hint"`
Arguments interface{} `yaml:"arguments"`
AllowedTools interface{} `yaml:"allowed-tools"`
Model string `yaml:"model"`
DisableModelInvocation interface{} `yaml:"disable-model-invocation"`
UserInvocable interface{} `yaml:"user-invocable"`
Version string `yaml:"version"`
Context string `yaml:"context"`
Agent string `yaml:"agent"`
Effort string `yaml:"effort"`
Paths interface{} `yaml:"paths"`
Hooks interface{} `yaml:"hooks"`
Shell interface{} `yaml:"shell"`
// Triggers is a list of natural-language phrases that should auto-activate
// this skill (e.g. ["browse this page", "take a screenshot"]). Inspired by
// gstack. When the user's prompt contains any trigger phrase, the skill is
// expanded automatically — no /slash-command needed.
Triggers interface{} `yaml:"triggers,omitempty"`
// PreambleTier controls how much context is prepended to the expanded skill
// prompt. Accepts int (1/2/3) or string ("basic"/"standard"/"full").
// 1 / basic — skill content only (default)
// 2 / standard — + working directory info
// 3 / full — + working directory + user preferences block
PreambleTier interface{} `yaml:"preamble-tier,omitempty"`
// Requires lists external dependencies the skill needs (Node.js, Python
// packages, system tools). The agent checks them at runtime and requests
// user permission before installing any missing dependency.
Requires interface{} `yaml:"requires,omitempty"`
}
func ParseFrontmatter ¶
func ParseFrontmatter(content string, filePath string) (FrontmatterData, string)
type FrontmatterShell ¶
type FrontmatterShell struct {
Before []string `yaml:"before,omitempty"`
After []string `yaml:"after,omitempty"`
OnError []string `yaml:"on_error,omitempty"`
OnComplete []string `yaml:"on_complete,omitempty"`
}
func ParseShellFrontmatter ¶
func ParseShellFrontmatter(value interface{}, skillName string) *FrontmatterShell
type HooksSettings ¶
type HooksSettings struct {
BeforeTool []string `yaml:"before_tool,omitempty"`
AfterTool []string `yaml:"after_tool,omitempty"`
Before []string `yaml:"before,omitempty"`
After []string `yaml:"after,omitempty"`
OnError []string `yaml:"on_error,omitempty"`
OnCancel []string `yaml:"on_cancel,omitempty"`
OnComplete []string `yaml:"on_complete,omitempty"`
ToolAllowed []string `yaml:"tool_allowed,omitempty"`
ToolDenied []string `yaml:"tool_denied,omitempty"`
}
func ParseHooksFromFrontmatter ¶
func ParseHooksFromFrontmatter(value interface{}) *HooksSettings
type LoadedFrom ¶
type LoadedFrom string
const ( LoadedFromCommandsDeprecated LoadedFrom = "commands_DEPRECATED" LoadedFromSkills LoadedFrom = "skills" LoadedFromPlugin LoadedFrom = "plugin" LoadedFromManaged LoadedFrom = "managed" LoadedFromBundled LoadedFrom = "bundled" LoadedFromMCP LoadedFrom = "mcp" )
type MCPSkillBuilder ¶
type SettingSource ¶
type SettingSource string
const ( SettingSourcePolicySettings SettingSource = "policySettings" SettingSourceUserSettings SettingSource = "userSettings" SettingSourceProjectSettings SettingSource = "projectSettings" SettingSourcePlugin SettingSource = "plugin" )
type Skill ¶
type Skill struct {
Name string
DisplayName string
Description string
HasUserSpecifiedDescription bool
AllowedTools []string
ArgumentHint string
ArgNames []string
WhenToUse string
Version string
Model string
DisableModelInvocation bool
UserInvocable bool
Context ExecutionContext
Agent string
Effort string
Paths []string
Content string // raw markdown body, used by ExecuteSkillPrompt fallback
ContentLength int
IsHidden bool
ProgressMessage string
Source SkillSource
LoadedFrom LoadedFrom
SkillRoot string
Hooks *HooksSettings
Shell *FrontmatterShell
// Triggers holds natural-language phrases that auto-activate this skill
// without a slash command (e.g. "browse this page", "take a screenshot").
Triggers []string
// PreambleTier controls context injection depth: 0=default (base dir),
// 1=basic (none), 2=standard (base dir), 3=full (base dir + context hint).
PreambleTier int
// Scope indicates the ownership/access level of this skill.
Scope SkillScope
// Requires lists external dependencies that must be present before the
// skill runs. The agent verifies each and requests user permission to
// install any that are missing.
Requires []SkillRequirement
GetPromptForCommand func(args string, ctx context.Context) ([]ContentBlock, error)
}
func CreateSkillFromFrontmatter ¶
func CreateSkillFromFrontmatter(frontmatter FrontmatterData, markdownContent string, skillName string, baseDir string, loadedFrom string, source SettingSource) (Skill, error)
func GetAllSkills ¶
func GetBundledSkills ¶
func GetBundledSkills() []Skill
func GetSkillsForContext ¶
GetSkillsForContext returns skills that are active for the given file context. Skills with no Paths restriction are always included. Skills with Paths are included only when at least one of the provided filePaths matches a pattern. When filePaths is empty, all skills are returned (no filtering).
func LoadMCPSkills ¶
func MatchTrigger ¶
MatchTrigger returns the first skill whose trigger phrases match userInput, or nil if no skill matches. Matching is case-insensitive substring search.
func (*Skill) MatchesTrigger ¶
MatchesTrigger reports whether userInput contains any of the skill's trigger phrases (case-insensitive substring match).
type SkillAlias ¶
func GetSkillAliases ¶
func GetSkillAliases() []SkillAlias
type SkillChangeCallback ¶
type SkillInput ¶
type SkillLoader ¶
type SkillOutput ¶
type SkillRequirement ¶
type SkillRequirement struct {
// Type is a human-readable label: "node", "python", "system", etc.
Type string `yaml:"type"`
// Check is a shell command that exits 0 when the dep is satisfied.
// Example: "node --version", "python3 -c 'import pptx'"
Check string `yaml:"check"`
// InstallCmd is run (with user permission) when Check fails.
// Supports ${SESHAT_SKILL_DIR} substitution.
InstallCmd string `yaml:"install-cmd"`
// Packages lists the packages for display purposes only.
Packages []string `yaml:"packages,omitempty"`
// Optional marks the requirement as non-blocking: the skill runs even if
// the dep is missing, but the agent is told some features may be degraded.
Optional bool `yaml:"optional,omitempty"`
}
SkillRequirement declares an external dependency (Node.js, Python package…) that must be present before the skill can run. If any requirement fails its check command, the skill prompt includes a pre-flight section instructing the agent to request user permission before installing.
func ParseRequires ¶
func ParseRequires(value interface{}) []SkillRequirement
ParseRequires converts a frontmatter requires value into a slice of SkillRequirement. Accepts either a YAML list of maps or a single map.
type SkillScope ¶
type SkillScope string
SkillScope controls who can invoke a skill and what context it can access.
const ( ScopeUser SkillScope = "user" // created/owned by the end-user ScopeRepo SkillScope = "repo" // scoped to the current project ScopeSystem SkillScope = "system" // platform-level (plugins, MCP) ScopeAdmin SkillScope = "admin" // policy-managed (admin-controlled) )
type SkillSource ¶
type SkillSource string
const ( SourceBundled SkillSource = "bundled" SourceCommands SkillSource = "commands" SourcePlugin SkillSource = "plugin" SourceManaged SkillSource = "managed" SourceMCP SkillSource = "mcp" )
type SkillTool ¶
type SkillTool struct {
// contains filtered or unexported fields
}
func NewSkillTool ¶
func NewSkillTool(loader SkillLoader) *SkillTool
func (*SkillTool) BackfillInput ¶
func (*SkillTool) Call ¶
func (t *SkillTool) Call(ctx context.Context, input contract.CallInput, permissionCheck types.CanUseToolFn) (contract.CallResult, error)
func (*SkillTool) CheckPermissions ¶
func (t *SkillTool) CheckPermissions(ctx context.Context, input map[string]any, toolCtx contract.ToolUseContext) types.PermissionResult
func (*SkillTool) Definition ¶
func (t *SkillTool) Definition() contract.Definition