Documentation
¶
Overview ¶
Package config holds LadyM's runtime configuration.
All values have sensible defaults so the engine works out-of-the-box with no env vars and no network. Anything that needs a key/model is an opt-in override.
Configuration sources (highest precedence first):
- cli_overrides passed to Load (e.g. from CLI flags).
- Environment variables (LADYM_*).
- The project file ./ladym.toml.
- The global file ~/.ladym/config.toml.
- The defaults (offline: hashing embedding, llm_provider == "none").
Secret literals (api_key/*_key/token/secret/password) found in TOML are rejected with a warning and dropped — operators must use <name>_env indirection (e.g. llm.api_key_env = "MY_LLM_KEY") so secrets never land on disk.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ActivationWeights ¶
type ActivationWeights struct {
Similarity float64
Recency float64
Frequency float64
Graph float64
TypeBoost float64
RecencyHalfLifeS float64
}
ActivationWeights are the weights for the ACT-R-inspired activation function.
type AttentionConfig ¶
AttentionConfig holds pre-write attention gate knobs.
type AuthConfig ¶ added in v0.4.0
type AuthConfig struct {
Enabled bool
}
AuthConfig mirrors the flat auth_* fields (populated by the loader) — the HTTP data-plane's Basic-auth master switch (`ladym serve --http`).
type CodeIndexConfig ¶
type CodeIndexConfig struct {
MaxBodyLinesPerSymbol int
RespectGitignore bool
ExtraIgnoreGlobs []string
Languages []string // nil = all supported
}
CodeIndexConfig holds knobs for codebase indexing.
type Config ¶
type Config struct {
DBPath string
Workspace string
PreferSQLiteVec bool
EnableWAL bool
// store backend (flat — source of truth for storage.OpenStore)
StoreBackend string // "sqlite" (default) or "postgres"
StoreDSN string // postgres DSN; may be written directly (not a secret literal)
StoreDSNEnv string // env var name to read the DSN from (secrets-off-disk pattern)
Store StoreConfig
// HTTP server auth (flat — source of truth for api.NewHandler)
AuthEnabled bool // [auth] enabled: users-table Basic auth; default false = allow all
Auth AuthConfig
// embedding (flat — source of truth for make_provider)
EmbeddingProvider string
EmbeddingModel string
EmbeddingDim int
EmbeddingBaseURL string
EmbeddingAPIKeyEnv string
EmbeddingFallback string
EmbeddingQueryCacheSize int
EmbeddingTimeoutS float64
EmbeddingAllowDimChange bool
EmbeddingHTTPRequest string
EmbeddingHTTPResponsePath string
Embedding EmbeddingConfig
// llm (flat — source of truth for make_agent)
LLMProvider string // "none" = heuristic / offline mode
LLMBaseURL string
LLMModel string
LLMAPIKeyEnv string
LLMMaxTokens int
LLMTemperature float64
LLMStructuredMethod string
LLMTimeoutS float64
LLMAPIKey string // plaintext LLM key (only when allow_plaintext_secrets)
AllowPlaintextSecrets bool // DEV/testing escape hatch; default stays secure
LLM LLMConfig
AgentsOverrides map[string]map[string]any
Activation ActivationWeights
Recall RecallConfig
Consolidate ConsolidateConfig
CodeIndex CodeIndexConfig
System2 System2Config
Attention AttentionConfig
}
Config is the runtime configuration for LadyM. The flat fields are the source of truth for the provider factories; the nested structs are a convenience mirror populated by the loader.
func Default ¶
func Default() *Config
Default returns a Config with all defaults populated (reading env at call time).
func ForTesting ¶
ForTesting returns a Config pointing at a temp db using the offline hashing embedding and the in-memory vector index.
type ConfigError ¶
type ConfigError struct {
Msg string
}
ConfigError is raised when runtime configuration makes an operation impossible. The message MUST be actionable and one-line — CLI/MCP surface it verbatim instead of dumping a traceback. This is fail-fast, NOT a fallback.
func (*ConfigError) Error ¶
func (e *ConfigError) Error() string
type ConsolidateConfig ¶
ConsolidateConfig holds knobs for L1→L2 consolidation.
type EmbeddingConfig ¶
type EmbeddingConfig struct {
Provider string
BaseURL string
Model string
APIKeyEnv string
Fallback string
QueryCacheSize int
TimeoutS float64
AllowDimChange bool
HTTPRequest string
HTTPResponsePath string
}
EmbeddingConfig mirrors the flat embedding_* fields (populated by the loader).
type LLMConfig ¶
type LLMConfig struct {
Provider string
BaseURL string
Model string
APIKeyEnv string
MaxTokens int
Temperature float64
StructuredMethod string
TimeoutS float64
}
LLMConfig mirrors the flat llm_* fields (populated by the loader).
type RecallConfig ¶
type RecallConfig struct {
TopKTier1 int
TopKTier2 int
GraphHops int
ReflectionMinHits int
ReflectionMinCoverage float64
EnableTier2 bool
}
RecallConfig holds two-tier retrieval knobs.
type StoreConfig ¶ added in v0.4.0
StoreConfig mirrors the flat store_* fields (populated by the loader).
type System2Config ¶
type System2Config struct {
Enabled bool
IntervalS int
MinEpisodesToRun int
MaxConsecutiveErrors int
L5ClusterSimilarity float64
L5MinClusterSize int
L5MergeSimilarity float64
L5MergeEveryNCycles int
L6MaxEpisodes int
L6HorizonS float64
}
System2Config holds background reflection cycle knobs.