Cortex

Traits

Define who an agent is — personality dimensions that influence behavior.

A Trait defines a personality dimension that influences HOW an agent works. Traits are declarative — you don't tell the agent what to do, you tell it who it is. The system assembles runtime parameters from trait declarations.

Structure

type Trait struct {
    cortex.Entity
    ID          id.TraitID
    Name        string
    Description string
    AppID       string
    Dimensions  []Dimension
    Influences  []Influence
    Category    TraitCategory
    Metadata    map[string]any
}

Dimensions

Each trait has one or more bipolar dimensions — axes with labeled extremes and a value from 0.0 to 1.0:

type Dimension struct {
    Name      string  // dimension name
    LowLabel  string  // label for 0.0 end
    HighLabel string  // label for 1.0 end
    Value     float64 // position on the axis (0.0–1.0)
}

Example: a "thoroughness" trait with a "depth" dimension:

Dimension{
    Name:      "depth",
    LowLabel:  "surface-level",
    HighLabel: "exhaustive",
    Value:     0.85, // leans heavily toward exhaustive
}

Influences

Influences define how a trait modifies agent behavior at runtime:

type Influence struct {
    Target    InfluenceTarget // what to modify
    Value     any             // the modification value
    Condition string          // optional condition
    Weight    float64         // influence strength (0.0–1.0)
}

Influence targets

TargetEffect
prompt_injectionInjects text into the system prompt
temperatureModifies the LLM sampling temperature
max_stepsAdjusts the maximum reasoning steps
tool_selectionInfluences which tools are preferred
response_styleModifies output formatting

Categories

Traits are organized into four categories:

CategoryDescription
personalityCore personality dimensions (e.g., openness, conscientiousness)
workstyleHow the agent approaches tasks (e.g., thoroughness, speed)
communicationCommunication preferences (e.g., directness, empathy)
riskRisk tolerance and decision-making style

Store interface

type Store interface {
    CreateTrait(ctx context.Context, trait *Trait) error
    GetTrait(ctx context.Context, traitID id.TraitID) (*Trait, error)
    GetTraitByName(ctx context.Context, appID, name string) (*Trait, error)
    UpdateTrait(ctx context.Context, trait *Trait) error
    DeleteTrait(ctx context.Context, traitID id.TraitID) error
    ListTraits(ctx context.Context, filter *ListFilter) ([]*Trait, error)
}

API routes

MethodPathDescription
POST/cortex/traitsCreate a trait
GET/cortex/traitsList traits
GET/cortex/traits/{name}Get a trait by name
PUT/cortex/traits/{name}Update a trait
DELETE/cortex/traits/{id}Delete a trait

On this page