Help us shape the future of Go! Take the 2026 Go Developer Survey

config

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package config resolves the harness configuration by SPEC §3 precedence: built-in defaults, then the user config, then the repo .adh/config.toml, then the .adh/autonomy runtime override, then ADH_* environment variables (each overriding the last); command-line flags override the result at the call site. resolve is a pure overlay of decoded TOML documents onto the defaults; Load is the thin shell that reads the files and env.

Security (SPEC §3.2, §5.2): the approval phrase is NEVER sourced from env or file — ADH_APPROVAL_PHRASE is ignored — so the agent has no self-grant route.

Index

Constants

View Source
const (
	// RepoConfigFile is the repo-level config path (SPEC §3): the loader's repo
	// layer and the path `adh init` writes the starter config to.
	RepoConfigFile = ".adh/config.toml"

	// UnconfirmedLesson is the default disposition for a critic finding no artifact
	// confirmed (§19.2, §19.4): keep it as a §11 lesson candidate.
	UnconfirmedLesson = "lesson"
)
View Source
const StarterTOML = `` /* 1197-byte string literal not displayed */

StarterTOML is the documented starter config `adh init` writes to .adh/config.toml (SPEC §3.1). It resolves to the built-in defaults with the knobs surfaced and commented so an operator can tailor a deployment; unknown keys (illustrative sections like [oracle]) are ignored by the loader.

Variables

This section is empty.

Functions

func ProfileConfigFile

func ProfileConfigFile(profile string) string

ProfileConfigFile is the repo-local profile config path (SPEC §3 tier 3): the layer `--profile <name>` (or ADH_PROFILE) selects, overlaying the repo config.

Types

type Config

type Config struct {
	Autonomy   string     `toml:"autonomy"`
	Models     Models     `toml:"models"`
	Gates      Gates      `toml:"gates"`
	Critic     Critic     `toml:"critic"`
	Proof      Proof      `toml:"proof"`
	Evaluation Evaluation `toml:"evaluation"`
	Identity   Identity   `toml:"identity"`
}

Config is the resolved harness configuration (SPEC §3.1).

func Defaults

func Defaults() Config

Defaults returns the built-in configuration: autonomy L2, the placeholder reasoning/fast model identifiers, the SPEC §5.1 judgment set, and an approval phrase required.

func Load

func Load(getenv func(string) string) (Config, error)

Load resolves the configuration by precedence. getenv is injected so the precedence is testable without touching the process environment.

func (*Config) AutonomyLevel

func (c *Config) AutonomyLevel() authority.Level

AutonomyLevel parses the resolved autonomy string, defaulting to L2 when it is unset or unparseable.

func (*Config) BaselineModels

func (c *Config) BaselineModels() map[string]string

BaselineModels is the per-role model binding for a requalification epoch (§14): each judgment role binds to the reasoning-class identifier, the rest to the fast-class one.

func (*Config) CriticUnconfirmed

func (c *Config) CriticUnconfirmed() string

CriticUnconfirmed is the configured disposition for an unconfirmed critic finding (§19.2), defaulting to the §11 lesson candidate when unset.

func (*Config) DeniedInputs

func (c *Config) DeniedInputs() []adh.CriticInput

DeniedInputs is the critic's deny list as domain values.

Requires: the config validated, so every name is known and deniable. Ensures: one value per configured name, in configured order. Pure.

func (*Config) JudgmentRoles

func (c *Config) JudgmentRoles() authority.JudgmentRoles

JudgmentRoles is the model-gate's judgment set as typed stages, normalizing the SPEC aliases "eval" and "exec".

func (*Config) MaxReworks

func (c *Config) MaxReworks() int

MaxReworks is the configured Evaluation rework budget (§4.1), falling back to evaluation.DefaultMaxReworks when unset so the default has a single owner.

func (*Config) ProofContract

func (c *Config) ProofContract(res adh.Resolution) string

ProofContract returns the acceptance bar a resolution's proof must satisfy to close (SPEC §3.1 `[proof.contract]`, §12): the configured text when set, else the resolution's generic built-in default (adh.Resolution.ProofKind), so the default text has a single owner. The harness enforces that matching proof exists (NO-PROOF-NO-CLOSE); this text is the bar the critic and close hold it to.

type Critic

type Critic struct {
	GroundFrom  []string `toml:"ground_from"`
	Deny        []string `toml:"deny"`
	Unconfirmed string   `toml:"unconfirmed"`
}

Critic is the cold-critic policy (SPEC-ADDITIONS §19.4).

**Deny is enforced and GroundFrom describes.** The difference used to be invisible and both were read by nothing, which is worse in Deny than in an ordinary unused field: a deny-list naming `transcript` beside GroundFrom reads as *the* mechanism excluding the builder's history, and as configurable. Neither was true, so anyone hardening the critic would have edited it and believed they had succeeded.

Deny is now checked by the renderer against the view it built, so removing an entry weakens something real and adding one adh cannot honour is a load error rather than a decoration. The structural omission in prompt.Render remains the guarantee — an after-the-fact assertion cannot stop a field being populated — and the check is belt and braces on top of it.

GroundFrom is descriptive: adh assembles the critic's grounding whole and does not filter it, so this list records what the critic is grounded in and selects nothing. The set it must match is built in critic.Ground. Both lists are validated against adh.CriticInputs, so a typo in either is named at load.

Unconfirmed is the disposition of a finding no artifact confirmed and is acted on by the eval command.

type Evaluation

type Evaluation struct {
	MaxReworks int `toml:"max_reworks"`
}

Evaluation is the Evaluation-stage policy (SPEC §4.1). MaxReworks bounds the rework loop: the times a confirmed finding may return an arc to Execution before it fails terminally. Zero means unset — MaxReworks() then falls back to the evaluation package's default, so that default keeps a single owner.

type Gates

type Gates struct {
	ApprovalPhraseRequired bool `toml:"approval_phrase_required"`
}

Gates holds the human-gate policy.

type Identity

type Identity struct {
	// Actor is the full actor id including its class, e.g. "human:steve" or
	// "ci:nightly". The class is declared rather than inferred: a bare name would have
	// to be guessed into a class, and guessing "human" is exactly the guess that lets a
	// CI runner mint sign-offs. Unset means the harness has no identity and cannot
	// record a verification.
	Actor string `toml:"actor"`
}

Identity is who this harness records as the actor on a verification event (SPEC-ADDITIONS §10.4).

**Config-derived, and attributable rather than authenticated.** It establishes who the harness was configured as, not who was at the keyboard, and adh states that limit rather than implying more. A flag would let any caller mint a `human:` event, which makes the tier fold worth defeating.

type ModelGateConf

type ModelGateConf struct {
	JudgmentRoles []string `toml:"judgment_roles"`
}

ModelGateConf lists the roles that must run on a reasoning-class model.

type Models

type Models struct {
	Reasoning string        `toml:"reasoning"`
	Fast      string        `toml:"fast"`
	Gate      ModelGateConf `toml:"gate"`
}

Models is the per-class model binding and the model-gate's judgment set.

type Proof

type Proof struct {
	Contract map[string]string `toml:"contract"`
}

Proof is the proof policy (SPEC §3.1, §5.4). Contract maps each resolution to the acceptance bar its proof must satisfy to close (§12); a deployment tailors it per key, and any key it omits falls back to the generic built-in default.

Jump to

Keyboard shortcuts

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