Documentation
¶
Overview ¶
Package roles is the agent's cast of specialists.
One general assistant is a generalist by necessity, and a generalist is mediocre at everything. A role is a named specialist: its own instructions, its own set of tools, and optionally its own model — a reviewer that only reads, a researcher that only browses, a report writer that only writes.
Roles are how one conversation becomes a team. The primary agent delegates a self-contained piece of work to the role suited to it, and that role runs with exactly the reach it needs and no more.
Index ¶
- type Registry
- func (r *Registry) Count() int
- func (r *Registry) Delete(name string) error
- func (r *Registry) Get(name string) (Role, bool)
- func (r *Registry) List() []Role
- func (r *Registry) Reload() error
- func (r *Registry) Save(role Role) (Role, error)
- func (r *Registry) Subroles(parent string) []Role
- func (r *Registry) Visible() []Role
- type Role
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry holds the roles available to a process.
func NewRegistry ¶
NewRegistry builds a registry that reads the bundled roles plus any in the given directories. Directory roles override bundled ones by name, so a user can adjust a shipped role by dropping a file with the same name.
func (*Registry) Reload ¶
Reload rescans the user directories, keeping the bundled roles and letting a directory role override one by name.
func (*Registry) Save ¶
Save writes a role to disk as a Markdown file with YAML front matter, then reloads. It refuses to shadow or overwrite a builtin role: builtins are read-only, so a Save is allowed only for a new name or an existing local one.
type Role ¶
type Role struct {
// Name is how the role is addressed: kebab-case, unique.
Name string `json:"name"`
// Title is the human label.
Title string `json:"title"`
// Summary is one line: what this role is for.
Summary string `json:"summary"`
// Category groups roles in the picker — "general", "engineering",
// "security", and so on.
Category string `json:"category"`
// Toolset is which tools the role runs with. Empty inherits the default.
Toolset string `json:"toolset"`
// Model overrides the model for this role. Empty inherits.
Model string `json:"model"`
// Tags aid discovery.
Tags []string `json:"tags,omitempty"`
// Danger marks a role whose work needs authorisation to be lawful —
// security testing against a target you do not own. The UI warns; the
// prompt insists on scope.
Danger bool `json:"danger,omitempty"`
// Subrole hides a role from the top-level picker and the generalist's
// list_roles: it is reached only by a master role that delegates to it. The
// security specialists are subroles of the "security" master.
Subrole bool `json:"subrole,omitempty"`
// Parent names the master role a subrole belongs to. Empty for top-level
// roles. Used to group subroles under their master.
Parent string `json:"parent,omitempty"`
// Effort overrides the reasoning effort for this role (low|medium|high|…).
// Empty inherits. A reviewer can think hard; a formatter need not.
Effort string `json:"effort,omitempty"`
// MaxTurns caps a delegated run of this role. Zero inherits the default.
MaxTurns int `json:"max_turns,omitempty"`
// Prompt is the role's standing instructions, appended to the system
// prompt when the role is active.
Prompt string `json:"-"`
// Source is "builtin" or "local".
Source string `json:"source"`
// Path is the file a local role was loaded from, so it can be edited or
// deleted. Empty for builtin roles (embedded in the binary).
Path string `json:"-"`
}
Role is one specialist.