Documentation
¶
Overview ¶
Package autonomy implements the three-tier trust model for agent action evaluation.
Index ¶
Constants ¶
const DefaultCostThresholdUSD = 5.00
DefaultCostThresholdUSD is the default API cost threshold in USD.
Variables ¶
This section is empty.
Functions ¶
func SystemDefaults ¶
func SystemDefaults() map[ActionType]Tier
SystemDefaults returns the built-in tier assignments for all known actions.
Types ¶
type ActionType ¶
type ActionType string
ActionType identifies a specific kind of agent action.
const ( // Tier 1 defaults (always autonomous). ActionReadFile ActionType = "read_file" ActionSearch ActionType = "search" ActionCreateFile ActionType = "create_file" ActionOpenIssue ActionType = "open_issue" ActionCommentIssue ActionType = "comment_issue" ActionLabelIssue ActionType = "label_issue" ActionRunTests ActionType = "run_tests" ActionCreateBranch ActionType = "create_branch" ActionCommit ActionType = "commit" ActionRunLint ActionType = "run_lint" ActionQueryAPI ActionType = "query_api" // Tier 2 defaults (autonomous with logging). ActionEditFile ActionType = "edit_file" ActionCloseIssue ActionType = "close_issue" ActionCreatePR ActionType = "create_pr" ActionPushBranch ActionType = "push_branch" ActionMergeStaging ActionType = "merge_staging" ActionDeleteTemp ActionType = "delete_temp" ActionAPICallPaid ActionType = "api_call_paid" ActionRunService ActionType = "run_service" // Tier 3 defaults (requires confirmation). ActionMergeMain ActionType = "merge_main" ActionAddDependency ActionType = "add_dependency" ActionModifyCI ActionType = "modify_ci" ActionDeleteFile ActionType = "delete_file" ActionForcePush ActionType = "force_push" ActionAPICallExpense ActionType = "api_call_expensive" ActionCreateTag ActionType = "create_tag" ActionRestructure ActionType = "restructure" ActionModifySecrets ActionType = "modify_secrets" ActionIrreversible ActionType = "irreversible" )
type AutonomyPolicy ¶
type AutonomyPolicy interface {
TierFor(action ActionType) Tier
RequiresConfirmation(action ActionType) bool
CostThreshold() float64
}
AutonomyPolicy evaluates the trust tier for agent actions.
type Config ¶
type Config struct {
Defaults Defaults `yaml:"defaults"`
TierOverrides map[ActionType]Tier `yaml:"tier_overrides"`
Agents map[string]ScopedOverrides `yaml:"agents"`
Branches map[string]ScopedOverrides `yaml:"branches"`
Merge MergeConfig `yaml:"merge"`
}
Config represents the full autonomy configuration from .samverk/autonomy.yaml.
func DefaultConfig ¶
func DefaultConfig() Config
DefaultConfig returns a Config with system defaults and no overrides.
func LoadConfig ¶
LoadConfig reads and parses an autonomy config from the given path.
func LoadOrDefault ¶
LoadOrDefault loads the autonomy config from projectDir/.samverk/autonomy.yaml. If the file does not exist, it returns the default config.
type Defaults ¶
type Defaults struct {
APICostThresholdUSD float64 `yaml:"api_cost_threshold_usd"`
}
Defaults holds global default values.
type MergeConfig ¶ added in v0.1.6
type MergeConfig struct {
AutoMergeOnCIPass bool `yaml:"auto_merge_on_ci_pass"`
TrustedAuthors []string `yaml:"trusted_authors"`
RequireAllChecksPass bool `yaml:"require_all_checks_pass"`
ExcludeLabels []string `yaml:"exclude_labels"`
}
MergeConfig controls auto-merge behavior for agent PRs.
type Policy ¶
type Policy struct {
// contains filtered or unexported fields
}
Policy holds the resolved autonomy configuration.
func (*Policy) CostThreshold ¶
CostThreshold returns the API cost threshold in USD.
func (*Policy) ForContext ¶
func (p *Policy) ForContext(agentType, branch string) AutonomyPolicy
ForContext returns a context-bound policy that resolves tiers using the full precedence chain: branch > agent > global > system default.
func (*Policy) RequiresConfirmation ¶
func (p *Policy) RequiresConfirmation(action ActionType) bool
RequiresConfirmation returns true if the action is Tier 3.
func (*Policy) TierFor ¶
func (p *Policy) TierFor(action ActionType) Tier
TierFor resolves the tier for an action using only global overrides and system defaults (no agent or branch context).
type ScopedOverrides ¶
type ScopedOverrides struct {
TierOverrides map[ActionType]Tier `yaml:"tier_overrides"`
}
ScopedOverrides holds tier overrides for a specific agent type or branch pattern.