companion

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Save

func Save(root string, profile Profile) error

Save normalises the profile and writes it under the runtime root root, through a temporary file that replaces the old one, so a failure does not leave a half-written profile.

func SystemPrompt

func SystemPrompt(profile Profile) string

SystemPrompt renders the profile as a <companion> block for the system prompt (name, style, traits and instructions), or an empty string when the companion is disabled.

Types

type Profile

type Profile struct {
	Enabled      bool      `json:"enabled"`
	Name         string    `json:"name"`
	Style        string    `json:"style,omitempty"`
	Traits       []string  `json:"traits,omitempty"`
	Instructions string    `json:"instructions,omitempty"`
	CreatedAt    time.Time `json:"created_at"`
	UpdatedAt    time.Time `json:"updated_at"`
}

Profile is the persona of the optional companion: whether it is enabled, its name, style, traits and instructions, and when it was created and last updated.

func DefaultProfile

func DefaultProfile() Profile

DefaultProfile returns the default companion: enabled, named Seshat, with a calm, capable and direct style and warm, precise and proactive traits.

func Load

func Load(root string) (Profile, error)

Load reads the companion profile stored under the runtime root root. When there is none it returns the default profile with Enabled set to false.

func Normalize

func Normalize(profile Profile) Profile

Normalize trims the text fields of a profile, gives a blank name the default one, drops empty traits, sets CreatedAt when it is zero and sets UpdatedAt to now.

Jump to

Keyboard shortcuts

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