character

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2026 License: MIT Imports: 11 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 self loads the agent's life story: who it is, written by its creator.

Index

Constants

This section is empty.

Variables

View Source
var BuiltIn = []Craft{
	{Kind: "notes", About: "notes on something you're learning or thinking through"},
	{Kind: "writing", About: "a short piece of writing of any other kind"},
	{Kind: "table", About: "a table in rows and columns: a list, a comparison, a budget", Data: "table"},
	{Kind: "schedule", About: "a plan of dated events, to put in a calendar", Data: "events"},
}
View Source
var Circles = []string{"family", "friend", "school", "work", "community"}
View Source
var DecisionTypes = []string{"general", "engineering", "product", "autonomy", "life"}
View Source
var Files = []string{"character.yaml", "work.yaml", "judgment.yaml"}
View Source
var Reserved = []string{"journal", "reading_notes", "review"}

Reserved are kinds an ability sets itself (the journal, reading notes).

Functions

func CircleOf

func CircleOf(relation string) string

Types

type Case

type Case struct {
	Key       string   `yaml:"key"`
	Type      string   `yaml:"type"`
	Situation string   `yaml:"situation"`
	Options   []string `yaml:"options"`
	Choice    string   `yaml:"choice"`
	Reason    string   `yaml:"reason"` // the owner's own words; empty when they gave none
}

type Character

type Character struct {
	Name  string   `yaml:"name"`
	Story []string `yaml:"story"`
	// Timezone is overridden by the config's initiative.timezone when set.
	Timezone    string   `yaml:"timezone"`
	Personality []string `yaml:"personality"`
	Routine     []string `yaml:"routine"`
	Makes       []Craft  `yaml:"makes"`
	// Dreams, Skills and Family are copied into memory the first time; after
	// that memory wins.
	Dreams []string   `yaml:"dreams"`
	Skills []Skill    `yaml:"skills"`
	Family []Relative `yaml:"family"`
}

Character is the agent's life story. The agent never contradicts it; anything else about itself it decides when it comes up, and remembers.

func Parse

func Parse(raw []byte) (Character, error)

Parse reads and checks a character (character.yaml).

func (Character) Carrying

func (l Character) Carrying(kind string) []string

Carrying is the kinds of work it makes that carry data of kind.

func (Character) Crafts

func (l Character) Crafts() []Craft

type Craft

type Craft struct {
	Kind  string `yaml:"kind"` // snake_case; works are filed under it
	About string `yaml:"about"`
	// Data is what each one carries beside its words, so it can be made into
	// a file from it, like "score" for music (sent as MIDI); "" if none.
	Data string `yaml:"data"`
}

func (Craft) Carries

func (c Craft) Carries(kind string) bool

Carries is whether works of c carry data of kind (memory.Work.Carries).

type Judgment

type Judgment struct {
	// Priorities are most important first: when principles clash, the higher wins.
	Priorities []string    `yaml:"priorities"`
	Boundaries []string    `yaml:"boundaries"`
	Principles []Principle `yaml:"principles"`
	Cases      []Case      `yaml:"cases"`
}

Judgment is copied into memory the first time as proposed; only what the owner approves in the console is used.

func ParseJudgment

func ParseJudgment(raw []byte) (Judgment, error)

ParseJudgment reads and checks a judgment (judgment.yaml); empty is none.

type Owner

type Owner struct {
	Name     string
	Relation string // one of the template's Relations
	Account  string
}

type Principle

type Principle struct {
	Text  string   `yaml:"text"`
	Types []string `yaml:"types"`
	Cases []string `yaml:"cases"` // keys of the cases behind it
}

type Relative

type Relative struct {
	Name     string `yaml:"name"`
	Relation string `yaml:"relation"`
	// Account, when set, is how the agent knows them, not by name.
	Account string `yaml:"account"`
	Circle  string `yaml:"circle"` // empty: family
}

type Skill

type Skill struct {
	Name    string   `yaml:"name"`
	Level   int      `yaml:"level"` // 1 (beginner) to 10 (master)
	ShownBy []string `yaml:"shown_by"`
}

type Template

type Template struct {
	Key string `yaml:"-"` // its directory's name
	Dir string `yaml:"-"` // in files

	Name      string   `yaml:"name"`
	About     string   `yaml:"about"`
	Relations []string `yaml:"relations"`
	// contains filtered or unexported fields
}

Template is a folder laid out like a person's own, with {owner}, {relation}, {account} and {circle} filled in for whoever starts it.

func LoadTemplate

func LoadTemplate(files fs.FS, dir string) (Template, error)

func Templates

func Templates(files fs.FS, dir string) ([]Template, error)

Templates are the characters in dir, in files.

func (Template) Render

func (t Template) Render(o Owner) (map[string][]byte, error)

Render returns the folder's files by name, with the owner and the circle their relation is from filled in.

Jump to

Keyboard shortcuts

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