Documentation
¶
Overview ¶
Package persona defines the Persona entity — the whole person.
A Persona is the composition entity that brings everything together. It defines an agent's complete identity by composing skills, traits, behaviors, cognitive style, communication style, and perception.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ListFilter ¶
ListFilter controls pagination and matching for persona listing. Scope arrives on the context; Exact narrows to rows stored at precisely that depth instead of everything beneath it.
type Persona ¶
type Persona struct {
cortex.Entity
ID id.PersonaID `json:"id"`
Name string `json:"name"`
Description string `json:"description,omitempty"`
Scope cortex.Scope `json:"scope"`
Identity string `json:"identity"`
Skills []SkillAssignment `json:"skills,omitempty"`
Traits []TraitAssignment `json:"traits,omitempty"`
Behaviors []string `json:"behaviors,omitempty"`
CognitiveStyle cognitive.Style `json:"cognitive_style,omitempty"`
CommunicationStyle communication.Style `json:"communication_style,omitempty"`
Perception perception.Model `json:"perception,omitempty"`
Metadata map[string]any `json:"metadata,omitempty"`
}
Persona represents a complete agent identity composed from skills, traits, and behaviors.
func ClonePersona ¶
ClonePersona returns an independent deep copy of src as a new persona with the given ID and name and fresh timestamps. All other fields (including Scope and the full skill/trait/behavior/style composition) are preserved. The deep copy is a JSON round-trip, so all nested slices and maps are independent of src.
func (*Persona) Sections ¶
Sections returns the persona's contribution to an agent's system prompt: one section carrying the identity, or nothing at all when the persona has no identity text.
order is where this persona's first section sits in the assembled prompt; callers pass prompt.OrderPersona unless they are deliberately relocating it.
The heading lives inside Body rather than in the section's Title. A Title is prefixed by assembly and would land in the prompt at a different place than the heading has always occupied, so every producer here leaves Title empty and keeps its own heading in the body. Title is for sections a host authors.
type SkillAssignment ¶
type SkillAssignment struct {
SkillName string `json:"skill_name"`
Proficiency skill.Proficiency `json:"proficiency,omitempty"`
}
SkillAssignment assigns a skill to a persona with an optional proficiency override.
type Store ¶
type Store interface {
CreatePersona(ctx context.Context, persona *Persona) error
GetPersona(ctx context.Context, personaID id.PersonaID) (*Persona, error)
GetPersonaByName(ctx context.Context, name string) (*Persona, error)
UpdatePersona(ctx context.Context, persona *Persona) error
DeletePersona(ctx context.Context, personaID id.PersonaID) error
ListPersonas(ctx context.Context, filter *ListFilter) ([]*Persona, error)
CountPersonas(ctx context.Context, filter *ListFilter) (int64, error)
}
Store defines persistence for personas.
type TraitAssignment ¶
type TraitAssignment struct {
TraitName string `json:"trait_name"`
DimensionValues map[string]float64 `json:"dimension_values,omitempty"`
}
TraitAssignment assigns a trait to a persona with dimension value overrides.