Documentation
¶
Index ¶
- func BuildSystemPrompt(persona *Persona, projectContext string) string
- func DefaultDir() string
- func RenderPersonaFile(persona *Persona) string
- type Agent
- type Persona
- type PersonaExample
- type PersonaRegistry
- func (r *PersonaRegistry) Create(persona *Persona) error
- func (r *PersonaRegistry) Delete(name string) error
- func (r *PersonaRegistry) EnsureBuiltins() error
- func (r *PersonaRegistry) Get(name string) (*Persona, error)
- func (r *PersonaRegistry) List() []*Persona
- func (r *PersonaRegistry) LoadAll() error
- func (r *PersonaRegistry) SelectPersona(task string) *Persona
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildSystemPrompt ¶ added in v0.2.0
BuildSystemPrompt constructs a full system prompt by combining the persona's configuration with project-specific context.
func DefaultDir ¶
func DefaultDir() string
DefaultDir returns the user's agent directory (~/.hawk/agents/).
func RenderPersonaFile ¶ added in v0.2.0
RenderPersonaFile generates a markdown file with YAML frontmatter from a Persona.
Types ¶
type Agent ¶
type Agent struct {
Name string `json:"name"`
Description string `json:"description"`
Model string `json:"model,omitempty"`
Prompt string `json:"prompt"`
FilePath string `json:"file_path"`
}
Agent is a user-defined persona with a custom system prompt. Stored as markdown files with YAML frontmatter in ~/.hawk/agents/.
func ListAll ¶
ListAll discovers all agent definitions from the standard directories. Search order: ~/.hawk/agents/, .hawk/agents/ (project-local).
type Persona ¶ added in v0.2.0
type Persona struct {
Name string `json:"name"`
Description string `json:"description"`
Model string `json:"model"`
Provider string `json:"provider"`
SystemPrompt string `json:"system_prompt"`
Tools []string `json:"tools"`
ExcludedTools []string `json:"excluded_tools"`
Temperature float64 `json:"temperature"`
MaxTokens int `json:"max_tokens"`
Expertise []string `json:"expertise"`
CommunicationStyle string `json:"communication_style"`
Rules []string `json:"rules"`
Examples []PersonaExample `json:"examples"`
CreatedAt time.Time `json:"created_at"`
UsageCount int `json:"usage_count"`
SuccessRate float64 `json:"success_rate"`
}
Persona represents an enhanced agent definition with specific skills, model preferences, and behavioral configuration.
func BuiltinPersonas ¶ added in v0.2.0
func BuiltinPersonas() []*Persona
BuiltinPersonas returns the set of built-in personas that are auto-created on first run.
func ParsePersonaFile ¶ added in v0.2.0
ParsePersonaFile reads a persona definition from a markdown file with YAML frontmatter.
type PersonaExample ¶ added in v0.2.0
type PersonaExample struct {
Input string `json:"input"`
Output string `json:"output"`
Context string `json:"context"`
}
PersonaExample stores an input/output example for few-shot prompting.
type PersonaRegistry ¶ added in v0.2.0
type PersonaRegistry struct {
Personas map[string]*Persona
Dir string
// contains filtered or unexported fields
}
PersonaRegistry manages a collection of personas loaded from disk.
func NewPersonaRegistry ¶ added in v0.2.0
func NewPersonaRegistry(dir string) *PersonaRegistry
NewPersonaRegistry creates a new registry with the given storage directory. If dir is empty, it defaults to ~/.hawk/agents/.
func (*PersonaRegistry) Create ¶ added in v0.2.0
func (r *PersonaRegistry) Create(persona *Persona) error
Create saves a new persona to disk and adds it to the registry.
func (*PersonaRegistry) Delete ¶ added in v0.2.0
func (r *PersonaRegistry) Delete(name string) error
Delete removes a persona from the registry and disk.
func (*PersonaRegistry) EnsureBuiltins ¶ added in v0.2.0
func (r *PersonaRegistry) EnsureBuiltins() error
EnsureBuiltins creates the built-in personas in the directory if they do not exist.
func (*PersonaRegistry) Get ¶ added in v0.2.0
func (r *PersonaRegistry) Get(name string) (*Persona, error)
Get retrieves a persona by name.
func (*PersonaRegistry) List ¶ added in v0.2.0
func (r *PersonaRegistry) List() []*Persona
List returns all personas sorted by name.
func (*PersonaRegistry) LoadAll ¶ added in v0.2.0
func (r *PersonaRegistry) LoadAll() error
LoadAll reads all .md files from the registry directory and populates the Personas map.
func (*PersonaRegistry) SelectPersona ¶ added in v0.2.0
func (r *PersonaRegistry) SelectPersona(task string) *Persona
SelectPersona automatically selects the best persona for a given task by matching keywords in the task description against persona expertise.