Skip to main content
All configuration is stored in ~/.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
Run 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_KEYMINIMAX_API_KEYANTHROPIC_API_KEYGEMINI_API_KEYOPENROUTER_API_KEY → noop. Additional LLM variables:
If you set OPENROUTER_MODEL to a premium model like claude-sonnet or gpt-4o, background compression can cost $5+ per day under active use. Cheaper alternatives with comparable quality for memory compression: deepseek/deepseek-v4-pro, deepseek/deepseek-chat, qwen/qwen3-coder.

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_KEYOPENAI_API_KEYVOYAGE_API_KEYCOHERE_API_KEYOPENROUTER_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 to false 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.
Additional port and URL variables:

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.
All agents see all memories. Use this when you want every agent to benefit from the team’s accumulated context.
~/.agentmemory/.env

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.
Do not commit ~/.agentmemory/.env to version control. It may contain API keys and your bearer token.

Use agentmemory status to verify which features are active after editing your config. The status panel shows the detected LLM provider, embedding provider, and a checklist of every enabled feature flag.