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
- func GlobalConfigPath() string
- func HomeDir() string
- func ParseFloatValue(path string, value any) (float64, error)
- func ParseIntValue(path string, value any) (int, error)
- func ParseTomlSafely(text string, source string) (map[string]any, error)
- type ActivationWeights
- type ArchiveConfig
- type AttentionConfig
- type AuthConfig
- type CodeIndexConfig
- type Config
- type ConfigError
- type ConsolidateConfig
- type EmbeddingConfig
- type LLMConfig
- type MaintainConfig
- type RecallConfig
- type ResourceConfig
- type StoreConfig
- type System2Config
Constants ¶
const DirName = ".ladyM"
DirName is the LadyM directory name, used both under the user's home and as the workspace dotdir. The capital M is deliberate: v0.8.1 shipped this spelling and every site that resolves the path must agree, because a case-sensitive filesystem (Linux, CI, containers) treats ~/.ladym and ~/.ladyM as two different directories.
const LegacyDirName = ".ladym"
LegacyDirName is the pre-standardization spelling of DirName. Nothing loads from it — `ladym doctor` reports it so the user can move the files across.
Variables ¶
This section is empty.
Functions ¶
func GlobalConfigPath ¶ added in v0.8.2
func GlobalConfigPath() string
GlobalConfigPath resolves the global config file, ~/.ladyM/config.toml. It returns "" when that file does not exist.
There is deliberately no fallback to the legacy ~/.ladym spelling: an install still using it would silently keep running on defaults while appearing configured. `ladym doctor` reports the situation instead.
func HomeDir ¶ added in v0.8.2
func HomeDir() string
HomeDir returns the LadyM home directory (~/.ladyM), resolved at call time. When the home directory cannot be determined it falls back to the current directory.
func ParseFloatValue ¶ added in v0.8.3
ParseFloatValue parses a complete, finite numeric value.
func ParseIntValue ¶ added in v0.8.3
ParseIntValue parses a complete integer value without truncation or overflow.
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 ArchiveConfig ¶ added in v0.9.0
type ArchiveConfig struct {
Enabled bool
MaxEntryBytes int
MaxWorkspaceBytes int
RetentionS float64
}
func (ArchiveConfig) Validate ¶ added in v0.9.0
func (a ArchiveConfig) Validate() error
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
CaptureIdentityMode string // "legacy" (default) or opt-in "canonical"
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
Archive ArchiveConfig
// 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
EmbeddingCJKTokenizer string
Embedding EmbeddingConfig
// CJK tokenizer dictionary (flat — source of truth for storage's dict
// directory). "" = default ~/.ladyM/dict. Set to a shared volume mount
// (LADYM_DICT_DIR / dict_dir) in microservice deployments so every
// instance reads the dictionary one download provisioned.
CJKDictDir string
// 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
LLMReasoningEffort string // "low" | "medium" | "high" for OpenAI reasoning models; "" = provider default
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
Resource ResourceConfig
Maintain MaintainConfig
}
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
ReasoningEffort string
TimeoutS float64
}
LLMConfig mirrors the flat llm_* fields (populated by the loader).
type MaintainConfig ¶ added in v0.7.0
type MaintainConfig struct {
Enabled bool // whether the maintenance sub-steps run in a cycle (GC always runs)
BackfillBatch int // max episodes backfilled per cycle
LinkingEnabled bool // gate for the LLM semantic-linking sub-step
LinkingBudget int // max candidate pairs sent to the LLM per cycle
LinkingSimilarity float64 // cosine pre-filter for linking candidates
AliasMergeSimilarity float64 // cosine threshold for resource alias-merge candidates
}
MaintainConfig holds worker-maintenance knobs for the System 2 cycle's MaintainL4 step (spec §8/§10).
type RecallConfig ¶
type RecallConfig struct {
TopKTier1 int
TopKTier2 int
GraphHops int
MaxExpandedNodes int
ReflectionMinHits int
ReflectionMinCoverage float64
EnableTier2 bool
}
RecallConfig holds two-tier retrieval knobs.
type ResourceConfig ¶ added in v0.7.0
type ResourceConfig struct {
ResolveThreshold float64 // write side: vector match vs create-new
ReadThreshold float64 // read side: pivot resolution
Actions []string // extra canonical action words, appended to builtins
ActionAliases map[string]string // extra alias→canonical mappings, appended to builtins
}
ResourceConfig holds resource-entity resolution and action vocabulary knobs (spec §5.1/§5.5/§10).
type StoreConfig ¶ added in v0.4.0
StoreConfig mirrors the flat store_* fields (populated by the loader).
type System2Config ¶
type System2Config struct {
BudgetedEnabled bool
MaxCandidates int
MaxCalls int
MaxReservedBytes int
MaxWallS float64
Concurrency int
LeaseS float64
MaxAttempts int
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.