Documentation
¶
Overview ¶
Package config loads and merges acd-ctx configuration (spec §18).
Precedence, lowest to highest (§18.5): defaults, global file, matching "projects" override in the global file, local <root>/.acd-ctx/config.yaml, ACD_CTX_* environment variables, explicit flags. Each key resolves on its own. Effective reports which layer supplied each key.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultGlobalPath ¶
DefaultGlobalPath returns the global config path for this OS (§18.1).
Types ¶
type Config ¶
type Config struct {
// trigger.* (§8.1, §8.4)
UFloor apd.Decimal // trigger.u_floor
UHigh apd.Decimal // trigger.u_high
UEmerg apd.Decimal // trigger.u_emerg
StepBase int // trigger.step_base
StepMin int // trigger.step_min
StepMax int // trigger.step_max
StepReadGain apd.Decimal // trigger.step_read_gain
MinGrowthFloor int // trigger.min_growth_floor
MaxRefusals int // trigger.max_refusals
TiersEnabled bool // trigger.tiers_enabled
// cache.* (§9). Global only: TTL and prices depend on the provider.
CacheTTL time.Duration // cache.ttl
CacheMargin apd.Decimal // cache.margin
PriceUncached apd.Decimal // cache.price_uncached
PriceCached apd.Decimal // cache.price_cached
// compress.* (§10, §11)
PreserveRecentMessages int // compress.preserve_recent_messages
PreserveRecentTokens int // compress.preserve_recent_tokens
MinCompressRange int // compress.min_compress_range
MinSummaryChars int // compress.min_summary_chars
MaxSummaryChars int // compress.max_summary_chars
ProtectedTools []string // compress.protected_tools
FramingCheck bool // compress.framing_check
UserTurnAfterSummaries bool // compress.user_turn_after_summaries
IntentLedger bool // compress.intent_ledger
// ccr.* (§14)
CCRThresholdTokens int // ccr.threshold_tokens
CrushEnabled bool // ccr.crush
// recall.* (§13)
RecallAssist bool // recall.assist
RecallMinAcceptRate apd.Decimal // recall.min_accept_rate
// window.* (§8.1, §4): the context window the trigger measures against.
WindowLimit int // window.context_limit: 0 derives the window from the model
WindowModels map[string]int // window.models: model prefix (lower case) -> tokens
// compaction.* (docs/compaction-commands.md). Global only: the setting decides
// which requests are passed through unchanged, so a project file must not change it.
// strong (default): the fixed prompt markers of the clients whose compaction
// prompt is a full sentence; all: also the weak prefixes of OpenCode v2;
// off: text rules are not used. Header and item signals are always on.
CompactionTextRules string // compaction.text_rules
// storage: "global" (default) or "local" (§18.1, §18.3).
Storage string // storage
}
Config is the merged, typed configuration. Field comments give the YAML key.
type Entry ¶
type Entry struct {
Key string
Value string
Source string // "default", "global:<path>", "global:projects[<pattern>]", "local:<path>", "env:<VAR>", "flag"
}
Entry is one key in the effective configuration.
type Options ¶
type Options struct {
// GlobalPath is the global config file. Empty means DefaultGlobalPath().
GlobalPath string
// Root is the project root (the directory that holds .acd-ctx/, or the
// repository root). Empty disables local config and project overrides.
Root string
// Flags maps dotted keys (e.g. "trigger.step_base") to raw values. This is
// the highest-precedence layer.
Flags map[string]string
// LookupEnv reads environment variables. Nil means os.LookupEnv.
LookupEnv func(string) (string, bool)
}
Options selects the inputs for Load. Zero values mean "not provided".