Documentation
Browse documentation

Privacy and security

Local security model

Your memory is served by a small program on your computer. This page explains who can read it and how MemIndex keeps other programs and web pages out.

Who can read your memory on this computer

MemIndex runs a small service on your computer. Other programs on the same machine can reach it, so reading your notes needs a private install secret, just as changing them does. MemIndex creates the secret once. It is the worker-secret file in your data folder (~/.memindex unless you changed MEMINDEX_DATA_DIR), and only your user account can read that file.

A request without the secret gets a 401 answer and sees no notes. Only the health and readiness checks stay open, and they show no memory.

Your agent's hooks, the search tools, the command line, and the viewer send the secret for you. To open the viewer, use the link MemIndex prints when a session starts. A plain localhost address still loads the page, but it shows a notice that it was not let in and no notes. Observation TV on this computer works the same way. A remote Observation TV that sends your MEMINDEX_TV_TOKEN is not affected.

If you wrote your own script that calls the service, send the secret in an X-Memindex-Secret header. This keeps it off the command line, where other programs could see it. Use the address and port from npx memindex doctor:

printf 'X-Memindex-Secret: %s\n' "$(cat ~/.memindex/worker-secret)" | curl -H @- http://127.0.0.1:PORT/api/stats

Your tools also check that the program answering on that port is really your MemIndex before they send it anything. It must prove that it holds the same secret, without the secret ever being sent to it first. If another program has taken the port, for example while MemIndex was restarting, it gets neither the secret nor your notes; your notes wait on disk until MemIndex answers again. A page served from another local port, such as a development server, cannot read your notes from the browser either: only the viewer page MemIndex serves itself is let in, plus any origin you list in MEMINDEX_ALLOWED_ORIGINS.

Keep the secret and your private viewer link out of anything you share. Tools that were already running before you upgraded keep their old behavior until you restart them. If one reports that reading memory needs the install secret, restart it or run npx memindex update. See Troubleshooting.

Where it listens

By default the service listens on 127.0.0.1 only, so it cannot be reached from other computers. Binding it to another address with MEMINDEX_WORKER_HOST makes it reachable on your network. Do that only on purpose.

Two checks on every request

  1. A trusted origin. A request must name a host MemIndex trusts, such as localhost. A request from a web page must come from the viewer MemIndex serves itself, or from an origin you listed in MEMINDEX_ALLOWED_ORIGINS. Anything else gets a 403.
  2. The install secret. Reading or changing memory needs the secret in the X-Memindex-Secret header. A missing or wrong secret gets a 401.

The secret is 32 random bytes, created once, in a file only your account can read. If the file's permissions are looser than that, MemIndex refuses to use it.

Next steps