pub struct AppConfig {Show 20 fields
pub tier: Option<String>,
pub db: Option<String>,
pub ollama_url: Option<String>,
pub embed_url: Option<String>,
pub embedding_model: Option<String>,
pub llm_model: Option<String>,
pub cross_encoder: Option<bool>,
pub default_namespace: Option<String>,
pub max_memory_mb: Option<usize>,
pub ttl: Option<TtlConfig>,
pub archive_on_gc: Option<bool>,
pub api_key: Option<String>,
pub archive_max_days: Option<i64>,
pub identity: Option<IdentityConfig>,
pub scoring: Option<RecallScoringConfig>,
pub autonomous_hooks: Option<bool>,
pub logging: Option<LoggingConfig>,
pub audit: Option<AuditConfig>,
pub boot: Option<BootConfig>,
pub mcp: Option<McpConfig>,
}Expand description
Persistent configuration loaded from ~/.config/ai-memory/config.toml.
All fields are optional — CLI flags override file values, which override compiled defaults.
Fields§
§tier: Option<String>Feature tier: keyword, semantic, smart, autonomous
db: Option<String>Path to the SQLite database file
ollama_url: Option<String>Ollama base URL for LLM generation (default: http://localhost:11434)
embed_url: Option<String>Separate URL for embedding model (defaults to ollama_url if unset)
embedding_model: Option<String>Embedding model override: mini_lm_l6_v2 or nomic_embed_v15
llm_model: Option<String>LLM model override (Ollama tag, e.g. “gemma4:e2b”)
cross_encoder: Option<bool>Enable cross-encoder reranking (true/false)
default_namespace: Option<String>Default namespace for new memories
max_memory_mb: Option<usize>Maximum memory budget in MB (used for auto tier selection)
ttl: Option<TtlConfig>Per-tier TTL overrides
archive_on_gc: Option<bool>Archive memories before GC deletion (default: true)
api_key: Option<String>Optional API key for HTTP API authentication
archive_max_days: Option<i64>Maximum archive age in days for automatic purge during GC (default: disabled)
identity: Option<IdentityConfig>Identity-resolution overrides (Task 1.2 follow-up #198).
scoring: Option<RecallScoringConfig>Recall scoring — per-tier half-life for time-decay, and legacy_scoring
kill switch (v0.6.0.0).
autonomous_hooks: Option<bool>v0.6.0.0: when true, fire LLM autonomy hooks (auto_tag +
detect_contradiction) synchronously on every successful
memory_store. Off by default — the hook blocks store latency
behind an Ollama round-trip. AI_MEMORY_AUTONOMOUS_HOOKS=1
env var overrides the config file.
logging: Option<LoggingConfig>v0.6.3.1 (PR-5 / issue #487) — operational logging facility.
Default-OFF for privacy; opt-in turns on the rolling file
appender that captures every tracing::* call site to disk.
audit: Option<AuditConfig>v0.6.3.1 (PR-5 / issue #487) — security audit trail. Default-OFF for privacy; opt-in emits a hash-chained, tamper-evident JSON log of every memory mutation suitable for SIEM ingestion and SOC2 / HIPAA / GDPR / FedRAMP compliance evidence.
boot: Option<BootConfig>v0.6.3.1 (PR-9h / issue #487 PR #497 req #73) — boot privacy
kill-switch. Default-ON (existing users see no behavior change);
[boot] enabled = false silences boot entirely (empty stdout +
empty stderr, exit 0) for privacy-sensitive hosts where memory
titles must not enter CI logs. [boot] redact_titles = true
keeps the manifest header but replaces row titles with
<redacted> for compliance contexts that need the audit-trail
signal of “boot ran with N memories” without exposing subjects.
mcp: Option<McpConfig>v0.6.4 — MCP server tunables. Today this only carries profile
(the named tool surface). Future v0.6.4 phases add the
[mcp.allowlist] per-agent capability table (Track D —
v0.6.4-008).
Implementations§
Source§impl AppConfig
impl AppConfig
Sourcepub fn config_path() -> Option<PathBuf>
pub fn config_path() -> Option<PathBuf>
Returns the config file path: ~/.config/ai-memory/config.toml
Sourcepub fn load() -> Self
pub fn load() -> Self
Load config from disk. Returns AppConfig::default() if file is missing.
Set AI_MEMORY_NO_CONFIG=1 to skip config loading (used by integration tests).
Sourcepub fn effective_tier(&self, cli_tier: Option<&str>) -> FeatureTier
pub fn effective_tier(&self, cli_tier: Option<&str>) -> FeatureTier
Resolve the effective feature tier from config (CLI flag overrides).
Sourcepub fn effective_db(&self, cli_db: &Path) -> PathBuf
pub fn effective_db(&self, cli_db: &Path) -> PathBuf
Resolve the effective database path (CLI flag overrides config).
Sourcepub fn effective_ollama_url(&self) -> &str
pub fn effective_ollama_url(&self) -> &str
Resolve Ollama URL for LLM generation (config or default).
Sourcepub fn effective_ttl(&self) -> ResolvedTtl
pub fn effective_ttl(&self) -> ResolvedTtl
Resolve TTL configuration from config file, falling back to compiled defaults.
Sourcepub fn effective_scoring(&self) -> ResolvedScoring
pub fn effective_scoring(&self) -> ResolvedScoring
Resolve recall-scoring configuration (time-decay half-life) from the config file, falling back to compiled defaults. v0.6.0.0.
Sourcepub fn effective_archive_on_gc(&self) -> bool
pub fn effective_archive_on_gc(&self) -> bool
Whether to archive memories before GC deletion (default: true).
Sourcepub fn effective_profile(
&self,
cli_or_env: Option<&str>,
) -> Result<Profile, ProfileParseError>
pub fn effective_profile( &self, cli_or_env: Option<&str>, ) -> Result<Profile, ProfileParseError>
v0.6.4-001 — resolve the effective MCP tool profile.
Resolution order:
cli_or_env(already merged by clap’s#[arg(env="AI_MEMORY_PROFILE")])[mcp].profileconfig field- compiled default
"core"
§Errors
Returns crate::profile::ProfileParseError if any layer’s
value is malformed (unknown family or mixed-case token).
Sourcepub fn effective_autonomous_hooks(&self) -> bool
pub fn effective_autonomous_hooks(&self) -> bool
Whether post-store autonomy hooks (auto_tag + detect_contradiction)
fire on every successful memory_store. v0.6.0.0.
Precedence: AI_MEMORY_AUTONOMOUS_HOOKS=1 env var (truthy) >
config file > default false. AI_MEMORY_AUTONOMOUS_HOOKS=0 also
honored for explicit-off.
Sourcepub fn effective_anonymize_default(&self) -> bool
pub fn effective_anonymize_default(&self) -> bool
Whether to anonymize the default agent_id fallback (Task 1.2 #198).
Precedence: AI_MEMORY_ANONYMIZE=1 env var (truthy) > config file > default false.
Sourcepub fn effective_logging(&self) -> LoggingConfig
pub fn effective_logging(&self) -> LoggingConfig
Resolve the LoggingConfig block, returning a default
(disabled) instance when the config file omits it.
Sourcepub fn effective_audit(&self) -> AuditConfig
pub fn effective_audit(&self) -> AuditConfig
Resolve the AuditConfig block, returning a default
(disabled) instance when the config file omits it.
Sourcepub fn effective_boot(&self) -> BootConfig
pub fn effective_boot(&self) -> BootConfig
Resolve the BootConfig block, returning a default
(enabled, no redaction) instance when the config file omits
it. v0.6.3.1 (PR-9h / issue #487 PR #497 req #73).
Sourcepub fn effective_embed_url(&self) -> &str
pub fn effective_embed_url(&self) -> &str
Resolve URL for embedding model (falls back to ollama_url).
Sourcepub fn write_default_if_missing()
pub fn write_default_if_missing()
Write a default config file if one doesn’t exist yet.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for AppConfig
impl<'de> Deserialize<'de> for AppConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for AppConfig
impl RefUnwindSafe for AppConfig
impl Send for AppConfig
impl Sync for AppConfig
impl Unpin for AppConfig
impl UnsafeUnpin for AppConfig
impl UnwindSafe for AppConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more