config

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AutoDepthThresholds = []AutoDepthThreshold{
	{Lines: 100, Depth: "quick"},
	{Lines: 500, Depth: "standard"},
}

AutoDepthThresholds ports config.py AUTO_DEPTH_THRESHOLDS: <100 -> quick, 100-500 -> standard, >500 -> deep. Kept as an ordered slice (Python relied on insertion order of the {100:..,500:..} dict) so consumers can range in order.

View Source
var DepthProfiles = map[string]DepthProfile{
	"quick":    {MaxDimensions: 3, ModelTier: "budget"},
	"standard": {MaxDimensions: 6, ModelTier: "standard"},
	"deep":     {MaxDimensions: 12, ModelTier: "premium"},
}

DepthProfiles ports config.py DEPTH_PROFILES. These are static (no env), so a package var is fine.

Functions

func DefaultIgnorePaths

func DefaultIgnorePaths() []string

DefaultIgnorePaths is the config.py glob ignore list. Returned fresh per call.

func DefaultPhaseBudgets

func DefaultPhaseBudgets() map[string]float64

DefaultPhaseBudgets is the per-phase USD allocation (config.py). Returned as a fresh map per call so callers cannot mutate a shared instance.

func ResolveBudgetCaps

func ResolveBudgetCaps(maxCostUSD *float64, maxDurationSeconds *int) (float64, int, error)

ResolveBudgetCaps ports app.py _resolve_budget_caps. An explicit argument always wins, and the defaults are 2.0 / 3600 (real reviews measure 60-70 minutes — the historical 300s default killed every fresh install mid-pipeline). pr-af also read PR_AF_MAX_COST_USD and PR_AF_MAX_DURATION_SECONDS between the two; codeaf always passes the run's own caps (internal/praf's reviewInput), so nothing reads them.

Types

type AutoDepthThreshold

type AutoDepthThreshold struct {
	Lines int
	Depth string
}

AutoDepthThreshold maps a lines-changed ceiling to a depth. Ordered ascending; the first threshold whose Lines value the change count is under selects the depth. A change over the last threshold (>500) falls through to "deep".

type BudgetConfig

type BudgetConfig struct {
	MaxCostUSD         float64            `json:"max_cost_usd"`
	MaxDurationSeconds int                `json:"max_duration_seconds"`
	PhaseBudgets       map[string]float64 `json:"phase_budgets"`

	MaxConcurrentReviewers int `json:"max_concurrent_reviewers"`

	MaxReferenceFollowsPerReviewer int `json:"max_reference_follows_per_reviewer"`
	MaxChildSpawnsPerReviewer      int `json:"max_child_spawns_per_reviewer"`

	MaxCrossRefDeepDives int `json:"max_cross_ref_deep_dives"`

	MaxCoverageIterations int `json:"max_coverage_iterations"`

	MaxReviewDepth int `json:"max_review_depth"`

	// EvidencePackReviewers pre-reads each dimension's target files and injects
	// them so reviewers reason over a primed pack. Default ON: env
	// PR_AF_EVIDENCE_PACK not in {"0","false","no"}.
	EvidencePackReviewers bool `json:"evidence_pack_reviewers"`
}

BudgetConfig ports config.py BudgetConfig — global and per-phase budget caps. Numeric defaults are the §D "Config numeric tables" verbatim. Note max_duration_seconds is always overridden per call to the resolved value (3600 by default) via ReviewConfig.FromInput.

func DefaultBudgetConfig

func DefaultBudgetConfig() BudgetConfig

DefaultBudgetConfig builds a BudgetConfig with the config.py defaults, reading PR_AF_EVIDENCE_PACK at call time.

type CommentConfig

type CommentConfig struct {
	MinSeverity                 string `json:"min_severity"` // Minimum severity to include
	MaxComments                 int    `json:"max_comments"` // Cap inline comments
	IncludeSuggestions          bool   `json:"include_suggestions"`
	IncludeDimensionAttribution bool   `json:"include_dimension_attribution"`
	IncludeConfidence           bool   `json:"include_confidence"`
	SuggestionMode              string `json:"suggestion_mode"` // comment | code

	// PolishEnabled runs a parallel .ai() pass that rewrites each comment body
	// right before posting; on any per-call failure the original body is kept.
	PolishEnabled bool `json:"polish_enabled"`

	// MergeGateEnabled runs a parallel .ai() pass classifying each finding as
	// blocking vs advisory. Default ON; failures default to advisory.
	MergeGateEnabled bool `json:"merge_gate_enabled"`

	// PostWorthinessGate: an experienced-reviewer precision pass. DEFAULT OFF;
	// enabled by PR_AF_POSTWORTHINESS_GATE in {"1","true","yes"}.
	PostWorthinessGate bool `json:"post_worthiness_gate"`

	SeverityEmojis map[string]string `json:"severity_emojis"`
}

CommentConfig ports config.py CommentConfig — comment formatting and posting preferences (§D numeric tables). PostWorthinessGate is env-driven (default OFF); every other default is a plain constant.

func DefaultCommentConfig

func DefaultCommentConfig() CommentConfig

DefaultCommentConfig builds the config.py comment defaults, reading PR_AF_POSTWORTHINESS_GATE at call time.

type DepthProfile

type DepthProfile struct {
	MaxDimensions int    `json:"max_dimensions"`
	ModelTier     string `json:"model_tier"` // budget | standard | premium
}

DepthProfile ports config.py DepthProfile — a pre-built review-depth profile.

type ModelConfig

type ModelConfig struct {
	IntakeGate      string `json:"intake_gate"`      // .ai() fast classification
	IntakeFallback  string `json:"intake_fallback"`  // .harness() when not confident
	AnatomySemantic string `json:"anatomy_semantic"` // Narrative understanding
	Planner         string `json:"planner"`          // THE critical agent
	Reviewer        string `json:"reviewer"`         // Deep code analysis
	CrossRef        string `json:"cross_ref"`        // Interaction detection
	Adversary       string `json:"adversary"`        // Challenge quality
	CoverageGate    string `json:"coverage_gate"`    // Simple completeness check
	DedupGate       string `json:"dedup_gate"`       // Near-duplicate detection
}

ModelConfig ports config.py ModelConfig — model routing per agent. Budget models for gates/classification; premium models for planning/reviewing/ challenging (plan quality = review quality, so the planner gets premium).

func DefaultModelConfig

func DefaultModelConfig() ModelConfig

DefaultModelConfig builds the config.py model-routing defaults.

type ReviewConfig

type ReviewConfig struct {
	Budget   BudgetConfig  `json:"budget"`
	Model    ModelConfig   `json:"models"`
	Scoring  ScoringConfig `json:"scoring"`
	Comments CommentConfig `json:"comments"`

	IgnorePaths []string         `json:"ignore_paths"`
	Hints       []string         `json:"hints"`
	DepthRules  []map[string]any `json:"depth_rules"`
}

ReviewConfig ports config.py ReviewConfig — the top-level config combining all sub-configs. The Go `Model` field carries the json tag "models" to match the Python field name.

func DefaultReviewConfig

func DefaultReviewConfig() ReviewConfig

DefaultReviewConfig assembles a ReviewConfig from the sub-config defaults (the Go analog of pydantic's ReviewConfig() with its default_factory fields).

func (ReviewConfig) FromInput

FromInput ports ReviewConfig.from_input — it merges per-call API overrides into the defaults. The value receiver is ignored (matching the Python classmethod semantics: it always starts from a fresh default config).

Budget caps: Python resolves max_cost_usd / max_duration_seconds in review() BEFORE constructing the ReviewInput, so from_input always writes a concrete resolved value over the BudgetConfig defaults (the raw BudgetConfig duration default is dead — the per-call value is 3600 by default). The Go ReviewInput carries these as *float64 / *int, so FromInput runs the same ResolveBudgetCaps cascade (explicit > env > 2.0/3600) to reproduce that effective value exactly.

type ScoringConfig

type ScoringConfig struct {
	BaseWeights          map[string]float64 `json:"base_weights"`
	Multipliers          map[string]float64 `json:"multipliers"`
	ConfidenceThresholds map[string]float64 `json:"confidence_thresholds"`
}

ScoringConfig ports config.py ScoringConfig — deterministic scoring weights and multipliers (§D numeric tables). LLMs reason about issues; code computes scores, so the same findings always produce the same scores. Maps are returned fresh per call so a caller cannot mutate a shared default.

func DefaultScoringConfig

func DefaultScoringConfig() ScoringConfig

DefaultScoringConfig builds the config.py scoring defaults.

Jump to

Keyboard shortcuts

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