Documentation
¶
Index ¶
- Constants
- Variables
- func ExpandHome(path string) string
- func GetAppDir() (string, error)
- func GetConfigPath() string
- func GetPIDPath() (string, error)
- func InitConfig() error
- func ResetForTesting()
- func SafePath(path string) error
- func ValidateBinaryPath(path string) error
- func ValidateConfig(cfg *Config) error
- func ValidateReload(oldCfg, newCfg *Config) error
- func WriteConfig(path string, cfg *Config) error
- func WriteMinimalConfig(path string, cfg *Config) error
- type AnalysisConfig
- type ClaudeConfig
- type Config
- type ConfigSchema
- type DaemonConfig
- type EmbeddingsConfig
- type GraphConfig
- type HardcodedSetting
- type IntegrationsConfig
- type MCPConfig
- type MinimalClaudeConfig
- type MinimalConfig
- type MinimalDaemonConfig
- type MinimalEmbeddingsConfig
- type MinimalGraphConfig
- type MinimalIntegrationsConfig
- type MinimalMCPConfig
- type RootField
- type SchemaField
- type SchemaItem
- type SchemaSection
- type ValidationError
- type Validator
Constants ¶
const ( AppDirName = ".memorizer" MemoryDirName = "memory" CacheDirName = ".cache" ConfigFile = "config.yaml" DaemonLogFile = "daemon.log" DaemonPIDFile = "daemon.pid" MCPLogFile = "mcp.log" )
Application directory and file names
const ( EmbeddingsAPIKeyEnv = "OPENAI_API_KEY" // Internal settings - not configurable EmbeddingsCacheEnabled = true // Always enabled for performance EmbeddingsBatchSize = 100 // Optimized for OpenAI API rate limits )
Hardcoded Embeddings environment variable names and internal settings
const ( DefaultEmbeddingsProvider = "openai" DefaultEmbeddingsModel = "text-embedding-3-small" DefaultEmbeddingsDimensions = 1536 )
Embeddings defaults - can be overridden in config.yaml
const (
ClaudeAPIKeyEnv = "ANTHROPIC_API_KEY"
)
Hardcoded environment variable names (convention over configuration) These define which environment variables are checked for credentials. The actual values (API keys, passwords) come from the environment or config file.
const (
GraphPasswordEnv = "FALKORDB_PASSWORD"
)
Hardcoded Graph environment variable names
const (
OutputShowRecentDays = 7
)
Hardcoded Output settings (convention over configuration)
Variables ¶
var DefaultConfig = Config{ MemoryRoot: "~/" + AppDirName + "/" + MemoryDirName, Claude: ClaudeConfig{ Model: "claude-sonnet-4-5-20250929", MaxTokens: 1500, Timeout: 30, EnableVision: true, }, Analysis: AnalysisConfig{ Enabled: true, MaxFileSize: 10485760, SkipExtensions: DefaultSkipExtensions, SkipFiles: DefaultSkipFiles, CacheDir: "~/" + AppDirName + "/" + CacheDirName, }, Daemon: DaemonConfig{ DebounceMs: 500, Workers: 3, RateLimitPerMin: 20, FullRebuildIntervalMinutes: 60, HTTPPort: 0, LogFile: "~/" + AppDirName + "/" + DaemonLogFile, LogLevel: "info", }, MCP: MCPConfig{ LogFile: "~/" + AppDirName + "/" + MCPLogFile, LogLevel: "info", DaemonHost: "localhost", DaemonPort: 0, }, Integrations: IntegrationsConfig{ Enabled: []string{}, }, Graph: GraphConfig{ Host: "localhost", Port: 6379, Database: "memorizer", Password: "", SimilarityThreshold: 0.7, MaxSimilarFiles: 10, }, Embeddings: EmbeddingsConfig{ Enabled: false, APIKey: "", Provider: DefaultEmbeddingsProvider, Model: DefaultEmbeddingsModel, Dimensions: DefaultEmbeddingsDimensions, }, }
DefaultConfig provides sensible defaults for all configuration settings. INTERNAL settings (not shown in initialized config but available for power users): - claude.max_tokens, analysis.max_file_size, analysis.skip_extensions, analysis.skip_files - daemon.debounce_ms, daemon.workers, daemon.rate_limit_per_min, daemon.full_rebuild_interval_minutes - graph.similarity_threshold, graph.max_similar_files, integrations.enabled
var DefaultSkipExtensions = []string{".zip", ".tar", ".gz", ".exe", ".bin", ".dmg", ".iso"}
Default skip patterns for analysis
var DefaultSkipFiles = []string{"memorizer"}
Functions ¶
func ExpandHome ¶
func GetAppDir ¶
GetAppDir returns the application directory path. Checks MEMORIZER_APP_DIR environment variable first, then falls back to ~/.agentic-memorizer
func GetConfigPath ¶
func GetConfigPath() string
func GetPIDPath ¶
GetPIDPath returns the daemon PID file path. The PID file is stored at ~/.agentic-memorizer/daemon.pid
func InitConfig ¶
func InitConfig() error
func ResetForTesting ¶
func ResetForTesting()
ResetForTesting resets viper state for testing purposes. This allows tests to use different config files without interference. Should only be called from test code.
func ValidateBinaryPath ¶
ValidateBinaryPath validates a binary path for execution
func ValidateConfig ¶
ValidateConfig validates the complete configuration
func ValidateReload ¶
ValidateReload checks if configuration changes are compatible with hot-reload Returns an error if any immutable fields have changed
func WriteConfig ¶
func WriteMinimalConfig ¶ added in v0.13.0
WriteMinimalConfig writes only user-facing configuration settings. Internal settings are omitted and will use defaults when loaded.
Types ¶
type AnalysisConfig ¶
type AnalysisConfig struct {
Enabled bool `mapstructure:"enabled" yaml:"enabled"`
MaxFileSize int64 `mapstructure:"max_file_size" yaml:"max_file_size"`
SkipExtensions []string `mapstructure:"skip_extensions" yaml:"skip_extensions"`
SkipFiles []string `mapstructure:"skip_files" yaml:"skip_files"`
CacheDir string `mapstructure:"cache_dir" yaml:"cache_dir"`
}
type ClaudeConfig ¶
type ClaudeConfig struct {
APIKey string `mapstructure:"api_key" yaml:"api_key"`
Model string `mapstructure:"model" yaml:"model"`
MaxTokens int `mapstructure:"max_tokens" yaml:"max_tokens"`
Timeout int `mapstructure:"timeout" yaml:"timeout"` // API request timeout in seconds (5-300)
EnableVision bool `mapstructure:"enable_vision" yaml:"enable_vision"` // Enable vision API for image analysis
}
type Config ¶
type Config struct {
MemoryRoot string `mapstructure:"memory_root" yaml:"memory_root"`
Claude ClaudeConfig `mapstructure:"claude" yaml:"claude"`
Analysis AnalysisConfig `mapstructure:"analysis" yaml:"analysis"`
Daemon DaemonConfig `mapstructure:"daemon" yaml:"daemon"`
MCP MCPConfig `mapstructure:"mcp" yaml:"mcp"`
Integrations IntegrationsConfig `mapstructure:"integrations" yaml:"integrations"`
Graph GraphConfig `mapstructure:"graph" yaml:"graph"`
Embeddings EmbeddingsConfig `mapstructure:"embeddings" yaml:"embeddings"`
}
func (*Config) ToMinimalConfig ¶ added in v0.13.0
func (c *Config) ToMinimalConfig() *MinimalConfig
ToMinimalConfig converts a full Config to a MinimalConfig for writing. Only user-facing settings are included; internal settings use defaults.
type ConfigSchema ¶ added in v0.13.0
type ConfigSchema struct {
Items []SchemaItem // Can contain both RootField and SchemaSection
Hardcoded []HardcodedSetting
}
ConfigSchema describes all configuration settings including configurable settings (minimal and advanced) and hardcoded conventions.
func GetConfigSchema ¶ added in v0.13.0
func GetConfigSchema() *ConfigSchema
GetConfigSchema returns the complete configuration schema. Schema is generated automatically via reflection on Config and MinimalConfig structs. Tier classification is derived: fields in MinimalConfig are "minimal", others are "advanced".
type DaemonConfig ¶
type DaemonConfig struct {
DebounceMs int `mapstructure:"debounce_ms" yaml:"debounce_ms"`
Workers int `mapstructure:"workers" yaml:"workers"`
RateLimitPerMin int `mapstructure:"rate_limit_per_min" yaml:"rate_limit_per_min"`
FullRebuildIntervalMinutes int `mapstructure:"full_rebuild_interval_minutes" yaml:"full_rebuild_interval_minutes"`
HTTPPort int `mapstructure:"http_port" yaml:"http_port"`
LogFile string `mapstructure:"log_file" yaml:"log_file"`
LogLevel string `mapstructure:"log_level" yaml:"log_level"`
}
type EmbeddingsConfig ¶ added in v0.13.0
type EmbeddingsConfig struct {
Enabled bool `mapstructure:"enabled" yaml:"enabled"`
APIKey string `mapstructure:"api_key" yaml:"api_key"`
Provider string `mapstructure:"provider" yaml:"provider"` // Embedding provider (only "openai" currently supported)
Model string `mapstructure:"model" yaml:"model"` // Embedding model (e.g., text-embedding-3-small)
Dimensions int `mapstructure:"dimensions" yaml:"dimensions"` // Vector dimensions (must match model)
}
EmbeddingsConfig contains embedding provider configuration. Provider, model, and dimensions have sensible defaults but can be overridden.
type GraphConfig ¶ added in v0.13.0
type GraphConfig struct {
Host string `mapstructure:"host" yaml:"host"`
Port int `mapstructure:"port" yaml:"port"`
Database string `mapstructure:"database" yaml:"database"` // Graph database name
Password string `mapstructure:"password" yaml:"password"`
SimilarityThreshold float64 `mapstructure:"similarity_threshold" yaml:"similarity_threshold"`
MaxSimilarFiles int `mapstructure:"max_similar_files" yaml:"max_similar_files"`
}
GraphConfig contains FalkorDB knowledge graph configuration. FalkorDB is the required storage backend - there is no option to disable it.
type HardcodedSetting ¶ added in v0.13.0
HardcodedSetting describes a non-configurable constant
type IntegrationsConfig ¶
type IntegrationsConfig struct {
Enabled []string `mapstructure:"enabled" yaml:"enabled"`
}
IntegrationsConfig represents the complete integrations configuration section. The Enabled list tracks which integrations have been configured via setup commands. Integration-specific configuration (hooks, tools, etc.) is stored in framework-specific files (e.g., ~/.claude.json, ~/.claude/settings.json) rather than in this config file.
type MCPConfig ¶
type MCPConfig struct {
LogFile string `mapstructure:"log_file" yaml:"log_file"`
LogLevel string `mapstructure:"log_level" yaml:"log_level"`
DaemonHost string `mapstructure:"daemon_host" yaml:"daemon_host"`
DaemonPort int `mapstructure:"daemon_port" yaml:"daemon_port"`
}
func (*MCPConfig) GetDaemonURL ¶ added in v0.13.0
GetDaemonURL returns the daemon HTTP API URL constructed from host and port. Returns empty string if daemon port is not configured (0).
type MinimalClaudeConfig ¶ added in v0.13.0
type MinimalConfig ¶ added in v0.13.0
type MinimalConfig struct {
MemoryRoot string `yaml:"memory_root"`
Claude MinimalClaudeConfig `yaml:"claude,omitempty"`
Daemon MinimalDaemonConfig `yaml:"daemon,omitempty"`
MCP MinimalMCPConfig `yaml:"mcp,omitempty"`
Graph MinimalGraphConfig `yaml:"graph,omitempty"`
Embeddings MinimalEmbeddingsConfig `yaml:"embeddings,omitempty"`
Integrations MinimalIntegrationsConfig `yaml:"integrations,omitempty"`
}
MinimalConfig contains only user-facing settings for initial configuration. Internal settings use defaults and are not written to the initialized config file.
type MinimalDaemonConfig ¶ added in v0.13.0
type MinimalEmbeddingsConfig ¶ added in v0.13.0
type MinimalEmbeddingsConfig struct {
APIKey string `yaml:"api_key,omitempty"`
}
type MinimalGraphConfig ¶ added in v0.13.0
type MinimalIntegrationsConfig ¶ added in v0.13.0
type MinimalIntegrationsConfig struct {
Enabled []string `yaml:"enabled,omitempty"`
}
type MinimalMCPConfig ¶ added in v0.13.0
type RootField ¶ added in v0.13.0
type RootField struct {
Name string
Type string
Default any
Tier string
HotReload bool
Description string
}
RootField represents a simple-type field at the root of the configuration. Unlike nested sections, root fields are displayed directly without a wrapping section.
type SchemaField ¶ added in v0.13.0
type SchemaField struct {
Name string
Type string // "string", "int", "bool", "float64", "[]string"
Default any
Tier string // "minimal" or "advanced"
HotReload bool // true if hot-reloadable without daemon restart
Description string
}
SchemaField describes a single configuration field
type SchemaItem ¶ added in v0.13.0
type SchemaItem interface {
// contains filtered or unexported methods
}
SchemaItem represents an item in the configuration schema. It can be either a SchemaSection (for nested struct fields) or a RootField (for simple type fields at the root level).
type SchemaSection ¶ added in v0.13.0
type SchemaSection struct {
Name string
Description string
Fields []SchemaField
}
SchemaSection represents a config section (claude, daemon, etc.)
type ValidationError ¶
ValidationError represents a configuration validation error
func (*ValidationError) Error ¶
func (e *ValidationError) Error() string
Error implements the error interface