Documentation
¶
Overview ¶
Package profile defines agent profiles and operational modes for Helix. Profiles are curated tool subsets with prompt overrides targeting specific agent environments (Claude Code, Codex, IDE assistants, CI bots). Modes define behavioral patterns (read, edit, review, admin) with tool inclusion/exclusion rules and prompt fragments.
Index ¶
- func GetProfileSkill() *profileSkill
- func LoadOverrides(store *ProfileStore, profileDir, modeDir string) error
- type Mode
- type Profile
- type ProfileStore
- func (s *ProfileStore) DefaultProfile() *Profile
- func (s *ProfileStore) Mode(name string) (*Mode, bool)
- func (s *ProfileStore) ModeNames() []string
- func (s *ProfileStore) Profile(name string) (*Profile, bool)
- func (s *ProfileStore) ProfileNames() []string
- func (s *ProfileStore) SetProfile(name string, p *Profile)
- func (s *ProfileStore) ToolDescriptionOverrides(profileName string) map[string]string
- type SessionProvider
- type SwitchModeResult
- type TokenBudgetResult
- type ToolTokenInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetProfileSkill ¶
func GetProfileSkill() *profileSkill
GetProfileSkill returns the registered profile skill instance for wiring. Returns nil if the skill has not been registered yet.
func LoadOverrides ¶
func LoadOverrides(store *ProfileStore, profileDir, modeDir string) error
LoadOverrides reads YAML files from disk directories and merges them into an existing ProfileStore. Fields present in override files overwrite embedded defaults; missing fields keep their embedded values. If a directory does not exist, it is silently skipped.
Types ¶
type Mode ¶
type Mode struct {
skill.ModeSpec `yaml:",inline"`
// Prompt is a mode-specific prompt fragment providing behavioral guidance.
Prompt string `yaml:"prompt"`
}
Mode extends ModeSpec with behavioral policies. Modes control tool availability and prompt fragments within a session.
type Profile ¶
type Profile struct {
skill.ContextSpec `yaml:",inline"`
// Prompt is a system prompt fragment providing agent-specific guidance.
Prompt string `yaml:"prompt"`
// ToolDescriptionOverrides rewrites tool descriptions for this profile.
// Key is tool name, value is the replacement description.
ToolDescriptionOverrides map[string]string `yaml:"tool_description_overrides"`
// DefaultMode is the initial operational mode for new sessions.
DefaultMode string `yaml:"default_mode"`
// SingleProject restricts sessions to a single project when true.
SingleProject bool `yaml:"single_project"`
// AllowedModeTransitions defines the state machine for mode switching.
// Key is the source mode, value is the list of allowed target modes.
AllowedModeTransitions map[string][]string `yaml:"allowed_mode_transitions"`
}
Profile extends ContextSpec with agent-specific fields. Each profile targets a specific agent environment and controls which tools are exposed, how they are described, and what prompt guidance is provided.
type ProfileStore ¶
type ProfileStore struct {
// contains filtered or unexported fields
}
ProfileStore holds loaded profiles and modes, keyed by name.
func LoadEmbedded ¶
func LoadEmbedded() (*ProfileStore, error)
LoadEmbedded reads all embedded profile and mode YAML files and returns a populated ProfileStore.
func NewProfileStore ¶
func NewProfileStore() *ProfileStore
NewProfileStore creates an empty ProfileStore.
func (*ProfileStore) DefaultProfile ¶
func (s *ProfileStore) DefaultProfile() *Profile
DefaultProfile returns the "full" profile as a fallback. If no "full" profile is loaded, returns nil.
func (*ProfileStore) Mode ¶
func (s *ProfileStore) Mode(name string) (*Mode, bool)
Mode returns a mode by name and whether it was found.
func (*ProfileStore) ModeNames ¶
func (s *ProfileStore) ModeNames() []string
ModeNames returns a sorted list of all mode names.
func (*ProfileStore) Profile ¶
func (s *ProfileStore) Profile(name string) (*Profile, bool)
Profile returns a profile by name and whether it was found.
func (*ProfileStore) ProfileNames ¶
func (s *ProfileStore) ProfileNames() []string
ProfileNames returns a sorted list of all profile names.
func (*ProfileStore) SetProfile ¶
func (s *ProfileStore) SetProfile(name string, p *Profile)
SetProfile adds or replaces a profile in the store. Intended for testing and dynamic profile injection.
func (*ProfileStore) ToolDescriptionOverrides ¶
func (s *ProfileStore) ToolDescriptionOverrides(profileName string) map[string]string
ToolDescriptionOverrides returns the description override map for the named profile. Returns nil if the profile has no overrides or is not found. This method satisfies the mcp.ProfileResolver interface.
type SessionProvider ¶
type SessionProvider interface {
CurrentSession() *mcp.SessionInfo
}
SessionProvider gives the profile skill access to the current session state. The MCP server wires this up during startup.
type SwitchModeResult ¶
type SwitchModeResult struct {
PreviousMode string `json:"previous_mode"`
CurrentMode string `json:"current_mode"`
ToolsAvailable int `json:"tools_available"`
}
SwitchModeResult is the response payload for the switch_mode tool.
type TokenBudgetResult ¶
type TokenBudgetResult struct {
TotalTokens int `json:"total_tokens"`
ToolCount int `json:"tool_count"`
PerTool []ToolTokenInfo `json:"per_tool,omitempty"`
}
TokenBudgetResult is the response payload for the get_token_budget tool.
type ToolTokenInfo ¶
type ToolTokenInfo struct {
Name string `json:"name"`
SchemaTokens int `json:"schema_tokens"`
DescriptionTokens int `json:"description_tokens"`
}
ToolTokenInfo holds per-tool token estimates.