roles

package
v0.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 16, 2026 License: Apache-2.0 Imports: 8 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

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

func NewRegistry(dirs []string) *Registry

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) Count

func (r *Registry) Count() int

Count is how many roles are loaded.

func (*Registry) Delete

func (r *Registry) Delete(name string) error

Delete removes a local role file. Builtin roles cannot be deleted.

func (*Registry) Get

func (r *Registry) Get(name string) (Role, bool)

Get returns one role.

func (*Registry) List

func (r *Registry) List() []Role

List returns every role, sorted by category then name.

func (*Registry) Reload

func (r *Registry) Reload() error

Reload rescans the user directories, keeping the bundled roles and letting a directory role override one by name.

func (*Registry) Save

func (r *Registry) Save(role Role) (Role, error)

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.

func (*Registry) Subroles

func (r *Registry) Subroles(parent string) []Role

Subroles returns the specialists that belong to a master role, sorted.

func (*Registry) Visible

func (r *Registry) Visible() []Role

Visible returns the top-level roles — every role that is not a subrole. This is what the picker and the generalist's list_roles show: a master role stands in for its specialists, which stay hidden until the master delegates to them.

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL