Documentation
¶
Overview ¶
Package config provides loading and aggregation of Genie configuration.
It solves the problem of unifying all component settings (model, MCP, tools, messenger, cron, data sources, security, etc.) from files (.genie.toml, .genie.yaml) and environment variables. LoadGenieConfig resolves secret placeholders (${VAR}) via a SecretProvider and applies defaults so the rest of the application receives a single GenieConfig struct. Without this package, each component would read config independently and secret resolution would be scattered.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( Version = "dev" BuildDate = "" )
Functions ¶
func LoadMCPConfig ¶
func LoadMCPConfig(ctx context.Context, sp security.SecretProvider, path string) (mcp.MCPConfig, error)
LoadMCPConfig loads only the MCP section from the config file at path. It uses the same path resolution as LoadGenieConfig (path can be empty to mean "no config") and expands ${VAR} via the given SecretProvider. This allows "genie mcp validate" to run without requiring model provider API keys.
func WarnMissingTokens ¶
func WarnMissingTokens(ctx context.Context, cfg GenieConfig, configPath string)
WarnMissingTokens logs a warning for each model provider that typically requires an API key but has an empty token. Call this after the final config pass so that runtimevar-backed secrets have been resolved. Without this separation, the two-pass loading in cmd/root.go would emit spurious warnings during the preliminary env-only pass.
Types ¶
type GenieConfig ¶
type GenieConfig struct {
// AgentName is the user-chosen name for the agent. It gives the agent a
// personality and is used for the default audit log path
// (~/.genie/{agent_name}.<yyyy_mm_dd>.ndjson).
AgentName string `yaml:"agent_name,omitempty" toml:"agent_name,omitempty"`
// AuditPath overrides the default audit log path. When set, the auditor
// writes to this single file (no date rotation). Used for tests or custom paths.
AuditPath string `yaml:"audit_path,omitempty" toml:"audit_path,omitempty"`
ModelConfig modelprovider.ModelConfig `yaml:"model_config,omitempty" toml:"model_config,omitempty"`
SkillsRoots []string `yaml:"skills_roots,omitempty" toml:"skills_roots,omitempty"` // Supports multiple roots including HTTPS URLs
MCP mcp.MCPConfig `yaml:"mcp,omitempty" toml:"mcp,omitempty"`
WebSearch websearch.Config `yaml:"web_search,omitempty" toml:"web_search,omitempty"`
VectorMemory vector.Config `yaml:"vector_memory,omitempty" toml:"vector_memory,omitempty"`
Graph graph.Config `yaml:"graph,omitempty" toml:"graph,omitempty"`
Messenger messenger.Config `yaml:"messenger,omitempty" toml:"messenger,omitempty"`
Browser browser.Config `yaml:"browser,omitempty" toml:"browser,omitempty"`
SCM scm.Config `yaml:"scm,omitempty" toml:"scm,omitempty"`
ProjectManagement pm.Config `yaml:"project_management,omitempty" toml:"project_management,omitempty"`
Email email.Config `yaml:"email,omitempty" toml:"email,omitempty"`
GDrive gdrive.Config `yaml:"google_drive,omitempty" toml:"google_drive,omitempty"`
HITL hitl.Config `yaml:"hitl,omitempty" toml:"hitl,omitempty"`
DBConfig db.Config `yaml:"db_config,omitempty" toml:"db_config,omitempty"`
Langfuse langfuse.Config `yaml:"langfuse,omitempty" toml:"langfuse,omitempty"`
Runbook runbook.Config `yaml:"runbook,omitempty" toml:"runbook,omitempty"`
Cron cron.Config `yaml:"cron,omitempty" toml:"cron,omitempty"`
// Unified data sources configuration
DataSources datasource.Config `yaml:"data_sources,omitempty" toml:"data_sources,omitempty"`
Security security.Config `yaml:"security,omitempty" toml:"security,omitempty"`
PII pii.Config `yaml:"pii,omitempty" toml:"pii,omitempty"`
Toolwrap toolwrap.MiddlewareConfig `yaml:"toolwrap,omitempty" toml:"toolwrap,omitempty"`
// DisablePensieve disables the Pensieve context management tools
// (delete_context, check_budget, note, read_notes) from arXiv:2602.12108.
// When true, the agent can actively manage its own context window.
// delete_context and note require HITL approval; check_budget and
// read_notes are read-only and auto-approved.
DisablePensieve bool `yaml:"disable_pensieve,omitempty" toml:"disable_pensieve,omitempty"`
}
func LoadGenieConfig ¶
func LoadGenieConfig(ctx context.Context, sp security.SecretProvider, path string) (GenieConfig, error)
LoadGenieConfig loads the Genie configuration from a file, resolving secret-dependent defaults and ${VAR} placeholders through the given SecretProvider. Each ${NAME} occurrence in the config file is resolved by calling sp.GetSecret(ctx, NAME), which may consult runtimevar backends (GCP Secret Manager, AWS Secrets Manager, mounted files, etc.) or fall back to os.Getenv depending on the provider.
Passing security.NewEnvProvider() preserves the legacy os.Getenv behavior. Passing a security.Manager created from the config's [security.secrets] section enables runtimevar-backed resolution.
After interpolation, secret values are resolved via sp.GetSecret; empty or missing values are not logged here (use WarnMissingTokens or provider-specific validation if early surfacing of typos is needed).