Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GlobalAgentsDir ¶
func GlobalAgentsDir() string
GlobalAgentsDir returns ~/.config/brocode/agents.
func ProjectAgentsDir ¶
ProjectAgentsDir returns <workspaceDir>/.brocode/agents.
Types ¶
type CustomAgent ¶
type CustomAgent struct {
Name string `yaml:"name" json:"name"`
Description string `yaml:"description" json:"description"`
Mode string `yaml:"mode" json:"mode"` // BUILDER, PLANNER, MINER, SUBAGENT
Model string `yaml:"model,omitempty" json:"model,omitempty"`
Temperature *float64 `yaml:"temperature,omitempty" json:"temperature,omitempty"`
Tools ToolFilter `yaml:"tools,omitempty" json:"tools,omitempty"`
Permissions PermissionFilter `yaml:"permissions,omitempty" json:"permissions,omitempty"`
Hooks map[string]string `yaml:"hooks,omitempty" json:"hooks,omitempty"` // on_turn_start, on_turn_end, on_tool_call, on_tool_result, on_turn_error
Prompt string `yaml:"-" json:"prompt"`
Path string `yaml:"-" json:"path"`
IsProject bool `yaml:"-" json:"is_project"`
}
CustomAgent represents a user-defined agent or custom mode.
func ParseAgentContent ¶
func ParseAgentContent(content, filePath string) (*CustomAgent, error)
ParseAgentContent parses markdown content with YAML frontmatter into a CustomAgent.
func ParseAgentFile ¶
func ParseAgentFile(filePath string) (*CustomAgent, error)
ParseAgentFile reads and unmarshals a custom agent Markdown file with YAML frontmatter.
func (*CustomAgent) CheckCommand ¶
func (a *CustomAgent) CheckCommand(cmd string) (allowed bool, denied bool)
CheckCommand evaluates a bash command against the agent's permission filters.
func (*CustomAgent) IsToolAllowed ¶
func (a *CustomAgent) IsToolAllowed(toolName string) bool
IsToolAllowed checks if a tool is permitted under this agent's tool filter.
func (*CustomAgent) ToHooks ¶
func (a *CustomAgent) ToHooks() []hooks.Hook
ToHooks converts the agent's declarative hooks into hooks.Hook structs.
type Loader ¶
type Loader struct {
// contains filtered or unexported fields
}
Loader discovers and caches custom agents across project and global directories.
func NewLoader ¶
NewLoader loads all custom agents. Project-level agents override global ones with the same name.
func NewLoaderWithDirs ¶
NewLoaderWithDirs initializes agent discovery across explicit project and global directories.
func (*Loader) Find ¶
func (l *Loader) Find(name string) *CustomAgent
Find finds an agent by name (case-insensitive).
type PermissionFilter ¶
type PermissionFilter struct {
Allow []string `yaml:"allow,omitempty" json:"allow,omitempty"`
Deny []string `yaml:"deny,omitempty" json:"deny,omitempty"`
}
PermissionFilter defines allowed and denied bash command patterns.
type ToolFilter ¶
type ToolFilter struct {
Allow []string `yaml:"allow,omitempty" json:"allow,omitempty"`
Deny []string `yaml:"deny,omitempty" json:"deny,omitempty"`
}
ToolFilter defines allowed and denied tool patterns for a custom agent.