pub struct MemoryConfig {Show 53 fields
pub compression_guidelines: CompressionGuidelinesConfig,
pub sqlite_path: String,
pub history_limit: u32,
pub qdrant_url: String,
pub qdrant_api_key: Option<Secret>,
pub semantic: SemanticConfig,
pub summarization_threshold: usize,
pub context_budget_tokens: usize,
pub soft_compaction_threshold: f32,
pub hard_compaction_threshold: f32,
pub compaction_preserve_tail: usize,
pub compaction_cooldown_turns: u8,
pub auto_budget: bool,
pub prune_protect_tokens: usize,
pub cross_session_score_threshold: f32,
pub vector_backend: VectorBackend,
pub token_safety_margin: f32,
pub redact_credentials: bool,
pub autosave_assistant: bool,
pub autosave_min_length: usize,
pub tool_call_cutoff: usize,
pub sqlite_pool_size: u32,
pub sessions: SessionsConfig,
pub documents: DocumentConfig,
pub eviction: EvictionConfig,
pub compression: CompressionConfig,
pub sidequest: SidequestConfig,
pub graph: GraphConfig,
pub shutdown_summary: bool,
pub shutdown_summary_min_messages: usize,
pub shutdown_summary_max_messages: usize,
pub shutdown_summary_timeout_secs: u64,
pub structured_summaries: bool,
pub tiers: TierConfig,
pub admission: AdmissionConfig,
pub digest: DigestConfig,
pub context_strategy: ContextStrategy,
pub crossover_turn_threshold: u32,
pub consolidation: ConsolidationConfig,
pub forgetting: ForgettingConfig,
pub database_url: Option<String>,
pub store_routing: StoreRoutingConfig,
pub persona: PersonaConfig,
pub trajectory: TrajectoryConfig,
pub category: CategoryConfig,
pub tree: TreeConfig,
pub microcompact: MicrocompactConfig,
pub autodream: AutoDreamConfig,
pub key_facts_dedup_threshold: f32,
pub compression_spectrum: CompressionSpectrumConfig,
pub retrieval: RetrievalConfig,
pub reasoning: ReasoningConfig,
pub hebbian: HebbianConfig,
}Expand description
Memory subsystem configuration, nested under [memory] in TOML.
Controls SQLite and Qdrant storage, semantic recall, context compaction,
multi-tier promotion, and all memory-related background tasks.
§Example (TOML)
[memory]
sqlite_path = "~/.local/share/zeph/data/zeph.db"
qdrant_url = "http://localhost:6334"
history_limit = 50
summarization_threshold = 50
auto_budget = trueFields§
§compression_guidelines: CompressionGuidelinesConfig§sqlite_path: String§history_limit: u32§qdrant_url: String§qdrant_api_key: Option<Secret>Optional API key for authenticating to a remote or managed Qdrant cluster.
Required when qdrant_url points to a non-localhost host (e.g. Qdrant Cloud).
Leave None for local dev instances. The actual key is resolved from the vault:
zeph vault set ZEPH_QDRANT_API_KEY "<key>".
The value is wrapped in Secret to prevent accidental logging.
skip_serializing prevents the key from being written back to TOML on config save.
semantic: SemanticConfig§summarization_threshold: usize§context_budget_tokens: usize§soft_compaction_threshold: f32§hard_compaction_threshold: f32§compaction_preserve_tail: usize§compaction_cooldown_turns: u8§auto_budget: bool§prune_protect_tokens: usize§cross_session_score_threshold: f32§vector_backend: VectorBackend§token_safety_margin: f32§redact_credentials: bool§autosave_assistant: bool§autosave_min_length: usize§tool_call_cutoff: usize§sqlite_pool_size: u32§sessions: SessionsConfig§documents: DocumentConfig§eviction: EvictionConfig§compression: CompressionConfig§sidequest: SidequestConfig§graph: GraphConfig§shutdown_summary: boolStore a lightweight session summary to the vector store on shutdown when no session
summary exists yet for this conversation. Enables cross-session recall for short or
interrupted sessions that never triggered hard compaction. Default: true.
shutdown_summary_min_messages: usizeMinimum number of user-turn messages required before a shutdown summary is generated.
Sessions below this threshold are considered trivial and skipped. Default: 4.
shutdown_summary_max_messages: usizeMaximum number of recent messages (user + assistant) sent to the LLM for shutdown
summarization. Caps token cost for long sessions that never triggered hard compaction.
Default: 20.
shutdown_summary_timeout_secs: u64Per-attempt timeout in seconds for each LLM call during shutdown summarization.
Applies independently to the structured call and to the plain-text fallback.
Default: 10.
structured_summaries: boolUse structured anchored summaries for context compaction.
When enabled, hard compaction requests a JSON schema from the LLM
instead of free-form prose. Falls back to prose if the LLM fails
to produce valid JSON. Default: false.
tiers: TierConfigAOI three-layer memory tier promotion system.
When tiers.enabled = true, a background sweep promotes frequently-accessed episodic
messages to a semantic tier by clustering near-duplicates and distilling via LLM.
admission: AdmissionConfigA-MAC adaptive memory admission control.
When admission.enabled = true, each message is evaluated before saving and rejected
if its composite admission score falls below the configured threshold.
digest: DigestConfigSession digest generation at session end. Default: disabled.
context_strategy: ContextStrategyContext assembly strategy. Default: full_history (current behavior).
crossover_turn_threshold: u32Number of turns at which Adaptive strategy switches to MemoryFirst. Default: 20.
consolidation: ConsolidationConfigAll-Mem lifelong memory consolidation sweep.
When consolidation.enabled = true, a background loop clusters semantically similar
messages and merges them into consolidated entries via LLM.
forgetting: ForgettingConfigSleepGate forgetting sweep (#2397).
When forgetting.enabled = true, a background loop periodically decays importance
scores and prunes memories below the forgetting floor.
database_url: Option<String>PostgreSQL connection URL.
Used when the binary is compiled with --features postgres.
Can be overridden by the vault key ZEPH_DATABASE_URL.
Example: postgres://user:pass@localhost:5432/zeph
Default: None (uses sqlite_path instead).
store_routing: StoreRoutingConfigCost-sensitive store routing (#2444).
When store_routing.enabled = true, query intent is classified and routed to
the cheapest sufficient backend instead of querying all stores on every turn.
persona: PersonaConfigPersona memory layer (#2461).
When persona.enabled = true, user preferences and domain knowledge are extracted
from conversation history and injected into context after the system prompt.
trajectory: TrajectoryConfigTrajectory-informed memory (#2498).
category: CategoryConfigCategory-aware memory (#2428).
tree: TreeConfigTiMem temporal-hierarchical memory tree (#2262).
microcompact: MicrocompactConfigTime-based microcompact (#2699).
When microcompact.enabled = true, stale low-value tool outputs are cleared
from context when the session has been idle longer than gap_threshold_minutes.
autodream: AutoDreamConfigautoDream background memory consolidation (#2697).
When autodream.enabled = true, a constrained consolidation subagent runs
after a session ends if both min_sessions and min_hours gates pass.
key_facts_dedup_threshold: f32Cosine similarity threshold for deduplicating key facts in zeph_key_facts (#2717).
Before inserting a new key fact, its nearest neighbour is looked up in the
zeph_key_facts collection. If the best score is ≥ this threshold the fact is
considered a near-duplicate and skipped. Set to a value greater than 1.0 (e.g.
2.0) to disable dedup entirely. Default: 0.95.
compression_spectrum: CompressionSpectrumConfigExperience compression spectrum (#3305).
Controls three-tier retrieval policy and background skill-promotion engine.
retrieval: RetrievalConfigMemMachine-inspired retrieval-stage tuning (#3340).
Controls ANN candidate depth, search-prompt formatting, and the shape of memory snippets
injected into agent context. Separate from SemanticConfig because these knobs apply
uniformly across graph, hybrid, and vector-only recall paths.
§Example (TOML)
[memory.retrieval]
depth = 40
search_prompt_template = ""
context_format = "structured"reasoning: ReasoningConfigReasoningBank: distilled reasoning strategy memory (#3342).
When reasoning.enabled = true, each completed agent turn is evaluated by a self-judge
LLM call; successful and failed reasoning chains are compressed into short, generalizable
strategy summaries stored in reasoning_strategies (SQLite) and a matching Qdrant
collection. Top-k strategies are retrieved by embedding similarity at context-build time
and injected before the LLM call.
hebbian: HebbianConfigHebbian edge-weight reinforcement configuration (HL-F1/F2, #3344).
When enabled = true, the weight of each graph_edges row is incremented
by hebbian_lr every time that edge is traversed during a recall. Default: disabled.
§Example (TOML)
[memory.hebbian]
enabled = true
hebbian_lr = 0.1