Documentation
¶
Index ¶
- Variables
- func ExpandArgs(body, rawArgs string) string
- func ExpandShellInjections(body string) string
- func ExpandVars(body, skillDir, sessionID string) string
- func FirstLine(s string, maxLen int) string
- func NormalizeAgentType(agent string) string
- func NormalizeName(name string) string
- func RenderListing(skills []Spec, opts ListingOptions) string
- func SourceAllowsPrivilegedFields(source string) bool
- func SourceAllowsShellExecution(source string) bool
- func StripFrontmatter(content string) string
- func ValidName(name string) bool
- func WrapPrompt(spec Spec, body string) string
- type Catalog
- type Delta
- type DirSource
- type GetPromptFn
- type InvocationMode
- type InvocationResult
- type InvocationSource
- type InvokeInput
- type ListingOptions
- type Spec
- type UsageTracker
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func ExpandArgs ¶
func ExpandShellInjections ¶
func ExpandVars ¶
func NormalizeAgentType ¶
func NormalizeName ¶
func RenderListing ¶
func RenderListing(skills []Spec, opts ListingOptions) string
RenderListing renders the skill listing that goes into the cached system block. Two-phase on purpose:
- walk `skills` in the caller's order (OrderForPrompt's usage ranking) and keep entries until the char budget runs out — the most relevant skills win the budget;
- sort the survivors by a time-independent key and render.
Phase 2 is what makes the output byte-stable. Usage scores decay with wall time, so rendering in ranking order would reshuffle the block on every rebuild and invalidate the prompt cache prefix for no semantic gain. The output only changes when the surviving SET changes, which needs the catalog to exceed the budget AND a ranking swap across the cutoff.
func StripFrontmatter ¶
func WrapPrompt ¶
Types ¶
type Catalog ¶
type Catalog struct {
// contains filtered or unexported fields
}
func NewStaticCatalog ¶
func (*Catalog) Retarget ¶ added in v0.3.0
Retarget points the catalog at a new workspace root. Only the activation check (Spec.Paths, resolved against cwd) depends on it — the specs themselves come from plugin contributions and configured directories, so no reload is needed. Called on a worktree enter/exit: leaving the boot cwd here would keep deciding which skills apply from the workspace the session has left.
type GetPromptFn ¶
type InvocationMode ¶
type InvocationMode string
const ( ModeInline InvocationMode = "inline" ModeFork InvocationMode = "fork" )
type InvocationResult ¶
type InvocationResult struct {
Spec Spec
Mode InvocationMode
PromptText string
Agent string
Delta Delta
}
func ProcessInvocation ¶
func ProcessInvocation(ctx context.Context, catalog *Catalog, in InvokeInput) (*InvocationResult, error)
type InvocationSource ¶
type InvocationSource string
const ( SourceModel InvocationSource = "model" SourceUser InvocationSource = "user" )
type InvokeInput ¶
type InvokeInput struct {
Name string
Args string
SessionID string
Source InvocationSource
}
type ListingOptions ¶
type ListingOptions struct {
CharBudget int
MaxLineChars int
MaxWhenChars int
IncludeWhenToUse bool
}
func DefaultListingOptions ¶
func DefaultListingOptions() ListingOptions
type Spec ¶
type Spec struct {
Name string
Description string
WhenToUse string
Version string
FilePath string
BaseDir string
Source string
DisableModelInvocation bool
DisableUserInvocation bool
ArgumentHint string
ArgumentNames []string
Context string
Agent string
Model string
Effort string
AllowedTools []string
Paths []string
HasExplicitDescription bool
FrontmatterKeys []string
GetPrompt GetPromptFn
}
func BundledSpecs ¶
func LoadFromDir ¶
func OrderForPrompt ¶
OrderForPrompt ranks skills by relevance (applicable → usage → source → name). The ranking decides which skills SURVIVE RenderListing's char budget, not the order they appear in — see RenderListing.
func ValidateDir ¶
type UsageTracker ¶
type UsageTracker struct {
// contains filtered or unexported fields
}
func NewUsageTracker ¶
func NewUsageTracker(path string) (*UsageTracker, error)