Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AppliedSpell ¶
type AppliedSpell struct {
// SpellName is the name of the spell that was applied
SpellName string
// SystemPrompt is the final system prompt after applying mode logic
SystemPrompt string
// Tool configuration
EnabledTools []string
DisabledTools []string
// Response configuration
MaxTokens int
ResponseFormat string
ResponseStyle string
// Reasoning configuration
ReasoningEffort ReasoningEffort
ShowThinking bool
// Sampling configuration
Temperature float64
}
AppliedSpell contains the result of applying a spell to a session
func ApplySpell ¶
func ApplySpell(spell *Spell, basePrompt string, modeOverride *LayerMode) *AppliedSpell
ApplySpell applies a spell to the session configuration basePrompt is the existing system prompt (from CLAUDE.md, etc.) modeOverride allows the user to override the spell's default mode
type LayerMode ¶
type LayerMode string
LayerMode determines how a spell interacts with existing system prompt
type Loader ¶
type Loader struct {
UserDir string // User-global spells directory (~/.hex/spells/)
ProjectDir string // Project-local spells directory (.hex/spells/)
BuiltinDir string // Built-in spells directory (deprecated, use BuiltinFS)
BuiltinFSys fs.FS // Embedded filesystem for builtin spells
}
Loader discovers and loads spells from multiple directories
type ReasoningConfig ¶
type ReasoningConfig struct {
Effort ReasoningEffort `yaml:"effort,omitempty"` // none, low, medium, high
ShowThinking bool `yaml:"show_thinking,omitempty"` // expose thinking blocks
}
ReasoningConfig defines reasoning behavior for modern models
type ReasoningEffort ¶
type ReasoningEffort string
ReasoningEffort levels for modern AI models
const ( ReasoningEffortNone ReasoningEffort = "none" ReasoningEffortLow ReasoningEffort = "low" ReasoningEffortMedium ReasoningEffort = "medium" ReasoningEffortHigh ReasoningEffort = "high" )
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry stores and manages loaded spells
type ResponseConfig ¶
type ResponseConfig struct {
MaxTokens int `yaml:"max_tokens,omitempty"` // max response tokens
Format string `yaml:"format,omitempty"` // text, json, markdown
Style string `yaml:"style,omitempty"` // concise, detailed, code-first
}
ResponseConfig defines response preferences
type SamplingConfig ¶
type SamplingConfig struct {
Temperature float64 `yaml:"temperature,omitempty"`
}
SamplingConfig defines legacy sampling parameters
type Spell ¶
type Spell struct {
// Metadata from system.md frontmatter
Name string `yaml:"name"`
Description string `yaml:"description"`
Author string `yaml:"author,omitempty"`
Version string `yaml:"version,omitempty"`
// System prompt content (body of system.md)
SystemPrompt string `yaml:"-"`
// Configuration from config.yaml
Config SpellConfig `yaml:"-"`
// Tool overrides from tools/*.yaml
ToolOverrides map[string]ToolOverride `yaml:"-"`
// Runtime metadata
Mode LayerMode `yaml:"-"` // Effective mode (from config or override)
Source string `yaml:"-"` // builtin, user, project
FilePath string `yaml:"-"` // Path to spell directory
}
Spell represents a switchable agent personality
func ParseSpellDirectory ¶
ParseSpellDirectory loads a spell from a directory
func ParseSpellFromFS ¶
ParseSpellFromFS loads a spell from an embedded filesystem
type SpellConfig ¶
type SpellConfig struct {
Mode LayerMode `yaml:"mode,omitempty"`
Tools ToolsConfig `yaml:"tools,omitempty"`
Reasoning ReasoningConfig `yaml:"reasoning,omitempty"`
Response ResponseConfig `yaml:"response,omitempty"`
Sampling SamplingConfig `yaml:"sampling,omitempty"`
}
SpellConfig holds all configuration options for a spell
type ToolOverride ¶
type ToolOverride struct {
Schema map[string]interface{} `yaml:"schema,omitempty"`
Defaults map[string]interface{} `yaml:"defaults,omitempty"`
Restrictions []string `yaml:"restrictions,omitempty"`
}
ToolOverride customizes a specific tool's behavior
type ToolsConfig ¶
type ToolsConfig struct {
Enabled []string `yaml:"enabled,omitempty"` // Tools to enable (empty = all)
Disabled []string `yaml:"disabled,omitempty"` // Tools to disable
}
ToolsConfig defines tool availability for a spell