Documentation
¶
Overview ¶
Package agent loads and validates Prism agent specifications.
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 loads and caches agent specs from an fs.FS.
func NewRegistry ¶
NewRegistry creates a Registry that reads specs from fsys. The FS should be the agents directory (or a sub-FS of the project root at "agents"). For a local directory: agent.NewRegistry(os.DirFS(agentDir)) For GitHub: agent.NewRegistry(fs.Sub(githubFS, "agents"))
type Spec ¶
type Spec struct {
// Required frontmatter fields.
ID string `yaml:"id" json:"id"`
Name string `yaml:"name" json:"name"`
Description string `yaml:"description" json:"description"`
Model string `yaml:"model" json:"model"`
ContextBudget int `yaml:"context_budget" json:"context_budget"`
AllowedSkills []string `yaml:"allowed_skills" json:"allowed_skills"`
LatencyBudgetMS int `yaml:"latency_budget_ms" json:"latency_budget_ms"`
// Recommended frontmatter fields.
// Temperature is a pointer so an explicit `temperature: 0` (deterministic
// sampling) is distinguishable from an omitted key (engine default).
Temperature *float64 `yaml:"temperature" json:"temperature,omitempty"`
Tools []string `yaml:"tools" json:"tools,omitempty"`
Outputs string `yaml:"outputs" json:"outputs,omitempty"`
ConstitutionPath string `yaml:"constitution_path" json:"constitution_path,omitempty"`
// Optional frontmatter fields.
Models []string `yaml:"models" json:"models,omitempty"`
TokenBudget int `yaml:"token_budget" json:"token_budget,omitempty"`
Metadata map[string]string `yaml:"metadata" json:"metadata,omitempty"`
// Body is the Markdown text after the closing frontmatter delimiter.
// It serves as the inline constitution when ConstitutionPath is empty.
Body string `yaml:"-" json:"body,omitempty"`
}
Spec holds the parsed YAML frontmatter and Markdown body of an agent file.
func Parse ¶
Parse parses raw bytes that begin with a YAML frontmatter block delimited by "---". The sourcePath is used only for error messages and id-stem validation.
func (*Spec) AllowsSkill ¶
AllowsSkill reports whether the named skill is in the agent's allowed_skills.
func (*Spec) ResolveConstitution ¶
ResolveConstitution returns the constitution text for this agent following a three-priority chain:
- constitution_path field (resolved relative to the FS root)
- inline spec body (Markdown after the frontmatter block)
- legacy constitutions/<id>.md (relative to the FS root)
The second return value names the source: "path", "body", or "legacy". fsys should be the project root FS (not the agents sub-FS).
type Summary ¶
type Summary struct {
ID string `json:"id"`
Name string `json:"name"`
Description string `json:"description"`
Model string `json:"model"`
AllowedSkills []string `json:"allowed_skills,omitempty"`
LatencyBudgetMS int `json:"latency_budget_ms,omitempty"`
}
Summary is a lightweight agent descriptor suitable for list output.