Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

[memory] — memory behavior

Settings for how memories are stored, deduplicated, chunked, and abstracted.

[memory]
max_memories = 10000
similarity_threshold = 0.65
search_similarity_threshold = 0.2
max_search_results = 50

Capacity

FieldDefaultWhat it controls
max_memories10000Soft cap on memories per bank. Used for log warnings and admission control.
max_search_results50Default upper bound on results per query. Tools can override per-call.
max_list_limit10000Hard ceiling for list_memories with no explicit limit. Prevents accidental full-table scans.
memory_ttl_hoursNoneTime-to-live in hours. None = no expiry. Some(0) = no expiry (same as None).
max_content_length32768Reject content longer than this (bytes).
max_cascade_fanout5000Max abstraction dependents to load at once during cascade deletion. Prevents OOM.
raw_content_scan_limit5000Max raw content candidates during keyword/text search fallback.
max_total_candidates10000Max in-memory candidates during pyramid assembly before final ranking.

Similarity thresholds

FieldDefaultWhat it controls
similarity_threshold0.65Deduplication threshold. When a new memory’s embedding is closer than this to an existing one, dedup logic kicks in.
merge_threshold0.75Higher threshold to merge two memories into one (vs. keep both).
search_similarity_thresholdSome(0.2)Reject search results below this. Lower = more results.
near_duplicate_threshold0.92When a new memory’s embedding similarity to an existing memory exceeds this, a warning is logged. 0.0 disables. (Quality-control)
auto_link_threshold0.75Similarity threshold for auto-creating references relations between new and existing memories. 0.0 disables auto-linking.
auto_link_max_relations10Max auto-link relations per stored memory.

Enhancement

FieldDefaultWhat it controls
auto_enhancetrueAutomatically enrich new memories with LLM-generated metadata (entities, keywords, importance). Costs LLM tokens.
deduplicatetrueSkip storing near-duplicates.
auto_summary_threshold32768When L0 content accumulates past this size, trigger the L0→L1 summarization worker.

Document processing

FieldDefaultWhat it controls
document_chunk_size2000Chunk size in characters for document ingestion. 0 = no chunking.
chunk_threshold_chars1000When a single L0 memory exceeds this, split into sub-chunks for embedding. 0 = disable.
chunk_size_chars1000Target sub-chunk size in characters.
chunk_overlap_chars100Overlap between consecutive sub-chunks.

Warning

chunk_threshold_chars > chunk_size_chars will log a warning at startup — it means some content past the threshold can still slip through unsplit if it’s under chunk_threshold_chars.

LLM-assisted parsing (off by default)

These cost LLM tokens but help with malformed or unknown content.

FieldDefaultWhat it controls
use_llm_query_classificationfalseUse LLM for query intent classification (vs. keyword heuristic).
llm_format_detectionfalseWhen content-based format detection returns “unknown”, ask the LLM to identify. Sends first 4 KB.
llm_fallback_parsingfalseWhen structured parsers fail, ask the LLM to extract summary, entities, and content type.

Cost & quality

FieldDefaultWhat it controls
session_token_budget0Per-session LLM token budget. 0 = unlimited. When exceeded, expensive ops (enhance, classify, abstract) are skipped.
dry_runfalseLog what would be done without executing LLM calls. Useful for cost estimation.
contradiction_detectionfalseWhen storing new memories, ask the LLM to check the top-3 semantically similar memories for factual contradictions.
access_decay_hours168Time decay half-life (hours) for access-frequency boosting. Recent accesses boost score; older decay. 0 disables. (168 = 1 week)

Next