pub struct AppConfig {Show 43 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 auto_tag_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>,
pub permissions: Option<PermissionsConfig>,
pub transcripts: Option<TranscriptsConfig>,
pub hooks: Option<HooksConfig>,
pub subscriptions: Option<SubscriptionsConfig>,
pub verify: Option<VerifyConfig>,
pub postgres_statement_timeout_secs: Option<u64>,
pub postgres_pool_max_connections: Option<u32>,
pub postgres_pool_min_connections: Option<u32>,
pub postgres_acquire_timeout_secs: Option<u64>,
pub request_timeout_secs: Option<u64>,
pub llm_call_timeout_secs: Option<u64>,
pub mcp_federation_forward_url: Option<String>,
pub agents: Option<AgentsConfig>,
pub governance: Option<GovernanceConfig>,
pub confidence: Option<ConfidenceConfig>,
pub admin: Option<AdminConfig>,
pub schema_version: Option<u32>,
pub llm: Option<LlmSection>,
pub embeddings: Option<EmbeddingsSection>,
pub reranker: Option<RerankerSection>,
pub storage: Option<StorageSection>,
pub limits: Option<LimitsSection>,
}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>use the sectioned [llm].base_url / [embeddings].url (#1146); slated for removal in v0.8.0
Ollama base URL for LLM generation (default: http://localhost:11434)
DOC-6 (FX-C4-batch2, 2026-05-26): legacy flat field, slated
for removal in v0.8.0. Use the sectioned [llm].base_url /
[embeddings].url shape from #1146 instead. Run
ai-memory config migrate to rewrite legacy configs.
embed_url: Option<String>use [embeddings].url (#1146); slated for removal in v0.8.0
Separate URL for embedding model (defaults to ollama_url if unset)
DOC-6: legacy; use [embeddings].url.
embedding_model: Option<String>use [embeddings].model (#1146); slated for removal in v0.8.0
Embedding model override: mini_lm_l6_v2 or nomic_embed_v15
DOC-6: legacy; use [embeddings].model.
llm_model: Option<String>use [llm].model (#1146); slated for removal in v0.8.0
LLM model override (Ollama tag, e.g. “gemma4:e2b”)
DOC-6: legacy; use [llm].model.
auto_tag_model: Option<String>use [llm.auto_tag].model (#1146); slated for removal in v0.8.0
Dedicated model for auto_tag (and other short-structured LLM calls).
Defaults to gemma3:4b (fast, deterministic, ~0.7s p50 vs 15s for
thinking-mode Gemma 4). Falls back to llm_model if unset.
See L15 patch (2026-05-11) for rationale.
DOC-6: legacy; use [llm.auto_tag].model.
cross_encoder: Option<bool>use [reranker].enabled (#1146); slated for removal in v0.8.0
Enable cross-encoder reranking (true/false)
DOC-6: legacy; use [reranker].enabled.
default_namespace: Option<String>use [storage].default_namespace (#1146); slated for removal in v0.8.0
Default namespace for new memories
DOC-6: legacy; use [storage].default_namespace.
max_memory_mb: Option<usize>auto-tier resolution now resolves via the sectioned [storage] block (#1146); slated for removal in v0.8.0
Maximum memory budget in MB (used for auto tier selection)
DOC-6: legacy; the auto-tier path now resolves via the
sectioned [storage] block.
ttl: Option<TtlConfig>Per-tier TTL overrides
archive_on_gc: Option<bool>use [storage].archive_on_gc (#1146); slated for removal in v0.8.0
Archive memories before GC deletion (default: true)
DOC-6: legacy; use [storage].archive_on_gc.
api_key: Option<String>Optional API key for HTTP API authentication.
#1262 — skip_serializing prevents the secret from being
echoed back through any serde_json::to_string(&AppConfig)
path (capabilities overlays, debug dumps, audit traces).
#1454 — the manual Debug impl on AppConfig (just below the
struct) renders this field as <redacted>, so a {:?} of the
config never leaks the secret either (skip_serializing only
guards the serde JSON path, not Debug).
#1258 — AppConfig::zeroize_secrets (a free helper method,
NOT a blanket Drop impl) zeroizes this buffer; callers invoke
it immediately before scope-exit. A blanket Drop is
deliberately avoided so the ..AppConfig::default()
struct-update spread used across ~20 test sites still compiles.
archive_max_days: Option<i64>archive purge resolution moves under the sectioned [storage] block (#1146); slated for removal in v0.8.0
Maximum archive age in days for automatic purge during GC (default: disabled)
DOC-6: legacy; the archive purge knob resolves via the
sectioned [storage] block at v0.7.x.
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).
permissions: Option<PermissionsConfig>v0.7.0 K3 — [permissions] block. Drives the gate’s enforcement
posture (enforce / advisory / off). When unset, the
compiled default in PermissionsConfig::default applies
(advisory — preserves the v0.6.x honest-disclosure posture
where governance metadata was recorded but not blocked at the
gate). New installs that want the strict gate set
[permissions] mode = "enforce" explicitly.
transcripts: Option<TranscriptsConfig>v0.7.0 I3 — [transcripts] block. Per-namespace TTL and
archive-grace overrides for the transcript lifecycle sweeper.
Unset → compiled defaults apply globally
(DEFAULT_TRANSCRIPT_TTL_SECS / DEFAULT_TRANSCRIPT_ARCHIVE_GRACE_SECS).
hooks: Option<HooksConfig>v0.7.0 K7 — [hooks] block. Currently carries the
[hooks.subscription] hmac_secret server-wide override that
signs every outgoing webhook payload regardless of whether the
individual subscription supplied a per-subscription secret.
When unset, only per-subscription secrets are used (legacy
pre-K7 behaviour).
subscriptions: Option<SubscriptionsConfig>v0.7.0 H11 (#628 blocker) — [subscriptions] block. Carries
the allow_loopback_webhooks opt-in that re-enables loopback
webhook URLs (127.0.0.1, localhost, [::1]). Default-OFF
closes an authenticated SSRF gadget against local services
(Postgres on 5432, the hooks daemon, etc.). Operators who need
loopback for testing must set this explicitly.
verify: Option<VerifyConfig>v0.7.0 H5 (round-2) — [verify] block. Today exposes one
knob: require_nonce (default false). When true, every
POST /api/v1/links/verify request MUST include a
verification_nonce (UUID v4 expected); missing or replayed
nonces are rejected with 409 Conflict. Default-OFF preserves
the v0.6.x verify-anytime semantics for unmigrated clients.
postgres_statement_timeout_secs: Option<u64>v0.7.0 M4 — connection-level statement_timeout (in seconds)
applied via an after_connect hook to every postgres
connection in the pool. Bounds runaway queries — a pathological
pg_sleep(60) or an unbounded scan can otherwise wedge a
connection forever. Defaults to 30s when unset; set to 0 to
disable the limit (matches the postgres SET semantics).
Operators only need to touch this when the workload requires
long-running maintenance queries from the daemon itself.
postgres_pool_max_connections: Option<u32>v0.7.0 (a) — connection-pool ceiling (sqlx max_connections)
for the postgres backend. None selects the compiled
DEFAULT_MAX_CONNECTIONS. Operators tune this per module/daemon
without a recompile via AI_MEMORY_PG_POOL_MAX. Resolved by
[AppConfig::resolve_pg_pool]; non-positive values fall through
to the default.
postgres_pool_min_connections: Option<u32>v0.7.0 (a) — connection-pool floor of always-open warm
connections (sqlx min_connections). None selects the
compiled DEFAULT_MIN_CONNECTIONS. Operator knob:
AI_MEMORY_PG_POOL_MIN. Resolved by
[AppConfig::resolve_pg_pool]; non-positive values fall through
to the default.
postgres_acquire_timeout_secs: Option<u64>v0.7.0 (a) — how long a pool acquire() waits for a free
connection before erroring (sqlx acquire_timeout), in whole
seconds. None selects the compiled default derived from
DEFAULT_ACQUIRE_TIMEOUT. Operator knob:
AI_MEMORY_PG_ACQUIRE_TIMEOUT_SECS. Resolved by
[AppConfig::resolve_pg_pool]; non-positive values fall through
to the default.
request_timeout_secs: Option<u64>v0.7.0 H7 (round-2) — per-HTTP-request wall-clock timeout in
seconds. Applied as a middleware to every axum route in
crate::build_router so a slow-POST (slowloris-style)
attacker cannot keep a handler scope alive indefinitely.
None selects the compiled default of 60 seconds; operators
who need a different ceiling set
request_timeout_secs = <secs> in config.toml.
llm_call_timeout_secs: Option<u64>v0.7.0 H8 (round-2) — per-LLM-call wall-clock timeout in
seconds. Wraps every spawn_blocking invocation of an Ollama
call (auto_tag, expand_query, summarize_memories, …)
in tokio::time::timeout. None selects the compiled
default of 30 seconds; on timeout the call falls back to the
LLM-absent path (already exercised by L5/L7).
mcp_federation_forward_url: Option<String>v0.7.0 (issue #318) — when set, the MCP stdio server forwards
every write tool (memory_store, memory_link, memory_delete)
to this HTTP endpoint (typically the local ai-memory serve
daemon at http://localhost:9077) instead of writing to SQLite
directly. The HTTP daemon then runs the existing
broadcast_store_quorum / broadcast_link_quorum / etc. fanout,
closing the gap surfaced by a2a-gate v0.6.0 r6 where MCP-stdio
writes replicated locally but never reached the federation mesh.
Unset (the default) keeps the legacy direct-SQLite path so
single-node MCP deployments without a federation daemon behave
exactly as before. The forwarder uses reqwest::blocking and
surfaces HTTP errors as MCP error strings; on transport failure
the response carries the underlying error so operators can
distinguish “fanout daemon not running” from “quorum not met”.
agents: Option<AgentsConfig>v0.7.0 (issue #518) — [agents.defaults] block. Carries the
recall_scope defaults spliced into memory_recall /
GET /api/v1/recall / ai-memory recall requests that pass
session_default=true (or --session-default on the CLI) and
omit one or more filter fields. Closes the OpenClaw v0.6.3.1
“what were you working on?” recovery gap — agents picking up a
new session no longer need to remember to splice the canonical
namespace + recency filters on every cross-session recall.
None (the default) preserves single-tenant deployments and
existing recall semantics exactly as-is. The splice happens in
the handler before the storage call; explicit args always win
over the defaults.
governance: Option<GovernanceConfig>v0.7.0 SEC-2 (Cluster D, issue #767) — [governance] block.
Today exposes one knob: require_operator_pubkey (default
false). When true, daemon serve startup REFUSES to boot
if the governance_rules table contains any enabled = 1
rows AND no operator pubkey is resolved (env var or
~/.config/ai-memory/operator.key.pub). Closes the
fail-OPEN gap where a SQL-write gadget could install
enabled = 1 rules that the pre-L1-6 loader would honour
without signature check. Default false preserves the
pre-cluster-D contract for the install-script deploy where
no operator pubkey is yet on disk.
confidence: Option<ConfidenceConfig>v0.7.0 Cluster G (#767) — [confidence] block. Carries the
retention window for confidence_shadow_observations consumed
by the periodic GC sweep (shadow_retention_days, default 30).
Unset → the compiled default applies. Closes PERF-4: the v0.7.0
Form 5 closeout (#758) shipped the shadow-mode table but did
NOT ship retention, so a long-running shadow-enabled deployment
would see unbounded growth.
admin: Option<AdminConfig>v0.7.0 SHIP cluster (#946 / #957 / #960 / #961, 2026-05-20) —
[admin] top-level block. Carries the operator-configured
allowlist of agent_ids whose authenticated HTTP requests
are treated as admin-class callers (full cross-tenant
visibility for endpoints that must observe corpus-scale
metadata: GET /api/v1/export, GET /api/v1/agents,
GET /api/v1/stats, the POST /api/v1/quota/status list
path). None (the default) closes those endpoints to all
non-admin callers — the safe-by-default posture per CLAUDE.md
pm-v3. See AdminConfig for the full role-gate semantics.
schema_version: Option<u32>v0.7.x (#1146) — explicit configuration schema version. None
or 1 selects the v0.6.x flat-field parse path; 2 selects
the sectioned parse path ([llm], [embeddings], [reranker],
[storage]) and emits a WARN if any legacy flat field is also
present. Future bumps (3, 4, …) introduce additional schema
transitions and are gated through ai-memory config migrate.
llm: Option<LlmSection>v0.7.x (#1146) — [llm] sectioned LLM configuration. Carries
the canonical backend / model / base_url / api_key references
consumed by every LLM-init surface (MCP stdio, HTTP daemon,
ai-memory atomise, ai-memory curator, embed-client
disambiguator, the boot banner). Resolved via
AppConfig::resolve_llm; the resolver applies the uniform
precedence ladder (CLI flag > AI_MEMORY_LLM_* env > [llm]
section > legacy flat fields > compiled default).
Includes an optional [llm.auto_tag] sub-table for the fast
structured-output sibling that handles auto_tag, query
expansion, and contradiction detection — see LlmSection.
embeddings: Option<EmbeddingsSection>v0.7.x (#1146) — [embeddings] sectioned embedding-model
configuration. Consumed by the embedder bootstrap in
daemon_runtime and the MCP embed-client fallback path.
Resolved via AppConfig::resolve_embeddings.
reranker: Option<RerankerSection>v0.7.x (#1146) — [reranker] sectioned cross-encoder
configuration. Folds the legacy cross_encoder = bool knob
into a { enabled, model } table with explicit model
selection. Resolved via AppConfig::resolve_reranker.
storage: Option<StorageSection>v0.7.x (#1146) — [storage] sectioned storage configuration.
Carries default_namespace, archive_on_gc, archive_max_days,
max_memory_mb (folded from the previously-flat top-level
fields). The db path stays top-level per the I4 carve-out in
#1146 (path expansion semantics pinned by #507).
limits: Option<LimitsSection>v0.7.x — [limits] sectioned operator-tunable capacity limits.
Carries the per-(agent, namespace) daily memory-write quota, the
lifetime storage cap, the daily link-creation quota, and the
list/bulk request page-size cap. Resolved via
AppConfig::resolve_limits; the resolver applies the uniform
precedence ladder (AI_MEMORY_MAX_* env > [limits] section >
compiled default). Defaults are deliberately generous so the
substrate is invisible to small-scale operators; operators with
high event-rate workloads raise them per-deployment without
recompiling. See LimitsSection.
Implementations§
Source§impl AppConfig
impl AppConfig
Sourcepub fn zeroize_secrets(&mut self)
pub fn zeroize_secrets(&mut self)
#1258 — manually zeroize the api_key buffer. Callers that hold
the only owner of an AppConfig and are about to drop it
invoke this immediately before scope-exit so the secret bytes
do not linger on the heap. The free-standing helper (instead of
a blanket Drop impl on AppConfig) preserves the
..AppConfig::default() struct-update syntax used by ~20
existing test sites; adding a blanket Drop would forbid the
move-by-spread pattern Rust requires for Drop types.
Source§impl AppConfig
impl AppConfig
Sourcepub fn effective_hooks_hmac_secret(&self) -> Option<String>
pub fn effective_hooks_hmac_secret(&self) -> Option<String>
v0.7.0 K7 — resolved server-wide webhook HMAC secret. None
means no server-wide override (per-subscription secrets still
apply via the legacy code path).
Sourcepub fn effective_recall_scope(&self) -> Option<&RecallScope>
pub fn effective_recall_scope(&self) -> Option<&RecallScope>
v0.7.0 (issue #518) — resolved [agents.defaults.recall_scope]
block. Returns Some(&scope) when configured, None otherwise.
Consumed by the recall handlers (sqlite + postgres SAL branches,
MCP handle_recall, CLI cmd_recall) to splice defaults into
requests that pass session_default=true and omit one or more
filter fields.
Sourcepub fn effective_allow_loopback_webhooks(&self) -> bool
pub fn effective_allow_loopback_webhooks(&self) -> bool
v0.7.0 H11 (#628 blocker) — resolved loopback-webhook opt-in
flag. Defaults to false (loopback rejected — closes the
authenticated SSRF gadget against local services). Operators
who need loopback for testing set
[subscriptions] allow_loopback_webhooks = true.
Resolution order (mirrors effective_permissions_mode):
AI_MEMORY_ALLOW_LOOPBACK_WEBHOOKSenv var (1/true— case-insensitive). Lets the integration suite — which setsAI_MEMORY_NO_CONFIG=1and therefore cannot use[subscriptions]fromconfig.toml— bind wiremock at127.0.0.1:0and drive webhooks through it without touching the production default.[subscriptions].allow_loopback_webhooksfromconfig.toml.- Compiled default (
false— loopback rejected).
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_permissions_mode(&self) -> PermissionsMode
pub fn effective_permissions_mode(&self) -> PermissionsMode
v0.7.0 K3 — resolve the effective PermissionsMode consulted
by crate::db::enforce_governance.
Resolution order:
AI_MEMORY_PERMISSIONS_MODEenv var (enforce/advisory/off, case-insensitive). Lets the integration suite — which setsAI_MEMORY_NO_CONFIG=1and therefore cannot use[permissions]fromconfig.toml— flip the gate to Enforce per scenario.[permissions].modefromconfig.toml.- v0.7.0 secure default (
PermissionsMode::Enforce) when no explicit configuration is present. Round-2 F8 / Round-3 re-verify: prior to this round the unconfigured fallback wasPermissionsMode::default(=advisory), which left an upgrading deployment withmetadata.governance.write=ownerbypassable. We now resolve viacrate::permissions::resolve_v07_default_modeso every process-wide entry point (CLI, MCP, HTTP serve) shares the same secure-by-default posture; operators who want advisory set[permissions].mode = "advisory"explicitly.
Sourcepub fn effective_permission_rules(&self) -> Vec<PermissionRule>
pub fn effective_permission_rules(&self) -> Vec<PermissionRule>
v0.7.0 K9 — resolve the effective declarative rule set
consulted by crate::permissions::Permissions::evaluate.
Returns the rules from [permissions] when configured;
otherwise an empty vec (no declarative rules — mode + hooks
resolve every decision).
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).
Expands a leading ~ / ~/ in the config-provided path to $HOME
before returning (issue #507). Without this, db = "~/.claude/ai-memory.db"
in config.toml would land on disk as the literal four-char dir
~/.claude/... relative to cwd and the daemon would report
warn db unavailable against the real DB that lives at the
expanded path.
Sourcepub fn effective_ollama_url(&self) -> &str
pub fn effective_ollama_url(&self) -> &str
Resolve Ollama URL for LLM generation (config or default).
DOC-6: legacy resolver — kept for v0.7.x backward compat.
New callers should use the sectioned [llm] resolver.
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).
DOC-6: legacy resolver — kept for v0.7.x backward compat.
Sourcepub fn effective_request_timeout_secs(&self) -> u64
pub fn effective_request_timeout_secs(&self) -> u64
v0.7.0 H7 (round-2) — resolved per-request HTTP timeout.
Falls back to DEFAULT_REQUEST_TIMEOUT_SECS when the
request_timeout_secs config field is unset.
Sourcepub fn effective_llm_call_timeout_secs(&self) -> u64
pub fn effective_llm_call_timeout_secs(&self) -> u64
v0.7.0 H8 (round-2) — resolved per-LLM-call timeout. Falls
back to DEFAULT_LLM_CALL_TIMEOUT_SECS when the
llm_call_timeout_secs config field is unset.
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_transcripts(&self) -> TranscriptsConfig
pub fn effective_transcripts(&self) -> TranscriptsConfig
v0.7.0 I3 — resolve the TranscriptsConfig block, returning
a default (no namespace overrides → compiled global defaults)
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).
DOC-6: legacy resolver — kept for v0.7.x backward compat.
Sourcepub fn resolve_llm(
&self,
cli_backend: Option<&str>,
cli_model: Option<&str>,
cli_base_url: Option<&str>,
) -> ResolvedLlm
pub fn resolve_llm( &self, cli_backend: Option<&str>, cli_model: Option<&str>, cli_base_url: Option<&str>, ) -> ResolvedLlm
v0.7.x (#1146) — resolve the canonical LLM configuration.
cli_backend / cli_model / cli_base_url carry CLI-flag
overrides (pass None for ai-memory mcp / ai-memory serve
which currently expose no CLI override; the CLI plumbing lands
in a follow-up commit).
DOC-6: this resolver intentionally reads the legacy flat
fields as the lowest-precedence fallback layer (per the
sectioned/v2 contract), so the #[allow(deprecated)]
attribute is necessary here. External callers should pass
CLI / env / [llm] section values and let this resolver
reach for the legacy fields only when those are unset.
Sourcepub fn resolve_llm_auto_tag(&self) -> ResolvedLlm
pub fn resolve_llm_auto_tag(&self) -> ResolvedLlm
v0.7.x (#1146) — resolve the [llm.auto_tag] fast-structured-
output sibling. Fields fall back to Self::resolve_llm field-
by-field; commonly only model is overridden (defaults to
gemma3:4b per the L15 fast-structured-output policy).
DOC-6: reads the legacy auto_tag_model field as the
lowest-precedence fallback layer (#[allow(deprecated)]).
Sourcepub fn resolve_embeddings(&self) -> ResolvedEmbeddings
pub fn resolve_embeddings(&self) -> ResolvedEmbeddings
v0.7.x (#1146) — resolve the canonical embedder configuration.
#1598 — extended per-field precedence ladder:
backend:AI_MEMORY_EMBED_BACKENDenv >[embeddings].backendcompiled default (
ollama).url:AI_MEMORY_EMBED_BASE_URLenv >[embeddings].base_url[embeddings].url> legacyembed_url> legacyollama_urlthe backend alias’s default base URL (API backends) > the localhost Ollama default.model:AI_MEMORY_EMBED_MODELenv >[embeddings].modellegacy
embedding_model> compiled default (nomic-embed-text-v1.5); legacy aliases canonicalised.api_key: [resolve_embed_api_key] ladder (AI_MEMORY_EMBED_API_KEY> per-vendor alias env >[embeddings].api_key_env>[embeddings].api_key_file).embedding_dim:[embeddings].dimoverride >canonical_embedding_dimtable >None.
DOC-6: reads the legacy embed_url/embedding_model/
ollama_url fields as the lowest-precedence fallback layer.
Sourcepub fn resolve_reranker(&self) -> ResolvedReranker
pub fn resolve_reranker(&self) -> ResolvedReranker
v0.7.x (#1146) — resolve the canonical reranker configuration.
Folds the legacy cross_encoder: Option<bool> flag into the
enabled field; model defaults to ms-marco-MiniLM-L-6-v2.
DOC-6: reads the legacy cross_encoder field as the
lowest-precedence fallback layer.
Sourcepub fn resolve_models(&self) -> ResolvedModels
pub fn resolve_models(&self) -> ResolvedModels
v0.7.x (issue #1168) — bundle the three model-resolver outputs
into a single ResolvedModels triple for the capabilities
surface (MCP memory_capabilities, HTTP GET /api/v1/capabilities).
Routes through the canonical Self::resolve_llm,
Self::resolve_embeddings, and Self::resolve_reranker
resolvers so the capabilities models.* block reflects the
same resolved configuration the live LLM client / embedder /
reranker were built from, NEVER the compiled tier preset.
Pairs with ResolvedModels::from_tier_preset (back-compat
constructor for tests that scaffold a TierConfig without an
AppConfig).
Sourcepub fn resolve_storage(&self) -> ResolvedStorage
pub fn resolve_storage(&self) -> ResolvedStorage
v0.7.x (#1146) — resolve the canonical storage configuration.
DOC-6: reads the legacy default_namespace/archive_on_gc/
archive_max_days/max_memory_mb fields as the
lowest-precedence fallback layer.
Sourcepub fn resolve_limits(&self) -> ResolvedLimits
pub fn resolve_limits(&self) -> ResolvedLimits
v0.7.x — resolve the operator-tunable capacity limits.
Precedence ladder per field (highest wins):
AI_MEMORY_MAX_* env > [limits] section > compiled default.
Non-positive values (≤ 0) at any layer are treated as “unset” so
a stray 0 never silently disables writes — the next layer down
is consulted instead. The compiled defaults are the named
crate::quotas::DEFAULT_MAX_* constants and
crate::handlers::MAX_BULK_SIZE; no numeric literals live in
this resolver.
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,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
impl<T> ErasedDestructor for Twhere
T: 'static,
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