Skip to content
GitHub

Configuration

The config section key is ai_memory.

application.yaml
ai_memory:
enabled: true
default_backend: in_memory
ttl_seconds: 2592000
working:
system_prompt_tokens: 512
recent_turns_fraction: 0.4
episodic_fraction: 0.3
semantic_fraction: 0.2
tool_descriptions_fraction: 0.1
max_recent_turns: 20
episodic:
default_top_k: 10
recency_weight: 0.3
importance_weight: 0.2
relevance_weight: 0.5
ttl_seconds: 0
semantic:
min_confidence: 0.5
max_facts_per_entity: 100
consolidation:
enabled: true
interval_seconds: 3600.0
age_threshold_hours: 24.0
importance_prune_threshold: 0.1
batch_size: 100
NameTypeDefaultEnv VarDescription
enabledboolTrueLEX_AI_MEMORY__ENABLEDEnable the AI memory subsystem
default_backendstr"in_memory"LEX_AI_MEMORY__DEFAULT_BACKENDBackend type (in_memory, cache, database, vector)
ttl_secondsint2592000LEX_AI_MEMORY__TTL_SECONDSDefault entry TTL (0 = never expire)
NameTypeDefaultEnv VarDescription
system_prompt_tokensint512LEX_AI_MEMORY__WORKING__SYSTEM_PROMPT_TOKENSFixed token allocation for system prompt
recent_turns_fractionfloat0.4LEX_AI_MEMORY__WORKING__RECENT_TURNS_FRACTIONFraction of remaining budget for recent turns
episodic_fractionfloat0.3LEX_AI_MEMORY__WORKING__EPISODIC_FRACTIONFraction for episodic recall
semantic_fractionfloat0.2LEX_AI_MEMORY__WORKING__SEMANTIC_FRACTIONFraction for semantic facts
tool_descriptions_fractionfloat0.1LEX_AI_MEMORY__WORKING__TOOL_DESCRIPTIONS_FRACTIONFraction for tool descriptions
max_recent_turnsint20LEX_AI_MEMORY__WORKING__MAX_RECENT_TURNSHard cap on recent turns
NameTypeDefaultEnv VarDescription
default_top_kint10LEX_AI_MEMORY__EPISODIC__DEFAULT_TOP_KDefault number of episodes to retrieve
recency_weightfloat0.3LEX_AI_MEMORY__EPISODIC__RECENCY_WEIGHTWeight for temporal recency
importance_weightfloat0.2LEX_AI_MEMORY__EPISODIC__IMPORTANCE_WEIGHTWeight for entry importance
relevance_weightfloat0.5LEX_AI_MEMORY__EPISODIC__RELEVANCE_WEIGHTWeight for semantic similarity
ttl_secondsint0LEX_AI_MEMORY__EPISODIC__TTL_SECONDSEntry TTL (0 = never expire)
NameTypeDefaultEnv VarDescription
min_confidencefloat0.5LEX_AI_MEMORY__SEMANTIC__MIN_CONFIDENCEMinimum confidence to store a fact
max_facts_per_entityint100LEX_AI_MEMORY__SEMANTIC__MAX_FACTS_PER_ENTITYHard cap on facts per entity
NameTypeDefaultEnv VarDescription
enabledboolTrueLEX_AI_MEMORY__CONSOLIDATION__ENABLEDEnable automatic consolidation
interval_secondsfloat3600.0LEX_AI_MEMORY__CONSOLIDATION__INTERVAL_SECONDSHow often to run a consolidation pass
age_threshold_hoursfloat24.0LEX_AI_MEMORY__CONSOLIDATION__AGE_THRESHOLD_HOURSMin entry age before consolidation
importance_prune_thresholdfloat0.1LEX_AI_MEMORY__CONSOLIDATION__IMPORTANCE_PRUNE_THRESHOLDEntries below this are prunable
batch_sizeint100LEX_AI_MEMORY__CONSOLIDATION__BATCH_SIZEMax entries per consolidation pass

Prefix: LEX_AI_MEMORY__, nested delimiter __:

Terminal window
export LEX_AI_MEMORY__DEFAULT_BACKEND=cache
export LEX_AI_MEMORY__WORKING__MAX_RECENT_TURNS=50
export LEX_AI_MEMORY__CONSOLIDATION__INTERVAL_SECONDS=7200