config

package
v0.7.2 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2026 License: Apache-2.0 Imports: 16 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 config loads and validates the portable project configuration (.idea-harness/project.yaml and harness.yaml) against embedded JSON Schemas (§28, §30). It also enforces that secrets never live in the portable tree.

Index

Constants

View Source
const DefaultOpenHandsAPIKeyEnv = "OPENHANDS_API_KEY"

DefaultOpenHandsAPIKeyEnv is the session-key variable when api_key_env is unset.

View Source
const DefaultOpenHandsWorkspaceDir = "/workspace/idea-harness"

DefaultOpenHandsWorkspaceDir is the server-side base directory when workspace_dir is unset.

View Source
const Dir = ".idea-harness"

Dir is the portable config directory name inside a project.

View Source
const MinLinearPollSeconds = 15

MinLinearPollSeconds is the floor on poll_interval_seconds.

View Source
const MinMetricCadenceMinutes = 15

MinMetricCadenceMinutes is the floor on how often a scheduled measurement runs, whatever a metric's cadence says: a command source is a container start, and "1m" would be one a minute forever.

Variables

View Source
var (
	ConvergenceModes     = []string{"guarded", "legacy"}
	ConvergenceGates     = []string{"high", "critical"}
	ConvergenceLaterBars = []string{"changed", "critical", "any"}
)

Convergence modes, gate severities and later-finding bars (review.convergence).

View Source
var DefaultSlackEvents = []string{
	"initiative.created",
	"initiative.needs_judgment",
	"review.prd_approved",
	"review.plan_approved",
	"change_set.ready_for_review",
	"change_set.approved",
	"change_set.rejected",
	"change_set.applied",
	"change_set.reverted",
	"verify.passed",
	"verify.failed",
	"run.failed",
	"outcome.drifted",
	"initiative.budget_exceeded",
	"eval.regressed",
}

DefaultSlackEvents is what Slack posts when `events` is unset: every kind a human might act on or want to know about, minus the per-task and "a change set started" chatter that would bury them.

View Source
var IntegrationEventKinds = []string{
	"initiative.created",
	"initiative.needs_judgment",
	"review.prd_approved",
	"review.plan_approved",
	"change_set.created",
	"change_set.ready_for_review",
	"change_set.approved",
	"change_set.rejected",
	"change_set.applied",
	"change_set.reverted",
	"verify.passed",
	"verify.failed",
	"run.failed",
	"task.status_changed",
	"outcome.drifted",
	"initiative.budget_exceeded",
	"eval.regressed",
}

IntegrationEventKinds is the vocabulary of domain events the integration bus publishes (internal/integrations: Kind). It lives here, in the leaf config package, so `integrations.slack.events` can be validated at load time; the integrations package pins its own constants to this list in a test.

View Source
var Presets = []Preset{
	{Key: "openai", Label: "OpenAI", Type: ProviderOpenAI, BaseURL: "https://api.openai.com/v1", DefaultKeyEnv: "OPENAI_API_KEY", NeedsKey: true},
	{Key: "anthropic", Label: "Anthropic", Type: ProviderAnthropic, BaseURL: "https://api.anthropic.com/v1", DefaultKeyEnv: "ANTHROPIC_API_KEY", NeedsKey: true},
	{Key: "gemini", Label: "Google Gemini", Type: ProviderGemini, BaseURL: "https://generativelanguage.googleapis.com/v1beta", DefaultKeyEnv: "GOOGLE_API_KEY", NeedsKey: true},
	{Key: "deepseek", Label: "DeepSeek", Type: ProviderOpenAI, BaseURL: "https://api.deepseek.com/v1", DefaultKeyEnv: "DEEPSEEK_API_KEY", NeedsKey: true},
	{Key: "openrouter", Label: "OpenRouter", Type: ProviderOpenAI, BaseURL: "https://openrouter.ai/api/v1", DefaultKeyEnv: "OPENROUTER_API_KEY", NeedsKey: true},
	{Key: "ollama", Label: "Ollama (local)", Type: ProviderOpenAI, BaseURL: "http://localhost:11434/v1", DefaultKeyEnv: "", NeedsKey: false},
}

Presets are the built-in providers (§10, §41). OpenRouter and Ollama speak the OpenAI-compatible wire format with different endpoints; Gemini and Anthropic use native APIs.

View Source
var RigorLevels = []string{"auto", "quick", "standard", "thorough"}

RigorLevels are review.rigor's allowed configured values.

View Source
var VerifyModelReviewDimensions = []string{"docs_completeness", "operational_readiness"}

VerifyModelReviewDimensions are the deterministic dimensions that accept an optional model-reviewed check (verify.model_review).

Functions

func HarnessTopLevelKeys added in v0.4.0

func HarnessTopLevelKeys() []string

HarnessTopLevelKeys returns the field names harness.yaml accepts at its top level, from the schema that validates it.

This exists so advice about harness.yaml can be checked against harness.yaml. `idea reviews` recommended `set tests_cmd in harness.yaml`, built by concatenating a finding category with "_cmd"; the field is `test_cmd`, and following the advice literally made `idea config validate` exit 1 with `additional properties 'tests_cmd' not allowed`. Nothing tied the prose to the schema, so nothing caught it.

func HasErrors

func HasErrors(problems []Problem) bool

HasErrors reports whether any problem is error-severity.

func IsLoopbackHost added in v0.5.0

func IsLoopbackHost(host string) bool

IsLoopbackHost reports whether host names this machine: "localhost" in any case, or any loopback IP (all of 127.0.0.0/8, and ::1).

func LoadDotEnv

func LoadDotEnv(dir string) map[string]string

LoadDotEnv reads a .env file (KEY=VALUE, with optional `export` prefix and quotes) and returns its values. Values are used only as a fallback to the real process environment for secret resolution (§47). No interpolation or shell expansion is performed.

func MarshalHarness added in v0.7.0

func MarshalHarness(h HarnessConfig) ([]byte, error)

MarshalHarness applies defaults, validates h exactly as Load would, and returns the YAML WriteHarness would write (without comment preservation).

func ParseModelSpec

func ParseModelSpec(spec string) (provider, model string)

ParseModelSpec splits a "provider/model" default-model string into its provider and model parts. A model with no "/" returns ("", model); the caller applies the default provider. Splitting is on the FIRST slash so OpenRouter model ids like "anthropic/claude-3.7-sonnet" remain intact.

func ResolveMCPValue added in v0.7.0

func ResolveMCPValue(nv MCPNameValue, lookup func(string) string) (string, bool)

ResolveMCPValue returns an entry's value: the literal, or the named variable from lookup. ok is false when ValueEnv names a variable that is set nowhere.

func SetDotEnv added in v0.7.0

func SetDotEnv(dir, key, value string) error

SetDotEnv upserts KEY=VALUE into dir/.env, preserving every other line and comment. A line that already sets KEY (with or without `export`, quoted or not) is replaced in place; otherwise a line is appended. The file is created mode 0600 — it holds secrets — and a missing file starts empty.

func ValidRigor added in v0.6.0

func ValidRigor(s string) bool

ValidRigor reports whether s is a recognized review.rigor value. Empty is valid and means "auto" (applyDefaults fills it in).

func ValidateBaseURL

func ValidateBaseURL(raw string) error

ValidateBaseURL requires https, except on loopback where http is the norm for local runtimes (ollama, LM Studio). Plain http to any other host puts the API key and the prompt on the wire in the clear.

func ValidateExecutor added in v0.7.0

func ValidateExecutor(e ExecutorConfig) error

ValidateExecutor is the load-time structural check of the executor block, for a writer (PUT /executors) that wants to refuse before writing.

func ValidateHarnessYAML added in v0.7.0

func ValidateHarnessYAML(data []byte) error

ValidateHarnessYAML runs Load's harness.yaml checks on a document.

func ValidateOpenHandsURL added in v0.7.0

func ValidateOpenHandsURL(raw string) error

ValidateOpenHandsURL checks an Agent Server URL: absolute http(s), no credentials in it, and https unless the host is loopback. A plain-http URL to another machine would carry the session key, the work root and the provider key in the clear.

func ValidateProvider

func ValidateProvider(name string, pc ProviderConfig) error

ValidateProvider checks one provider entry on the WRITE path (and, via Problems, on a hand-edited harness.yaml). A provider entry decides where prompts and an API key are sent, so it is validated before it is stored, not when it is first used.

func WriteHarness

func WriteHarness(dir string, h HarnessConfig) error

WriteHarness writes harness.yaml to dir, applying defaults first. It is the single write path for harness configuration -- `idea model set`, `idea executors setup` and every Settings and Automations save go through it (§47: no secrets written -- only *_env references are permitted).

The candidate is held to exactly what Load will hold it to -- the JSON Schema, the inline-secret sweep, and the structural checks -- before a byte is written. It used to check only `network`, so a writer could save a file the next Load refused, and every project-scoped route then answered with that file's parse error until someone hand-edited it back.

Comments a person wrote into an existing harness.yaml are kept: the file is committable and hand-edited, and a Settings save that silently dropped every `# why we pinned this image` note was a reason not to use Settings. Keys keep their existing order; new keys are appended where the struct puts them.

Types

type ACPConfig added in v0.7.0

type ACPConfig struct {
	// Command is the agent's argv INSIDE the container, e.g.
	// ["claude-code-acp"] or ["gemini", "--experimental-acp"]. The tokens
	// {model} and {bare_model} are replaced with executor.model as
	// provider/model and as the bare model id: ACP has no standard way to
	// choose a model, and every agent takes it differently.
	Command []string `json:"command,omitempty" yaml:"command,omitempty"`
	// KeyEnv renames the provider key inside the container. The value is read
	// from the provider's own variable (OPENAI_API_KEY, GOOGLE_API_KEY, ...)
	// and exposed to the agent under this name instead -- Gemini CLI reads
	// GEMINI_API_KEY, not the GOOGLE_API_KEY the gemini preset uses. Empty
	// keeps the provider's own name.
	KeyEnv string `json:"key_env,omitempty" yaml:"key_env,omitempty"`
	// TimeoutSeconds bounds one prompt turn. When it expires the client sends
	// session/cancel, waits briefly, then kills the container. Zero uses the
	// default (840 s: just under the engine's own 15-minute ceiling, so the
	// agent gets a clean cancel rather than the engine's hard stop).
	TimeoutSeconds int `json:"timeout_seconds,omitempty" yaml:"timeout_seconds,omitempty"`
}

ACPConfig configures the acp executor kind.

func (ACPConfig) IsZero added in v0.7.0

func (a ACPConfig) IsZero() bool

IsZero lets yaml.v3's omitempty drop an unset acp: block, so a project that never chose acp does not gain an empty `acp: {}` on its next write.

type AutomationsConfig added in v0.7.0

type AutomationsConfig struct {
	MetricMeasurement *MetricAutomationConfig `json:"metric_measurement,omitempty" yaml:"metric_measurement,omitempty"`
	Eval              *EvalAutomationConfig   `json:"eval,omitempty" yaml:"eval,omitempty"`
}

AutomationsConfig is harness.yaml's `automations` section: background jobs the daemon runs on a schedule. Every one is off unless its `enabled` is true -- nothing here runs because a section merely exists, and nothing in the harness turns one on by itself. (Linear inbound polling, the third background job the Automations view lists, keeps its switch where it always was: integrations.linear.inbound.)

func (AutomationsConfig) IsZero added in v0.7.0

func (a AutomationsConfig) IsZero() bool

IsZero lets yaml.v3's omitempty drop an empty automations block.

type BudgetConfig added in v0.7.0

type BudgetConfig struct {
	// DefaultInitiativeUSD caps each initiative's spend, in US dollars. Zero
	// (the default) means no cap.
	DefaultInitiativeUSD float64 `json:"default_initiative_usd,omitempty" yaml:"default_initiative_usd,omitempty"`
}

BudgetConfig is harness.yaml's `budget` section: the spending cap every initiative in the project is held to unless it sets its own (`idea budget <initiative> --set <usd>`, stored in the project database because a cap is a decision about one piece of work, not portable configuration).

It is a different control from review.max_cost_usd. That one is a process-lifetime ceiling on model calls, reset whenever the daemon reloads the project; this one is measured from the initiative's own recorded spend (GET .../costs), so it survives restarts and counts the coding agent's measured spend too.

type CheckConfig

type CheckConfig struct {
	Image string `json:"image,omitempty" yaml:"image,omitempty"`
}

CheckConfig configures the deterministic build/test check sandbox (review H3). The image must contain the project's toolchain (e.g. golang:1.25, node:22).

type Config

type Config struct {
	Project ProjectConfig
	Harness HarnessConfig
}

Config is the fully-loaded portable configuration for one project.

func Default

func Default() Config

Default returns the default configuration. The network is disabled by default so research never silently exfiltrates local content (§15). The executor defaults to auto: a real coding agent when Docker and the coding model's key are both available, the placeholder internal executor -- with a loud warning -- otherwise (executor.go).

func Load

func Load(dir string) (Config, error)

Load reads and validates project.yaml and harness.yaml from dir. Missing files fall back to Default(); present files are strictly validated against the raw document (so unknown fields and inline secrets are rejected, not silently dropped).

func (Config) Problems

func (c Config) Problems() []Problem

Problems reports configuration findings that Load deliberately does not turn into load errors (§D5): a config that is wrong must still open, or upgrading the binary would brick an existing project. Callers render these; nothing here mutates or rejects.

func (Config) ProblemsWithEnv

func (c Config) ProblemsWithEnv(dotEnv map[string]string) []Problem

ProblemsWithEnv is Problems with the project's .env as a fallback for API-key resolution, matching how the daemon resolves keys (runtime.go lookupEnv).

type ConvergenceConfig added in v0.7.0

type ConvergenceConfig struct {
	// Mode is "guarded" (the default) or "legacy". Legacy is the pre-0.7
	// loop exactly: no prior-cycle context, no demotions, no stall detector.
	// It stays selectable so the difference is measurable and as an escape
	// hatch.
	Mode string `json:"mode,omitempty" yaml:"mode,omitempty"`
	// GateSeverity is the lowest adversarial severity that can block:
	// "high" (the default -- critical and high block, as before) or
	// "critical". Lower severities are recorded as advisory, never dropped.
	// Deterministic checks are never affected.
	GateSeverity string `json:"gate_severity,omitempty" yaml:"gate_severity,omitempty"`
	// RequireCitation, when true (the default), makes an adversarial
	// finding block only if it cites an active requirement code -- or, for
	// a gap the PRD left out, the idea itself with evidence quoting it. An
	// uncited finding is scope expansion by construction and is recorded as
	// advisory. A pointer so an explicit false is distinguishable from unset.
	RequireCitation *bool `json:"require_citation,omitempty" yaml:"require_citation,omitempty"`
	// LaterFindings is the bar a finding that is NEW in cycle 2+ must clear
	// to block: "changed" (the default -- it must be about a requirement
	// the revision added or changed, or be critical), "critical" (it must be
	// critical), or "any" (no extra bar). A new finding about text the
	// reviewer already saw unchanged in the previous cycle is a goalpost
	// moving, not a regression the revision introduced.
	LaterFindings string `json:"later_findings,omitempty" yaml:"later_findings,omitempty"`
	// StallCycles is how many consecutive cycles the open blocking count may
	// fail to decrease before the loop stops early for a human (default 1).
	// A loop that is not making progress will not start making it by
	// spending the remaining max_cycles budget.
	StallCycles int `json:"stall_cycles,omitempty" yaml:"stall_cycles,omitempty"`
}

ConvergenceConfig is review.convergence: the rules that let an adversarial review loop finish without lowering its bar for a genuine blocker.

It exists because the PRD review did not converge in 2 of 2 measured real-model runs, and reading the loop explained why: the reviewer was memoryless (it never saw the previous cycle's findings or what the revision did about them), so every cycle was a fresh review of a larger PRD; any one critical/high finding anywhere -- new, rephrased, or about text that had not changed -- blocked; and nothing measured whether the loop was making progress, so it ran blind to max_cycles. See docs/configuration.md, "Review convergence".

func (ConvergenceConfig) CitationRequired added in v0.7.0

func (c ConvergenceConfig) CitationRequired() bool

CitationRequired reports the effective require_citation.

func (ConvergenceConfig) Effective added in v0.7.0

func (c ConvergenceConfig) Effective() ConvergenceConfig

Effective returns c with every unset field resolved to its default, which is what the engine runs under. Kept here, beside the fields, so the defaults are stated once (docs/configuration.md quotes them).

func (ConvergenceConfig) Legacy added in v0.7.0

func (c ConvergenceConfig) Legacy() bool

Legacy reports whether the pre-0.7 loop was selected.

type DemoConfig added in v0.4.0

type DemoConfig struct {
	// BlockReviewCycles makes the demo provider's adversarial reviewer emit a
	// blocking finding for this many review calls before reverting to its usual
	// empty list. Set it to `review.max_cycles` to make the PRD review park the
	// initiative on a human.
	//
	// A count consumed from a queue, not a flag, because all three adversarial
	// reviews share the schema name `review` and a flag would block the plan and
	// change-set reviews too. M1's review cycles are the first calls a run makes,
	// so the queue drains on exactly them.
	BlockReviewCycles int `json:"block_review_cycles,omitempty" yaml:"block_review_cycles,omitempty"`
	// BlockPlanReviewCycles does the same for the M2 execution-plan review.
	// A separate queue from the PRD review's, because they are separate reviews
	// with separate escapes -- and because one shared queue could spill a
	// leftover blocker onto the change-set review, which nothing can clear.
	//
	// Unclamped, unlike BlockReviewCycles: `idea revise-plan` clears a plan
	// review however many times it blocks, so a surplus is survivable here.
	BlockPlanReviewCycles int `json:"block_plan_review_cycles,omitempty" yaml:"block_plan_review_cycles,omitempty"`
	// BlockChangeSetReviewCycles does the same for the M3 change-set review.
	//
	// Its own queue, on its own key, for the reason the plan review needed one:
	// the change-set review shared the `review` key with the PRD review, so
	// there was no way to make it block without a leftover PRD response landing
	// here -- and no way to reach the state where a human must accept a change
	// set the reviewer will not pass. That state was a live-lock the keyed
	// magic path hit every run, and no demo configuration could produce it.
	BlockChangeSetReviewCycles int `json:"block_change_set_review_cycles,omitempty" yaml:"block_change_set_review_cycles,omitempty"`
	// DanglePlanDependency makes the first execution plan name a dependency no
	// task provides, which parks the initiative on `plan_dependencies` -- the
	// one judgment reason whose fix is regenerating the plan and never
	// approving it.
	DanglePlanDependency bool `json:"dangle_plan_dependency,omitempty" yaml:"dangle_plan_dependency,omitempty"`
	// CostPerCallUSD makes every demo model call report this cost. The demo
	// provider is otherwise free, so a spending cap (budget) could never be
	// reached on the only path CI and the browser suite run; this is what
	// lets them show a cap stopping a run without a real provider.
	CostPerCallUSD float64 `json:"cost_per_call_usd,omitempty" yaml:"cost_per_call_usd,omitempty"`
}

DemoConfig steers the built-in demo provider.

It exists because the demo reviewer returned zero findings unconditionally, so the review loop always converged and `needs_human_judgment` was structurally unreachable on the only path CI, scripts/smoke.sh and six DX audits ever ran. A P0 that fails 4/4 on the README's own quick start survived six rounds in that blind spot.

Declared config rather than a magic string in the idea text: the marker would have ridden into the PRD, the task title, the placeholder file and the change-set patch -- and from there into the *change-set* reviewer, which shares the schema name `review`, where a blocking finding is unrecoverable.

type EmailConfig added in v0.7.0

type EmailConfig struct {
	// To is the recipient address (one address; a distribution list is fine).
	To string `json:"to" yaml:"to"`
	// From is the From address.
	From string `json:"from" yaml:"from"`
	// SMTPHost / SMTPPort are the submission endpoint (default port 587).
	SMTPHost string `json:"smtp_host" yaml:"smtp_host"`
	SMTPPort int    `json:"smtp_port,omitempty" yaml:"smtp_port,omitempty"`
	// SMTPUser is the login; empty means unauthenticated.
	SMTPUser string `json:"smtp_user,omitempty" yaml:"smtp_user,omitempty"`
	// SMTPPasswordEnv names the environment variable holding the password.
	SMTPPasswordEnv string `json:"smtp_password_env,omitempty" yaml:"smtp_password_env,omitempty"`
	// Events narrows what is emailed (IntegrationEventKinds). Empty means
	// DefaultSlackEvents.
	Events []string `json:"events,omitempty" yaml:"events,omitempty"`
	// UIBaseURL is prefixed to deep links, like Slack's.
	UIBaseURL string `json:"ui_base_url,omitempty" yaml:"ui_base_url,omitempty"`
}

EmailConfig is `integrations.email`: outbound notifications over SMTP. Like Slack, it is notifications-only — email is never a capture channel. The password is an env-var NAME, never a value.

func (EmailConfig) EffectiveEvents added in v0.7.0

func (e EmailConfig) EffectiveEvents() []string

EffectiveEvents returns Events, or DefaultSlackEvents when unset.

func (EmailConfig) EffectivePort added in v0.7.0

func (e EmailConfig) EffectivePort() int

EffectivePort returns SMTPPort, or 587 when unset.

func (EmailConfig) SMTPPasswordEnvName added in v0.7.0

func (e EmailConfig) SMTPPasswordEnvName() string

SMTPPasswordEnvName returns the password's environment variable name.

type EvalAutomationConfig added in v0.7.0

type EvalAutomationConfig struct {
	Enabled bool `json:"enabled" yaml:"enabled"`
	// Model is the provider/model every case runs against. Required: a
	// scheduled scripted run measures nothing that changes between runs.
	Model string `json:"model" yaml:"model"`
	// Suite is a suite file path relative to the project root; empty is the
	// built-in default suite.
	Suite string `json:"suite,omitempty" yaml:"suite,omitempty"`
	// Cases narrows the suite to these case names; empty runs every case.
	Cases []string `json:"cases,omitempty" yaml:"cases,omitempty"`
	// IntervalHours is how often it runs. Default 24 (daily), minimum 1.
	IntervalHours int `json:"interval_hours,omitempty" yaml:"interval_hours,omitempty"`
	// MaxCostUSD caps one run's total spend. Required and > 0 when enabled:
	// a scheduled job that spends real money has to say how much.
	MaxCostUSD float64 `json:"max_cost_usd" yaml:"max_cost_usd"`
	// Baseline is a saved report (`idea eval --json-out`) to compare each run
	// with, relative to the project root. Empty compares with the previous
	// scheduled run that finished.
	Baseline string `json:"baseline,omitempty" yaml:"baseline,omitempty"`
}

EvalAutomationConfig schedules `idea eval` against a real model.

func (EvalAutomationConfig) EffectiveIntervalHours added in v0.7.0

func (e EvalAutomationConfig) EffectiveIntervalHours() int

EffectiveIntervalHours returns IntervalHours with its default applied.

type ExecuteConfig added in v0.7.0

type ExecuteConfig struct {
	// MaxFiles caps the file count a change set's diff may touch. <=0 (unset)
	// uses defaultMaxFiles — see EffectiveMaxFiles.
	MaxFiles int `json:"max_files,omitempty" yaml:"max_files,omitempty"`
	// MaxParallel is how many independent ready tasks `idea execute` runs at
	// once (a wave). <=0 (unset) means 1 — the serial behaviour. Independent
	// tasks whose depends_on predecessors are applied run concurrently;
	// overlapping edits are caught at apply by fsdiff.StaleBase.
	MaxParallel int `json:"max_parallel,omitempty" yaml:"max_parallel,omitempty"`
}

ExecuteConfig bounds the blast radius of a single change set (review C). A change set whose diff touches more files than MaxFiles allows is refused before the adversarial review ever runs (workflow.Engine.Execute), naming the count, the limit, and how to proceed: split the task, or raise the limit.

The count is of files the change set's diff (fsdiff.Diff(before, after)) actually touches, which already excludes fsdiff's own always-on exclusions (well-known toolchain/cache directories, the harness's own control-plane paths) and, for the after-image, the workspace's own .gitignore — so a lockfile regen or another generated/ignored file an agent rewrites does not count against a limit meant for hand-written sprawl.

func (ExecuteConfig) EffectiveMaxFiles added in v0.7.0

func (c ExecuteConfig) EffectiveMaxFiles() int

EffectiveMaxFiles is execute.max_files as Execute actually enforces it — the same <=0-means-default convention as ReviewConfig.EffectiveMaxCycles.

func (ExecuteConfig) EffectiveMaxParallel added in v0.7.0

func (c ExecuteConfig) EffectiveMaxParallel() int

EffectiveMaxParallel is execute.max_parallel as Execute actually enforces it: <=0 (unset) means 1 — serial.

type ExecutorConfig

type ExecutorConfig struct {
	Kind  ExecutorKind `json:"kind" yaml:"kind"`
	Image string       `json:"image,omitempty" yaml:"image,omitempty"`
	Model string       `json:"model,omitempty" yaml:"model,omitempty"`
	// ACP configures kind: acp (executor.go). Ignored by every other kind.
	ACP ACPConfig `json:"acp,omitempty" yaml:"acp,omitempty"`
	// OpenHands configures kind: openhands (executor.go). Ignored by every
	// other kind.
	OpenHands OpenHandsConfig `json:"openhands,omitempty" yaml:"openhands,omitempty"`
	// MCPServers are handed to an ACP agent in session/new (executor.go).
	MCPServers []MCPServerConfig `json:"mcp_servers,omitempty" yaml:"mcp_servers,omitempty"`
}

ExecutorConfig selects and configures the execute-pipeline executor. Image is the container image for the container and agent kinds; Model is the coding model for the agent kinds. Neither is read by the internal kind.

type ExecutorKind

type ExecutorKind string

ExecutorKind selects the coding executor the execute pipeline uses (§48–§52).

const (
	ExecutorInternal  ExecutorKind = "internal"
	ExecutorContainer ExecutorKind = "container"
	ExecutorOMP       ExecutorKind = "omp"
	ExecutorHermes    ExecutorKind = "hermes"
	// ExecutorACP, ExecutorOpenHands and ExecutorAuto are documented in
	// executor.go.
	ExecutorACP       ExecutorKind = "acp"
	ExecutorOpenHands ExecutorKind = "openhands"
	ExecutorAuto      ExecutorKind = "auto"
)

func (ExecutorKind) Valid

func (k ExecutorKind) Valid() bool

type GitConfig added in v0.6.0

type GitConfig struct {
	// AllowDefaultBranch permits the commit-on-apply path to commit while HEAD
	// is checked out on the repository's default branch. Off by default: an
	// agent commit landing directly on the default branch, with no human
	// commit of their own in between, is a stronger claim than opting into
	// git_commit alone should make. Irrelevant when BranchPerInitiative is on,
	// since apply then commits on the initiative's own branch.
	AllowDefaultBranch bool `json:"allow_default_branch,omitempty" yaml:"allow_default_branch,omitempty"`
	// BranchPerInitiative opts into creating and checking out idea/<slug> on an
	// initiative's first apply, then committing each of its change sets there
	// instead of on whatever branch the workspace was already on. This implies
	// committing (review defect D): setting this true is sufficient on its
	// own, without also setting git_commit -- see GitCommit's doc comment for
	// why that used to be a second, undocumented requirement.
	BranchPerInitiative bool `json:"branch_per_initiative,omitempty" yaml:"branch_per_initiative,omitempty"`
}

GitConfig configures git-native behavior beyond git_commit (review C4, adopted change #2). Both fields are opt-in and off by default.

type HarnessConfig

type HarnessConfig struct {
	Network  NetworkPolicy  `json:"network" yaml:"network"`
	Review   ReviewConfig   `json:"review" yaml:"review"`
	Research ResearchConfig `json:"research" yaml:"research"`
	// Constitution lists the project's immutable principles. Each is injected
	// into every stage and reviewer as a hard constraint (the project_policy
	// context selector); the reviewer is instructed to flag any violation. Empty
	// means no project-specific constitution.
	Constitution []string                  `json:"constitution,omitempty" yaml:"constitution,omitempty"`
	Providers    map[string]ProviderConfig `json:"providers" yaml:"providers"`
	DefaultModel string                    `json:"default_model" yaml:"default_model"`
	Executor     ExecutorConfig            `json:"executor" yaml:"executor"`
	Check        CheckConfig               `json:"check" yaml:"check"`
	// Execute bounds a single change set's blast radius (review C). See
	// ExecuteConfig's doc comment.
	Execute ExecuteConfig `json:"execute,omitempty" yaml:"execute,omitempty"`
	// Models is the per-role model map: role name → "provider/model". Roles
	// without an entry fall back to default_model (§40). The coding "implementer"
	// role is a valid key here, letting OMP/Hermes run different models.
	Models map[string]string `json:"models" yaml:"models"`
	// BuildCmd/TestCmd are the deterministic check commands (review B5). They are
	// config-supplied, never model/agent output; when empty the corresponding
	// check is recorded not_applicable.
	BuildCmd string `json:"build_cmd,omitempty" yaml:"build_cmd,omitempty"`
	TestCmd  string `json:"test_cmd,omitempty" yaml:"test_cmd,omitempty"`
	// CheckTimeoutSeconds bounds each deterministic build/test check. Zero uses
	// the default of 600s (10m) (review SRE).
	CheckTimeoutSeconds int `json:"check_timeout_seconds,omitempty" yaml:"check_timeout_seconds,omitempty"`
	// GitCommit opts into creating a git commit (with repo hooks disabled) for
	// each applied change set (§M7). Off by default: a hook runs arbitrary code
	// under the daemon's privileged environment, so this must never be implied
	// by anything OTHER than an explicit opt-in -- which is exactly what
	// Git.BranchPerInitiative is (review defect D): it is documented as
	// committing each change set onto the initiative's branch, so setting it
	// alone, with GitCommit left false, also commits. A user who wants neither
	// leaves both false; there is no way to get branch-per-initiative's
	// bookkeeping (Initiative.GitBranch, `idea pr`) without commits landing on
	// it, since an uncommitted branch is not a reviewable one.
	GitCommit bool `json:"git_commit" yaml:"git_commit"`
	// Git configures git-native behavior beyond the commit-on-apply toggle
	// above (review #2, C4). Git.BranchPerInitiative alone is sufficient to
	// commit (see GitCommit's doc comment) -- GitCommit itself need not also
	// be set.
	Git GitConfig `json:"git,omitempty" yaml:"git,omitempty"`
	// Demo configures the built-in deterministic provider. It does nothing when
	// a real provider is configured.
	Demo DemoConfig `json:"demo,omitempty" yaml:"demo,omitempty"`
	// Integrations configures the Slack and Linear integrations
	// (integrations.go). Each is off unless its section is present; tokens are
	// never read from here, only from the environment or the project's .env,
	// named by the *_env fields.
	Integrations IntegrationsConfig `json:"integrations,omitempty" yaml:"integrations,omitempty"`
	// Verify configures the quality dimensions `idea verify` measures beyond
	// the acceptance tests (verify.go).
	Verify VerifyConfig `json:"verify,omitempty" yaml:"verify,omitempty"`
	// Outcomes configures outcome-metric measurement (OutcomesConfig).
	Outcomes OutcomesConfig `json:"outcomes,omitempty" yaml:"outcomes,omitempty"`
	// Budget is the per-initiative spending cap (automations.go).
	Budget BudgetConfig `json:"budget,omitempty" yaml:"budget,omitempty"`
	// Automations are the opt-in scheduled jobs (automations.go).
	Automations AutomationsConfig `json:"automations,omitempty" yaml:"automations,omitempty"`
}

HarnessConfig is harness.yaml (portable, committable).

type IntegrationsConfig added in v0.7.0

type IntegrationsConfig struct {
	Slack    *SlackConfig           `json:"slack,omitempty" yaml:"slack,omitempty"`
	Linear   *LinearConfig          `json:"linear,omitempty" yaml:"linear,omitempty"`
	Email    *EmailConfig           `json:"email,omitempty" yaml:"email,omitempty"`
	Telegram *TelegramChannelConfig `json:"telegram,omitempty" yaml:"telegram,omitempty"`
}

IntegrationsConfig is harness.yaml's `integrations` section. Each integration is enabled by its section being present -- there is no separate `enabled` flag to forget -- and disabled by removing it.

func (IntegrationsConfig) Configured added in v0.7.0

func (c IntegrationsConfig) Configured() bool

Configured reports whether any integration is configured.

type LinearConfig added in v0.7.0

type LinearConfig struct {
	// TeamKey is the Linear team key (the "ENG" in ENG-123).
	TeamKey string `json:"team_key" yaml:"team_key"`
	// Project optionally files created issues under a Linear project (by name).
	Project string `json:"project,omitempty" yaml:"project,omitempty"`
	// InboundLabel is the label that turns a Linear issue into an initiative.
	// Default "idea".
	InboundLabel string `json:"inbound_label,omitempty" yaml:"inbound_label,omitempty"`
	// Inbound turns the label poll on or off. Default true.
	Inbound *bool `json:"inbound,omitempty" yaml:"inbound,omitempty"`
	// PollIntervalSeconds is how often Linear is polled. Default 60, minimum 15
	// (Linear's API is rate limited per key, and nothing here is urgent).
	PollIntervalSeconds int `json:"poll_interval_seconds,omitempty" yaml:"poll_interval_seconds,omitempty"`
	// StateMapping overrides the workflow state names. Unset entries default
	// to Todo, In Progress, In Review, Done and Canceled.
	StateMapping LinearStateMapping `json:"state_mapping,omitempty" yaml:"state_mapping,omitempty"`
	// APIKeyEnv names the environment variable holding the Linear API key.
	// Default LINEAR_API_KEY.
	APIKeyEnv string `json:"api_key_env,omitempty" yaml:"api_key_env,omitempty"`
}

LinearConfig is `integrations.linear`.

func (LinearConfig) APIKeyEnvName added in v0.7.0

func (l LinearConfig) APIKeyEnvName() string

APIKeyEnvName returns the API key's environment variable name.

func (LinearConfig) EffectiveInboundLabel added in v0.7.0

func (l LinearConfig) EffectiveInboundLabel() string

EffectiveInboundLabel returns InboundLabel or "idea".

func (LinearConfig) EffectivePollSeconds added in v0.7.0

func (l LinearConfig) EffectivePollSeconds() int

EffectivePollSeconds returns the poll interval with its default applied.

func (LinearConfig) EffectiveStates added in v0.7.0

func (l LinearConfig) EffectiveStates() LinearStateMapping

EffectiveStates returns the state mapping with defaults applied.

func (LinearConfig) InboundEnabled added in v0.7.0

func (l LinearConfig) InboundEnabled() bool

InboundEnabled reports the effective inbound flag (default true).

type LinearStateMapping added in v0.7.0

type LinearStateMapping struct {
	Todo       string `json:"todo,omitempty" yaml:"todo,omitempty"`
	InProgress string `json:"in_progress,omitempty" yaml:"in_progress,omitempty"`
	InReview   string `json:"in_review,omitempty" yaml:"in_review,omitempty"`
	Done       string `json:"done,omitempty" yaml:"done,omitempty"`
	Canceled   string `json:"canceled,omitempty" yaml:"canceled,omitempty"`
}

LinearStateMapping maps the harness's task lifecycle onto the names of the team's Linear workflow states.

type MCPNameValue added in v0.7.0

type MCPNameValue struct {
	Name     string `json:"name" yaml:"name"`
	Value    string `json:"value,omitempty" yaml:"value,omitempty"`
	ValueEnv string `json:"value_env,omitempty" yaml:"value_env,omitempty"`
}

MCPNameValue is one env variable or HTTP header for an MCP server. Exactly one of Value (a literal, for a non-secret setting) or ValueEnv (the NAME of a variable resolved from the daemon's environment, then the project's .env -- the lookup provider keys use) is set. harness.yaml is committable, so a secret is never written inline: Load refuses a literal Value whose name or content looks like one.

type MCPServerConfig added in v0.7.0

type MCPServerConfig struct {
	Name string `json:"name" yaml:"name"`
	// Type is "stdio" (the default), "http" or "sse".
	Type    string         `json:"type,omitempty" yaml:"type,omitempty"`
	Command string         `json:"command,omitempty" yaml:"command,omitempty"`
	Args    []string       `json:"args,omitempty" yaml:"args,omitempty"`
	Env     []MCPNameValue `json:"env,omitempty" yaml:"env,omitempty"`
	URL     string         `json:"url,omitempty" yaml:"url,omitempty"`
	Headers []MCPNameValue `json:"headers,omitempty" yaml:"headers,omitempty"`
}

MCPServerConfig is one MCP server handed to an ACP agent in session/new, in ACP's own McpServer shape: a stdio server (Command, Args, Env) or an http/sse server (Type, URL, Headers).

The trust tradeoff, stated once here and in docs/agents.md: a stdio server runs INSIDE the agent's container, as the agent's child, with the same isolation and the same network egress. An http/sse server is reached by the agent over the network, and whatever credential its headers carry is handed to the agent to send.

func (MCPServerConfig) EffectiveType added in v0.7.0

func (m MCPServerConfig) EffectiveType() string

EffectiveType is the server's transport, defaulting to stdio.

type MetricAutomationConfig added in v0.7.0

type MetricAutomationConfig struct {
	Enabled bool `json:"enabled" yaml:"enabled"`
}

MetricAutomationConfig schedules `idea metric measure` for every live outcome metric whose source is a command or a url, each on its own cadence. Manual metrics are never touched (there is nothing to measure), and url sources still need outcomes.allow_url_sources -- enabling the schedule does not imply network access.

type NetworkPolicy

type NetworkPolicy string

NetworkPolicy is the v0.1 network mode (§46). It governs ONLY the deterministic idea-brief/research/PRD pipeline (Engine.researchEvidence and the offline fact→assumption downgrade in Engine.runResearch) -- it does NOT gate the coding agent's network access (executor.kind omp/hermes always has egress, deliberately, to reach its model API: internal/executor/agent.go) or the build/test check sandbox's (internal/executor/sandbox.go always runs with `--network none`, unconditionally). A prior version of this comment, and of docs/configuration.md, did not say so, which read as though setting this to "disabled" also sandboxed those (review defect #3).

const (
	NetworkDisabled NetworkPolicy = "disabled"
	NetworkEnabled  NetworkPolicy = "enabled"
)

func (NetworkPolicy) Valid

func (n NetworkPolicy) Valid() bool

type OpenHandsConfig added in v0.7.0

type OpenHandsConfig struct {
	// URL is the Agent Server's base URL, e.g. https://agents.example.com.
	// It must be https unless the host is loopback (a server on this
	// machine, or an SSH tunnel to one): the session key, the work root and
	// usually the provider key travel over it.
	URL string `json:"url,omitempty" yaml:"url,omitempty"`
	// APIKeyEnv names the variable holding the server's session API key
	// (sent as X-Session-API-Key), read like a provider key: the daemon's
	// environment, then the project's .env. Never the key itself --
	// harness.yaml is committable. Empty means OPENHANDS_API_KEY; a server
	// started without a key needs none, and the variable may then be unset.
	APIKeyEnv string `json:"api_key_env,omitempty" yaml:"api_key_env,omitempty"`
	// Agent is which agent the server runs: "openhands" (the default, the
	// server's own agent driving executor.model through its LLM layer) or
	// "acp" (an Agent Client Protocol agent the server's image carries, such
	// as claude-agent-acp or codex-acp, started with ACPCommand).
	Agent string `json:"agent,omitempty" yaml:"agent,omitempty"`
	// ACPCommand is the ACP agent's argv on the server, for agent: acp.
	ACPCommand []string `json:"acp_command,omitempty" yaml:"acp_command,omitempty"`
	// WorkspaceDir is the absolute directory on the server under which each
	// run gets its own subdirectory. Empty means /workspace/idea-harness.
	WorkspaceDir string `json:"workspace_dir,omitempty" yaml:"workspace_dir,omitempty"`
	// WithholdProviderKey keeps the coding model's provider key on this
	// machine: the server must then supply its own (agent: acp reads it from
	// the server's environment; the openhands agent needs one configured
	// server-side). By default the key is sent with the run, because the
	// agent on the server is what calls the model.
	WithholdProviderKey bool `json:"withhold_provider_key,omitempty" yaml:"withhold_provider_key,omitempty"`
	// MaxIterations bounds the agent's steps on the server. Zero uses the
	// default (100).
	MaxIterations int `json:"max_iterations,omitempty" yaml:"max_iterations,omitempty"`
	// TimeoutSeconds bounds one run, measured from dispatch. When it
	// expires the run is interrupted on the server. Zero uses the default
	// (840 s, under the engine's own 15-minute ceiling, as for acp).
	TimeoutSeconds int `json:"timeout_seconds,omitempty" yaml:"timeout_seconds,omitempty"`
	// UIURL is an OpenHands web UI that shows this server's conversations,
	// e.g. https://openhands.example.com. Optional: when set, a run on the
	// server links to <ui_url>/conversations/<conversation id> ("Open in
	// OpenHands"). The Agent Server itself serves no UI, so without this
	// there is no link -- its address is never guessed.
	UIURL string `json:"ui_url,omitempty" yaml:"ui_url,omitempty"`
}

OpenHandsConfig configures the openhands executor kind.

func (OpenHandsConfig) EffectiveAPIKeyEnv added in v0.7.0

func (o OpenHandsConfig) EffectiveAPIKeyEnv() string

EffectiveAPIKeyEnv is APIKeyEnv, defaulted.

func (OpenHandsConfig) EffectiveAgent added in v0.7.0

func (o OpenHandsConfig) EffectiveAgent() string

EffectiveAgent is Agent, defaulted.

func (OpenHandsConfig) EffectiveWorkspaceDir added in v0.7.0

func (o OpenHandsConfig) EffectiveWorkspaceDir() string

EffectiveWorkspaceDir is WorkspaceDir, defaulted.

func (OpenHandsConfig) IsZero added in v0.7.0

func (o OpenHandsConfig) IsZero() bool

IsZero lets yaml.v3's omitempty drop an unset openhands: block.

type OutcomesConfig added in v0.7.0

type OutcomesConfig struct {
	// Image is the sandbox image a command source runs in. Empty falls back
	// to check.image, then to the image derived from the project's toolchain
	// markers, then to the sandbox's minimal default -- the same no-network,
	// read-only sandbox the build/test checks use either way.
	Image string `json:"image,omitempty" yaml:"image,omitempty"`
	// MeasureTimeoutSeconds bounds one command source. Zero means 120s.
	MeasureTimeoutSeconds int `json:"measure_timeout_seconds,omitempty" yaml:"measure_timeout_seconds,omitempty"`
	// AllowURLSources opts into fetching url sources. Off by default: it is
	// the one measurement path that reaches the network, so it is never
	// implied -- not even by `network: enabled`, which governs the research
	// pipeline. Fetches go through the SSRF-guarded fetcher either way
	// (public http(s) addresses only).
	AllowURLSources bool `json:"allow_url_sources,omitempty" yaml:"allow_url_sources,omitempty"`
}

OutcomesConfig configures how outcome metrics are measured (`idea metric measure`). Nothing here runs on its own: a command or url source is measured when a human or an MCP client asks, or on its cadence once a person enables automations.metric_measurement (automations.go).

type ParseError added in v0.4.0

type ParseError struct {
	// File, relative to the project root — never the absolute path.
	File string
	Msg  string
}

ParseError is a malformed config file: the user's YAML, not the daemon's fault. Both shapes it can take — YAML that does not parse, and YAML that parses but the schema rejects — because the second is the more common one and they are the same problem to a caller: this file has to be edited before any request against this project can succeed.

It used to travel as a bare fmt.Errorf, so every project-scoped handler mapped it to 404 — `config.Load` runs inside EnsureProject, and a failure there is indistinguishable from "no such project" to the caller. That violated the spec's own NotFound contract ("the message names the kind and the reference that was asked for") and leaked an absolute filesystem path into the response, which InternalError explicitly promises never happens.

500 is the wrong repair: internal/daemon/errors.go reserves it for "the daemon's problem", and telling a client to retry a syntax error in a file only the user can fix is worse than the 404 was. So this carries enough for a 4xx that names the file, the line, and nothing else.

func (*ParseError) Error added in v0.4.0

func (e *ParseError) Error() string

type PerformanceBudget added in v0.7.0

type PerformanceBudget struct {
	Name    string `json:"name" yaml:"name"`
	Command string `json:"command" yaml:"command"`
	// Metric is a regular expression matched against the command's output;
	// its first capture group must parse as a number (e.g.
	// `BenchmarkParse\S*\s+\d+\s+([0-9.]+) ns/op`).
	Metric string `json:"metric" yaml:"metric"`
	// Unit labels the number in reports ("ns/op", "bytes"). Cosmetic.
	Unit string `json:"unit,omitempty" yaml:"unit,omitempty"`
	// Max fails the budget when the measured value exceeds it. Nil: no
	// absolute ceiling.
	Max *float64 `json:"max,omitempty" yaml:"max,omitempty"`
	// MaxRegressionPct fails the budget when the value grew by more than this
	// percentage over the previous measurement's. Zero: no regression check.
	MaxRegressionPct float64 `json:"max_regression_pct,omitempty" yaml:"max_regression_pct,omitempty"`
}

PerformanceBudget is one user-declared performance budget: a command run in the no-network sandbox, a regular expression whose first capture group is the measured number, and a threshold -- absolute (Max), relative to the previous measurement (MaxRegressionPct), or both.

type Preset

type Preset struct {
	Key           string
	Label         string
	Type          ProviderType
	BaseURL       string
	DefaultKeyEnv string
	NeedsKey      bool
}

Preset is a well-known provider preset used for config resolution and UI.

func PresetFor

func PresetFor(key string) *Preset

PresetFor returns the preset matching a provider key, or nil for a custom key.

func PresetForBaseURL added in v0.6.0

func PresetForBaseURL(baseURL string) *Preset

PresetForBaseURL returns the preset whose BaseURL matches baseURL (a trailing-slash-insensitive comparison), or nil if none does.

This recovers a provider's underlying built-in KIND when its harness.yaml key does not name one directly (review MEDIUM #6): a `providers:` entry can be renamed to anything (`providers: openai-work: base_url: https://api.openai.com/v1`, docs/configuration.md's own example shape), and PresetFor("openai-work") is nil even though the endpoint is plainly OpenAI's. A caller that needs to know WHICH of the six built-in providers this actually talks to -- not just its wire Type, which only distinguishes three API shapes and cannot tell deepseek/openrouter/ollama apart, all ProviderOpenAI -- matches on BaseURL instead, since a renamed provider still points at the same real endpoint.

type Problem

type Problem struct {
	Severity Severity `json:"severity"`
	Field    string   `json:"field"`
	Message  string   `json:"message"`
	// EnvDependent marks a problem whose answer depends on which process asked.
	// Only the missing-key check is: it resolves the variable with os.Getenv, so
	// the CLI sees the shell you typed in while the run is made by the daemon,
	// which read its own environment once at start. `idea doctor` drops these
	// and asks the daemon instead.
	//
	// A field rather than matching the message text: the first version of this
	// matched a substring, and rewording the message silently un-marked it.
	EnvDependent bool `json:"-"`
}

Problem is one configuration finding. Field is the harness.yaml path it came from so the operator knows which line to edit.

func UnknownModelProblems

func UnknownModelProblems(field, spec string) []Problem

unknownModelProblems warns when the model half of a spec matches no catalog entry for a provider whose catalog is known.

Nothing validated the model half at all, so `idea model set anthropic/claude-3-7-sonnet` printed success and the first call came back a non-retryable 404 -- and nine such ids shipped in the documentation before an audit caught them by reading.

A warning, not an error: a valid model can postdate the bundled catalog, and refusing it would make the tool unusable the week a provider ships something. openrouter and ollama are skipped entirely: openrouter's ids are arbitrary upstream strings, and ollama serves whatever the operator has pulled locally. For both, the bundled catalog cannot be authoritative by construction, so a warning there would be noise on correct configurations.

type ProjectConfig

type ProjectConfig struct {
	Name string `json:"name" yaml:"name"`
}

ProjectConfig is project.yaml (portable, committable).

type ProviderConfig

type ProviderConfig struct {
	Type      ProviderType `json:"type" yaml:"type"`
	APIKeyEnv string       `json:"api_key_env" yaml:"api_key_env"`
	BaseURL   string       `json:"base_url" yaml:"base_url"`
	Models    []string     `json:"models" yaml:"models"`
}

ProviderConfig describes one model provider (§40). API keys are resolved from the environment variable named by APIKeyEnv — never stored inline. Type and BaseURL are optional: when empty they are derived from the provider key's preset (see providers.go).

type ProviderType

type ProviderType string

ProviderType is the wire protocol a provider speaks.

const (
	ProviderOpenAI    ProviderType = "openai"    // OpenAI-compatible chat completions
	ProviderAnthropic ProviderType = "anthropic" // Anthropic messages API
	ProviderGemini    ProviderType = "gemini"    // Google generative-language API
)

func ResolveProvider

func ResolveProvider(key string, pc ProviderConfig) (ProviderType, string, string)

ResolveProvider derives the effective type, base URL, and key-env name for a provider entry, falling back to the preset for known keys (§40).

func (ProviderType) Valid

func (t ProviderType) Valid() bool

type ResearchConfig

type ResearchConfig struct {
	URLs []string `json:"urls" yaml:"urls"`
}

ResearchConfig controls the research web tool (§46). URLs are seed sources fetched (public-address-only) during the research stage when network is enabled.

type ReviewConfig

type ReviewConfig struct {
	MaxCycles  int     `json:"max_cycles" yaml:"max_cycles"`
	MaxTokens  int64   `json:"max_tokens" yaml:"max_tokens"`
	MaxCostUSD float64 `json:"max_cost_usd" yaml:"max_cost_usd"`
	// Rigor calibrates how much scrutiny the PRD, plan and change-set reviews
	// apply (review B1): one of "auto" (the default -- calibrated from
	// project size and change size), "quick", "standard", or "thorough".
	// Auto exists because a fixed rigor level was the ICP round's root
	// cause: a 60-line toy app got the same review depth as an enterprise
	// system, and the loop never converged.
	Rigor string `json:"rigor,omitempty" yaml:"rigor,omitempty"`
	// Convergence governs how the PRD review loop decides it has converged,
	// and how the plan review gates (see ConvergenceConfig). Zero value is
	// the guarded default.
	Convergence ConvergenceConfig `json:"convergence,omitempty" yaml:"convergence,omitempty"`
}

ReviewConfig is the review budget (§11, §16).

func (ReviewConfig) EffectiveMaxCycles added in v0.6.0

func (r ReviewConfig) EffectiveMaxCycles() int

EffectiveMaxCycles is MaxCycles as the engine actually enforces it: any value <= 0 (unset, or explicitly zero) coerces to 3, the same rule workflow.New/Engine.Reload apply to their own copy of this config before running a review loop. applyDefaults only defaults the raw field to 3 when every review.* field is unset (review MEDIUM #7) -- a harness.yaml that sets, say, max_tokens alongside max_cycles == 0 leaves the raw field at zero -- so a caller that needs to know the true effective cap without going through an *Engine (daemon.demoProvider's block_review_cycles clamp) must call this, not read MaxCycles directly.

type Severity

type Severity string

Severity classifies a Problem. An error means the configuration cannot do what it says (a model spec that resolves to no provider, an endpoint that would ship credentials off-box); a warn means it will work but degrade — most commonly demo mode, which is a legitimate way to run the product.

const (
	SeverityError Severity = "error"
	SeverityWarn  Severity = "warn"
)

type SlackConfig added in v0.7.0

type SlackConfig struct {
	// Channel is the channel ID (C0123...) notifications post to. An ID rather
	// than a #name because slash commands are routed back to a project by the
	// channel ID Slack reports, and a name would never match it.
	Channel string `json:"channel" yaml:"channel"`
	// Events narrows what is posted (IntegrationEventKinds). Empty means
	// DefaultSlackEvents.
	Events []string `json:"events,omitempty" yaml:"events,omitempty"`
	// MentionOnJudgment is who to mention when an initiative parks on
	// needs_human_judgment: Slack user IDs (U0123...), or "here"/"channel".
	MentionOnJudgment []string `json:"mention_on_judgment,omitempty" yaml:"mention_on_judgment,omitempty"`
	// AllowedUsers are the Slack user IDs whose button clicks and slash
	// commands are acted on. Empty (the default) means none are: Slack is
	// notify-only until someone is named here. A Slack workspace's membership
	// is not this project's approver list, so it is never assumed to be.
	AllowedUsers []string `json:"allowed_users,omitempty" yaml:"allowed_users,omitempty"`
	// SocketMode turns on the interactive half (buttons, /idea) over a Socket
	// Mode websocket, which needs SLACK_APP_TOKEN. Defaults to true; it is
	// skipped, with a status warning, when no app token is available.
	SocketMode *bool `json:"socket_mode,omitempty" yaml:"socket_mode,omitempty"`
	// BotTokenEnv / AppTokenEnv name the environment variables holding the
	// xoxb- bot token and xapp- app-level token. Default SLACK_BOT_TOKEN and
	// SLACK_APP_TOKEN.
	BotTokenEnv string `json:"bot_token_env,omitempty" yaml:"bot_token_env,omitempty"`
	AppTokenEnv string `json:"app_token_env,omitempty" yaml:"app_token_env,omitempty"`
	// UIBaseURL is prefixed to deep links. Defaults to the daemon's own
	// address -- which is loopback, so the links only open on this machine.
	UIBaseURL string `json:"ui_base_url,omitempty" yaml:"ui_base_url,omitempty"`
}

SlackConfig is `integrations.slack`.

func (SlackConfig) AppTokenEnvName added in v0.7.0

func (s SlackConfig) AppTokenEnvName() string

AppTokenEnvName returns the app-level token's environment variable name.

func (SlackConfig) BotTokenEnvName added in v0.7.0

func (s SlackConfig) BotTokenEnvName() string

BotTokenEnvName returns the bot token's environment variable name.

func (SlackConfig) EffectiveEvents added in v0.7.0

func (s SlackConfig) EffectiveEvents() []string

EffectiveEvents returns Events, or DefaultSlackEvents when unset.

func (SlackConfig) SocketModeEnabled added in v0.7.0

func (s SlackConfig) SocketModeEnabled() bool

SocketModeEnabled reports the effective socket_mode (default true).

type TelegramChannelConfig added in v0.7.0

type TelegramChannelConfig struct {
	// BotTokenEnv names the environment variable holding the @BotFather token.
	BotTokenEnv string `json:"bot_token_env" yaml:"bot_token_env"`
}

TelegramChannelConfig is `integrations.telegram`: the native capture bot. The daemon long-polls the bot and turns each text message into a draft initiative in THIS project, so the project is implicit — no `project` field.

func (TelegramChannelConfig) BotTokenEnvName added in v0.7.0

func (t TelegramChannelConfig) BotTokenEnvName() string

BotTokenEnvName returns the bot token's environment variable name.

type VerifyConfig added in v0.7.0

type VerifyConfig struct {
	// Dimensions sets a dimension's mode, overriding the rigor default:
	// dimension name -> "off" | "advisory" | "gate". Unknown names are refused
	// by the schema rather than ignored, so a typo cannot silently leave a
	// dimension at its default.
	Dimensions map[string]string `json:"dimensions,omitempty" yaml:"dimensions,omitempty"`
	// Setup configures setup_reproducibility.
	Setup VerifySetupConfig `json:"setup,omitempty" yaml:"setup,omitempty"`
	// Security configures the security dimension's scanners.
	Security VerifySecurityConfig `json:"security,omitempty" yaml:"security,omitempty"`
	// Performance declares performance budgets.
	Performance VerifyPerformanceConfig `json:"performance,omitempty" yaml:"performance,omitempty"`
	// ModelReview adds a model-reviewed check (the verification_engineer role,
	// citations required) to the named deterministic dimensions. Only
	// docs_completeness and operational_readiness take one; api_ergonomics is
	// model-reviewed by definition and needs no entry here.
	ModelReview []string `json:"model_review,omitempty" yaml:"model_review,omitempty"`
	// TimeoutSeconds bounds each sandboxed command a dimension runs. Zero uses
	// check_timeout_seconds, and that unset uses 600.
	TimeoutSeconds int `json:"timeout_seconds,omitempty" yaml:"timeout_seconds,omitempty"`
}

VerifyConfig is harness.yaml's `verify` section: the quality dimensions `idea verify` measures beyond the acceptance tests, and the commands some of them run. Everything here is optional. With the section absent, each dimension's mode comes from the effective review rigor (see workflow.QualityPolicy), the documented setup commands are detected from the README/Makefile/package.json, nothing runs with network access, and performance has no budgets (so it reports not_measured).

func (VerifyConfig) WantsModelReview added in v0.7.0

func (v VerifyConfig) WantsModelReview(dimension string) bool

WantsModelReview reports whether verify.model_review names dimension.

type VerifyPerformanceConfig added in v0.7.0

type VerifyPerformanceConfig struct {
	Budgets []PerformanceBudget `json:"budgets,omitempty" yaml:"budgets,omitempty"`
}

VerifyPerformanceConfig declares performance budgets.

type VerifyScanner added in v0.7.0

type VerifyScanner struct {
	Name    string `json:"name" yaml:"name"`
	Command string `json:"command" yaml:"command"`
	// Network runs this scanner with network access (a vulnerability database
	// download). Off by default. See docs/security-model.md.
	Network bool `json:"network,omitempty" yaml:"network,omitempty"`
}

VerifyScanner is one security scanner command.

type VerifySecurityConfig added in v0.7.0

type VerifySecurityConfig struct {
	// Scanners are commands run in the sandbox against a fresh copy of the
	// workspace; a non-zero exit is a fail. None are run by default: the
	// common ones (govulncheck, npm audit, pip-audit) need a vulnerability
	// database from the network, so a scanner that needs it must say
	// `network: true`, and without any scanner the vulnerability check is
	// recorded as not_measured rather than passed.
	Scanners []VerifyScanner `json:"scanners,omitempty" yaml:"scanners,omitempty"`
}

VerifySecurityConfig configures the security dimension.

type VerifySetupConfig added in v0.7.0

type VerifySetupConfig struct {
	// Commands replaces documented-command detection outright: run exactly
	// these, in order, in the no-network sandbox against a fresh copy of the
	// workspace. Empty means detect them from the README, Makefile and
	// package.json.
	Commands []string `json:"commands,omitempty" yaml:"commands,omitempty"`
	// Prepare are commands run BEFORE the offline phase, in a sandbox WITH
	// network access, to fetch dependencies (e.g. `go mod download`, `npm ci`).
	// Only commands listed here ever get the network; a documented install
	// command found in the README is skipped in the offline phase and
	// recorded, never promoted to this phase. See docs/security-model.md.
	Prepare []string `json:"prepare,omitempty" yaml:"prepare,omitempty"`
}

VerifySetupConfig configures setup_reproducibility.

Jump to

Keyboard shortcuts

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