// CONTENTS Part 05 · Data and persistence

// PART 05

Cache, search, and schema reference

Chapter 24 / 56 2 min read English Part 05 of 14

Three support systems make the hot path fast: the LLM response cache, full-text search, and the schema layer. This page gives the real configuration keys and defaults, read from the code.

LLM response cache

The cache (botllm/src/cache/) avoids regenerating answers. Behavior is per-bot configuration via ConfigManager:

Key Default in code Meaning
llm-cache true (with_db_pool.rs) enable response caching
llm-cache-semantic false (llm_setup.rs) reuse answers for semantically similar prompts, not only identical ones
llm-cache-threshold 0.85 (llm_setup.rs) similarity threshold for a semantic hit (0.0–1.0)
llm-cache-ttl the cache config’s own TTL (with_db_pool.rs fallback) entry lifetime in seconds

The semantic matcher embeds the prompt and compares against stored entries; when llm-cache-semantic is off, only exact-prompt hits are served. Note the correction against older documentation: the semantic mode defaults to off and the threshold defaults to 0.85, not 0.95.

Embedding for the semantic path uses the same embedding service as retrieval: embedding-url plus embedding-model (default model all-MiniLM-L6-v2). The on-device desktop builds instead spawn a local embedding server over a GGUF model from the stack.

Conversation memory windows

The episodic memory manager (botbasic_ai/src/keywords/episodic_memory/) trims and summarizes conversation context:

Key Default Meaning
episodic-memory-enabled true enable the manager
episodic-memory-history 2 previous exchanges kept verbatim in context
episodic-memory-threshold 4 summarize/compact after N exchanges
episodic-memory-model fast model bucket used for summarization
episodic-memory-max-episodes 100 episode cap
episodic-memory-retention-days 365 retention window
episodic-memory-auto-summarize true summarize automatically

The botsearch crate provides the full-text search service over platform content. Retrieval for the model is a different subsystem — vector search in Qdrant with the six rag-mode strategies (see the RAG page). Use botsearch for app-level search (finding records, documents, conversations), not for prompt context.

Cache in the wider platform

Cache Backed by Example
Suggestions Valkey suggestions:{bot}:{session} ADD_SUGGESTION delivery
Publish ledger memory + Redis mirror output_publish:{session} output publishing dedup
Drive listings in-process, 60 s TTL pipeline/drive_context.rs
Sandbox previews in-process, 1-hour TTL, capacity 128 generated HTML previews
Config reads per-bot config cache with invalidation config_reload.rs

Volatile caches are documented as such: a restart may drop any of them, and the durable source (PostgreSQL, Drive, Valkey) rebuilds them.

Schema reference pointers

  • Column-level reference: generated from botschema + migrations (schema reference page).
  • Changing the schema: see Migrations — migration → diesel migration run → diesel print-schema → update botschema → commit together.
  • App data that should not have a table at all: the user_data virtual-table system behind /api/db/*, namespaced per app.

Found a mistake? Open an issue · All books

// SEARCH ESC
Pagefind · 236 pages · 4 books Enter to open ↑ ↓ to move