Local-First & Privacy
memtomem is local-first: its default stores and search indexes live on your machine. Memory content is sent only across boundaries you configure, such as a remote embedding/LLM/rerank provider, remote MCP/LTM transport, webhook, Toolgraph server, or Langfuse tracing. Separately, local ONNX models download their model files over the network (see Model Downloads).
30-Second Boundary Check
Section titled “30-Second Boundary Check”| Path | Default state | Can content leave this machine? |
|---|---|---|
| SQLite storage, BM25 search, local ONNX embedding/reranking | local | No, unless you separately synchronize or expose the files |
MCP stdio, STM cache/metrics, loopback Web UI | local | No, except for traffic to an upstream MCP server you chose |
| Remote Ollama, OpenAI-compatible embedding/LLM, Cohere reranking | opt-in | Yes, to the configured endpoint |
| Remote MCP/LTM, webhooks, Toolgraph, Langfuse | opt-in | Yes, according to that integration’s configuration |
Model Downloads
Section titled “Model Downloads”Local ONNX embedding and reranking run on your machine, but their model files come from the network. When a model is needed and its Hugging Face snapshot is not in the cache, the files are downloaded from the Hugging Face Hub. If that download fails, fastembed can fall back to its own download URL. A model cached only through that fallback has no Hugging Face snapshot, so while online each load downloads from the Hub again and uses the fallback copy only if that fails. The exception is an embedding model with a non-fp32 embedding.onnx_variant: it loads the locally exported artifact in embedding.onnx_artifact_path instead of downloading. Reranker models are unaffected and follow the rule above. What is fetched is model weights; no memory content is sent. memtomem turns huggingface_hub telemetry off for these downloads.
- fastembed models are cached in
~/.memtomem/cache/fastembed/(created with mode0700on macOS and Linux when memtomem creates the default directory; existing caches keep their prior mode untilchmod 700 ~/.memtomem/cache/fastembed, and customMEMTOMEM_FASTEMBED_CACHE/FASTEMBED_CACHE_PATHpaths or Windows permissions are unchanged). Move the cache withMEMTOMEM_FASTEMBED_CACHE(checked first) orFASTEMBED_CACHE_PATH. memtomem applies onlyMEMTOMEM_*keys from a.envfile, so setFASTEMBED_CACHE_PATHin the shell environment or the client’senv.rerank.provider=local(sentence-transformers) uses the default Hugging Face cache instead. - While online,
mm warmupdownloads and loads the configured local models ahead of time. - Keyword-only mode (
embedding.provider=none, the Minimal preset) downloads no embedding model.
For an all-local setup, use the Minimal path or the local ONNX path (which downloads model files; see Model Downloads), keep Web UI and daemons on loopback, and do not configure optional remote providers.
Local-First Defaults
Section titled “Local-First Defaults”- Storage — The default store is local SQLite (
~/.memtomem/). The MCP stdio path exposes no network port;mm webbinds to loopback by default. - Embeddings — Keyword-only mode needs no embedding service. The built-in ONNX (fastembed) provider runs inference locally and downloads its model files as described in Model Downloads; Ollama and OpenAI-compatible providers are optional configured boundaries.
- Reranking — When you enable reranking, the default provider is local ONNX (fastembed) — no external API required.
- ONNX Runtime telemetry — Official ONNX Runtime builds from 1.29 upload telemetry to Microsoft on Linux and macOS by default. From memtomem 0.6.8, importing the package sets
ORT_DISABLE_TELEMETRY=1, so the server, themmCLI and the web UI all run with it off. A value already in the environment is left alone; setORT_DISABLE_TELEMETRY=0yourself to allow the upload. The Claude Code, Codex, OpenCode, Antigravity CLI and Cursor plugins pinned to memtomem 0.7.13, and the Hermes plugin installed at the 0.7.13 commit, also pass the same value in the server’s launch environment, as does the commit the Hermes catalog currently pins. A server older than 0.6.8 does not set it on import, so a manual entry that launches such a release runs with telemetry on unless the entry sets the variable. It does not cover a program that initializesonnxruntimebefore importing memtomem. On Windows, ONNX Runtime does not read this variable and emits ETW events, which Windows records only while a trace session is collecting. - STM proxy — The default client transport is stdio. Persisted response cache, metrics, and feedback are local SQLite files under
~/.memtomem/; configured upstream MCP servers and remote LTM transports retain their own network boundaries. - No account — It works without any login or sign-up.
- Opt-in external paths — OpenAI-compatible embeddings, Cohere reranking, non-loopback Ollama, external compression/extraction LLMs, remote MCP/LTM, webhooks, Toolgraph, and Langfuse may transmit data to their configured endpoint;
mm initandmm statussurface configured remote embedding, LLM, and reranker endpoints so non-local boundaries stay visible. On STM’s external-LLM path,privacy_scan_enabled(default on) checks credentials before the call and falls back locally on a hit; disabling it sends the upstream response unscanned and triggers a startup warning for external destinations. The embedding relevance scorer has its ownrelevance_scorer.privacy_scan_enabled(default on): on a hit the pass is ranked with BM25 and nothing is sent.
Filesystem Protection
Section titled “Filesystem Protection”The data directory (~/.memtomem/) is created with 0o700 permissions and its files are written 0o600 (owner read/write only). Separately, the runtime directory that holds the server’s pid/lock files ($XDG_RUNTIME_DIR/memtomem, or /tmp/memtomem-<uid>) is created 0o700 and startup refuses it if group/other access has been left open.
Secret Protection
Section titled “Secret Protection”memtomem blocks credential-, token-, and key-shaped content from flowing into your stores or wider scopes at several points.
- LTM secret write guard — LTM write paths check 26 secret patterns before saving, including a password in a URL, an
Authorization: Bearerheader, and*_TOKEN=/*_SECRET=assignments. The guard also reads the title and tags an entry is written with, and a copy of the text with JSON-style escapes (\",\n,\t,\uXXXX) resolved. The token patterns use ASCII word boundaries ([A-Za-z0-9_]), so tokens directly adjacent to Hangul (including Korean particles), kana, Han characters, or after accented Latin letters are also caught and refused. Previously stored notes are not rescanned automatically; audit them per tier withmm mem rescan --scope <tier>(stored memory chunks) andmm context rescan --scope <tier>(Context Gateway artifacts); each covers only its own store. - STM sensitive-content detection — Responses containing credential patterns (for example
sk-…,ghp_…, AWSAKIA…, JWTs, private keys — including credentials directly adjacent to Hangul, kana, Han, or accented Latin letters) are excluded from the response cache and selection telemetry. Underexposure.profile=strict, upstream tools whose metadata matches credential patterns are withheld assensitive_metadata(email addresses do not withhold tools), andotlp.endpointis validated against credential patterns even whenotlp.enabled=false. External LLM compression falls back to local truncation when its privacy scan finds a hit. Astm_compression_feedbackreport whosemissingtext the screen flags is stored as a placeholder instead of the text. The bundled STM runtime does not write responses into LTM. - STM error-text summaries — Exception messages can quote a URL query, an argument or part of a header back, so STM does not store or show them.
- Calls that raise: when a proxied call raises, the error the MCP client receives,
proxy_metrics.error_message, thestartup connect failedline instm_proxy_healthand theextract_error/index_errorcolumns name the exception type (ConnectError,HTTP 401 (HTTPStatusError)), as do runtime log lines. - Upstream
isErrorresults: these still reach the client unchanged; only their stored row is summarized asupstream isError (<n> chars). - What is kept: failures STM composes itself (open circuit breaker, oversize response, policy denial) keep their message; logged tracebacks keep their frames and each exception’s class, and the message becomes
[message withheld].MEMTOMEM_STM_LOG_EXCEPTION_TEXT=truerestores the full text in the server and daemon logs (read at startup); the hook and the configuration-failure stderr line always withhold it. Records below WARNING from loggers outsidememtomem_stmstay out of the logs unlessMEMTOMEM_STM_LOG_DEPENDENCIESis set.
- Calls that raise: when a proxied call raises, the error the MCP client receives,
- Indexing credential exclusion — LTM indexing applies a built-in credential denylist (
oauth_creds.json,credentials*,id_rsa*,*.pem,*.key,.ssh/**, …). A user!negationpattern cannot re-enable these built-in patterns. - Re-scan on share — When
mem_agent_sharecopies a memory into a wider namespace, the redaction guard re-scans it, and secret-looking content is blocked at share time. - Context Gateway — Writing or moving to the
project_sharedtier (git-tracked) hard-refuses on a detected secret, with no--forcevalve (git history is permanent). Theuserandproject_localtiers allow an override after review, except for settings sync: a canonical.memtomem/settings.jsonthat holds a credential is refused at every tier, because the canonical is tracked by git.
Query Privacy (STM Surfacing)
Section titled “Query Privacy (STM Surfacing)”STM surfacing extracts a query from each tool call to search LTM. You control how that query text is retained.
MEMTOMEM_STM_SURFACING__PERSIST_QUERY_TEXT=false— Store anhmac-sha256:<16-hex>digest, keyed by the feedback database, instead of the raw text (rows written before 0.7.9 keep theirsha256:digests). Thesurfacewebhook’squerysends the same digest.MEMTOMEM_STM_SURFACING__QUERY_RETENTION_DAYS(default30) — Clear raw query text retained in the feedback DB after the given number of days.- Sensitive-query skip (
sensitive_query) — Calls whose query — or raw arguments/template when the query is derived from them — matches a credential or email pattern (including credentials adjacent to Hangul, kana, Han, or accented Latin letters, and email addresses followed by an attached particle) skip surfacing before LTM: no digest search runs, nothing is delivered (including Pinned Context), nosurfacing_eventsrow orsurfacewebhook is emitted, and only an opportunity record (outcome="sensitive_query", whenopportunities_enabled=true) is logged. There is no switch to turn this gate off; a clean agent-suppliedcontext_query/_context_queryon a tool without a configured template still surfaces even when another argument carries a secret. - Opportunity log — Each call that entered surfacing records how it ended and the shape of its arguments (their number, a path’s depth, a common file extension), never their keys or values. Turn it off with
MEMTOMEM_STM_SURFACING__OPPORTUNITIES_ENABLED=false. - Call identifiers — Surfacing events store the host’s
tool_use_id, session ID and agent ID, but never the working directory (cwd). Delivered memories are recorded only as keyed hashes of their path and preview text. - Write-tool skip — Surfacing is automatically disabled for upstream tools that mutate state.
No Lock-In
Section titled “No Lock-In”STM imports your existing MCP servers and proxies them in front — but the move is reversible. mms eject restores an imported server to its original host MCP client config, and only removes the STM entry once the restore is verified.
Trust Boundary & Best Practices
Section titled “Trust Boundary & Best Practices”- STM trusts your local AI client and the upstream MCP servers you configure. Only proxy upstreams you trust.
- The optional surfacing daemon binds to loopback (
127.0.0.1) and authenticates with a per-start random token. Do not pointMEMTOMEM_STM_DAEMON__HOSTat a non-loopback address. - The LTM web UI (
mm web) binds to127.0.0.1by default and rejects browser cross-origin/api/*requests (GETand writes) with403unless--trusted-origin <hostname>explicitly allows the origin. - Report vulnerabilities via GitHub security advisory or contact@dapada.co.kr — not public issues.
Related
Section titled “Related”- LTM Environment Variables and STM Environment Variables — full privacy-related settings
- Proactive Surfacing — query privacy and gating
- Context Gateway — per-tier secret blocking
- Multi-Agent Collaboration — redaction on share