Reference

Environment variables

Memory Layer reads values from the process environment, from memory-layer.env files next to config files, and from TOML config. Environment overrides use the MEMORY_LAYER__SECTION__KEY shape.

Common variables

VariableRequiredUsed for
MEMORY_LAYER_CONFIGOptionalSame as --config <path> for commands that load app config.
MEMORY_LAYER_PROFILEOptionalForce dev or prod; normally inferred from binary path.
MEMORY_LAYER_WRITER_IDOptionalSame as --writer-id / --agent-id for write-capable commands.
MEMORY_LAYER__SERVICE__API_TOKENUsually generatedService API token when supplied through env instead of TOML.
MEMORY_LAYER__DATABASE__URLSometimesPostgreSQL URL override.
OPENAI_API_KEYWhen configuredOpenAI or OpenAI-compatible LLM/embedding provider key.
VOYAGE_API_KEYWhen configuredVoyage embedding provider key.
COHERE_API_KEYWhen configuredCohere embedding provider key.
GEMINI_API_KEYWhen configuredGemini embedding provider key.
MEMORY_LAYER_TEST_DATABASE_URLTest onlyPgvector-backed integration test database.
MEMORY_LAYER_TEST_REQUIRE_DBTest onlyMake DB-backed tests fail instead of skip when the test DB is unavailable.

DATABASE_URL is useful for psql commands and some setup snippets, but Memory Layer's own config field is [database].url or MEMORY_LAYER__DATABASE__URL.

Provider variables

Provider keys are indirect. The TOML api_key_env value names the environment variable the service reads:

[[embeddings.backends]]
name = "voyage-code"
provider = "voyage"
api_key_env = "VOYAGE_API_KEY"
model = "voyage-code-3"
VOYAGE_API_KEY=pa-...

For local Ollama, api_key_env = "" is normally correct.

Config override examples

MEMORY_LAYER_PROFILE=dev cargo run --bin memory -- status --project memory
MEMORY_LAYER__DATABASE__URL='postgres://memory_layer:secret@127.0.0.1:5432/memory_layer' memory doctor
MEMORY_LAYER_WRITER_ID=codex-docs memory remember --project memory --note "Updated reference docs"

Diagnostics

memory doctor
memory status --project <project-slug> --json
memory embeddings list

memory doctor is the safest way to discover missing provider variables without printing secret values.

Next

Read Global config.

© 2026 Olivier Van Acker (3vilM33pl3). Memory Layer is AGPL-3.0-or-later with commercial licensing available.

On this page