Skip to main content

AppConfig

Struct AppConfig 

Source
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

Source

pub fn config_path() -> Option<PathBuf>

Returns the config file path: ~/.config/ai-memory/config.toml

Source

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).

Source

pub fn load_from(path: &Path) -> Self

Load config from a specific path.

Source

pub fn effective_tier(&self, cli_tier: Option<&str>) -> FeatureTier

Resolve the effective feature tier from config (CLI flag overrides).

Source

pub fn effective_db(&self, cli_db: &Path) -> PathBuf

Resolve the effective database path (CLI flag overrides config).

Source

pub fn effective_ollama_url(&self) -> &str

Resolve Ollama URL for LLM generation (config or default).

Source

pub fn effective_ttl(&self) -> ResolvedTtl

Resolve TTL configuration from config file, falling back to compiled defaults.

Source

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.

Source

pub fn effective_archive_on_gc(&self) -> bool

Whether to archive memories before GC deletion (default: true).

Source

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:

  1. cli_or_env (already merged by clap’s #[arg(env="AI_MEMORY_PROFILE")])
  2. [mcp].profile config field
  3. compiled default "core"
§Errors

Returns crate::profile::ProfileParseError if any layer’s value is malformed (unknown family or mixed-case token).

Source

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.

Source

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.

Source

pub fn effective_logging(&self) -> LoggingConfig

Resolve the LoggingConfig block, returning a default (disabled) instance when the config file omits it.

Source

pub fn effective_audit(&self) -> AuditConfig

Resolve the AuditConfig block, returning a default (disabled) instance when the config file omits it.

Source

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).

Source

pub fn effective_embed_url(&self) -> &str

Resolve URL for embedding model (falls back to ollama_url).

Source

pub fn write_default_if_missing()

Write a default config file if one doesn’t exist yet.

Trait Implementations§

Source§

impl Clone for AppConfig

Source§

fn clone(&self) -> AppConfig

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for AppConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for AppConfig

Source§

fn default() -> AppConfig

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for AppConfig

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for AppConfig

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FromRef<T> for T
where T: Clone,

Source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> ErasedDestructor for T
where T: 'static,