~/.agentmemory/.env. Create it by running agentmemory init, then uncomment the variables you want to activate. Restart agentmemory after making changes — the server reads the file at startup and does not hot-reload.
Every variable is optional. Without any keys set, agentmemory runs in a safe no-LLM mode: observations are indexed via synthetic compression, hybrid BM25 search still works, but LLM-backed summarisation, consolidation, and reflection are disabled.
Minimal Config
The smallest useful configuration — an LLM provider key plus the two most impactful features:~/.agentmemory/.env
agentmemory doctor after editing to verify the daemon sees your changes.
LLM Providers
agentmemory uses a single LLM provider for compression, summarisation, consolidation, and reflection. Set exactly one provider key. The detection order when multiple keys are present is:OPENAI_API_KEY → MINIMAX_API_KEY → ANTHROPIC_API_KEY → GEMINI_API_KEY → OPENROUTER_API_KEY → noop.
Additional LLM variables:
Embedding Providers
Embeddings power the vector leg of agentmemory’s hybrid search. Without an embedding provider, search falls back to BM25-only mode. The detection order is:EMBEDDING_PROVIDER override → GEMINI_API_KEY → OPENAI_API_KEY → VOYAGE_API_KEY → COHERE_API_KEY → OPENROUTER_API_KEY → local (offline).
Additional embedding variables:
EMBEDDING_PROVIDER=local runs entirely offline using the bundled all-MiniLM-L6-v2 model. It is slower on first use (model download) but requires no API key and works in air-gapped environments.Feature Flags
All feature flags default tofalse unless noted. Enable them by setting the variable to true in ~/.agentmemory/.env.
Additional behaviour variables:
Ports
Overriding
III_REST_PORT automatically shifts all derived ports, so a single variable is all you need to run a second instance on the same machine.Data Directory
Agent Memory writes all engine state —state_store.db, stream files, and a generated iii-config.yaml — to a single data directory. By default this lives outside the repository you launch from, so running npx @agentmemory/agentmemory inside a project does not drop a data/ folder into your working tree.
Default location by platform:
Resolution order:
--data-dir flag → AGENTMEMORY_DATA_DIR env var → existing ./data directory from a prior run (adopted so existing users don’t boot into an empty store) → platform default.
Pass . or ./data explicitly to opt in to repo-local state:
--instance <N> combines with the data directory: each instance writes to an instance-<N> subdirectory of the resolved path, so multiple instances never overwrite each other.Search Tuning
Adjust the balance between keyword and semantic search, and control how much context is injected per session.BM25_WEIGHT and VECTOR_WEIGHT are independent — they do not need to sum to 1.0. The graph weight is an additive bonus on top of the hybrid score, not a separate stream.Multi-Agent Scoping
When you run multiple agents or users against the same memory server, use these variables to namespace memories and control whether agents share or isolate their recall.- Isolated agent memory
Security
When
AGENTMEMORY_SECRET is set, all CLI commands (status, doctor, import-jsonl, etc.) automatically attach the Authorization: Bearer <secret> header so they continue to work without any extra configuration.