Skip to content

armgit / xerj

Public Imported from GitHub
0

AI search engine and MCP server for bots and agents. One Rust binary indexes code, docs, logs, JSONL/CSV and PDFs for BM25 full-text, vector and hybrid search, code search without grep, agent memory and RAG. Elasticsearch-compatible API; Corpus Hub serves hundreds of reference memory corpora.

docs(#807): state the quickstart trust boundary and the /_memory namespace answer

xerj-org9162e85c1590
diff --git a/README.md b/README.md
index 6b909d1b1..50aca166f 100644
--- a/README.md
+++ b/README.md
@@ -50,6 +50,13 @@ xerj gain # what it did for you — count
Windows and a hand-verified install are under [Install by hand](#install-by-hand).
+That `--insecure` flag is a trust boundary, not a formality. It turns off TLS and API-key
+auth, so every caller that can reach the port is a superuser who can read and delete every
+index, including every `/_memory` namespace. It is meant for one user on a dev machine: a
+fresh node binds `127.0.0.1` only, and a cleartext bind on any other interface refuses to
+start unless you explicitly allow it. The full model is in
+[docs/SECURITY_MODEL.md](./docs/SECURITY_MODEL.md).
+
## Join the community
You join XERJ by running it and sending back one short field report on what it was like: a
@@ -104,6 +111,9 @@ xerj --insecure --data-dir ./data & # start it
xerj autoindex ~/my-project # point it at anything
```
+`--insecure` again means no TLS and no auth — every caller a superuser — so this is the
+same one-user-on-a-dev-machine boundary as above ([security model](./docs/SECURITY_MODEL.md)).
+
XERJ sniffs every file, works out what it is, and creates one index per dataset it finds.
Code arrives with its symbols and line numbers through tree-sitter, not as flat text:
@@ -194,6 +204,10 @@ xerj --insecure --data-dir ./data & # local dev: no TLS, no auth
xerj autoindex ~/my-project
```
+That is the dev-machine trust boundary from the top of this README — no TLS, no auth, every
+caller a superuser. It is fine on a laptop because a fresh node binds `127.0.0.1` and
+nothing else; a shared host wants the auth-on start just below.
+
If your server has auth on, which is the default for every start without `--insecure`
(including any start from a config file), hand `autoindex` the same key. It never picks the
key up from `xerj.toml`; pass `--api-key` or set `XERJ_API_KEY`, or every request comes back
@@ -255,8 +269,10 @@ xerj mcp # 2. MCP stdio server (your client runs
```
`xerj mcp` speaks MCP over stdio and proxies to the node named by `XERJ_URL` (default
-`http://localhost:9200`). It does not start a node; step 1 is the prerequisite. Drop this
-into your MCP client's config:
+`http://localhost:9200`). It does not start a node; step 1 is the prerequisite. The MCP
+server adds no trust of its own — it is the same binary talking stdio to your client and
+plain HTTP to the node, so the node's boundary is the one that counts, and step 1 above
+boots the same `--insecure` dev node. Drop this into your MCP client's config:
```json
{
diff --git a/docs/recipes/agentic-memory.md b/docs/recipes/agentic-memory.md
index 5fe821ce1..d80431a29 100644
--- a/docs/recipes/agentic-memory.md
+++ b/docs/recipes/agentic-memory.md
@@ -6,7 +6,10 @@ The usual answer is to bolt a separate vector database next to your search stack
XERJ folds that job into the engine you already run: a namespaced, offline
**agent-memory API** (`/_memory/{ns}`) that stores text + an embedding + metadata
and recalls the most relevant memories by **vector similarity** or **plain text**,
-with metadata filtering, forgetting, and hard per-agent isolation.
+with metadata filtering, forgetting, and query-level namespace isolation — a
+recall in one namespace never reads another's index. What that does and does not
+guarantee *between callers* is a trust boundary, stated in
+[Isolation](#isolation-what-a-namespace-does-and-does-not-guarantee) below.
This recipe builds a tiny simulated coding-assistant agent (no LLM required) that:
@@ -15,8 +18,8 @@ This recipe builds a tiny simulated coding-assistant agent (no LLM required) tha
lexically (BM25),
3. does a **metadata-filtered** recall ("only surface team *preferences*"),
4. **forgets** a memory that is no longer true, and
-5. proves **multi-namespace isolation**: a second agent can never see the first
- agent's memories.
+5. proves **query-level namespace isolation**: a recall issued in namespace `B`
+ never reads namespace `A`'s backing index.
Everything below was run end-to-end against a live XERJ. No pip installs — the
example is Python 3 stdlib only.
@@ -33,11 +36,37 @@ paths that serve the rest of the engine. That means:
vector index consistent with your source of truth.
- **kNN *and* BM25 in the same store.** Recall by embedding similarity, by keyword,
or filter both by metadata — no glue code.
-- **Namespaces are physical isolation.** Each agent (or tenant, or user) gets its
- own backing index; a recall in namespace `A` literally cannot read namespace `B`.
+- **Namespaces are separate physical indices.** Each agent (or tenant, or user)
+ gets its own backing index; a recall in namespace `A` literally cannot read
+ namespace `B`'s index. That is query-level isolation — it becomes privacy
+ between *callers* only with auth on and per-agent scoped keys; see
+ [Isolation](#isolation-what-a-namespace-does-and-does-not-guarantee).
- **Offline and zero-config.** You supply the vectors (from your own model); XERJ
never phones out to embed.
+## Isolation: what a namespace does and does not guarantee
+
+A namespace is a reserved index — `.xerj-memory-{ns}` — and the isolation lives
+there, at the query level. Two different promises are easy to confuse here:
+
+- **Always true, by construction:** a recall in namespace `A` touches only the
+ `.xerj-memory-A` index. There is no query you can write in one namespace that
+ reads another's data.
+- **Not automatic:** nothing stops *another caller* from naming namespace `A`
+ themselves. On the `--insecure` node this recipe boots, every caller is a
+ superuser — anyone who can reach the port can list, recall and delete every
+ namespace. The same is true for any client holding the admin key, and for a
+ scoped key granted `names: ["*"]`, which deliberately reaches the reserved
+ namespace.
+
+Privacy between callers exists only on an auth-enabled node where each agent
+holds its own scoped API key (`POST /_security/api_key`, role names limited to
+`.xerj-memory-{ns}`): a namespace is exactly as private as the scoped key that
+can reach it. The enforcement details are in
+[`docs/SECURITY_MODEL.md`](../SECURITY_MODEL.md) (§ "The reserved
+`.xerj-memory-*` namespace"), and the operator-facing walkthrough is
+[private agent-memory namespaces](https://xerj.org/answers/private-agent-memory-namespaces).
+
---
## The memory API, in four calls
@@ -277,7 +306,8 @@ if __name__ == "__main__":
## Reproduce it yourself
-Start XERJ (single node, no TLS/auth) on its default port and run the script.
+Start XERJ (single node, `--insecure` — no TLS, no auth, every caller a superuser, so
+this demo is for a dev machine) on its default port and run the script.
Nothing to install — the client is Python 3 **stdlib only**.
```bash
@@ -391,9 +421,12 @@ Read the run top to bottom:
the default relevance order. Verified: two same-vector memories tie on relevance;
with `recency_weight: 1.0` the newer one is returned first. Useful when an agent's
latest observation should win ties.
-- **Isolation is structural, not a filter.** Namespaces are separate physical
- indices, so there is no query you can write in one namespace that reads another.
- Use one namespace per agent/tenant/user.
+- **Isolation is structural at the query level, not a filter — and not a
+ caller boundary by itself.** Namespaces are separate physical indices, so
+ there is no query you can write in one namespace that reads another. Use one
+ namespace per agent/tenant/user, and if those callers must not read each
+ other, give each its own scoped API key on an auth-enabled node — see
+ [Isolation](#isolation-what-a-namespace-does-and-does-not-guarantee).
- **`GET /_memory/{ns}`** lists up to 100 most-recent entries for debugging/audit;
it is bounded and recent-first, not a full export.
- **Wire-compatible.** Because a namespace is a real index, you can inspect or
diff --git a/landing/docs/quickstart.html b/landing/docs/quickstart.html
index 18089b582..ecc2878ab 100644
--- a/landing/docs/quickstart.html
+++ b/landing/docs/quickstart.html
@@ -225,6 +225,7 @@
<h2>1 · Start the server</h2>
<p>XERJ is a single static binary and needs no config file to start. Run it in dev mode — <code class="inline">--insecure</code> turns off TLS <strong>and</strong> API-key auth, which is what lets the bare <code class="inline">curl</code>s in the rest of this page work:</p>
<pre class="code">$ xerj --insecure --data-dir ./data</pre>
+ <p>That flag is a trust boundary, not a convenience: with auth off, every caller that can reach the port is a superuser who can read and delete every index — including every <code class="inline">/_memory</code> namespace. It is meant for one user on a dev machine, and it is safe there because a fresh node binds <code class="inline">127.0.0.1</code> only; a cleartext bind on any other interface refuses to start unless you set <code class="inline">server.allow_insecure_network_bind</code>. Anything shared or exposed wants the auth-on start below, plus TLS — see <a href="/docs/security">Auth &amp; TLS</a>.</p>
<p>Auth is <strong>on by default</strong>. Any node started <em>without</em> <code class="inline">--insecure</code> — including one started from a config file, and including the config in the <a href="/docs/install">install guide</a> — mints an admin key on first boot, prints it, and writes it to <code class="inline">&lt;data_dir&gt;/admin.key</code>. Every client then has to send it, the CLI included:</p>
<pre class="code">$ xerj --config xerj.toml # see /docs/config for the keys
$ export XERJ_API_KEY="$(cat ./data/admin.key)" # data_dir defaults to ./data