Documentation
¶
Overview ¶
Package recipe is the recipe store of ADR 0036's 2026-10-15 amendment: a recipe is a typed record of closed-vocabulary agent_env_rules data, tagged with the seat capability it was distilled for, the acceptance-passing runs it came from and its status.
A recipe is DATA and nothing else. The record has six declared keys and refuses any other, the rule set is core.AgentEnvRules decoded the same strict way (so rules_code, the envharness key the ADR refuses by name, is an unknown key), and every string in it has a shape:
id, seat_tag a slug; the id is also the file name in the store, so it cannot climb out of it
tool and argument names a lower-case identifier
provenance entry a run id, no spaces
rewrite_error.text one line of plain ASCII prose, at most 160 bytes, none of the characters
that carry code (backtick, $, braces, brackets, quotes, pipes, parentheses)
pattern printable ASCII, at most 200 bytes, a Go (RE2) expression that does not match
the empty string (a pattern that fires on every result is a wipe, not a rule)
The shapes are not a safety argument by themselves. What keeps a recipe harmless is that an env rule never grants or denies an effect (ADR 0036, decision 3), that a recipe is only ever proposed or published by the audit, and that an operator applies it. The shapes keep the store from holding anything that is not rule data, so the next reader can review it as data.
Publishing is the audit's result and nothing else: a published record must carry the audit that earned it (verdict ADOPT, steps no worse than the incumbent's), so a record cannot be published by editing one word.
Index ¶
Constants ¶
const ( StatusProposed = "proposed" StatusPublished = "published" StatusDemoted = "demoted" )
Statuses.
const ( MaxTextBytes = 160 // rewrite_error.text: the bound the trace note uses for what the model was told MaxPatternBytes = 200 MaxProvenance = 64 )
Bounds on the free-form parts of a record.
Variables ¶
This section is empty.
Functions ¶
func Keys ¶
func Keys() []string
Keys lists the rule keys of the vocabulary, in the order core.AgentEnvRules declares them.
func LiveABKeys ¶
func LiveABKeys(r *core.AgentEnvRules) []string
LiveABKeys lists the keys a rule set uses that need a live A/B, in vocabulary order.
Types ¶
type Audit ¶
type Audit struct {
Seat string `json:"seat"`
BaselineHash string `json:"baseline_hash"`
EraMarker string `json:"era_marker"`
Verdict string `json:"verdict"`
StepsIncumbent float64 `json:"steps_incumbent"`
StepsCandidate float64 `json:"steps_candidate"`
}
Audit is the record of a recipe-audit run: which seat, which pre-registration, which era, the gate's verdict and the mean steps of the two arms over the tasks both finished.
func (Audit) StepsNoWorse ¶
StepsNoWorse reports whether the candidate used no more steps than the incumbent.
type Class ¶
type Class string
Class says how a rule key may be scored (ADR 0036, the 2026-10-15 amendment).
const ( // ClassReplay: the rule only removes or caps calls. A recorded trace holds the tool, the fate // and the stop class of every step, so it can be read against the rule without the seat // answering again: the branch (which tools may be called) and the parallelism (how many calls // of one tool a run makes), with the stop class of the run as what such a cut can move. ClassReplay Class = "replay" // ClassLiveAB: the rule changes an argument or what the seat reads. Every later step of the run // changes with it, and no recording says what the seat would have done next, so only a live // A/B on the seat can score it. recipe-audit is that A/B. ClassLiveAB Class = "live_ab" )
type Recipe ¶
type Recipe struct {
// ID names the record and its file in the store.
ID string `json:"id"`
// SeatTag is the seat capability class the recipe was distilled for and audited on. A recipe
// is evidence about one class of seat; it is never audited on another.
SeatTag string `json:"seat_tag"`
// Rules is the closed-vocabulary rule set: what would replace the seat's agent_env_rules.
Rules core.AgentEnvRules `json:"rules"`
// Provenance lists the acceptance-passing runs the rules were distilled from.
Provenance []string `json:"provenance"`
// Status is proposed, published or demoted.
Status string `json:"status"`
// Audit is what the last recipe-audit found. Nil on a proposed recipe.
Audit *Audit `json:"audit,omitempty"`
}
Recipe is one record.
func Decode ¶
Decode reads one recipe: exactly one JSON document, no unknown key anywhere in it (the rules and the audit included), no trailing data, and a record that validates.
type Store ¶
type Store struct{ Dir string }
Store is a directory of recipe files, one per id, named <id>.json. Every file is read through Decode, so a store never hands back a record that would not decode, and a file whose record names another id than its file name does is refused.
func (Store) List ¶
List reads every <id>.json in the store, in id order. A file that does not decode fails the listing by name: a store with a bad record in it is not a store to read from. Other files (notes, temporary files of a save in flight) are not recipes and are passed over.