system2

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: 3 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 system2 defines the provider-neutral interface to slow, deliberate reasoning models. Each provider lives in its own subpackage.

Index

Constants

This section is empty.

Variables

View Source
var ActSchema = map[string]any{"type": "object", "additionalProperties": false, "required": []string{"tool", "args", "why"},
	"properties": map[string]any{
		"tool": map[string]any{"type": "string", "description": "the tool's name, as listed"},
		"args": map[string]any{"type": "string", "description": "its arguments, a JSON object"},
		"why":  map[string]any{"type": "string", "description": "why, in a few words"},
	}}

ActSchema is one tool it proposes to use that changes things.

View Source
var ErrCutOff = errors.New("the answer was cut off before it was finished")

Functions

func RemoveEmDashes

func RemoveEmDashes(s string) string

RemoveEmDashes punctuates the way a person would without em dashes: a comma between words, a space after other punctuation, nothing at a line's ends. JSON stays valid: an em dash is never part of its syntax.

Types

type About

type About string
const (
	AboutSelf    About = "self" // the agent's own life, including things it just decided
	AboutSpeaker About = "speaker"
)

type Act

type Act struct {
	Tool string // e.g. "notes.write_file"
	Args string // its arguments, a JSON object
	Why  string
}

Act is a tool that changes things, proposed: run only once allowed.

type Correction

type Correction struct {
	Fact   string // the fact's ref in the note, e.g. "f2"
	Forget bool   // forget it; otherwise replace it with Text
	Text   string
}

type Feedback

type Feedback struct {
	Skill string
	Level int // 1 to 10
	About string
}

type Format

type Format struct {
	Name   string
	Schema map[string]any
}

type GoalTaken

type GoalTaken struct {
	Skill    string
	Level    int // a new skill's starting level, 1 to 10; 0 for one it has
	Text     string
	DoneWhen string
	Due      string // YYYY-MM-DD
	DreamID  string // "" for a new one
	NewDream string // third person with its name; "" for an existing one
}

type LessonLearned

type LessonLearned struct {
	Skill string
	Text  string
}

type Memory

type Memory struct {
	About About
	Text  string
}

type Move

type Move struct {
	Promise string // its ref in the note, e.g. "p1"
	By      string // local time, "2006-01-02T15:04", or "now"
}

Move is a new time for a promise it already made.

type Permission

type Permission struct {
	Class   string
	Verdict string
}

type Promise

type Promise struct {
	By      string // when it will send it, local time, "2006-01-02T15:04"
	What    string
	Ability string // the ability it needs, e.g. "read_article"; "" if it only writes
	Query   string
	As      string // the file it sends it as, e.g. "pdf"; "" for a message
	Work    string // the ref in the note of a work it already made that this sends, e.g. "w2"; "" to make one
}

type Reasoner

type Reasoner interface {
	Reason(ctx context.Context, req Request) (Response, error)
}

func WithoutEmDashes

func WithoutEmDashes(r Reasoner) Reasoner

WithoutEmDashes wraps r so nothing it writes has an em dash. The prompts ask for none; this catches the ones a model writes anyway.

type Reminder

type Reminder struct {
	When string // local time, "2006-01-02T15:04"
	What string
}

type Request

type Request struct {
	Instructions    string
	History         []Turn // oldest first
	Note            string
	Message         string // "" when the agent speaks first
	MaxOutputTokens int    // the most it may write, reasoning included; 0: the provider's default
	// CollectFacts asks for the structured fields of Response alongside the reply.
	CollectFacts bool
	// Format asks for JSON in Response.Text. Not used with CollectFacts.
	Format *Format
}

type Response

type Response struct {
	Provider string
	Text     string
	// Remember to Goals are filled only with CollectFacts. Permissions,
	// Feedback, Lessons, Tastes and Goals count only from the owner.
	Remember []Memory
	// WhoTheyAre is one sentence with names ("Ada is Daniel's cousin."); "" if not told.
	WhoTheyAre  string
	Reminders   []Reminder
	Promises    []Promise
	Permissions []Permission
	Corrections []Correction
	// Misread is the intent choice the speaker's previous message really was,
	// when they said it was misread; "" if not.
	Misread  string
	Feedback []Feedback
	Lessons  []LessonLearned
	Tastes   []Taste
	Goals    []GoalTaken
	Send     Send
	Moves    []Move
	Acts     []Act
	Usage    Usage
	CostUSD  float64 // 0 when no price is configured
}

type Role

type Role string
const (
	RolePerson Role = "person"
	RoleAgent  Role = "agent"
)

type Send

type Send struct {
	Work string // its ref in the note, e.g. "w2"; "" for none
	As   string // e.g. "pdf"
}

Send is a work it already made, sent with the reply as a file.

type Taste

type Taste struct {
	Kind  string // "" for any kind of work
	Likes bool
	Text  string
}

type Turn

type Turn struct {
	Role Role
	Text string
}

type Usage

type Usage struct {
	InputTokens     int
	OutputTokens    int
	ReasoningTokens int // part of OutputTokens
}

Directories

Path Synopsis
Package openai is the System 2 provider for OpenAI's Responses API.
Package openai is the System 2 provider for OpenAI's Responses API.

Jump to

Keyboard shortcuts

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