Skip to content

Configuration Reference

Momo is configured entirely via environment variables. This page lists all available options organized by functional area.

The embedded C FFI under momo/ffi uses the same configuration model when momo_engine_new is called with config_json = NULL.

Terminal window
# Minimal configuration
MOMO_API_KEYS=your-secret-key ./momo
# With external LLM for AI features
MOMO_API_KEYS=your-secret-key \
LLM_MODEL=openai/gpt-4o-mini \
LLM_API_KEY=sk-... \
./momo

VariableDescriptionDefault
MOMO_HOSTBind address0.0.0.0
MOMO_PORTListen port3000
MOMO_API_KEYSComma-separated API keys for authentication(empty)
MOMO_RUNTIME_MODERuntime mode: all, api, or workerall
MOMO_SINGLE_PROCESSWhen mode=all, run API+workers in one processfalse

Authentication behavior:

  • If MOMO_API_KEYS is empty/unset, protected routes return 401 Unauthorized
  • Public routes (/api/v1/health, /api/v1/openapi.json, /api/v1/docs) remain accessible
  • Multiple keys can be provided for rotation: key1,key2,key3

VariableDescriptionDefault
MOMO_MCP_ENABLEDEnable the built-in MCP servertrue
MOMO_MCP_PATHPath for streamable HTTP MCP endpoint/mcp
MOMO_MCP_REQUIRE_AUTHRequire Bearer auth for MCP requeststrue
MOMO_MCP_DEFAULT_CONTAINER_TAGFallback container tag when none provideddefault
MOMO_MCP_PROJECT_HEADERHeader for project scopingx-sm-project
MOMO_MCP_PUBLIC_URLPublic base URL for OAuth discovery(none)
MOMO_MCP_AUTHORIZATION_SERVEROAuth issuer URL for discovery(none)

VariableDescriptionDefault
DATABASE_URLSQLite/LibSQL path or Turso URLfile:momo.db
DATABASE_AUTH_TOKENAuth token for Turso cloud DB(none)
DATABASE_LOCAL_PATHLocal replica path for remote DB(none)
DATABASE_READ_URLDedicated read replica URL(none)
DATABASE_READ_AUTH_TOKENAuth token for read replica(none)
DATABASE_READ_LOCAL_PATHLocal path for read replica(none)
DATABASE_READ_SYNC_INTERVAL_SECSSync interval for read replica2
DATABASE_BUSY_TIMEOUT_MSWait time when DB is locked5000
DATABASE_INIT_RETRY_ATTEMPTSSchema init retries8
DATABASE_INIT_RETRY_DELAY_MSDelay between init retries100
DATABASE_JOURNAL_MODESQLite journal modeWAL
DATABASE_SYNCHRONOUSSQLite synchronous settingNORMAL
DATABASE_WRITE_BATCH_SIZEChunk rows per transaction128
DATABASE_WRITE_BATCH_PAUSE_MSPause between batches0

VariableDescriptionDefault
EMBEDDING_MODELModel nameBAAI/bge-small-en-v1.5
EMBEDDING_DIMENSIONSVector dimensions384
EMBEDDING_BATCH_SIZEBatch size for queries256
EMBEDDING_INGEST_BATCH_SIZEBatch size for ingestion32
EMBEDDING_DUAL_MODELUse separate instances for query/ingesttrue
EMBEDDING_INGEST_BATCH_PAUSE_MSPause between ingest batches0
VariableDescriptionDefault
EMBEDDING_MODELUse provider/model format(none)
EMBEDDING_API_KEYAPI key for the provider(none)
EMBEDDING_BASE_URLCustom base URL(none)
EMBEDDING_TIMEOUTRequest timeout (seconds)30
EMBEDDING_MAX_RETRIESMax retry attempts3
EMBEDDING_RATE_LIMITRequests per second(none)

Supported providers: openai, openrouter, ollama, lmstudio, deepseek


VariableDescriptionDefault
CHUNK_SIZEChunk size in tokens512
CHUNK_OVERLAPOverlap between chunks50
PROCESSING_POLL_INTERVAL_SECSWorker polling interval10

Note: File uploads are limited to 25MB (hardcoded). Use the documents API for larger content.


VariableDescriptionDefault
OCR_MODELOCR providerlocal/tesseract
OCR_API_KEYAPI key for cloud providers(none)
OCR_BASE_URLCustom base URL(none)
OCR_LANGUAGESComma-separated language codeseng
OCR_TIMEOUTTimeout in seconds60
OCR_MAX_DIMENSIONMax image dimension (pixels)4096
OCR_MIN_DIMENSIONMin image dimension (pixels)50

Supported providers: local/tesseract, mistral/pixtral-12b, deepseek/deepseek-vl, openai/gpt-4o


VariableDescriptionDefault
TRANSCRIPTION_MODELModellocal/whisper-small
TRANSCRIPTION_API_KEYAPI key for cloud providers(none)
TRANSCRIPTION_BASE_URLCustom base URL(none)
TRANSCRIPTION_MODEL_PATHPath to local whisper model(none)
TRANSCRIPTION_TIMEOUTTimeout in seconds300 (5min)
TRANSCRIPTION_MAX_FILE_SIZEMax file size in bytes104857600 (100MB)
TRANSCRIPTION_MAX_DURATIONMax duration in seconds7200 (2h)

Supported providers: local/whisper-small, openai/whisper-1


LLM is optional. Without it, core search/storage work but advanced features are disabled.

VariableDescriptionDefault
LLM_MODELModel (format: provider/model)(none)
LLM_API_KEYAPI key(none)
LLM_BASE_URLCustom base URL(none)
LLM_TIMEOUTTimeout in seconds30
LLM_MAX_RETRIESMax retry attempts3
ENABLE_QUERY_REWRITEEnable query expansionfalse
QUERY_REWRITE_CACHE_SIZECache size for rewrites1000
QUERY_REWRITE_TIMEOUT_SECSRewrite timeout2
ENABLE_AUTO_RELATIONSAuto-detect relationshipstrue
ENABLE_CONTRADICTION_DETECTIONEnable contradiction logicfalse
DEFAULT_FILTER_PROMPTCustom LLM filter prompt(none)

Supported providers: openai, openrouter, ollama, lmstudio


Reranking is disabled by default.

VariableDescriptionDefault
RERANK_ENABLEDEnable rerankingfalse
RERANK_MODELReranker modelbge-reranker-base
RERANK_CACHE_DIRModel cache directory.fastembed_cache
RERANK_BATCH_SIZEBatch size64
RERANK_DOMAIN_MODELSDomain-specific models (format: domain:model,domain2:model2)(none)

VariableDescriptionDefault
EPISODE_DECAY_DAYSHalf-life for episode decay30.0
EPISODE_DECAY_FACTORDecay multiplier per period0.9
EPISODE_DECAY_THRESHOLDForgetting candidate threshold0.3
EPISODE_FORGET_GRACE_DAYSGrace period before permanent forget7
FORGETTING_CHECK_INTERVALCheck interval in seconds3600 (1h)
PROFILE_REFRESH_INTERVAL_SECSProfile refresh interval86400 (24h)
VariableDescriptionDefault
ENABLE_INFERENCESEnable background inferencefalse
INFERENCE_INTERVAL_SECSRun interval86400 (24h)
INFERENCE_CONFIDENCE_THRESHOLDMin confidence for inferred memories0.7
INFERENCE_MAX_PER_RUNMax inferences per cycle50
INFERENCE_CANDIDATE_COUNTCandidates per seed5
INFERENCE_SEED_LIMITMax seed memories50
INFERENCE_EXCLUDE_EPISODESExclude episodes from seedstrue

VariableDescriptionDefault
RUST_LOGLog level filtermomo=info,tower_http=debug

Common patterns:

  • RUST_LOG=momo=debug — Debug logging
  • RUST_LOG=momo=trace — Trace logging (verbose)
  • RUST_LOG=error — Errors only

Momo uses a provider/model format for external services:

openai/gpt-4o-mini
openrouter/anthropic/claude-3-5-sonnet
ollama/llama3.2
lmstudio/bge-small-en-v1.5

If no provider prefix is given, defaults to local (embedded models via FastEmbed/Whisper/Tesseract).


Terminal window
# Server
export MOMO_HOST=0.0.0.0
export MOMO_PORT=3000
export MOMO_API_KEYS=prod-key-1,prod-key-2
# Database (Turso)
export DATABASE_URL=libsql://my-db.turso.io
export DATABASE_AUTH_TOKEN=my-token
# Embeddings (OpenAI)
export EMBEDDING_MODEL=openai/text-embedding-3-small
export EMBEDDING_API_KEY=sk-...
# LLM (OpenRouter)
export LLM_MODEL=openrouter/anthropic/claude-3-5-sonnet
export LLM_API_KEY=sk-or-...
export ENABLE_CONTRADICTION_DETECTION=true
export ENABLE_QUERY_REWRITE=true
# OCR (Tesseract local)
export OCR_MODEL=local/tesseract
export OCR_LANGUAGES=eng,deu
# Transcription (OpenAI)
export TRANSCRIPTION_MODEL=openai/whisper-1
export TRANSCRIPTION_API_KEY=sk-...
# Reranking
export RERANK_ENABLED=true
export RERANK_MODEL=bge-reranker-base
# Logging
export RUST_LOG=momo=info

If you are linking against momo-ffi instead of running the HTTP server:

  • momo_engine_new(NULL, ...) loads config from the environment using the same rules as the server.
  • Passing rebuild_embeddings=true tells the engine to rebuild when stored vector dimensions do not match the configured embedding model.
  • Background work is optional. Start workers with momo_engine_start_workers if your embedded integration needs the same worker-driven behavior as the server runtime.
  • The FFI crate is built with local embeddings support enabled.

See Embedded C FFI Reference for the exported ABI and JSON contracts.