agent

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package agent runs the "propose" step: it gives the role's question to a coding agent and collects its proposals in out/intentions.yaml.

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidOutput = errors.New("agent answered without valid proposals")

ErrInvalidOutput means the agent answered, but not with proposals the engine can read. Its answer is dropped, as if it had proposed nothing.

View Source
var ErrUnavailable = errors.New("agent unavailable")

ErrUnavailable means the agent could not be reached for a reason outside the role: quota, authentication, network, not installed. The run ends as blocked-external if the role cannot pass without it.

Functions

func Notice

func Notice(file string, call Call) string

Notice records the model that answered call in file, and says so when it is not the one that answered the same question last time on this machine. A call that did not say what it asked or what answered is not recorded. It never fails a run: a file it cannot read or write only means no notice.

func Prompt

func Prompt(req Request) (system, user string, err error)

Prompt assembles what the agent reads, in the contract's order: persona (returned apart, as the system prompt), knowledge, instruction, the task, the output contract, and the policy last.

func Seen

func Seen() string

Seen is where a machine keeps the last exact model that answered for each model asked: an alias floats to a new generation on its own, and the evaluation's scores are worth something only for the model that earned them (docs/adr/0004-follow-model-aliases-and-measure.md). WORKLINE_MODELS_SEEN names another file.

Types

type Agent

type Agent interface {
	Propose(Request) (Call, error)
}

Agent answers the question in in/task.md by writing out/intentions.yaml, and says what answered, even when it fails.

func Parse

func Parse(spec string) (Agent, error)

Parse turns an agent spec into an agent. "none" (or "") returns nil: no agent.

none                  no AI; the role's without-ai rule applies
claude                Claude Code, headless (claude -p), on the model the role's tier asks
claude:<model>        on that model, whatever the tier: an alias (sonnet) or an exact id
claude:<model>@<effort>, claude:@<effort>
                      and at that effort (none, low, medium, high, max), whatever the role's
cmd:<script>          runs <script> with sh -c: the prompt in, the proposals out (command.go)
fake:<file>           replays the proposals in <file> (conformance tests)
unavailable:<reason>  fails like an agent whose quota or login is gone

type Call

type Call struct {
	Agent  string `json:"agent"`
	Task   string `json:"task,omitempty"` // the kind of task, when pre named one
	Tier   string `json:"tier,omitempty"`
	Effort string `json:"effort,omitempty"` // the role's level, before the agent maps it
	Asked  string `json:"asked,omitempty"`  // the model named to the agent: an alias or an exact id
	Model  string `json:"model,omitempty"`  // the one that wrote the answer, as the agent reports it
	// What the call used, side calls included, as the agent reports it. On a
	// subscription the tokens are what counts; the cost is the list price.
	TokensIn     int     `json:"tokens-in,omitempty"`     // the whole input, cache included
	TokensCached int     `json:"tokens-cached,omitempty"` // the part of it read from cache
	TokensOut    int     `json:"tokens-out,omitempty"`
	CostUSD      float64 `json:"cost-usd,omitempty"`
	Seconds      float64 `json:"seconds"`
}

Call records one question put to an agent: what was asked, and what answered. The same tier names a newer model when the agent's aliases move, so a score is only worth something next to the exact model.

type Request

type Request struct {
	RunDir string
	Repo   string
	Role   *role.Role
	Tier   string // overrides the role's tier, when a retry steps up
}

Request is everything an agent gets for one decision.

Jump to

Keyboard shortcuts

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