Documentation
¶
Overview ¶
Environment Variables (all use NORNICDB_ prefix): Authentication:
- NORNICDB_AUTH="admin:admin" or "none"
- NORNICDB_MIN_PASSWORD_LENGTH=8
Server:
- NORNICDB_BOLT_PORT=7687
- NORNICDB_HTTP_PORT=7474
- NORNICDB_BOLT_ADDRESS="0.0.0.0"
- NORNICDB_DATA_DIR="./data"
Features:
- NORNICDB_EMBEDDING_PROVIDER="ollama" or "openai"
- NORNICDB_EMBEDDING_MODEL="bge-m3"
- NORNICDB_HEIMDALL_ENABLED=true
Vector Search (HNSW):
- NORNICDB_VECTOR_ANN_QUALITY="fast"|"balanced"|"accurate" (default: balanced)
- NORNICDB_VECTOR_HNSW_M: Max connections per node (default: based on quality preset)
- NORNICDB_VECTOR_HNSW_EF_CONSTRUCTION: Construction candidate list size (default: based on quality preset)
- NORNICDB_VECTOR_HNSW_EF_SEARCH: Search candidate list size (default: based on quality preset)
Logging:
- NORNICDB_LOG_LEVEL="INFO"
- NORNICDB_LOG_FORMAT="json"
For a complete list, see the Config struct field documentation.
Feature flags for experimental functionality in NornicDB.
Centralized feature flag management. All flags are loaded from environment variables via Config.Features and can be toggled at runtime for testing.
DEFAULTS:
- Tier 1 features (Cooldown, Edge Provenance, Evidence Buffering, Per-Node Config, WAL) are ENABLED BY DEFAULT for production safety
- Kalman, Topology, and GPU Clustering features are DISABLED by default (experimental)
Usage:
// Load from environment
config := config.LoadFromEnv()
if config.Features.KalmanEnabled {
// Use Kalman filtering
}
// Runtime toggles (for tests)
config.EnableKalmanFiltering()
if config.IsKalmanEnabled() { ... }
Environment variables (to ENABLE experimental features):
NORNICDB_KALMAN_ENABLED=true NORNICDB_AUTO_TLP_ENABLED=true NORNICDB_KMEANS_CLUSTERING_ENABLED=true NORNICDB_GPU_CLUSTERING_AUTO_INTEGRATION_ENABLED=true
Environment variables (to DISABLE default-on features if problems occur):
NORNICDB_EDGE_PROVENANCE_ENABLED=false NORNICDB_COOLDOWN_ENABLED=false NORNICDB_EVIDENCE_BUFFERING_ENABLED=false NORNICDB_PER_NODE_CONFIG_ENABLED=false NORNICDB_WAL_ENABLED=false
Index ¶
- Constants
- func ApplyEnvVars(config *Config) error
- func DisableAllFeatures()
- func DisableAutoTLP()
- func DisableAutoTLPLLMAugment()
- func DisableAutoTLPLLMQC()
- func DisableCooldown()
- func DisableCooldownAutoIntegration()
- func DisableEdgeDecay()
- func DisableEdgeProvenance()
- func DisableEdgeProvenanceAutoIntegration()
- func DisableEvidenceAutoIntegration()
- func DisableEvidenceBuffering()
- func DisableFeature(feature string)
- func DisableGPUClustering()
- func DisableGPUClusteringAutoIntegration()
- func DisableKalmanFiltering()
- func DisablePerNodeConfig()
- func DisableWAL()
- func EnableAllFeatures()
- func EnableAutoTLP()
- func EnableAutoTLPLLMAugment()
- func EnableAutoTLPLLMQC()
- func EnableCooldown()
- func EnableCooldownAutoIntegration()
- func EnableEdgeDecay()
- func EnableEdgeProvenance()
- func EnableEdgeProvenanceAutoIntegration()
- func EnableEvidenceAutoIntegration()
- func EnableEvidenceBuffering()
- func EnableFeature(feature string)
- func EnableGPUClustering()
- func EnableGPUClusteringAutoIntegration()
- func EnableKalmanFiltering()
- func EnablePerNodeConfig()
- func EnableWAL()
- func FindConfigFile() string
- func FormatMemorySize(bytes int64) string
- func GetEnabledFeatures() []string
- func GetParserType() string
- func IsANTLRParser() bool
- func IsAutoTLPEnabled() bool
- func IsAutoTLPLLMAugmentEnabled() bool
- func IsAutoTLPLLMQCEnabled() bool
- func IsCooldownAutoIntegrationEnabled() bool
- func IsCooldownEnabled() bool
- func IsEdgeDecayEnabled() bool
- func IsEdgeProvenanceAutoIntegrationEnabled() bool
- func IsEdgeProvenanceEnabled() bool
- func IsEvidenceAutoIntegrationEnabled() bool
- func IsEvidenceBufferingEnabled() bool
- func IsFeatureEnabled(feature string) bool
- func IsGPUClusteringAutoIntegrationEnabled() bool
- func IsGPUClusteringEnabled() bool
- func IsKalmanEnabled() bool
- func IsNornicParser() bool
- func IsPerNodeConfigAutoIntegrationEnabled() bool
- func IsPerNodeConfigEnabled() bool
- func IsWALEnabled() bool
- func ParseMemoryLimitMB(s string) (int64, error)
- func ResetFeatureFlags()
- func SetKalmanEnabled(enabled bool)
- func SetParserType(t string)
- func WithANTLRParser() func()
- func WithAutoTLPDisabled() func()
- func WithAutoTLPEnabled() func()
- func WithAutoTLPLLMAugmentDisabled() func()
- func WithAutoTLPLLMAugmentEnabled() func()
- func WithAutoTLPLLMQCDisabled() func()
- func WithAutoTLPLLMQCEnabled() func()
- func WithCooldownAutoIntegrationDisabled() func()
- func WithCooldownAutoIntegrationEnabled() func()
- func WithCooldownDisabled() func()
- func WithCooldownEnabled() func()
- func WithEdgeDecayDisabled() func()
- func WithEdgeDecayEnabled() func()
- func WithEdgeProvenanceAutoIntegrationDisabled() func()
- func WithEdgeProvenanceAutoIntegrationEnabled() func()
- func WithEdgeProvenanceDisabled() func()
- func WithEdgeProvenanceEnabled() func()
- func WithEvidenceAutoIntegrationDisabled() func()
- func WithEvidenceAutoIntegrationEnabled() func()
- func WithEvidenceBufferingDisabled() func()
- func WithEvidenceBufferingEnabled() func()
- func WithGPUClusteringAutoIntegrationDisabled() func()
- func WithGPUClusteringAutoIntegrationEnabled() func()
- func WithGPUClusteringDisabled() func()
- func WithGPUClusteringEnabled() func()
- func WithKalmanDisabled() func()
- func WithKalmanEnabled() func()
- func WithNornicParser() func()
- func WithPerNodeConfigAutoIntegrationDisabled() func()
- func WithPerNodeConfigAutoIntegrationEnabled() func()
- func WithPerNodeConfigDisabled() func()
- func WithPerNodeConfigEnabled() func()
- func WithWALDisabled() func()
- func WithWALEnabled() func()
- type AuthConfig
- type ComplianceConfig
- type Config
- type DatabaseConfig
- type EmbeddingWorkerConfig
- type FeatureFlagsConfig
- func (f *FeatureFlagsConfig) GetHeimdallAPIKey() string
- func (f *FeatureFlagsConfig) GetHeimdallAPIURL() string
- func (f *FeatureFlagsConfig) GetHeimdallAnomalyDetection() bool
- func (f *FeatureFlagsConfig) GetHeimdallBatchSize() int
- func (f *FeatureFlagsConfig) GetHeimdallContextSize() int
- func (f *FeatureFlagsConfig) GetHeimdallEnabled() bool
- func (f *FeatureFlagsConfig) GetHeimdallGPULayers() int
- func (f *FeatureFlagsConfig) GetHeimdallMCPEnable() bool
- func (f *FeatureFlagsConfig) GetHeimdallMCPTools() []string
- func (f *FeatureFlagsConfig) GetHeimdallMaxContextTokens() int
- func (f *FeatureFlagsConfig) GetHeimdallMaxSystemTokens() int
- func (f *FeatureFlagsConfig) GetHeimdallMaxTokens() int
- func (f *FeatureFlagsConfig) GetHeimdallMaxUserTokens() int
- func (f *FeatureFlagsConfig) GetHeimdallMemoryCuration() bool
- func (f *FeatureFlagsConfig) GetHeimdallModel() string
- func (f *FeatureFlagsConfig) GetHeimdallProvider() string
- func (f *FeatureFlagsConfig) GetHeimdallRuntimeDiagnosis() bool
- func (f *FeatureFlagsConfig) GetHeimdallTemperature() float32
- type FeatureStatus
- type FilteredValue
- type LoggingConfig
- type MemoryConfig
- type RetentionConfig
- type RetentionPolicyConfig
- type ServerConfig
- type StorageRuntimeConfig
- type YAMLConfig
Constants ¶
const ( // EnvKalmanEnabled is the environment variable to enable Kalman filtering EnvKalmanEnabled = "NORNICDB_KALMAN_ENABLED" // EnvAutoTLPEnabled is the environment variable to enable automatic TLP (Topological Link prediction) // When enabled, the inference engine automatically creates relationships based on: // - Semantic similarity (embedding distance) // - Co-access patterns (nodes accessed together) // - Temporal proximity (nodes in same session) // - Transitive inference (A→B→C suggests A→C) // DISABLED by default - enable with "true" or "1" EnvAutoTLPEnabled = "NORNICDB_AUTO_TLP_ENABLED" // EnvCooldownAutoIntegrationEnabled is the environment variable to enable automatic cooldown in inference EnvCooldownAutoIntegrationEnabled = "NORNICDB_COOLDOWN_AUTO_INTEGRATION_ENABLED" // EnvEvidenceAutoIntegrationEnabled is the environment variable to enable automatic evidence buffering in inference EnvEvidenceAutoIntegrationEnabled = "NORNICDB_EVIDENCE_AUTO_INTEGRATION_ENABLED" // EnvEdgeProvenanceAutoIntegrationEnabled is the environment variable to enable automatic provenance logging in inference EnvEdgeProvenanceAutoIntegrationEnabled = "NORNICDB_EDGE_PROVENANCE_AUTO_INTEGRATION_ENABLED" // EnvPerNodeConfigAutoIntegrationEnabled is the environment variable to enable automatic per-node config in inference EnvPerNodeConfigAutoIntegrationEnabled = "NORNICDB_PER_NODE_CONFIG_AUTO_INTEGRATION_ENABLED" // EnvEdgeProvenanceEnabled is the environment variable to enable edge provenance logging EnvEdgeProvenanceEnabled = "NORNICDB_EDGE_PROVENANCE_ENABLED" // EnvCooldownEnabled is the environment variable to enable cooldown logic EnvCooldownEnabled = "NORNICDB_COOLDOWN_ENABLED" // EnvEvidenceBufferingEnabled is the environment variable to enable evidence buffering EnvEvidenceBufferingEnabled = "NORNICDB_EVIDENCE_BUFFERING_ENABLED" // EnvPerNodeConfigEnabled is the environment variable to enable per-node configuration EnvPerNodeConfigEnabled = "NORNICDB_PER_NODE_CONFIG_ENABLED" // EnvWALEnabled is the environment variable to enable write-ahead logging EnvWALEnabled = "NORNICDB_WAL_ENABLED" // EnvGPUClusteringEnabled is the environment variable to enable GPU k-means clustering EnvGPUClusteringEnabled = "NORNICDB_KMEANS_CLUSTERING_ENABLED" // EnvGPUClusteringAutoIntegrationEnabled is the environment variable to enable automatic GPU clustering in inference EnvGPUClusteringAutoIntegrationEnabled = "NORNICDB_GPU_CLUSTERING_AUTO_INTEGRATION_ENABLED" // EnvEdgeDecayEnabled is the environment variable to enable automatic edge decay // Auto-generated edges decay over time if not reinforced (accessed) EnvEdgeDecayEnabled = "NORNICDB_EDGE_DECAY_ENABLED" // EnvAutoTLPLLMQCEnabled is the environment variable to enable LLM quality control for Auto-TLP // When enabled, TLP suggestions are batch-reviewed by Heimdall SLM before creation // This adds latency but improves relationship quality // DISABLED by default - requires Heimdall SLM to be configured EnvAutoTLPLLMQCEnabled = "NORNICDB_AUTO_TLP_LLM_QC_ENABLED" // EnvAutoTLPLLMAugmentEnabled allows Heimdall to suggest ADDITIONAL edges beyond TLP's candidates // When enabled, Heimdall can discover relationships that TLP algorithms missed // Requires EnvAutoTLPLLMQCEnabled to also be enabled // DISABLED by default - increases SLM workload EnvAutoTLPLLMAugmentEnabled = "NORNICDB_AUTO_TLP_LLM_AUGMENT_ENABLED" // EnvParserType selects the Cypher parser implementation // - "nornic" (default): Fast inline parser optimized for NornicDB // - "antlr": ANTLR-based OpenCypher parser (stricter, better error messages) // Environment: NORNICDB_PARSER EnvParserType = "NORNICDB_PARSER" // Parser type constants ParserTypeNornic = "nornic" ParserTypeANTLR = "antlr" // FeatureKalmanDecay enables Kalman filtering for memory decay prediction FeatureKalmanDecay = "kalman_decay" // FeatureKalmanCoAccess enables Kalman filtering for co-access confidence FeatureKalmanCoAccess = "kalman_coaccess" // FeatureKalmanLatency enables Kalman filtering for latency prediction FeatureKalmanLatency = "kalman_latency" // FeatureKalmanSimilarity enables Kalman filtering for similarity smoothing FeatureKalmanSimilarity = "kalman_similarity" // FeatureKalmanTemporal enables Kalman filtering for temporal patterns FeatureKalmanTemporal = "kalman_temporal" // FeatureTopologyAutoIntegration enables AUTOMATIC topology integration with inference engine // NOTE: Topology algorithms (CALL gds.linkPrediction.*) are ALWAYS available // This only controls automatic use in inference.Engine.OnStore() FeatureTopologyAutoIntegration = "topology_auto_integration" // FeatureCooldownAutoIntegration enables AUTOMATIC cooldown in inference engine // NOTE: CooldownTable is ALWAYS available for direct use // This only controls automatic use in inference.Engine.ProcessSuggestion() FeatureCooldownAutoIntegration = "cooldown_auto_integration" // FeatureEvidenceAutoIntegration enables AUTOMATIC evidence buffering in inference engine // NOTE: EvidenceBuffer is ALWAYS available for direct use // This only controls automatic use in inference.Engine.ProcessSuggestion() FeatureEvidenceAutoIntegration = "evidence_auto_integration" // FeatureEdgeProvenanceAutoIntegration enables AUTOMATIC provenance logging in inference engine // NOTE: EdgeMetaStore is ALWAYS available for direct use // This only controls automatic logging in inference.Engine.ProcessSuggestion() FeatureEdgeProvenanceAutoIntegration = "edge_provenance_auto_integration" // FeaturePerNodeConfigAutoIntegration enables AUTOMATIC per-node config in inference engine // NOTE: NodeConfigStore is ALWAYS available for direct use // This only controls automatic checking in inference.Engine.ProcessSuggestion() FeaturePerNodeConfigAutoIntegration = "per_node_config_auto_integration" // FeatureEdgeProvenance enables edge provenance logging for audit trails // Tracks why edges were created, when, and what evidence supports them FeatureEdgeProvenance = "edge_provenance" // FeatureCooldown enables cooldown logic to prevent echo chambers // Prevents rapid re-materialization of the same edge pairs FeatureCooldown = "cooldown" // FeatureEvidenceBuffering enables evidence buffering before materialization // Only materializes edges after accumulating sufficient evidence FeatureEvidenceBuffering = "evidence_buffering" // FeaturePerNodeConfig enables per-node configuration (pins, denies, caps) // Allows fine-grained control over edge materialization per node FeaturePerNodeConfig = "per_node_config" // FeatureWAL enables write-ahead logging for durability // Provides crash recovery via WAL + snapshots FeatureWAL = "wal" // FeatureGPUClustering enables GPU-accelerated k-means clustering for similarity search // Provides 10-50x speedup on indices with 10K+ embeddings FeatureGPUClustering = "gpu_clustering" // FeatureGPUClusteringAutoIntegration enables AUTOMATIC GPU clustering in inference engine // NOTE: ClusterIntegration is ALWAYS available for direct use // This only controls automatic use in inference.Engine.Search() FeatureGPUClusteringAutoIntegration = "gpu_clustering_auto_integration" )
Feature flag keys
Variables ¶
This section is empty.
Functions ¶
func ApplyEnvVars ¶
ApplyEnvVars applies environment variable overrides to an existing config. This is the exported version for use in main.go.
func DisableAllFeatures ¶
func DisableAllFeatures()
DisableAllFeatures disables all Kalman features.
func DisableAutoTLP ¶
func DisableAutoTLP()
DisableAutoTLP disables automatic TLP (relationship inference).
func DisableAutoTLPLLMAugment ¶
func DisableAutoTLPLLMAugment()
DisableAutoTLPLLMAugment disables LLM augmentation for Auto-TLP.
func DisableAutoTLPLLMQC ¶
func DisableAutoTLPLLMQC()
DisableAutoTLPLLMQC disables LLM quality control for Auto-TLP.
func DisableCooldownAutoIntegration ¶
func DisableCooldownAutoIntegration()
DisableCooldownAutoIntegration disables automatic cooldown in inference engine.
func DisableEdgeProvenance ¶
func DisableEdgeProvenance()
DisableEdgeProvenance disables edge provenance logging.
func DisableEdgeProvenanceAutoIntegration ¶
func DisableEdgeProvenanceAutoIntegration()
DisableEdgeProvenanceAutoIntegration disables automatic provenance logging in inference engine.
func DisableEvidenceAutoIntegration ¶
func DisableEvidenceAutoIntegration()
DisableEvidenceAutoIntegration disables automatic evidence buffering in inference engine.
func DisableEvidenceBuffering ¶
func DisableEvidenceBuffering()
DisableEvidenceBuffering disables evidence buffering.
func DisableFeature ¶
func DisableFeature(feature string)
DisableFeature disables a specific Kalman feature.
func DisableGPUClustering ¶
func DisableGPUClustering()
DisableGPUClustering disables GPU k-means clustering.
func DisableGPUClusteringAutoIntegration ¶
func DisableGPUClusteringAutoIntegration()
DisableGPUClusteringAutoIntegration disables automatic GPU clustering in inference engine.
func DisableKalmanFiltering ¶
func DisableKalmanFiltering()
DisableKalmanFiltering globally disables Kalman filtering.
func DisablePerNodeConfig ¶
func DisablePerNodeConfig()
DisablePerNodeConfig disables per-node configuration.
func EnableAutoTLP ¶
func EnableAutoTLP()
EnableAutoTLP enables automatic TLP (relationship inference). When enabled, the system automatically creates relationships between nodes based on semantic similarity, co-access patterns, and temporal proximity.
func EnableAutoTLPLLMAugment ¶
func EnableAutoTLPLLMAugment()
EnableAutoTLPLLMAugment enables LLM augmentation for Auto-TLP. When enabled, Heimdall can suggest additional edges beyond TLP's candidates.
func EnableAutoTLPLLMQC ¶
func EnableAutoTLPLLMQC()
EnableAutoTLPLLMQC enables LLM quality control for Auto-TLP edge creation. When enabled, the Heimdall SLM validates each edge suggestion before creation.
func EnableCooldownAutoIntegration ¶
func EnableCooldownAutoIntegration()
EnableCooldownAutoIntegration enables automatic cooldown in inference engine.
func EnableEdgeDecay ¶
func EnableEdgeDecay()
EnableEdgeDecay enables automatic edge decay for stale auto-generated edges.
func EnableEdgeProvenance ¶
func EnableEdgeProvenance()
EnableEdgeProvenance enables edge provenance logging.
func EnableEdgeProvenanceAutoIntegration ¶
func EnableEdgeProvenanceAutoIntegration()
EnableEdgeProvenanceAutoIntegration enables automatic provenance logging in inference engine.
func EnableEvidenceAutoIntegration ¶
func EnableEvidenceAutoIntegration()
EnableEvidenceAutoIntegration enables automatic evidence buffering in inference engine.
func EnableEvidenceBuffering ¶
func EnableEvidenceBuffering()
EnableEvidenceBuffering enables evidence buffering.
func EnableFeature ¶
func EnableFeature(feature string)
EnableFeature enables a specific Kalman feature.
func EnableGPUClustering ¶
func EnableGPUClustering()
EnableGPUClustering enables GPU k-means clustering for similarity search.
func EnableGPUClusteringAutoIntegration ¶
func EnableGPUClusteringAutoIntegration()
EnableGPUClusteringAutoIntegration enables automatic GPU clustering in inference engine.
func EnableKalmanFiltering ¶
func EnableKalmanFiltering()
EnableKalmanFiltering globally enables Kalman filtering. This is the master switch - individual features can still be disabled.
func EnablePerNodeConfig ¶
func EnablePerNodeConfig()
EnablePerNodeConfig enables per-node configuration.
func FindConfigFile ¶
func FindConfigFile() string
FindConfigFile searches for config file in standard locations. Returns the path to the first config file found, or empty string if none found. Search order:
- ~/.nornicdb/config.yaml (user home directory - highest priority)
- Same directory as the binary (config.yaml, nornicdb.yaml)
- Current working directory (config.yaml, nornicdb.yaml)
- ~/Library/Application Support/NornicDB/config.yaml (macOS)
- ~/.config/nornicdb/config.yaml (Linux/Unix XDG standard)
func FormatMemorySize ¶
FormatMemorySize formats bytes as human-readable string.
func GetEnabledFeatures ¶
func GetEnabledFeatures() []string
GetEnabledFeatures returns a list of enabled features.
func GetParserType ¶
func GetParserType() string
GetParserType returns the current parser type ("nornic" or "antlr"). Default is "nornic" (the fast inline parser).
func IsANTLRParser ¶
func IsANTLRParser() bool
IsANTLRParser returns true if the ANTLR parser is selected.
func IsAutoTLPEnabled ¶
func IsAutoTLPEnabled() bool
IsAutoTLPEnabled returns true if automatic TLP is enabled. Note: This does NOT affect Cypher procedures (CALL gds.linkPrediction.*) - they are always available.
func IsAutoTLPLLMAugmentEnabled ¶
func IsAutoTLPLLMAugmentEnabled() bool
IsAutoTLPLLMAugmentEnabled returns true if LLM augmentation is enabled. When enabled, Heimdall can suggest NEW edges that TLP algorithms missed. Requires IsAutoTLPLLMQCEnabled() to also be true to have any effect.
func IsAutoTLPLLMQCEnabled ¶
func IsAutoTLPLLMQCEnabled() bool
IsAutoTLPLLMQCEnabled returns true if LLM quality control is enabled for Auto-TLP. When enabled, each edge suggestion is validated by the Heimdall SLM before creation.
func IsCooldownAutoIntegrationEnabled ¶
func IsCooldownAutoIntegrationEnabled() bool
IsCooldownAutoIntegrationEnabled returns true if automatic cooldown is enabled in inference.
When enabled, ProcessSuggestion() will automatically check cooldown before allowing edge materialization. When disabled, you must manually check cooldown if desired.
Example (auto-integration enabled - default):
result := engine.ProcessSuggestion(suggestion, "session-123")
if result.ShouldMaterialize { // Cooldown already checked!
db.CreateEdge(...)
}
Example (auto-integration disabled - manual control):
// Disable auto-integration
os.Setenv("NORNICDB_COOLDOWN_AUTO_INTEGRATION_ENABLED", "false")
// Manually check cooldown
if engine.GetCooldownTable().CanMaterialize(src, dst, label) {
db.CreateEdge(...)
engine.GetCooldownTable().RecordMaterialization(src, dst, label)
}
func IsCooldownEnabled ¶
func IsCooldownEnabled() bool
IsCooldownEnabled returns true if cooldown is enabled.
func IsEdgeDecayEnabled ¶
func IsEdgeDecayEnabled() bool
IsEdgeDecayEnabled returns true if edge decay is enabled. When enabled, auto-generated edges decay over time and are deleted when their confidence drops below the threshold.
func IsEdgeProvenanceAutoIntegrationEnabled ¶
func IsEdgeProvenanceAutoIntegrationEnabled() bool
IsEdgeProvenanceAutoIntegrationEnabled returns true if automatic provenance logging is enabled. Note: This does NOT affect EdgeMetaStore direct use - it's always available.
func IsEdgeProvenanceEnabled ¶
func IsEdgeProvenanceEnabled() bool
IsEdgeProvenanceEnabled returns true if edge provenance is enabled.
func IsEvidenceAutoIntegrationEnabled ¶
func IsEvidenceAutoIntegrationEnabled() bool
IsEvidenceAutoIntegrationEnabled returns true if automatic evidence buffering is enabled. Note: This does NOT affect EvidenceBuffer direct use - it's always available.
func IsEvidenceBufferingEnabled ¶
func IsEvidenceBufferingEnabled() bool
IsEvidenceBufferingEnabled returns true if evidence buffering is enabled.
func IsFeatureEnabled ¶
IsFeatureEnabled returns true if a specific feature is enabled. Both the global Kalman flag AND the specific feature must be enabled.
func IsGPUClusteringAutoIntegrationEnabled ¶
func IsGPUClusteringAutoIntegrationEnabled() bool
IsGPUClusteringAutoIntegrationEnabled returns true if automatic GPU clustering is enabled.
When enabled, the inference engine will automatically use ClusterIntegration for similarity searches when available and configured.
Example (auto-integration enabled):
os.Setenv("NORNICDB_GPU_CLUSTERING_AUTO_INTEGRATION_ENABLED", "true")
// Engine automatically uses cluster-accelerated search
results, _ := engine.SimilaritySearch(ctx, embedding, 10)
Example (auto-integration disabled - manual control):
// Manually use cluster integration
ci := engine.GetClusterIntegration()
if ci != nil && ci.IsEnabled() {
results, _ := ci.Search(ctx, embedding, 10)
}
Note: This does NOT affect ClusterIntegration direct use - it's always available.
func IsGPUClusteringEnabled ¶
func IsGPUClusteringEnabled() bool
IsGPUClusteringEnabled returns true if GPU clustering is enabled.
func IsKalmanEnabled ¶
func IsKalmanEnabled() bool
IsKalmanEnabled returns true if Kalman filtering is globally enabled.
func IsNornicParser ¶
func IsNornicParser() bool
IsNornicParser returns true if the Nornic (inline) parser is selected.
func IsPerNodeConfigAutoIntegrationEnabled ¶
func IsPerNodeConfigAutoIntegrationEnabled() bool
IsPerNodeConfigAutoIntegrationEnabled returns true if per-node config is auto-integrated.
When enabled, ProcessSuggestion() automatically checks deny lists, edge caps, and trust levels before allowing edge materialization.
Example (auto-integration enabled - default):
// Set up node config
userConfig := storage.NewNodeConfig("user-123")
userConfig.MaxOutEdges = 50
userConfig.DenyList = []string{"spam-node"}
engine.GetNodeConfigStore().Set(userConfig)
// ProcessSuggestion automatically enforces limits
result := engine.ProcessSuggestion(suggestion, "session-123")
if result.NodeConfigBlocked {
log.Printf("Blocked by node config: %s", result.Reason)
}
Example (auto-integration disabled - manual control):
os.Setenv("NORNICDB_PER_NODE_CONFIG_AUTO_INTEGRATION_ENABLED", "false")
// Manually check node config
store := engine.GetNodeConfigStore()
if allowed, _ := store.IsEdgeAllowedWithReason(src, dst, label); allowed {
db.CreateEdge(...)
}
Note: This does NOT affect NodeConfigStore direct use - it's always available.
func IsPerNodeConfigEnabled ¶
func IsPerNodeConfigEnabled() bool
IsPerNodeConfigEnabled returns true if per-node config is enabled.
func ParseMemoryLimitMB ¶
ParseMemoryLimitMB parses a memory limit value expressed in megabytes. Valid examples: "0" (unlimited), "500" (500 MB). Invalid examples: "500MB", "1GB", "unlimited".
func ResetFeatureFlags ¶
func ResetFeatureFlags()
ResetFeatureFlags resets all feature flags to defaults.
func SetKalmanEnabled ¶
func SetKalmanEnabled(enabled bool)
SetKalmanEnabled sets the global Kalman filtering state.
func SetParserType ¶
func SetParserType(t string)
SetParserType sets the parser type ("nornic" or "antlr").
func WithANTLRParser ¶
func WithANTLRParser() func()
WithANTLRParser temporarily switches to ANTLR parser and returns cleanup function. Useful for A/B testing between parsers.
func WithAutoTLPDisabled ¶
func WithAutoTLPDisabled() func()
WithAutoTLPDisabled temporarily disables Auto-TLP and returns cleanup function.
func WithAutoTLPEnabled ¶
func WithAutoTLPEnabled() func()
WithAutoTLPEnabled temporarily enables Auto-TLP and returns cleanup function. Useful for A/B testing in unit tests.
Example:
cleanup := featureflags.WithAutoTLPEnabled() defer cleanup() // ... test code with Auto-TLP enabled ...
func WithAutoTLPLLMAugmentDisabled ¶
func WithAutoTLPLLMAugmentDisabled() func()
WithAutoTLPLLMAugmentDisabled temporarily disables LLM augmentation.
func WithAutoTLPLLMAugmentEnabled ¶
func WithAutoTLPLLMAugmentEnabled() func()
WithAutoTLPLLMAugmentEnabled temporarily enables LLM augmentation.
func WithAutoTLPLLMQCDisabled ¶
func WithAutoTLPLLMQCDisabled() func()
WithAutoTLPLLMQCDisabled temporarily disables LLM QC and returns cleanup function.
func WithAutoTLPLLMQCEnabled ¶
func WithAutoTLPLLMQCEnabled() func()
WithAutoTLPLLMQCEnabled temporarily enables LLM QC and returns cleanup function.
func WithCooldownAutoIntegrationDisabled ¶
func WithCooldownAutoIntegrationDisabled() func()
WithCooldownAutoIntegrationDisabled temporarily disables cooldown auto-integration.
func WithCooldownAutoIntegrationEnabled ¶
func WithCooldownAutoIntegrationEnabled() func()
WithCooldownAutoIntegrationEnabled temporarily enables cooldown auto-integration.
func WithCooldownDisabled ¶
func WithCooldownDisabled() func()
WithCooldownDisabled temporarily disables cooldown and returns cleanup function.
func WithCooldownEnabled ¶
func WithCooldownEnabled() func()
WithCooldownEnabled temporarily enables cooldown and returns cleanup function.
func WithEdgeDecayDisabled ¶
func WithEdgeDecayDisabled() func()
WithEdgeDecayDisabled temporarily disables edge decay and returns cleanup function.
func WithEdgeDecayEnabled ¶
func WithEdgeDecayEnabled() func()
WithEdgeDecayEnabled temporarily enables edge decay and returns cleanup function.
func WithEdgeProvenanceAutoIntegrationDisabled ¶
func WithEdgeProvenanceAutoIntegrationDisabled() func()
WithEdgeProvenanceAutoIntegrationDisabled temporarily disables edge provenance auto-integration.
func WithEdgeProvenanceAutoIntegrationEnabled ¶
func WithEdgeProvenanceAutoIntegrationEnabled() func()
WithEdgeProvenanceAutoIntegrationEnabled temporarily enables edge provenance auto-integration.
func WithEdgeProvenanceDisabled ¶
func WithEdgeProvenanceDisabled() func()
WithEdgeProvenanceDisabled temporarily disables edge provenance and returns cleanup function.
func WithEdgeProvenanceEnabled ¶
func WithEdgeProvenanceEnabled() func()
WithEdgeProvenanceEnabled temporarily enables edge provenance and returns cleanup function.
func WithEvidenceAutoIntegrationDisabled ¶
func WithEvidenceAutoIntegrationDisabled() func()
WithEvidenceAutoIntegrationDisabled temporarily disables evidence auto-integration.
func WithEvidenceAutoIntegrationEnabled ¶
func WithEvidenceAutoIntegrationEnabled() func()
WithEvidenceAutoIntegrationEnabled temporarily enables evidence auto-integration.
func WithEvidenceBufferingDisabled ¶
func WithEvidenceBufferingDisabled() func()
WithEvidenceBufferingDisabled temporarily disables evidence buffering and returns cleanup function.
func WithEvidenceBufferingEnabled ¶
func WithEvidenceBufferingEnabled() func()
WithEvidenceBufferingEnabled temporarily enables evidence buffering and returns cleanup function.
func WithGPUClusteringAutoIntegrationDisabled ¶
func WithGPUClusteringAutoIntegrationDisabled() func()
WithGPUClusteringAutoIntegrationDisabled temporarily disables GPU clustering auto-integration.
func WithGPUClusteringAutoIntegrationEnabled ¶
func WithGPUClusteringAutoIntegrationEnabled() func()
WithGPUClusteringAutoIntegrationEnabled temporarily enables GPU clustering auto-integration.
func WithGPUClusteringDisabled ¶
func WithGPUClusteringDisabled() func()
WithGPUClusteringDisabled temporarily disables GPU clustering and returns cleanup function.
func WithGPUClusteringEnabled ¶
func WithGPUClusteringEnabled() func()
WithGPUClusteringEnabled temporarily enables GPU clustering and returns cleanup function.
func WithKalmanDisabled ¶
func WithKalmanDisabled() func()
WithKalmanDisabled temporarily disables Kalman filtering and returns a cleanup function.
func WithKalmanEnabled ¶
func WithKalmanEnabled() func()
WithKalmanEnabled temporarily enables Kalman filtering and returns a cleanup function. Useful for tests that need to enable/disable filtering.
Example:
cleanup := filter.WithKalmanEnabled() defer cleanup() // ... test code with Kalman enabled ...
func WithNornicParser ¶
func WithNornicParser() func()
WithNornicParser temporarily switches to Nornic parser and returns cleanup function.
func WithPerNodeConfigAutoIntegrationDisabled ¶
func WithPerNodeConfigAutoIntegrationDisabled() func()
WithPerNodeConfigAutoIntegrationDisabled temporarily disables per-node config auto-integration.
func WithPerNodeConfigAutoIntegrationEnabled ¶
func WithPerNodeConfigAutoIntegrationEnabled() func()
WithPerNodeConfigAutoIntegrationEnabled temporarily enables per-node config auto-integration.
func WithPerNodeConfigDisabled ¶
func WithPerNodeConfigDisabled() func()
WithPerNodeConfigDisabled temporarily disables per-node config and returns cleanup function.
func WithPerNodeConfigEnabled ¶
func WithPerNodeConfigEnabled() func()
WithPerNodeConfigEnabled temporarily enables per-node config and returns cleanup function.
func WithWALDisabled ¶
func WithWALDisabled() func()
WithWALDisabled temporarily disables WAL and returns cleanup function.
func WithWALEnabled ¶
func WithWALEnabled() func()
WithWALEnabled temporarily enables WAL and returns cleanup function.
Types ¶
type AuthConfig ¶
type AuthConfig struct {
// Enabled controls whether authentication is required
Enabled bool
// InitialUsername is the default admin username
InitialUsername string
// InitialPassword is the default admin password
InitialPassword string
// MinPasswordLength for password policy
MinPasswordLength int
// TokenExpiry for JWT tokens
TokenExpiry time.Duration
// JWTSecret for signing tokens
JWTSecret string
}
AuthConfig holds authentication settings.
type ComplianceConfig ¶
type ComplianceConfig struct {
// AuditLogging - Required by: GDPR Art.30, HIPAA §164.312(b), FISMA, SOC2
AuditEnabled bool
AuditLogPath string
AuditRetentionDays int // How long to keep audit logs (HIPAA: 6 years, SOC2: 7 years)
// Data Retention - Required by: GDPR Art.5(1)(e), HIPAA §164.530(j)
// Retention is opt-in and disabled by default.
RetentionEnabled bool
RetentionPolicyDays int // Default retention period (0 = indefinite)
RetentionAutoDelete bool // Auto-delete vs archive after retention
RetentionExemptRoles []string // Roles exempt from retention (default "admin" matches auth.RoleAdmin; config cannot import auth due to cycle)
// Access Control - Required by: GDPR Art.32, HIPAA §164.312(a), FISMA
AccessControlEnabled bool
SessionTimeout time.Duration
MaxFailedLogins int
LockoutDuration time.Duration
// Encryption - Required by: GDPR Art.32, HIPAA §164.312(a)(2)(iv)
EncryptionAtRest bool
EncryptionInTransit bool
EncryptionKeyPath string
// Data Subject Rights - Required by: GDPR Art.15-20
DataExportEnabled bool // Right to data portability
DataErasureEnabled bool // Right to erasure/be forgotten
DataAccessEnabled bool // Right of access
// SubjectIdentifierProperties lists properties used to associate a node with a data subject.
// Nodes are considered owned by a subject when any configured property matches the subject ID.
SubjectIdentifierProperties []string
// SubjectPseudonymizeProperties lists properties whose values should be replaced with an anonymized token.
// When empty, SubjectIdentifierProperties are used.
SubjectPseudonymizeProperties []string
// SubjectRedactProperties lists properties to remove from matching nodes during anonymization.
SubjectRedactProperties []string
// Anonymization - Required by: GDPR Recital 26
AnonymizationEnabled bool
AnonymizationMethod string // "pseudonymization", "generalization", "suppression"
// Consent - Required by: GDPR Art.7
ConsentRequired bool
ConsentVersioning bool
ConsentAuditTrail bool
// Breach Notification - Required by: GDPR Art.33-34, HIPAA §164.408
BreachDetectionEnabled bool
BreachNotifyEmail string
BreachNotifyWebhook string
}
ComplianceConfig holds settings for GDPR/HIPAA/FISMA/SOC2 compliance. These are framework-agnostic controls that satisfy multiple regulations.
type Config ¶
type Config struct {
// Authentication (NORNICDB_AUTH format: "username/password" or "none")
Auth AuthConfig
// Database settings
Database DatabaseConfig
// Storage holds runtime-only storage settings (Plan 04-04). Distinct
// from Database which mirrors ENV/YAML on-disk schema.
Storage StorageRuntimeConfig
// Server settings
Server ServerConfig
// Memory/Decay settings (NornicDB-specific)
Memory MemoryConfig
// Embedding worker settings (NornicDB-specific)
EmbeddingWorker EmbeddingWorkerConfig
// Compliance settings for GDPR/HIPAA/FISMA/SOC2 (NornicDB-specific)
Compliance ComplianceConfig
// Retention settings (extended, label-aware)
Retention RetentionConfig
// Logging
Logging LoggingConfig
// Observability holds telemetry config (metrics, tracing, pprof).
// Phase 1 introduces this; Phase 2 wires slog from Logging.
Observability observability.ObservabilityConfig
// Feature flags for experimental/optional features
Features FeatureFlagsConfig
// Logger is the structured *slog.Logger threaded into storage and other
// runtime subsystems by Phase 2 D-01 logger DI. Optional; nil falls
// back to discard handlers at storage ctor entry per D-01a. Marked
// yaml:"-" / json:"-" because it is a runtime-only handle that must
// not appear in YAML/JSON config payloads.
Logger *slog.Logger `yaml:"-" json:"-"`
// PerDBOverrides carries the yaml-declared `databases:` map (loaded
// from LoadFromFile). The server applies these to dbconfig.Store at
// boot ONLY when the store has no row for that (dbName, key) pair
// yet — admin API edits remain authoritative across restarts.
// Empty/nil for callers that didn't go through LoadFromFile.
PerDBOverrides map[string]map[string]string `yaml:"-" json:"-"`
// DeferSearchWarmup tells nornicdb.Open NOT to start the per-DB
// search-index warmup until the caller explicitly calls
// db.MarkSearchWarmupReady(). The wiring layer (pkg/server) sets
// this so it can install the per-DB flags resolver before any
// warmup goroutine reads it.
//
// Default false: Open kicks the warmup gate open before returning
// so embedded callers (scripts, tests, anyone using the Open +
// query pattern without a server layer) get today's behaviour with
// no extra wiring. Setting it true is opt-in and carries the
// contract that the caller must release the gate; if they forget,
// search warmup blocks indefinitely. Runtime-only; never serialized.
DeferSearchWarmup bool `yaml:"-" json:"-"`
// CLIOverrides captures values that were explicitly set on the
// command line (only keys where cmd.Flags().Changed(...) is true).
// Treated as the highest-precedence source by dbconfig.Resolve so
// an operator's explicit `--search-bm25-enabled=false` at boot
// overrides any per-DB stored value, YAML, or env. CLI is the
// kill switch — when an operator types it during an incident, it
// must take effect even if a tenant's per-DB configuration says
// otherwise.
//
// Keys are the canonical NORNICDB_* env-var names (e.g.
// NORNICDB_SEARCH_BM25_ENABLED) so the resolver can use the same
// override key namespace it already uses for dbconfig store
// entries. Values are stringified to match the dbconfig store's
// schema. Nil/empty for non-CLI callers; that branch falls back
// to the existing per-DB > global precedence.
//
// Runtime-only; never serialized to YAML/JSON.
CLIOverrides map[string]string `yaml:"-" json:"-"`
}
func LoadDefaults ¶
func LoadDefaults() *Config
LoadDefaults returns a Config with all built-in safe defaults. This is the base configuration before any overrides are applied.
Precedence (lowest to highest):
- Built-in defaults (this function)
- Config file (YAML)
- Environment variables
- Command-line arguments (applied in main.go)
func LoadFromEnv ¶
func LoadFromEnv() *Config
LoadFromEnv loads configuration from environment variables.
This function reads all configuration from the environment, using Neo4j-compatible variable names where applicable (e.g., NORNICDB_AUTH, NEO4J_dbms_*) and NornicDB-specific variables prefixed with NORNICDB_.
All values have sensible defaults, so LoadFromEnv() can be called without any environment variables set.
Example:
// Minimal setup - uses all defaults
config := config.LoadFromEnv()
// With custom environment
os.Setenv("NORNICDB_AUTH", "myuser/mypass")
os.Setenv("NORNICDB_BOLT_PORT", "7688")
os.Setenv("NORNICDB_EMBEDDING_PROVIDER", "openai")
os.Setenv("NORNICDB_EMBEDDING_API_KEY", "sk-...")
config = config.LoadFromEnv()
if err := config.Validate(); err != nil {
log.Fatal(err)
}
Returns a fully populated Config with defaults applied where environment variables are not set.
Example 1 - Basic Development Setup:
// No environment variables set - use defaults
config := config.LoadFromEnv()
// Auth disabled by default (NORNICDB_AUTH=none)
fmt.Printf("Auth enabled: %v\n", config.Auth.Enabled) // false
// Bolt server on default port
fmt.Printf("Bolt: %s:%d\n",
config.Server.BoltAddress, config.Server.BoltPort) // 0.0.0.0:7687
// Memory decay disabled by default (opt-in)
fmt.Printf("Decay enabled: %v\n", config.Memory.DecayEnabled) // false
Example 2 - Production with Authentication:
// Set environment variables
os.Setenv("NORNICDB_AUTH", "admin/SecurePassword123!")
os.Setenv("NORNICDB_BOLT_PORT", "7687")
os.Setenv("NORNICDB_AUTH_JWT_SECRET", "your-32-char-secret-key-here!!")
os.Setenv("NORNICDB_AUDIT_ENABLED", "true")
config := config.LoadFromEnv()
// Validate before use
if err := config.Validate(); err != nil {
log.Fatal("Invalid config:", err)
}
// Auth now enabled
fmt.Printf("Admin: %s\n", config.Auth.InitialUsername) // admin
fmt.Printf("Audit: %s\n", config.Compliance.AuditLogPath)
Example 3 - Docker Compose Setup:
# docker-compose.yml
services:
nornicdb:
image: nornicdb:latest
environment:
- NORNICDB_AUTH=neo4j/password
- NORNICDB_DATA_DIR=/data
- NORNICDB_MEMORY_DECAY_ENABLED=true
- NORNICDB_EMBEDDING_PROVIDER=ollama
- NORNICDB_EMBEDDING_API_URL=http://ollama:11434
- NORNICDB_AUDIT_ENABLED=true
- NORNICDB_AUDIT_LOG_PATH=/logs/audit.log
volumes:
- nornicdb-data:/data
- nornicdb-logs:/logs
ports:
- "7687:7687"
- "7474:7474"
// In application code
config := config.LoadFromEnv()
// All environment variables automatically loaded
Example 4 - HIPAA Compliance Configuration:
// Set HIPAA-required environment variables
os.Setenv("NORNICDB_AUTH", "admin/ComplexPassword123!")
os.Setenv("NORNICDB_AUTH_TOKEN_EXPIRY", "4h")
os.Setenv("NORNICDB_AUDIT_ENABLED", "true")
os.Setenv("NORNICDB_AUDIT_RETENTION_DAYS", "2555") // 7 years
os.Setenv("NORNICDB_ENCRYPTION_AT_REST", "true")
os.Setenv("NORNICDB_ENCRYPTION_IN_TRANSIT", "true")
os.Setenv("NORNICDB_MAX_FAILED_LOGINS", "3")
os.Setenv("NORNICDB_LOCKOUT_DURATION", "30m")
os.Setenv("NORNICDB_SESSION_TIMEOUT", "15m")
config := config.LoadFromEnv()
// Verify HIPAA requirements met
if !config.Compliance.AuditEnabled {
log.Fatal("HIPAA requires audit logging")
}
if config.Compliance.AuditRetentionDays < 2555 {
log.Fatal("HIPAA requires 7-year audit retention")
}
Example 5 - Multi-Environment Setup:
// Load from .env file first
err := godotenv.Load(".env." + os.Getenv("ENV"))
if err != nil {
log.Printf("No .env file: %v", err)
}
// Then load from environment
config := config.LoadFromEnv()
// Override for specific environment
switch os.Getenv("ENV") {
case "production":
if !config.Auth.Enabled {
log.Fatal("Production requires authentication!")
}
case "development":
config.Logging.Level = "DEBUG"
case "test":
config.Database.DataDir = os.TempDir()
}
ELI12:
Think of LoadFromEnv like reading a recipe from sticky notes on your fridge:
- Each sticky note is an environment variable (e.g., "PORT=7687")
- If there's no sticky note, use the default ("PORT not found? Use 7687")
- The function reads ALL the sticky notes and builds a complete recipe
Why use environment variables?
- Security: Keep secrets out of code (passwords, API keys)
- Flexibility: Change settings without recompiling
- Docker-friendly: Easy to configure containers
- 12-Factor App: Industry best practice
Neo4j Compatibility:
- NORNICDB_AUTH format: "username/password" or "none"
- NEO4J_dbms_* settings match Neo4j exactly
- Tools like Neo4j Desktop work out of the box
Common Environment Variables:
Authentication: - NORNICDB_AUTH="neo4j/password" (enable auth) - NORNICDB_AUTH="none" (disable auth, dev only) - NORNICDB_AUTH_JWT_SECRET="..." (32+ chars) Network: - NORNICDB_BOLT_PORT=7687 - NORNICDB_HTTP_PORT=7474 Storage: - NORNICDB_DATA_DIR="./data" - NORNICDB_DEFAULT_DATABASE="nornic" Memory (NornicDB-specific): - NORNICDB_MEMORY_DECAY_ENABLED=true - NORNICDB_EMBEDDING_PROVIDER=ollama - NORNICDB_EMBEDDING_MODEL=bge-m3 Compliance: - NORNICDB_AUDIT_ENABLED=true - NORNICDB_AUDIT_RETENTION_DAYS=2555 - NORNICDB_ENCRYPTION_AT_REST=true
Configuration Priority:
- Environment variables (highest)
- Default values (if env var not set)
- No config files (environment-only by design)
Validation:
Always call config.Validate() after LoadFromEnv() to catch errors: - Missing required fields - Invalid values (negative numbers, bad formats) - Conflicting settings
Performance:
- O(n) where n = number of environment variables
- Typically <1ms to load full configuration
- Config is loaded once at startup
Thread Safety:
LoadFromEnv reads environment variables which are process-global and should not be modified after startup. The returned Config is immutable.
This function is kept for backward compatibility but LoadFromFile is preferred as it properly implements the precedence: defaults -> config file -> env vars.
func LoadFromFile ¶
LoadFromFile loads configuration with proper precedence:
- Built-in defaults (lowest priority)
- YAML config file
- Environment variables (highest priority before CLI args)
Command-line arguments are applied by the caller (main.go) after this.
Example YAML:
server: port: 7687 host: "localhost" auth: "admin:admin" # Format: username:password or "none" embedding: enabled: true provider: "local"
The auth field supports both colon format (admin:admin) for consistency and slash format (admin/password) for Neo4j compatibility.
func (*Config) String ¶
String returns a safe string representation of the Config.
Sensitive values like passwords and API keys are NOT included in the output, making this safe for logging.
Example:
config := config.LoadFromEnv()
log.Printf("Starting with config: %s", config)
// Output: Config{Auth: true, Bolt: 0.0.0.0:7687, HTTP: 0.0.0.0:7474, DataDir: ./data}
Returns a string suitable for logging and debugging.
func (*Config) Validate ¶
Validate checks the configuration for logical errors and invalid values.
This method checks:
- Authentication is properly configured if enabled
- Password meets minimum length requirements
- Port numbers are valid (> 0)
- Embedding dimensions are positive
Call Validate() after LoadFromEnv() and before using the Config.
Example:
config := config.LoadFromEnv()
if err := config.Validate(); err != nil {
log.Fatalf("Configuration error: %v", err)
}
// Config is valid, proceed with startup
Returns nil if configuration is valid, or an error describing the problem.
type DatabaseConfig ¶
type DatabaseConfig struct {
// DataDir is the directory for data storage
DataDir string
// DefaultDatabase name
DefaultDatabase string
// ReadOnly mode
ReadOnly bool
// TransactionTimeout for long-running queries
TransactionTimeout time.Duration
// MaxConcurrentTransactions limit
MaxConcurrentTransactions int
// WALSyncMode controls when WAL writes are synced to disk.
// - "batch" (default): fsync every WALSyncInterval - good balance
// - "immediate": fsync after each write - safest but 2-5x slower
// - "none": no fsync - fastest but data loss on crash
// Environment: NORNICDB_WAL_SYNC_MODE
WALSyncMode string
// WALSyncInterval for batch sync mode (default: 100ms).
// Smaller = safer but slower, larger = faster but more data at risk.
// Environment: NORNICDB_WAL_SYNC_INTERVAL
WALSyncInterval time.Duration
// WALAutoCompactionEnabled controls automatic snapshots + WAL truncation.
// Default: true (preserves existing behavior).
// Environment: NORNICDB_WAL_AUTO_COMPACTION_ENABLED
WALAutoCompactionEnabled bool
// StrictDurability enables maximum safety settings (opt-in):
// - WAL: immediate sync (fsync every write)
// - Badger: SyncWrites=true
// - AsyncEngine: smaller flush interval (10ms)
// WARNING: 2-5x slower writes. Use for financial/critical data only.
// Environment: NORNICDB_STRICT_DURABILITY
StrictDurability bool
// WALRetentionMaxSegments keeps at most N sealed segments (0 = unlimited, default: 0).
// Segments are sealed when they reach MaxFileSize or MaxEntries.
// Set to > 0 to enable immutable segment retention for audit trails.
// Environment: NORNICDB_WAL_RETENTION_MAX_SEGMENTS
WALRetentionMaxSegments int
// WALRetentionMaxAge keeps segments newer than this duration (0 = unlimited, default: 0).
// Older segments are eligible for deletion after snapshots.
// Example: 7 * 24 * time.Hour to keep 7 days of WAL history.
// Environment: NORNICDB_WAL_RETENTION_MAX_AGE
WALRetentionMaxAge time.Duration
// WALRetentionLedgerDefaults enables ledger-grade retention defaults when no explicit
// retention settings are supplied. This is opt-in and defaults to false.
// When true, defaults to 24 segments and 7 days if no explicit retention is set.
// Environment: NORNICDB_WAL_LEDGER_RETENTION_DEFAULTS
WALRetentionLedgerDefaults bool
// WALSnapshotRetentionMaxCount is the max number of snapshot files to keep (0 = use storage default, typically 3).
// Environment: NORNICDB_WAL_SNAPSHOT_RETENTION_MAX_COUNT
WALSnapshotRetentionMaxCount int
// WALSnapshotRetentionMaxAge is the max age of snapshot files to keep (0 = unlimited).
// Environment: NORNICDB_WAL_SNAPSHOT_RETENTION_MAX_AGE
WALSnapshotRetentionMaxAge time.Duration
// EncryptionEnabled controls whether database encryption is active
// Env: NORNICDB_ENCRYPTION_ENABLED
EncryptionEnabled bool
// EncryptionPassword for database encryption at rest
// Required when EncryptionEnabled is true. Use a strong password in production.
// Env: NORNICDB_ENCRYPTION_PASSWORD
EncryptionPassword string
// EncryptionProvider selects key management mode for at-rest DB key material.
// Supported: "password" (default), "local".
// Env: NORNICDB_ENCRYPTION_PROVIDER
EncryptionProvider string
// EncryptionKeyURI identifies the KEK in provider-backed modes.
// Env: NORNICDB_ENCRYPTION_KEY_URI
EncryptionKeyURI string
// EncryptionMasterKey provides the provider master key material (dev/local).
// Expected encoding: raw 32-byte string OR hex/base64 depending on provider.
// Env: NORNICDB_ENCRYPTION_MASTER_KEY
EncryptionMasterKey string
// AWS KMS provider settings.
EncryptionAWSRegion string
EncryptionAWSKMSKeyID string
EncryptionAWSEndpoint string
EncryptionAWSRoleARN string
EncryptionAWSRoleSessionName string
EncryptionAWSAccessKey string
EncryptionAWSSecretKey string
EncryptionAWSSessionToken string
EncryptionAWSWebIdentityTokenFile string
// Azure Key Vault provider settings.
EncryptionAzureVaultName string
EncryptionAzureKeyName string
EncryptionAzureTenantID string
EncryptionAzureClientID string
EncryptionAzureClientSecret string
EncryptionAzureEnvironment string
EncryptionAzureResource string
// GCP Cloud KMS provider settings.
EncryptionGCPProject string
EncryptionGCPLocation string
EncryptionGCPKeyRing string
EncryptionGCPKeyName string
EncryptionGCPCredentialsFile string
// Encryption audit settings for provider-backed modes.
EncryptionAuditLogPath string
EncryptionAuditSignEvents bool
EncryptionAuditSignKey string
// Encryption rotation settings for persisted wrapped DEKs.
EncryptionRotationEnabled bool
EncryptionRotationInterval time.Duration
// AsyncWritesEnabled enables async writes for faster performance.
// Writes return immediately after caching; flushed to disk in background.
// Env: NORNICDB_ASYNC_WRITES_ENABLED (default: true)
AsyncWritesEnabled bool
// AsyncFlushInterval controls how often pending writes are flushed.
// Smaller = more consistent, larger = better throughput.
// Env: NORNICDB_ASYNC_FLUSH_INTERVAL (default: 50ms)
AsyncFlushInterval time.Duration
// AsyncMaxNodeCacheSize is the max nodes to buffer before forcing a flush.
// Prevents unbounded memory growth during bulk inserts.
// Set to 0 for unlimited (not recommended for bulk operations).
// Env: NORNICDB_ASYNC_MAX_NODE_CACHE_SIZE (default: 50000)
AsyncMaxNodeCacheSize int
// AsyncMaxEdgeCacheSize is the max edges to buffer before forcing a flush.
// Prevents unbounded memory growth during bulk inserts.
// Set to 0 for unlimited (not recommended for bulk operations).
// Env: NORNICDB_ASYNC_MAX_EDGE_CACHE_SIZE (default: 100000)
AsyncMaxEdgeCacheSize int
// BadgerNodeCacheMaxEntries is the max nodes to keep in the hot node cache.
// When exceeded, the cache is cleared (simple eviction).
// Env: NORNICDB_BADGER_NODE_CACHE_MAX_ENTRIES (default: 10000)
BadgerNodeCacheMaxEntries int
// BadgerEdgeTypeCacheMaxTypes is the max distinct edge types to cache for GetEdgesByType.
// When exceeded, the cache is cleared (simple eviction).
// Env: NORNICDB_BADGER_EDGE_TYPE_CACHE_MAX_TYPES (default: 50)
BadgerEdgeTypeCacheMaxTypes int
// MVCCRetentionMaxVersions keeps at most this many closed historical MVCC versions per key by default.
// The current head is always preserved separately.
// Env: NORNICDB_MVCC_RETENTION_MAX_VERSIONS (default: 1)
MVCCRetentionMaxVersions int
// MVCCRetentionTTL protects MVCC versions newer than now-TTL from pruning.
// Zero disables age-based protection.
// Env: NORNICDB_MVCC_RETENTION_TTL
MVCCRetentionTTL time.Duration
// IDFreelistTTL is the debounce window before a deleted node/edge's
// numID can be recycled. Long enough that any in-flight snapshot
// reader that started before the delete has finished. Default 30s
// — query-scoped readers finish in seconds, so 30s is comfortably
// beyond the normal read window.
// Env: NORNICDB_ID_FREELIST_TTL (e.g. "30s", "5m", "1h")
IDFreelistTTL time.Duration
// MVCCLifecycleEnabled enables the MVCC lifecycle manager.
MVCCLifecycleEnabled bool
// MVCCLifecycleCycleInterval controls background lifecycle cadence.
MVCCLifecycleCycleInterval time.Duration
// MVCCLifecycleMaxSnapshotAge bounds snapshot lifetime under pressure.
MVCCLifecycleMaxSnapshotAge time.Duration
// MVCCLifecycleMaxChainCap bounds pathological MVCC chain growth.
MVCCLifecycleMaxChainCap int
// AllowStorageUpgrade authorizes the engine to advance the on-disk
// storage version through migration arms this binary understands.
// Without it, opening an out-of-date data directory fails with a
// clear error message. The upgrade is one-way; operators should
// back up before enabling this. Set via --upgrade-storage on the CLI.
AllowStorageUpgrade bool
// PersistSearchIndexes (EXPERIMENTAL) when true saves BM25, vector, and HNSW indexes under DataDir and loads
// them on startup so BuildIndexes can skip the full storage iteration. Default: false.
// Note: if indexes are incompatible/missing and must be rebuilt, startup can be long for large datasets.
// For example, rebuilding IVF-HNSW for ~1M embeddings can take ~30 minutes on startup (hardware dependent).
// Env: NORNICDB_PERSIST_SEARCH_INDEXES
PersistSearchIndexes bool
}
DatabaseConfig holds database settings.
type EmbeddingWorkerConfig ¶
type EmbeddingWorkerConfig struct {
// NumWorkers is the number of concurrent workers processing embeddings
// Use more workers for network-based embedders (OpenAI, etc.) or multiple GPUs
NumWorkers int
// ScanInterval is how often to scan for nodes without embeddings
ScanInterval time.Duration
// BatchDelay is the delay between processing individual nodes
BatchDelay time.Duration
// TriggerDebounceDelay delays write-triggered scans until mutation bursts settle.
TriggerDebounceDelay time.Duration
// MaxRetries is the max retry attempts per node
MaxRetries int
// ChunkSize is max tokens per chunk.
ChunkSize int
// ChunkOverlap is tokens to overlap between chunks.
ChunkOverlap int
// PropertiesInclude: if non-empty, only these property keys are used when building embedding text.
// Enables "embed only content" or "embed only title,description". Empty = use all (subject to PropertiesExclude).
PropertiesInclude []string
// PropertiesExclude: these property keys are never used when building embedding text (in addition to built-in skips).
PropertiesExclude []string
// IncludeLabels: if true (default), node labels are prepended to the embedding text.
IncludeLabels bool
}
EmbeddingWorkerConfig holds settings for the background embedding worker. Environment variables:
- NORNICDB_EMBED_SCAN_INTERVAL: How often to scan for unembedded nodes (default: 15m)
- NORNICDB_EMBED_BATCH_DELAY: Delay between processing nodes (default: 500ms)
- NORNICDB_EMBED_TRIGGER_DEBOUNCE: Delay before write-triggered scans fire (default: 2s)
- NORNICDB_EMBED_MAX_RETRIES: Max retry attempts per node (default: 3)
- NORNICDB_EMBED_CHUNK_SIZE: Max tokens per chunk (default: 8192)
- NORNICDB_EMBED_CHUNK_OVERLAP: Tokens to overlap between chunks (default: 50)
- NORNICDB_EMBED_WORKER_NUM_WORKERS: Number of concurrent embedding workers (default: 1)
- NORNICDB_EMBEDDING_PROPERTIES_INCLUDE: Comma-separated property keys to use for embedding text (empty = all)
- NORNICDB_EMBEDDING_PROPERTIES_EXCLUDE: Comma-separated property keys to exclude from embedding text
- NORNICDB_EMBEDDING_INCLUDE_LABELS: Whether to prepend node labels to embedding text (default: true)
type FeatureFlagsConfig ¶
type FeatureFlagsConfig struct {
// Kalman filtering for predictive smoothing
KalmanEnabled bool
// Topological link prediction AUTOMATIC integration
// NOTE: Neo4j GDS procedures (CALL gds.linkPrediction.*) are ALWAYS available
// This flag only controls automatic integration with inference.Engine.OnStore()
TopologyAutoIntegrationEnabled bool // Enable automatic topology in OnStore()
TopologyAlgorithm string // adamic_adar, jaccard, etc.
TopologyWeight float64 // 0.0-1.0, weight vs semantic
TopologyTopK int
TopologyMinScore float64
TopologyGraphRefreshInterval int
// A/B testing for automatic topology integration
TopologyABTestEnabled bool
TopologyABTestPercentage int // 0-100
// Heimdall - the cognitive guardian of NornicDB
// When enabled, NornicDB loads a local SLM for anomaly detection,
// runtime diagnosis, and memory curation.
// Environment: NORNICDB_HEIMDALL_ENABLED (default: false)
HeimdallEnabled bool
// Heimdall model name (without .gguf extension for local; model name for ollama/openai)
// Environment: NORNICDB_HEIMDALL_MODEL (default: qwen2.5-1.5b-instruct-q4_k_m)
HeimdallModel string
// Heimdall provider: "local" (GGUF), "ollama", or "openai"
// Environment: NORNICDB_HEIMDALL_PROVIDER (default: local)
HeimdallProvider string
// Heimdall API URL for remote providers (ollama/openai)
// Environment: NORNICDB_HEIMDALL_API_URL (e.g. http://localhost:11434 for ollama)
HeimdallAPIURL string
// Heimdall API key for openai (and other authenticated providers)
// Environment: NORNICDB_HEIMDALL_API_KEY
HeimdallAPIKey string
// GPU layers for Heimdall SLM (-1=auto, 0=CPU only)
// Falls back to CPU if GPU memory insufficient
// Environment: NORNICDB_HEIMDALL_GPU_LAYERS (default: -1)
HeimdallGPULayers int
// Context size for Heimdall model (max tokens in context window)
// This controls GPU memory usage for KV cache. Lower = less memory.
// Default: 8192 (8K) - memory efficient, saves ~2GB GPU RAM vs 32K
// For longer conversations, increase to 16384 or 32768
// Environment: NORNICDB_HEIMDALL_CONTEXT_SIZE (default: 8192)
HeimdallContextSize int
// Batch size for Heimdall model (tokens processed at once)
// Should be <= ContextSize. Higher values may improve throughput.
// Default: 2048 (2K) - balanced for typical prompt sizes
// Environment: NORNICDB_HEIMDALL_BATCH_SIZE (default: 2048)
HeimdallBatchSize int
// Max tokens for Heimdall generation
// Environment: NORNICDB_HEIMDALL_MAX_TOKENS (default: 512)
HeimdallMaxTokens int
// Temperature for Heimdall (lower = more deterministic)
// Environment: NORNICDB_HEIMDALL_TEMPERATURE (default: 0.1)
HeimdallTemperature float32
// Enable Heimdall anomaly detection on graph
// Environment: NORNICDB_HEIMDALL_ANOMALY_DETECTION (default: true when Heimdall enabled)
HeimdallAnomalyDetection bool
// Enable Heimdall runtime diagnosis
// Environment: NORNICDB_HEIMDALL_RUNTIME_DIAGNOSIS (default: true when Heimdall enabled)
HeimdallRuntimeDiagnosis bool
// Enable Heimdall memory curation (experimental)
// Environment: NORNICDB_HEIMDALL_MEMORY_CURATION (default: false)
HeimdallMemoryCuration bool
// Expose MCP tools (store, recall, discover, link, task, tasks) to the Heimdall agentic loop.
// When false, the LLM does not see or call MCP tools (reduces context size). Default: false.
// Environment: NORNICDB_HEIMDALL_MCP_ENABLE (default: false)
HeimdallMCPEnable bool
// Allowlist of MCP tool names to expose when HeimdallMCPEnable is true. Nil = expose all tools;
// empty slice = expose none (disable); non-empty = only those names (e.g. ["store","link"]).
// Environment: NORNICDB_HEIMDALL_MCP_TOOLS (comma-separated; unset = all, empty string = none)
HeimdallMCPTools []string
// SearchRerankEnabled enables Stage-2 reranking for vector/hybrid search.
// Environment: NORNICDB_SEARCH_RERANK_ENABLED (default: false)
SearchRerankEnabled bool
// SearchRerankProvider: "local" (GGUF), "ollama", "openai", or "http" (Cohere/HuggingFace TEI/custom).
// Environment: NORNICDB_SEARCH_RERANK_PROVIDER (default: local)
SearchRerankProvider string
// SearchRerankModel: for local = GGUF filename (e.g. bge-reranker-v2-m3-Q4_K_M.gguf); for API = model name/id.
// Environment: NORNICDB_SEARCH_RERANK_MODEL
SearchRerankModel string
// SearchRerankAPIURL is the rerank API endpoint for ollama/openai/http (e.g. http://localhost:11434/rerank, https://api.cohere.ai/v1/rerank).
// Environment: NORNICDB_SEARCH_RERANK_API_URL
SearchRerankAPIURL string
// SearchRerankAPIKey for authenticated providers (e.g. OpenAI, Cohere).
// Environment: NORNICDB_SEARCH_RERANK_API_KEY
SearchRerankAPIKey string
// Max context tokens for prompt validation (should match HeimdallContextSize)
// This is the total token budget for system + user + output combined.
// Environment: NORNICDB_HEIMDALL_MAX_CONTEXT_TOKENS (default: 8192)
HeimdallMaxContextTokens int
// Max tokens reserved for system prompt (actions + instructions + Cypher primer)
// The system prompt includes: action definitions, Cypher reference, and plugin context.
// Remaining context is split between user message and model output.
// Environment: NORNICDB_HEIMDALL_MAX_SYSTEM_TOKENS (default: 6000)
HeimdallMaxSystemTokens int
// Max tokens reserved for user message input
// Longer user messages (complex queries, multi-line inputs) need more budget.
// Environment: NORNICDB_HEIMDALL_MAX_USER_TOKENS (default: 2000)
HeimdallMaxUserTokens int
// QdrantGRPCEnabled enables the Qdrant-compatible gRPC server
// Environment: NORNICDB_QDRANT_GRPC_ENABLED (default: false)
QdrantGRPCEnabled bool
// QdrantGRPCListenAddr is the address for the Qdrant gRPC server
// Environment: NORNICDB_QDRANT_GRPC_LISTEN_ADDR (default: ":6334")
QdrantGRPCListenAddr string
// QdrantGRPCMaxVectorDim is the maximum allowed vector dimension
// Environment: NORNICDB_QDRANT_GRPC_MAX_VECTOR_DIM (default: 4096)
QdrantGRPCMaxVectorDim int
// QdrantGRPCMaxBatchPoints is the max points per upsert batch
// Environment: NORNICDB_QDRANT_GRPC_MAX_BATCH_POINTS (default: 1000)
QdrantGRPCMaxBatchPoints int
// QdrantGRPCMaxTopK is the maximum search results
// Environment: NORNICDB_QDRANT_GRPC_MAX_TOP_K (default: 1000)
QdrantGRPCMaxTopK int
// QdrantGRPCMethodPermissions optionally overrides required permissions for
// specific Qdrant gRPC RPCs.
//
// This is configured via YAML config only (not env vars) under:
// qdrant_grpc:
// rbac:
// methods:
// "Points/Upsert": "write"
//
// Values are one of: read, write, create, delete, admin, schema, user_manage.
QdrantGRPCMethodPermissions map[string]string
}
FeatureFlagsConfig holds all feature flags for experimental/optional features. Centralized location for all feature toggles in NornicDB.
func (*FeatureFlagsConfig) GetHeimdallAPIKey ¶
func (f *FeatureFlagsConfig) GetHeimdallAPIKey() string
func (*FeatureFlagsConfig) GetHeimdallAPIURL ¶
func (f *FeatureFlagsConfig) GetHeimdallAPIURL() string
func (*FeatureFlagsConfig) GetHeimdallAnomalyDetection ¶
func (f *FeatureFlagsConfig) GetHeimdallAnomalyDetection() bool
func (*FeatureFlagsConfig) GetHeimdallBatchSize ¶
func (f *FeatureFlagsConfig) GetHeimdallBatchSize() int
func (*FeatureFlagsConfig) GetHeimdallContextSize ¶
func (f *FeatureFlagsConfig) GetHeimdallContextSize() int
func (*FeatureFlagsConfig) GetHeimdallEnabled ¶
func (f *FeatureFlagsConfig) GetHeimdallEnabled() bool
Heimdall config getter methods for heimdall.FeatureFlagsSource interface
func (*FeatureFlagsConfig) GetHeimdallGPULayers ¶
func (f *FeatureFlagsConfig) GetHeimdallGPULayers() int
func (*FeatureFlagsConfig) GetHeimdallMCPEnable ¶
func (f *FeatureFlagsConfig) GetHeimdallMCPEnable() bool
func (*FeatureFlagsConfig) GetHeimdallMCPTools ¶
func (f *FeatureFlagsConfig) GetHeimdallMCPTools() []string
func (*FeatureFlagsConfig) GetHeimdallMaxContextTokens ¶
func (f *FeatureFlagsConfig) GetHeimdallMaxContextTokens() int
func (*FeatureFlagsConfig) GetHeimdallMaxSystemTokens ¶
func (f *FeatureFlagsConfig) GetHeimdallMaxSystemTokens() int
func (*FeatureFlagsConfig) GetHeimdallMaxTokens ¶
func (f *FeatureFlagsConfig) GetHeimdallMaxTokens() int
func (*FeatureFlagsConfig) GetHeimdallMaxUserTokens ¶
func (f *FeatureFlagsConfig) GetHeimdallMaxUserTokens() int
func (*FeatureFlagsConfig) GetHeimdallMemoryCuration ¶
func (f *FeatureFlagsConfig) GetHeimdallMemoryCuration() bool
func (*FeatureFlagsConfig) GetHeimdallModel ¶
func (f *FeatureFlagsConfig) GetHeimdallModel() string
func (*FeatureFlagsConfig) GetHeimdallProvider ¶
func (f *FeatureFlagsConfig) GetHeimdallProvider() string
func (*FeatureFlagsConfig) GetHeimdallRuntimeDiagnosis ¶
func (f *FeatureFlagsConfig) GetHeimdallRuntimeDiagnosis() bool
func (*FeatureFlagsConfig) GetHeimdallTemperature ¶
func (f *FeatureFlagsConfig) GetHeimdallTemperature() float32
type FeatureStatus ¶
type FeatureStatus struct {
GlobalEnabled bool
KalmanEnabled bool
TopologyEnabled bool
EdgeProvenanceEnabled bool
CooldownEnabled bool
EvidenceBufferingEnabled bool
PerNodeConfigEnabled bool
WALEnabled bool
GPUClusteringEnabled bool
Features map[string]bool
}
FeatureStatus returns the current status of all features.
func GetFeatureStatus ¶
func GetFeatureStatus() FeatureStatus
GetFeatureStatus returns the complete feature status.
type FilteredValue ¶
type FilteredValue struct {
Raw float64 // Original unfiltered value
Filtered float64 // Filtered value (same as Raw if disabled)
WasFiltered bool // True if filtering was applied
Feature string // Which feature flag controlled this
}
FilteredValue represents a value that may or may not have been filtered. Useful for A/B testing and comparison. Note: Kalman-specific methods have been moved to pkg/filter package.
type LoggingConfig ¶
type LoggingConfig struct {
// Level (DEBUG, INFO, WARN, ERROR)
Level string
// Format (json, text)
Format string
// Output path (stdout, stderr, or file path)
Output string
// QueryLogEnabled for query logging
QueryLogEnabled bool
// SlowQueryThreshold for logging slow queries (single source of truth
// per D-04d; replaces the prior pkg/server.Config.SlowQueryThreshold).
SlowQueryThreshold time.Duration
// SlowQueryLogFile is the optional file path for the slow-query log
// stream. Empty => log to the configured server logger. Single source of
// truth per D-04d.
SlowQueryLogFile string
}
LoggingConfig holds logging settings.
type MemoryConfig ¶
type MemoryConfig struct {
// DecayEnabled controls memory decay
DecayEnabled bool
// DecayInterval controls how often access metadata is flushed from
// in-memory accumulators to Badger. Shorter intervals mean access
// counts reach the scorer faster; longer intervals reduce write I/O.
DecayInterval time.Duration
// AccessFlushBufferSize is the maximum number of distinct entities buffered
// in the access accumulator before an automatic flush is triggered. 0 means
// unlimited (flush only on the DecayInterval timer).
AccessFlushBufferSize int
// VisibilityThreshold is the score below which nodes are suppressed from
// visibility in query results.
VisibilityThreshold float64
// EmbeddingEnabled controls whether embedding generation is active
// Env: NORNICDB_EMBEDDING_ENABLED
EmbeddingEnabled bool
// EmbeddingProvider (local, ollama, openai)
EmbeddingProvider string
// EmbeddingModel name
EmbeddingModel string
// EmbeddingAPIURL endpoint
EmbeddingAPIURL string
// EmbeddingAPIKey for authenticated providers (OpenAI, etc.). Env: NORNICDB_EMBEDDING_API_KEY
EmbeddingAPIKey string
// EmbeddingDimensions size
EmbeddingDimensions int
// EmbeddingCacheSize is max embeddings to cache (0 = disabled, default: 10000)
// Each cached embedding uses ~4KB (1024 dims × 4 bytes)
// 10000 cache = ~40MB memory, provides significant speedup for repeated queries
EmbeddingCacheSize int
// SearchMinSimilarity is the minimum cosine similarity threshold for vector search results.
// Apple Intelligence embeddings produce scores in 0.2-0.8 range, bge-m3/mxbai produce 0.7-0.99.
// Default: 0.0 (let RRF ranking handle relevance filtering)
// Env: NORNICDB_SEARCH_MIN_SIMILARITY
SearchMinSimilarity float64
// SearchBM25Enabled is the global default for whether BM25 fulltext search
// is enabled. Per-database overrides via dbconfig.Store always win.
// Env: NORNICDB_SEARCH_BM25_ENABLED (default: true)
SearchBM25Enabled bool
// SearchBM25Warming is the global default trigger for BM25 build:
// "startup" builds at boot (today's behaviour) or "lazy" defers to the
// first inbound search query for the database.
// Env: NORNICDB_SEARCH_BM25_WARMING (default: startup)
SearchBM25Warming string
// SearchVectorEnabled is the global default for whether vector search is
// enabled. When false, no ANN strategy (HNSW, IVF-HNSW, brute-force, GPU,
// Metal, Qdrant pass-through) is built or queryable for that database;
// node embeddings are not iterated into RAM. Per-database overrides win.
// Env: NORNICDB_SEARCH_VECTOR_ENABLED (default: true)
SearchVectorEnabled bool
// SearchVectorWarming is the global default trigger for vector index build:
// "startup" or "lazy". See SearchBM25Warming.
// Env: NORNICDB_SEARCH_VECTOR_WARMING (default: startup)
SearchVectorWarming string
// ModelsDir is the directory containing local GGUF models
// Env: NORNICDB_MODELS_DIR (default: ./models)
ModelsDir string
// EmbeddingGPULayers controls GPU offloading for local embeddings
// -1 = auto, 0 = CPU only, >0 = specific layers
// Env: NORNICDB_EMBEDDING_GPU_LAYERS
EmbeddingGPULayers int
// EmbeddingWarmupInterval for periodic model warmup
// Env: NORNICDB_EMBEDDING_WARMUP_INTERVAL
EmbeddingWarmupInterval time.Duration
// DefaultNodeLabel is the label applied to nodes when no label is specified.
// Env: NORNICDB_DEFAULT_NODE_LABEL (default: "Memory")
DefaultNodeLabel string
// AutoLinksEnabled for automatic relationship detection
AutoLinksEnabled bool
// AutoLinksSimilarityThreshold for similarity-based links
AutoLinksSimilarityThreshold float64
// KmeansMinEmbeddings is minimum embeddings required for k-means clustering
// Env: NORNICDB_KMEANS_MIN_EMBEDDINGS (default: 1000)
KmeansMinEmbeddings int
// KmeansClusterInterval is how often to run k-means clustering (0 = disabled)
// Env: NORNICDB_KMEANS_CLUSTER_INTERVAL (default: 5m)
KmeansClusterInterval time.Duration
// KmeansNumClusters is the number of k-means clusters (0 = auto from dataset size).
// Env: NORNICDB_KMEANS_NUM_CLUSTERS (0 or unset = auto)
KmeansNumClusters int
// RuntimeLimit is the soft memory limit (GOMEMLIMIT) in bytes
// 0 = unlimited (Go manages automatically)
// Set to 80% of container memory for optimal performance
RuntimeLimit int64
// RuntimeLimitStr is the configured value in megabytes as a string (e.g., "500")
RuntimeLimitStr string
// GCPercent controls GC aggressiveness (GOGC)
// 100 = default, lower = more aggressive (less memory, more CPU)
GCPercent int
// PoolEnabled controls object pooling for query results
PoolEnabled bool
// PoolMaxSize limits pool memory usage per pool
PoolMaxSize int
// QueryCacheEnabled controls query plan caching
QueryCacheEnabled bool
// QueryCacheSize is the maximum number of cached query plans
QueryCacheSize int
// QueryCacheTTL is how long cached plans remain valid
QueryCacheTTL time.Duration
}
MemoryConfig holds NornicDB memory decay settings and runtime memory management.
func (*MemoryConfig) ApplyRuntimeMemory ¶
func (c *MemoryConfig) ApplyRuntimeMemory()
ApplyRuntimeMemory applies the runtime memory settings to the Go runtime. Should be called early in main() before heavy allocations.
type RetentionConfig ¶ added in v1.0.43
type RetentionConfig struct {
// SweepIntervalSeconds controls how often the retention sweep runs in whole seconds.
SweepIntervalSeconds int
// ExcludedLabels lists labels that are globally exempt from retention deletion.
ExcludedLabels []string
// PoliciesFile is the optional JSON persistence path for retention policies.
PoliciesFile string
// DefaultPolicies loads the built-in compliance policies on startup.
DefaultPolicies bool
// MaxSweepRecords limits how many records a single sweep iteration will process.
MaxSweepRecords int
// Policies defines per-category policies inline in config.
Policies []RetentionPolicyConfig
}
RetentionConfig holds extended retention configuration.
type RetentionPolicyConfig ¶ added in v1.0.43
type RetentionPolicyConfig struct {
ID string `yaml:"id"`
Name string `yaml:"name"`
Category string `yaml:"category"`
RetentionDays int `yaml:"retention_days"`
Indefinite bool `yaml:"indefinite"`
ArchiveBeforeDelete bool `yaml:"archive_before_delete"`
ArchivePath string `yaml:"archive_path"`
ComplianceFrameworks []string `yaml:"compliance_frameworks"`
Description string `yaml:"description"`
Active *bool `yaml:"active"`
}
RetentionPolicyConfig defines a single retention policy in YAML config.
type ServerConfig ¶
type ServerConfig struct {
// BoltEnabled controls Bolt protocol server
BoltEnabled bool
// BoltPort for Bolt connections (default 7687)
BoltPort int
// BoltAddress to bind to
BoltAddress string
// BoltServerAnnouncement overrides the Bolt HELLO SUCCESS "server" metadata.
// Use this only as a client compatibility workaround for strict Neo4j-only tools.
// Env: NORNICDB_BOLT_SERVER_ANNOUNCEMENT
BoltServerAnnouncement string
// BoltTLSEnabled for encrypted connections
BoltTLSEnabled bool
// BoltTLSCert path to certificate
BoltTLSCert string
// BoltTLSKey path to private key
BoltTLSKey string
// BoltTLSRequire rejects any plaintext connection on the Bolt port.
// Env: NORNICDB_BOLT_TLS_REQUIRE
BoltTLSRequire bool
// BoltTLSClientCAFile enables mTLS by verifying client certs against
// this CA. Env: NORNICDB_BOLT_TLS_CLIENT_CA
BoltTLSClientCAFile string
// BoltTLSClientAuthMode controls client-cert handling when ClientCAFile
// is set. Values: "none", "request", "request_verify", "require_verify".
// Env: NORNICDB_BOLT_TLS_CLIENT_AUTH_MODE
BoltTLSClientAuthMode string
// BoltSniffTimeout bounds the transport-sniff peek (default 5s).
// Env: NORNICDB_BOLT_SNIFF_TIMEOUT
BoltSniffTimeout time.Duration
// BoltAuthTimeout bounds pre-HELLO handshake/auth (default 30s).
// Env: NORNICDB_BOLT_AUTH_TIMEOUT
BoltAuthTimeout time.Duration
// BoltWebSocketEnabled allows WebSocket transport on the Bolt port
// (default true). Env: NORNICDB_BOLT_WEBSOCKET_ENABLED
BoltWebSocketEnabled bool
// BoltWebSocketAllowedOrigins comma-separated allowlist for WS Origin
// header. "*" allows any. Env: NORNICDB_BOLT_WEBSOCKET_ALLOWED_ORIGINS
BoltWebSocketAllowedOrigins string
// BoltWebSocketMaxMessageSize bounds inbound WS BinaryMessage size
// (default 65536). Env: NORNICDB_BOLT_WEBSOCKET_MAX_MESSAGE_SIZE
BoltWebSocketMaxMessageSize int64
// BoltWebSocketWriteBufferSize bufio writer size for WS sessions
// (default 262144). Env: NORNICDB_BOLT_WEBSOCKET_WRITE_BUFFER_SIZE
BoltWebSocketWriteBufferSize int
// BoltWebSocketPingInterval cadence for WS ping control frames
// (default 30s). Env: NORNICDB_BOLT_WEBSOCKET_PING_INTERVAL
BoltWebSocketPingInterval time.Duration
// BoltWebSocketPongTimeout pong arrival deadline (default 60s).
// Env: NORNICDB_BOLT_WEBSOCKET_PONG_TIMEOUT
BoltWebSocketPongTimeout time.Duration
// HTTPEnabled controls HTTP API server
HTTPEnabled bool
// HTTPPort for HTTP connections (default 7474)
HTTPPort int
// HTTPAddress to bind to
HTTPAddress string
// HTTPSEnabled for encrypted connections
HTTPSEnabled bool
// HTTPSPort for HTTPS connections (default 7473)
HTTPSPort int
// HTTPTLSCert path to certificate
HTTPTLSCert string
// HTTPTLSKey path to private key
HTTPTLSKey string
// Environment is the runtime environment (development, production)
// Env: NORNICDB_ENV (default: development)
Environment string
// AllowHTTP permits non-TLS connections (development only)
// Env: NORNICDB_ALLOW_HTTP (default: true in development)
AllowHTTP bool
// PluginsDir is the directory for APOC plugins
// Env: NORNICDB_PLUGINS_DIR (default: ./plugins)
PluginsDir string
// HeimdallPluginsDir is the directory for Heimdall plugins
// Env: NORNICDB_HEIMDALL_PLUGINS_DIR (default: ./plugins/heimdall)
HeimdallPluginsDir string
// EnableCORS enables CORS headers for cross-origin requests
// Env: NORNICDB_CORS_ENABLED (default: false for security)
EnableCORS bool
// CORSOrigins is a comma-separated list of allowed origins
// Use "*" to allow all origins (not recommended for production with credentials)
// Env: NORNICDB_CORS_ORIGINS (default: empty - must be explicitly configured)
// Example: "https://myapp.com,https://admin.myapp.com"
CORSOrigins []string
}
ServerConfig holds server settings.
type StorageRuntimeConfig ¶ added in v1.1.0
type StorageRuntimeConfig struct {
// BytesMetricInterval overrides the bytes_metrics_sweeper cadence.
// Zero/unset uses storage.DefaultBytesMetricsInterval (30s).
BytesMetricInterval time.Duration `yaml:"bytes_metric_interval"`
}
Configuration is organized into logical sections:
- Auth: Authentication and authorization
- Database: Storage and transaction settings
- Server: Bolt and HTTP server settings
- Memory: NornicDB-specific memory decay and embeddings
- Compliance: GDPR/HIPAA/FISMA/SOC2 compliance controls
- Logging: Logging configuration
- Features: Experimental and optional features (feature flags)
Use LoadFromEnv() to create a Config from environment variables.
Example:
config := config.LoadFromEnv()
if err := config.Validate(); err != nil {
log.Fatal(err)
}
fmt.Printf("Config: %s\n", config)
StorageRuntimeConfig holds runtime-only storage settings that do not belong on DatabaseConfig (which mirrors persisted ENV/YAML knobs).
Plan 04-04 introduces BytesMetricInterval here so cmd/nornicdb can override the D-07 30s default sweep cadence at startup without polluting the on-disk config schema.
type YAMLConfig ¶
type YAMLConfig struct {
// Server configuration
Server struct {
BoltPort int `yaml:"bolt_port"`
HTTPPort int `yaml:"http_port"`
Port int `yaml:"port"` // Alias for bolt_port
Host string `yaml:"host"` // Bind address
Address string `yaml:"address"` // Alias for host
DataDir string `yaml:"data_dir"` // Data directory
Auth string `yaml:"auth"` // Format: "username:password" or "none"
BoltEnabled bool `yaml:"bolt_enabled"` // Enable Bolt protocol
HTTPEnabled bool `yaml:"http_enabled"` // Enable HTTP API
BoltServerAnnouncement string `yaml:"bolt_server_announcement"` // Override Bolt HELLO server metadata
TLS struct {
Enabled bool `yaml:"enabled"`
CertFile string `yaml:"cert_file"`
KeyFile string `yaml:"key_file"`
} `yaml:"tls"`
} `yaml:"server"`
// Database/Storage configuration
Database struct {
DataDir string `yaml:"data_dir"`
DefaultDatabase string `yaml:"default_database"`
ReadOnly bool `yaml:"read_only"`
TransactionTimeout string `yaml:"transaction_timeout"`
MaxConcurrentTransactions int `yaml:"max_concurrent_transactions"`
StrictDurability bool `yaml:"strict_durability"`
WALSyncMode string `yaml:"wal_sync_mode"`
WALSyncInterval string `yaml:"wal_sync_interval"`
WALAutoCompactionEnabled *bool `yaml:"wal_auto_compaction_enabled"`
WALRetentionMaxSegments int `yaml:"wal_retention_max_segments"`
WALRetentionMaxAge string `yaml:"wal_retention_max_age"`
WALRetentionLedgerDefaults bool `yaml:"wal_ledger_retention_defaults"`
WALSnapshotRetentionMaxCount int `yaml:"wal_snapshot_retention_max_count"`
WALSnapshotRetentionMaxAge string `yaml:"wal_snapshot_retention_max_age"`
EncryptionEnabled bool `yaml:"encryption_enabled"`
EncryptionPassword string `yaml:"encryption_password"`
EncryptionProvider string `yaml:"encryption_provider"`
EncryptionKeyURI string `yaml:"encryption_key_uri"`
EncryptionMasterKey string `yaml:"encryption_master_key"`
EncryptionAWSRegion string `yaml:"encryption_aws_region"`
EncryptionAWSKMSKeyID string `yaml:"encryption_aws_kms_key_id"`
EncryptionAWSEndpoint string `yaml:"encryption_aws_endpoint"`
EncryptionAWSRoleARN string `yaml:"encryption_aws_role_arn"`
EncryptionAWSRoleSessionName string `yaml:"encryption_aws_role_session_name"`
EncryptionAWSAccessKey string `yaml:"encryption_aws_access_key"`
EncryptionAWSSecretKey string `yaml:"encryption_aws_secret_key"`
EncryptionAWSSessionToken string `yaml:"encryption_aws_session_token"`
EncryptionAWSSharedCredsFilename string `yaml:"encryption_aws_shared_creds_filename"`
EncryptionAWSSharedCredsProfile string `yaml:"encryption_aws_shared_creds_profile"`
EncryptionAWSWebIdentityTokenFile string `yaml:"encryption_aws_web_identity_token_file"`
EncryptionAzureVaultName string `yaml:"encryption_azure_vault_name"`
EncryptionAzureKeyName string `yaml:"encryption_azure_key_name"`
EncryptionAzureTenantID string `yaml:"encryption_azure_tenant_id"`
EncryptionAzureClientID string `yaml:"encryption_azure_client_id"`
EncryptionAzureClientSecret string `yaml:"encryption_azure_client_secret"`
EncryptionAzureEnvironment string `yaml:"encryption_azure_environment"`
EncryptionAzureResource string `yaml:"encryption_azure_resource"`
EncryptionGCPProject string `yaml:"encryption_gcp_project"`
EncryptionGCPLocation string `yaml:"encryption_gcp_location"`
EncryptionGCPKeyRing string `yaml:"encryption_gcp_key_ring"`
EncryptionGCPKeyName string `yaml:"encryption_gcp_key_name"`
EncryptionGCPCredentialsFile string `yaml:"encryption_gcp_credentials_file"`
EncryptionAuditLogPath string `yaml:"encryption_audit_log_path"`
EncryptionAuditSignEvents *bool `yaml:"encryption_audit_sign_events"`
EncryptionAuditSignKey string `yaml:"encryption_audit_sign_key"`
EncryptionRotationEnabled *bool `yaml:"encryption_rotation_enabled"`
EncryptionRotationInterval string `yaml:"encryption_rotation_interval"`
BadgerNodeCacheMaxEntries int `yaml:"badger_node_cache_max_entries"`
BadgerEdgeTypeCacheMaxTypes int `yaml:"badger_edge_type_cache_max_types"`
MVCCRetentionMaxVersions int `yaml:"mvcc_retention_max_versions"`
MVCCRetentionTTL string `yaml:"mvcc_retention_ttl"`
IDFreelistTTL string `yaml:"id_freelist_ttl"`
MVCCLifecycleEnabled *bool `yaml:"mvcc_lifecycle_enabled"`
MVCCLifecycleCycleInterval string `yaml:"mvcc_lifecycle_interval"`
MVCCLifecycleMaxSnapshotAge string `yaml:"mvcc_lifecycle_max_snapshot_age"`
MVCCLifecycleMaxChainCap int `yaml:"mvcc_lifecycle_max_chain_cap"`
PersistSearchIndexes bool `yaml:"persist_search_indexes"`
} `yaml:"database"`
// Storage alias for database
Storage struct {
Path string `yaml:"path"`
// BytesMetricInterval is the cadence for the Plan 04-04 D-07
// bytes_metrics_sweeper lifecycle.Component. Default 30s when
// zero/unset. Configurable for tests + ops who want denser or
// sparser cadence.
BytesMetricInterval time.Duration `yaml:"bytes_metric_interval"`
} `yaml:"storage"`
// Authentication configuration
Auth struct {
Enabled bool `yaml:"enabled"`
Username string `yaml:"username"`
Password string `yaml:"password"`
MinPasswordLength int `yaml:"min_password_length"`
TokenExpiry string `yaml:"token_expiry"`
JWTSecret string `yaml:"jwt_secret"`
} `yaml:"auth"`
// Embedding configuration
Embedding struct {
Enabled bool `yaml:"enabled"`
Provider string `yaml:"provider"`
Model string `yaml:"model"`
URL string `yaml:"url"`
APIKey string `yaml:"api_key"`
Dimensions int `yaml:"dimensions"`
CacheSize int `yaml:"cache_size"`
MinSimilarity float64 `yaml:"min_similarity"`
} `yaml:"embedding"`
// Per-database search index master switches and warming triggers
// (global defaults; per-DB overrides via dbconfig.Store always win).
// `enabled`: bool, default true. `warming`: "startup"|"lazy", default startup.
Search struct {
BM25Enabled *bool `yaml:"bm25_enabled"`
BM25Warming string `yaml:"bm25_warming"`
VectorEnabled *bool `yaml:"vector_enabled"`
VectorWarming string `yaml:"vector_warming"`
} `yaml:"search"`
// Memory/Decay configuration
Memory struct {
DecayEnabled bool `yaml:"decay_enabled"`
DecayIntervalSeconds int `yaml:"decay_interval"`
AccessFlushBufferSize int `yaml:"access_flush_buffer_size"`
VisibilityThreshold float64 `yaml:"visibility_threshold"`
AutoLinksEnabled bool `yaml:"auto_links_enabled"`
AutoLinksSimilarityThreshold float64 `yaml:"auto_links_similarity_threshold"`
RuntimeLimit string `yaml:"runtime_limit"`
GCPercent int `yaml:"gc_percent"`
PoolEnabled bool `yaml:"pool_enabled"`
PoolMaxSize int `yaml:"pool_max_size"`
QueryCacheEnabled bool `yaml:"query_cache_enabled"`
QueryCacheSize int `yaml:"query_cache_size"`
QueryCacheTTL string `yaml:"query_cache_ttl"`
} `yaml:"memory"`
// Embedding worker configuration
EmbeddingWorker struct {
ScanInterval string `yaml:"scan_interval"`
BatchDelay string `yaml:"batch_delay"`
TriggerDebounce string `yaml:"trigger_debounce"`
MaxRetries int `yaml:"max_retries"`
ChunkSize int `yaml:"chunk_size"`
ChunkOverlap int `yaml:"chunk_overlap"`
PropertiesInclude []string `yaml:"properties_include"`
PropertiesExclude []string `yaml:"properties_exclude"`
IncludeLabels *bool `yaml:"include_labels"`
} `yaml:"embedding_worker"`
// K-means clustering
Kmeans struct {
Enabled bool `yaml:"enabled"`
} `yaml:"kmeans"`
// Auto-TLP (Topology Link Prediction)
AutoTLP struct {
Enabled bool `yaml:"enabled"`
Algorithm string `yaml:"algorithm"`
Weight float64 `yaml:"weight"`
TopK int `yaml:"top_k"`
MinScore float64 `yaml:"min_score"`
GraphRefreshInterval int `yaml:"graph_refresh_interval"`
ABTestEnabled bool `yaml:"ab_test_enabled"`
ABTestPercentage int `yaml:"ab_test_percentage"`
} `yaml:"auto_tlp"`
// Heimdall AI guardian
Heimdall struct {
Enabled bool `yaml:"enabled"`
Model string `yaml:"model"`
Provider string `yaml:"provider"` // local, ollama, openai
APIURL string `yaml:"api_url"` // for ollama/openai
APIKey string `yaml:"api_key"` // for openai
GPULayers *int `yaml:"gpu_layers"`
ContextSize int `yaml:"context_size"`
BatchSize int `yaml:"batch_size"`
MaxTokens int `yaml:"max_tokens"`
Temperature float64 `yaml:"temperature"`
AnomalyDetection bool `yaml:"anomaly_detection"`
RuntimeDiagnosis bool `yaml:"runtime_diagnosis"`
MemoryCuration bool `yaml:"memory_curation"`
MaxContextTokens int `yaml:"max_context_tokens"`
MaxSystemTokens int `yaml:"max_system_tokens"`
MaxUserTokens int `yaml:"max_user_tokens"`
MCPEnable bool `yaml:"mcp_enable"` // expose MCP tools to agentic loop (default: false)
MCPTools []string `yaml:"mcp_tools"` // allowlist: nil/omit = all, [] = none, [store,link] = only those
} `yaml:"heimdall"`
// Search rerank (Stage-2 reranking: local GGUF or external API like embeddings/Heimdall).
SearchRerank struct {
Enabled bool `yaml:"enabled"`
Provider string `yaml:"provider"` // local, ollama, openai, http
Model string `yaml:"model"`
APIURL string `yaml:"api_url"`
APIKey string `yaml:"api_key"`
} `yaml:"search_rerank"`
// Feature flags (subset supported in YAML).
Features struct {
// Qdrant gRPC compatibility endpoint.
QdrantGRPCEnabled bool `yaml:"qdrant_grpc_enabled"`
QdrantGRPCListenAddr string `yaml:"qdrant_grpc_listen_addr"`
QdrantGRPCMaxVectorDim int `yaml:"qdrant_grpc_max_vector_dim"`
QdrantGRPCMaxBatchPoints int `yaml:"qdrant_grpc_max_batch_points"`
QdrantGRPCMaxTopK int `yaml:"qdrant_grpc_max_top_k"`
QdrantGRPCRBAC struct {
Methods map[string]string `yaml:"methods"`
} `yaml:"qdrant_grpc_rbac"`
} `yaml:"features"`
// Qdrant gRPC compatibility endpoint (legacy YAML shape; supported for compatibility).
QdrantGRPC struct {
Enabled bool `yaml:"enabled"`
ListenAddr string `yaml:"listen_addr"`
MaxVectorDim int `yaml:"max_vector_dim"`
MaxBatchPoints int `yaml:"max_batch_points"`
MaxTopK int `yaml:"max_top_k"`
RBAC struct {
Methods map[string]string `yaml:"methods"`
} `yaml:"rbac"`
} `yaml:"qdrant_grpc"`
// Compliance settings
Compliance struct {
// Audit
AuditEnabled bool `yaml:"audit_enabled"`
AuditLogPath string `yaml:"audit_log_path"`
AuditRetentionDays int `yaml:"audit_retention_days"`
// Retention
RetentionEnabled bool `yaml:"retention_enabled"`
RetentionPolicyDays int `yaml:"retention_policy_days"`
RetentionAutoDelete bool `yaml:"retention_auto_delete"`
RetentionExemptRoles []string `yaml:"retention_exempt_roles"`
// Access Control
AccessControlEnabled bool `yaml:"access_control_enabled"`
SessionTimeout string `yaml:"session_timeout"`
MaxFailedLogins int `yaml:"max_failed_logins"`
LockoutDuration string `yaml:"lockout_duration"`
// Encryption
EncryptionAtRest bool `yaml:"encryption_at_rest"`
EncryptionInTransit bool `yaml:"encryption_in_transit"`
EncryptionKeyPath string `yaml:"encryption_key_path"`
// Data Subject Rights
DataExportEnabled bool `yaml:"data_export_enabled"`
DataErasureEnabled bool `yaml:"data_erasure_enabled"`
DataAccessEnabled bool `yaml:"data_access_enabled"`
SubjectIdentifierProperties []string `yaml:"subject_identifier_properties"`
SubjectPseudonymizeProperties []string `yaml:"subject_pseudonymize_properties"`
SubjectRedactProperties []string `yaml:"subject_redact_properties"`
// Anonymization
AnonymizationEnabled bool `yaml:"anonymization_enabled"`
AnonymizationMethod string `yaml:"anonymization_method"`
// Consent
ConsentRequired bool `yaml:"consent_required"`
ConsentVersioning bool `yaml:"consent_versioning"`
ConsentAuditTrail bool `yaml:"consent_audit_trail"`
// Breach
BreachDetectionEnabled bool `yaml:"breach_detection_enabled"`
BreachNotifyEmail string `yaml:"breach_notify_email"`
BreachNotifyWebhook string `yaml:"breach_notify_webhook"`
} `yaml:"compliance"`
Retention struct {
SweepInterval int `yaml:"sweep_interval"`
ExcludedLabels []string `yaml:"excluded_labels"`
PoliciesFile string `yaml:"policies_file"`
DefaultPolicies bool `yaml:"default_policies"`
MaxSweepRecords int `yaml:"max_sweep_records"`
Policies []RetentionPolicyConfig `yaml:"policies"`
} `yaml:"retention"`
// Logging configuration
Logging struct {
Level string `yaml:"level"`
Format string `yaml:"format"`
Output string `yaml:"output"`
QueryLogEnabled bool `yaml:"query_log_enabled"`
SlowQueryThreshold string `yaml:"slow_query_threshold"`
} `yaml:"logging"`
// Observability configuration (Phase 1 — OBS-02)
Observability struct {
Metrics struct {
Enabled *bool `yaml:"enabled"`
Listen string `yaml:"listen"`
TenantLabelsEnabled *bool `yaml:"tenant_labels_enabled"`
} `yaml:"metrics"`
Tracing struct {
Enabled *bool `yaml:"enabled"`
Endpoint string `yaml:"endpoint"`
Protocol string `yaml:"protocol"`
Insecure *bool `yaml:"insecure"`
Timeout string `yaml:"timeout"`
} `yaml:"tracing"`
Pprof struct {
Enabled *bool `yaml:"enabled"`
Listen string `yaml:"listen"`
} `yaml:"pprof"`
} `yaml:"observability"`
// Plugins configuration
Plugins struct {
Dir string `yaml:"dir"` // APOC plugins directory
HeimdallDir string `yaml:"heimdall_dir"` // Heimdall plugins directory
} `yaml:"plugins"`
// Databases is a per-database override map (keyed by database name).
// Each entry is a free-form string→string map of dbconfig keys (e.g.
// NORNICDB_SEARCH_BM25_ENABLED) → values. Loaded into dbconfig.Store
// at first boot ONLY when the store has no row for that (dbName, key)
// pair yet — admin API edits made later are authoritative across
// restarts. See pkg/config/dbconfig/store.go LoadWithYAMLDefaults.
//
// Example:
//
// databases:
// analytics:
// NORNICDB_SEARCH_BM25_ENABLED: "false"
// NORNICDB_SEARCH_VECTOR_WARMING: "lazy"
// audit_logs:
// NORNICDB_SEARCH_BM25_ENABLED: "false"
// NORNICDB_SEARCH_VECTOR_ENABLED: "false"
Databases map[string]map[string]string `yaml:"databases"`
}
YAMLConfig represents the YAML configuration file structure. All fields mirror the environment variable configuration options.