Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

atlas

Atlas is Drew’s unified search system: one search engine over the corpora Drew and his agents produce — AI-client conversations first, and, through the same staging discipline, notes, repository documents, GitHub comments, query traces, and reports. Every stored unit keeps its provenance (where it came from: the session, client, source reference, and commit or observation date it was taken from), every unit carries a sensitivity classification, and retrieval is hybrid: a full-text branch and a vector branch run over the same filtered candidate set and their rankings are fused into one result list. The engine is a Rust library, atlas-core; everything else in this book is a surface over it.

Source: https://github.com/developing-today/code/blob/main/pkgs/atlas-search/Cargo.toml

What is in the corpus

The corpus model is three levels: sessions (one conversation or source unit) contain messages, and messages are split into chunks — the searchable unit, roughly 3,500 characters each, deduplicated by content hash so re-ingesting the same material adds nothing twice. Each session is classified with a kind, topics, and projects, and each chunk carries an effective sensitivity (its own, falling back to its session’s label).

The last verified census is a frozen snapshot, and this book dates it wherever it is quoted: on 2026-10-31 the corpus held 18,325 sessions / 122,124 messages / 107,639 chunks. Physically, that census is now a local canonical database plus 29 topic shards: 28 internal shards holding 107,001 chunks and 1 secret shard holding 638 chunks, with zero public-tier shards. Later records describe a monolith of about 7.3 GB without a verified recount, so the store has grown since the census; the counts above are the last verified ones, not a live count. The full treatment is in The corpus: provenance and content addressing.

Two properties define the system, and both are enforced before ranking, never after:

  • Provenance first. A search hit is never bare text. Every result names its chunk, its session, the client that produced the session, and its classification, and a follow-up fetch returns one chunk with that same provenance attached. A result that cannot say where it came from is not a result Atlas serves.
  • Tiered sensitivity. Sensitivity is a four-step ladder, shareable < personal < local-only < secret-bearing. A caller searches under a ceiling — the highest sensitivity it may see — and the ceiling is applied inside the branch queries, so material above the ceiling is absent from the results, not merely down-ranked. The default ceiling is personal; seeing secret-bearing material requires spelling that ceiling out, and a service can clamp a caller’s ceiling down to the cap recorded for its client identity, never up. See Sensitivity tiers and client ceilings.

Retrieval itself is one-stage hybrid search. The full-text branch is an FTS5 (BM25) match; the vector branch compares the query’s embedding against chunk embeddings by cosine distance; the two ranked pools — 100 candidates per branch by default — are fused with reciprocal rank fusion (RRF constant 10) into a final list of 10 by default. All chunks are embedded with one model, Snowflake snowflake-arctic-embed-m-v2.0 at the full 768 dimensions, because vectors from different embedding models are not comparable. See Retrieval: hybrid full-text and vector search and Embeddings: Snowflake Arctic and the parity contract.

Why Atlas exists

Before Atlas, each AI client’s history lived in that client’s own on-disk store, in that client’s own shape. Finding “what did we decide about X last month” meant knowing which client the conversation happened in and searching that silo — or not finding it at all. Agents had no shared memory of prior sessions, and a human had no single place to ask.

Atlas replaces the silos with one normalised store and one query surface:

  • One index over every client. Conversations from every supported client are normalised into the same sessions → messages → chunks shape, so one query searches all of them. A filter can still narrow to one client, kind, topic, or project, and to a date range over session creation.
  • Search as a service, not as SQL. Callers use a search command, an HTTP job protocol, or an MCP tool. They never write queries against the corpus tables, and they cannot widen their own sensitivity ceiling: the ceiling travels with the request and is clamped by the surface that serves it.
  • An index that is disposable; corpora that are not. The searchable store is derived from sources that keep their own homes. Embeddings, shards, and caches can be rebuilt; the sources of record are the truth. That is what makes re-embedding under a better model, or re-sharding the store, a mechanical operation instead of a migration of record.

Who it serves

  • Drew, at the command line. The atlas-search binary is the owner’s tool: standalone search and chunk fetch, the service’s provisioning verbs (init, fetch-model), and the operator verbs for staging, classification, evaluation, and trace handling that the reference part of this book covers. At this surface the disclosure context defaults to the owner’s, and the ceiling can be raised explicitly to secret-bearing.
  • Agents, through fleet and through MCP. An agent seat normally searches through fleet search, the fleet binary’s search domain, which either delegates to the standalone atlas-search artifact or talks to the laptop service, depending on the seat. Agents connected through the mcpx daemon use the Atlas MCP server hosted on the Cloudflare Worker: one tool, search, under a pinned personal ceiling. See Consumers: fleet, agents, memory and ID and The Atlas MCP server.
  • The laptop service’s named clients. The service keeps a client table — in version 1: Drew’s CLI (ceiling cap secret-bearing), OpenChamber sessions (cap personal), fork/OpenCode agents (cap personal), and sandbox scripts (cap personal) — plus the Cloudflare Worker as the cf-worker client (cap personal). Each client presents its own token; the server clamps every request to that client’s cap.
  • ID, as a future consumer. ID is Drew’s identity and graph system. An Atlas → ID publication format — corpus objects with their provenance and lineage relations, published as ID-graph objects — is designed, and the search-integration design work continues in this book’s design part. ID is not a live search client today; where this book describes that relationship it is describing a design, and it says so. See Consumers: fleet, agents, memory and ID.

The surface map

Atlas is one engine with several surfaces. The map below is the whole system on one page; The shape of the system explains how the pieces fit together.

SurfaceWhat it isWhere it is covered
Engine cratesatlas-core (search semantics: filters, ceilings, both branches, fusion, the result envelope, the Turso and local backends), atlas-embed (the Snowflake embedder over a dynamically loaded ONNX Runtime), atlas-proto (the wire contract: job-protocol types and the versioned query-parameter defaults), atlas-search (the binary crate: CLI, service, and via-service client)The crates, atlas-core: the engine as a library
atlas-search binary and toolsSix installed binaries: atlas-search (search, get-chunk, serve, init, fetch-model, traces, feedback), atlas-stage (staging units and promotion), atlas-classify (the classification sweep), atlas-eval (the offline evaluation runner), atlas-sweep (the ingestion sweep runner), atlas-github-comments (the GitHub-comments extraction feed)atlas-search: search and get-chunk
Laptop serviceThe same search semantics behind a loopback HTTP job protocol on 127.0.0.1:18760, with one resident embedder shared by every client and per-client ceiling caps. The live unit runs it as fleet serve search; atlas-search serve is the same service and the kept rollbackThe service and the Worker
Cloudflare Worker and MCPA Worker at https://atlas-search.developing-today.workers.dev exposing gated REST search plus a stateless MCP endpoint with one search tool, a per-query Durable Object cache, and no Turso credentials of its own: it calls back to the laptop service for embeddings and fan-outThe service and the Worker, The Atlas MCP server
fleet search clientThe fleet binary’s search domain: the agent-facing client surface, with seat-dependent routing between the service and standalone delegationfleet search and fleet serve search
Python referenceatlas_search.py, the original implementation, kept permanently as the parity oracle and evaluation instrument; it is also the only surface that still offers the dormant bge-small fallback embedderatlas_search.py: the Python reference implementation

How to read this book

  • First run: Installation and provisioning, then Quickstart. You will have the binaries installed, the model and service provisioned, and will have run the same search three ways.
  • Understanding the system: The shape of the system, then Architecture, then the concept chapter for the part you are working in — corpus, sensitivity, embeddings, retrieval, ingest, the service, consumers, evaluation.
  • Looking up an exact surface: the reference part gives, for every command and endpoint, its invocation shape, every flag with its default, its behaviour notes, a worked example, its failure shapes, and its exit codes.
  • Building or operating: the library part covers the crates as a Rust API; the tutorials walk through complete tasks; the development and operations parts cover changing Atlas and running it.
  • Design work: the design part is explicitly design. Those chapters describe systems that do not exist yet — automatic ingest, query planning, layered search, reranking, the recommender, fleet and ID integration — and each one ends by grounding itself in what exists today.

Conventions used in this book

  • Defaults are stated literally. When a flag, parameter, or setting has a default, the default is given as the value itself — for example “final results (default 10)”, “pool 100 per branch”, “ceiling personal”.
  • Source wins over help. Where a binary’s help text and its source or live behaviour disagree, this book states the source behaviour and says that it is doing so. Help text is never silently treated as truth.
  • Secrets are named, never valued. This book gives secret names (for example the Bitwarden name turso.atlas-ro-token), token file paths, and environment variable names. It never prints a secret value, a client token, or corpus content from a restricted tier.
  • Examples are toy examples. Search examples use invented queries and invented results. No real corpus text — from any tier — is reproduced in this book.
  • Design is marked as design. A chapter in the design part, and any designed-but-unshipped behaviour mentioned elsewhere, is labelled as a design with its tracking issues named. Designed behaviour is never written as if it works today.
  • Numbers are dated. Census counts and other frozen snapshots carry their measurement date (the corpus census is 2026-10-31). A number without a date in this book is a constant of the code — a default, a dimension, a limit — not a measurement.
  • Chapters are self-contained. Each chapter defines its terms where it first uses them and cross-links instead of assuming you have read the chapters before it.

Installation and provisioning

Installing Atlas means three separate things, and this chapter keeps them separate: building the binaries (code, delivered by Nix), provisioning the embedding model and the ONNX Runtime (data and a shared library the binaries load at run time), and provisioning the credentials and service state the binaries read (tokens resolved by name, a service config written once by an init verb). The Worker has a fourth, separate deploy path, covered at the end. If you only want to search, the first two sections and the model section are enough; the service sections matter when a seat will serve or use the service route.

Source: https://github.com/developing-today/code/blob/main/pkgs/atlas-search/default.nix and https://github.com/developing-today/code/blob/main/pkgs/atlas-search/flake.nix

The two Nix routes

Atlas lives in the repository at pkgs/atlas-search/, a self-contained package with its own Cargo workspace, its own flake.nix, and a rust-toolchain.toml pinning the Rust toolchain at channel 1.99.1 — the single place the pin lives; the flake.nix comment and CI state the same figure (see Building and testing).

Route 1 — the package’s own sub-flake. From the repository root:

nix build path:./pkgs/atlas-search

The sub-flake exposes one package, atlas-search (also its default), and a check that is the package itself. When a crane library is supplied — the sub-flake supplies one — dependency compilation is split into its own derivation keyed only on the manifests, the lockfile, the crate sources, and schema/, so a workspace-source change rebuilds only the workspace crates. Callers that do not pass a crane library get the same package through the monolithic rustPlatform.buildRustPackage path: same sources, same checks, no split.

Route 2 — home-manager, via callPackage. On the laptop, the home configuration (home/common/default.nix) builds the same default.nix the pkgs/id way:

atlasSearch = pkgs.callPackage ../../pkgs/atlas-search {
  rustPlatform = pkgs.makeRustPlatform {
    cargo = atlasSearchToolchain;
    rustc = atlasSearchToolchain;
  };
};

with atlasSearchToolchain read from pkgs/atlas-search/rust-toolchain.toml through the id rust overlay. The resulting package is added to home.packages, so the Rust binary is the resolved atlas-search command on the laptop. The Python reference implementation is kept alongside it under the name atlas-search-py; it is not the resolved command. The same home configuration also declares the atlas-search.service user unit — see Quickstart for using the service and the operations part of this book for running it.

There is no non-Nix install route for the Rust binaries. The Python reference (atlas_search.py, at the package root) runs with the Python standard library alone for full-text search and get-chunk, but it is a parity and evaluation instrument, not the install path.

What gets installed

One package installs exactly six binaries, all version 0.1.0 where a version surface exists:

BinaryWhat it is
atlas-searchThe access layer: search, get-chunk, serve, init, fetch-model, traces, and feedback. The package’s mainProgram. --version prints atlas-search 0.1.0.
atlas-stageStaging units and the staging registry: provision, lookup, ingest, items, promote, units. It has no --version flag — passing one is a usage error, exit 2 (source behaviour; the other hand-rolled tools below likewise have no version surface).
atlas-classifyThe classification operating procedure: run, schema-review, schema-apply against a corpus database.
atlas-evalThe offline ranking-evaluation runner: two positional arguments, an eval document and a dev or test split.
atlas-sweepThe ingestion sweep runner: pause/resume a source class, run one sweep request, manage dead letters, report. It creates no schedule; cadence is an operator decision.
atlas-github-commentsThe GitHub-comments extraction feed: incremental, watermark-based extraction of the estate’s issue and review comments into corpus records.

The package build runs the test suite in its check phase and an install check afterwards: fixtures/smoke_check.py runs one full-text-only query and one embedded query against a fixture database and byte-compares the results with the recorded Python envelopes, and probes that the packaged ONNX Runtime loads with no environment override set (below).

ONNX Runtime provisioning: vendored, loaded dynamically, never downloaded

Vector search needs ONNX Runtime (the shared library libonnxruntime.so) to run the embedding model. Atlas’s rule, learned during packaging and now mechanised, is absolute: the runtime is never downloaded at build time or at run time. The ort crate is built with its load-dynamic feature and without its default prebuilt-binary fetch, and the library comes from the Nix closure:

  • The package vendors its own ONNX Runtime in-tree, at pkgs/atlas-search/onnxruntime/, pinned to the upstream release the corpus and the Gate A parity fixtures were certified under — version 1.31.1. This is deliberately not the ambient nixpkgs version (which is older): the service aligns up to the corpus, never the corpus down to the library.
  • default.nix compiles a default library path into the binary as the compile-time value ATLAS_SEARCH_ORT_LIB_DEFAULT, pointing at the vendored package’s libonnxruntime.so in the Nix store. Because that path is a store reference, the runtime — and with it libstdc++.so.6 and libz.so.1, which the library needs — is part of the package’s runtime closure. You can verify that with nix-store -qR &lt;out&gt; on the build result.

At run time the binary resolves the library in this order:

  1. The environment variable ATLAS_ORT_LIB, when set to an existing file.
  2. A staged copy at ~/.local/state/atlas-search/ort/libonnxruntime.so, when present.
  3. The compiled-in ATLAS_SEARCH_ORT_LIB_DEFAULT (packaged builds only; development builds never set it).

One surface has an extra fallback: atlas-stage promote additionally probes the Atlas virtualenv’s ~/atlas/v3-venv/lib/python3.14/site-packages/onnxruntime/capi/libonnxruntime.so.1.31.1 before giving up. A missing runtime is a loud error, not a silent full-text-only degradation — except that full-text-only search and get-chunk never load the embedder at all, and so never fail on a missing runtime or a missing model. The version matters, not just the presence: the parity gate is version-matched, and a different runtime version produces small numeric deltas (about 1e-7 per component against 1.27.1) that fail the gate as not applicable rather than as a verdict.

Model provisioning: the state dir and fetch-model

The embedding model is data, not code, and it is not in the Nix store. It lives in the Atlas state directory:

~/.local/state/atlas-search/model/<rev>/

where &lt;rev&gt; is the pinned HuggingFace revision 95c2741480856aa9666782eb4afe11959938017f of the model Snowflake/snowflake-arctic-embed-m-v2.0. Provision it with:

atlas-search fetch-model

fetch-model takes no options. It downloads the pinned revision’s tokenizer.json and onnx/model.onnx, verifies both against the SHA-256 hashes recorded in the source, and installs the snapshot atomically. If the snapshot already verifies, the verb is a no-op; a hash mismatch refuses the install and exits 2. At run time, model resolution is: the environment variable ATLAS_MODEL_DIR when it names an existing directory, else the state-dir snapshot above, else the HuggingFace cache snapshot under ~/.cache/huggingface/hub/ for the same pinned revision, else a model-not-found error. A missing or mismatched model fails vector and hybrid search loudly; full-text search and get-chunk keep working with no model present, because neither loads the embedder.

Service provisioning: init, the client table, and client files

The laptop service is provisioned once:

atlas-search init

This generates the service config at ~/.local/state/atlas-search/service.json (override with --config or the environment variable ATLAS_SEARCH_SERVICE_CONFIG), with file mode 0600. The document carries the listen address 127.0.0.1:18760, the default vector table, and the version-1 client table — named clients, each with a freshly generated token and a ceiling cap: drew-cli (cap secret-bearing), openchamber (cap personal), fork-server (cap personal), sandbox-scripts (cap personal). The verb prints the config path and each client’s cap; it never prints a token value. Running init when a config already exists is an error, exit 2; --force replaces the config and rotates every client token. Raising a client’s cap afterwards is a local edit of this file by Drew — no verb does it.

A seat that will use the service route needs the matching client side: its token is presented from the environment variable ATLAS_SEARCH_TOKEN when set, else from the JSON file at ~/.config/atlas-search/client.json (a JSON object with one token string field, expected mode 0600; the path is overridable with ATLAS_SEARCH_CLIENT_CONFIG). A seat with neither cannot use the service route and falls back to standalone search, loudly. The service itself is started by the home-manager unit as fleet serve search (the same service, rehomed into the fleet binary); atlas-search serve is the kept rollback, selected by one flag in the home configuration.

The Turso token chain (names only)

The default search backend is the hosted Turso corpus, reached with a read-only token. The service holds no write credential for any Turso database, and every statement the backends build is a SELECT. The token is resolved, in order, from:

  1. The environment variable ATLAS_TURSO_TOKEN.
  2. Bitwarden Secrets Manager, by name — the names tried are turso.atlas-ro-token, turso.atlas-read-only-token, and atlas-ro. (Reaching Bitwarden itself uses the BWS_ACCESS_TOKEN environment variable, or the fleet’s bws environment helper when that is unset.)
  3. A cached mint at ~/.cache/atlas-search/turso-token.json, when it names the atlas database and is less than 20 hours old (file mode 0600).
  4. A fresh read-only mint through the turso CLI: turso db tokens create atlas --read-only -e 7d, cached at mode 0600.

If no source resolves, the search fails with a fatal error naming the sources it tried. Shard fan-out uses separate per-tier read-only tokens, again by environment name only: ATLAS_TURSO_TOKEN_PUBLIC, ATLAS_TURSO_TOKEN_INTERNAL, and ATLAS_TURSO_TOKEN_SECRET, plus TURSO_API_TOKEN for shard discovery through the Turso platform API. A tier with no token is simply not connected — and discovery is opened only up to the caller’s own ceiling, so a default personal caller never needs the secret-tier variable. No token value appears in this book, in the service config’s printed output, or in any log the tools write.

Worker deploy prerequisites

The Cloudflare Worker (pkgs/atlas-search/worker/) is not a Nix install; it deploys separately, and only its prerequisites are listed here — the deploy procedure itself is in the operations part of this book.

  • Tooling. Local development and tests use wrangler (with wrangler.toml as the local configuration) and the Worker’s npm test suite. Deploys go through the sanctioned cf binary’s versions flow, never a silent overwrite; for deploys, cloudflare.config.ts is the source of truth and must be kept in step with wrangler.toml.
  • Bindings (names only). A Durable Object binding QUERY_CACHE (class QueryCache, SQLite-backed), a D1 binding HOT_CACHE (database name atlas-hot-cache; the committed database id is a local placeholder, replaced with the real id when the database is created at deploy time), and the plain variables SERVICE_BASE (the tunnel hostname the Worker calls the laptop service on) and HOT_CACHE_ENABLED (committed value "false").
  • Secrets (names only). GATE_TOKEN (the inbound bearer gate, covering both the REST routes and /mcp), SERVICE_TOKEN (the service’s cf-worker client token), and ACCESS_CLIENT_ID / ACCESS_CLIENT_SECRET (the Cloudflare Access service token for the tunnel hostname). At deploy time these are assembled from fleet secrets — names atlas.search-worker-gate-token, atlas.search-cf-worker-token, cloudflare.access-atlas-search-client-id, and cloudflare.access-atlas-search-client-secret — into a throwaway secrets file that is deleted after the upload; the cf CLI’s own API token is the fleet secret named cloudflare.api-token-account-wide. No value lands in the repository.
  • The service behind it. The Worker holds no Turso credentials and keeps no shard list. It needs the laptop service reachable through its tunnel hostname with the Access token above; while the service is unreachable the Worker degrades to 502 with nothing cached.

Verifying the install

atlas-search --version
atlas-search search "weekend market rain plan" --mode fts --k 3 --text

The first prints atlas-search 0.1.0. The second runs a full-text-only search — no model, no ONNX Runtime needed — and prints human-readable results. Add a hybrid search (drop --mode fts) once fetch-model has run, and you have verified the model and the runtime as well. That is the whole first-run path; Quickstart takes the same search through all three surfaces.

Quickstart

The five-minute path. It assumes Atlas is installed and the model is provisioned (see Installation and provisioning) and runs one search three ways — standalone, through the fleet client, and through the hosted MCP endpoint — because those are the three ways anything in the fleet actually searches. Then it follows one hit back to its chunk. Every query and every result in this chapter is a toy example, invented for this page; no real corpus text appears here.

Source: https://github.com/developing-today/code/blob/main/pkgs/atlas-search/crates/atlas-search/src/main.rs and https://github.com/developing-today/code/blob/main/pkgs/fleet/crates/fleet-search/src/cli.rs

The toy query, used unchanged on all three surfaces:

weekend market rain plan
atlas-search search "weekend market rain plan" --k 5

Standalone is the default mode and it is complete: the query is embedded in-process, the corpus is talked to directly (the hosted Turso backend when a token resolves, else the local database file), and the answer is printed as one JSON envelope on stdout. Nothing needs to be running. Add --text for a human-readable rendering of the same envelope:

atlas-search search "weekend market rain plan" --k 5 --text

Two things worth knowing on the first run. First, the embedder is lazy: a full-text-only search (--mode fts) and get-chunk never load the model, so they work on a machine where fetch-model has not run yet, while hybrid and vector search fail loudly there. Second, every standalone search writes a query-trace record and returns its query_id in the envelope; a failure to write the trace fails the search. Traces are the raw material of the statistics and feedback chapters later in this book.

fleet search "weekend market rain plan" --k 5 --text

fleet search is the fleet binary’s search domain — the surface an agent seat uses. The spelling fleet search search "weekend market rain plan" is the same surface with atlas-search’s own shape; the leading search token is consumed and the two forms are identical. The flags mirror the standalone search’s common subset: --k (default 10), --pool (default 100), --mode (default hybrid), the classification filters --kind, --topic, --project, --client, the date filters --since / --until, --max-sensitivity (default personal), --expand, --with-message, --hydrate, --text, and the routing flags below. Engine-only knobs (the backend and database flags, the query-parameter contract group) are not part of this surface; the reference chapter fleet search and fleet serve search lists exactly which flags exist here and which do not.

Routing is the one behavioural difference from the standalone binary, and it is seat-dependent by design (the Atlas Q3 routing decision):

  • An explicit --via-service or --standalone flag wins, then the environment variable ATLAS_SEARCH_VIA=service, then the fleet config’s [search] via setting.
  • Otherwise the seat default applies: the sandbox seat prefers the service; the laptop seat — the serving host, recognised by the presence of the service config file — defaults to standalone.

Whichever route is chosen, a via-service failure is never silent: the client prints fleet search: warning: --via-service: &lt;detail&gt;; falling back to standalone on stderr and delegates to the standalone artifact, whose output it inherits byte-for-byte. If neither route is available — no service answer and no standalone artifact on PATH — the command exits 3 and says so. The via-service route needs the seat’s client token, presented from ATLAS_SEARCH_TOKEN or from ~/.config/atlas-search/client.json; the server clamps the requested ceiling to that client identity’s cap.

3. Through the hosted endpoint: an MCP tools/call

The Cloudflare Worker at https://atlas-search.developing-today.workers.dev exposes the same search as a stateless MCP (Model Context Protocol) endpoint at POST /mcp, gated by the same bearer token as its REST routes. In production the laptop’s mcpx daemon is connected to it as its atlas server, with the gate token expanded from the daemon’s environment at run time; the raw protocol shape below is what that connection carries. The token is an environment variable’s value here — never a literal in a command you keep:

curl -s https://atlas-search.developing-today.workers.dev/mcp \
  -H "Authorization: Bearer $ATLAS_SEARCH_GATE_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
        "jsonrpc": "2.0",
        "id": 1,
        "method": "tools/call",
        "params": {
          "name": "search",
          "arguments": { "query": "weekend market rain plan", "k": 5 }
        }
      }'

The endpoint has exactly one tool, named search, with a required query string and an optional k (an integer from 1 to 50, default 10 — the Worker clamps any other value into that range). A successful call answers with a JSON-RPC result whose content holds the search envelope as a JSON text block and whose structuredContent holds the identical envelope as an object, with isError: false. That envelope is the Worker’s wrapper — cache ("miss" or "hit"), key (the cache key), query (the normalised query), result (the service’s search envelope, passed through verbatim), and meta (timestamps, hit count, timings, and the pinned model and dimensions) — over exactly the same execution path as the Worker’s POST /v1/search REST route. An MCP search and a REST search for the same normalised query and k share one cache entry; a repeat query is served from the per-query Durable Object cache and reports "cache": "hit".

Two pins define this surface and no request field can change them: the disclosure context is hosted-per-user and the sensitivity ceiling is personal. Every MCP caller shares that one hosted identity today. The full protocol treatment is in The Atlas MCP server.

Following a hit: get-chunk

A search hit names a chunk_id. Fetch that chunk, with its provenance and a little context on either side:

atlas-search get-chunk 900001 --neighbors 2 --text
fleet search get-chunk 900001 --neighbors 2 --text

Both print the chunk’s text together with the session, client, and sensitivity it came from, plus N neighbouring chunks from the same message on either side (--neighbors default 0, maximum 100). The fleet form always runs through the standalone artifact: get-chunk is job-scoped in the service protocol, so there is no via-service path for it, and when via-service is in effect the client says so loudly before delegating. A chunk id that does not exist exits 1 with atlas-search: chunk &lt;id&gt; not found.

What the JSON result contains

The standalone and fleet searches print one envelope. Abridged, with toy values:

{
  "query": "weekend market rain plan",
  "mode": "hybrid",
  "backend": "turso",
  "filters_applied": { "max_sensitivity": "personal" },
  "results": [
    {
      "chunk_id": 900001,
      "session_id": "toy-session-1",
      "score": 0.181818,
      "rank_sources": { "fts": 1, "vector": 1 },
      "text": "if the market moves indoors when it rains, the stall list goes on the door",
      "session": {
        "title": "Toy example session",
        "client": "toy-client",
        "created_at": "2026-01-05T14:23:00Z",
        "kind": "chat",
        "topics": ["markets"],
        "projects": [],
        "sensitivity": "personal"
      },
      "vector_distance": 0.001881
    }
  ],
  "vector": {
    "model": "Snowflake/snowflake-arctic-embed-m-v2.0",
    "table": "vec_snowflake_m_v2_768_f32",
    "embedder": "auto",
    "trunc": null,
    "pool": 100,
    "vector_backend": "scan"
  },
  "notes": []
}

Reading it, top to bottom: query, mode, and backend record what was asked and which backend answered. filters_applied records the filters and ceiling that were actually enforced — check this field, not your command line, when a result surprises you. Each entry in results carries its chunk_id (the id get-chunk takes), its fused score, its rank_sources (the rank it held in each branch that found it — a hit found by only one branch has only that branch’s entry), its text, a session object with the provenance (title, client, creation time, kind, topics, projects, sensitivity), and, for vector-branch hits, its vector_distance. The vector block records the embedding space the search ran in — model, vector table, embedder, truncation, pool, and vector backend — because a score is only meaningful inside one space. notes is where the surfaces speak up: a via-service fallback, a missing local vector store, a shard fan-out diagnostic, and similar facts are spliced here rather than printed only to a log. A served (via-service) envelope additionally reports the effective_ceiling the server enforced after clamping, which can be lower than the ceiling you requested — never higher. With --group-by-session, results rolls chunk hits up to sessions instead (score = the session’s best chunk, plus a hit count); with --with-message, each hit also carries its parent message’s text, truncated at 50,000 characters.

The sensitivity default, in one paragraph

Every search in this chapter ran at the default ceiling, personal, on the ladder shareable < personal < local-only < secret-bearing: chunks classified local-only or secret-bearing were excluded inside the branch queries, before any ranking happened, so they are absent from the results rather than ranked low in them. Raising the ceiling is always explicit — --max-sensitivity secret-bearing on the CLI (the ceiling must be spelled out in full), the server’s clamp to your client identity’s cap on the service route, and no mechanism at all on the Worker, which is pinned to personal. Intersecting with the ceiling, each surface also carries a disclosure context (the CLI’s search defaults to fleet-internal; get-chunk, the owner’s explicit-id tool, defaults to local-owner; the Worker is pinned to hosted-per-user), and the effective ceiling is the lower of the two — neither widens the other. The full model is Sensitivity tiers and client ceilings.

Where to go next

The shape of the system explains why the three surfaces above return the same envelope — one engine, three access surfaces, two execution modes — and the reference chapter atlas-search: search and get-chunk gives every flag, default, failure shape, and exit code for the commands used here.

The shape of the system

Atlas has one engine, three access surfaces, and two execution modes. This chapter is that sentence expanded: what the engine is, what the surfaces are, how a query moves in each mode, and where the data lives while all of that happens. It ends with the discipline this book follows for telling shipped behaviour from designed behaviour, because Atlas has a large design archive and the difference matters.

Source: https://github.com/developing-today/code/blob/main/pkgs/atlas-search/crates/atlas-core/src/lib.rs and https://github.com/developing-today/code/blob/main/pkgs/atlas-search/crates/atlas-proto/query-parameters-v1.json

One engine: atlas-core

All search semantics live in one Rust library crate, atlas-core: classification filters and sensitivity ceilings, the full-text branch, the vector branch, reciprocal-rank fusion, and the result envelope. It is a semantics-exact port of the production Python implementation, and the Python remains its parity oracle. The engine’s shape is a trait and a pipeline:

  • A SearchBackend gathers the two branch pools. Two implementations ship: TursoBackend (the hosted corpus over the libsql HTTPS pipeline API, read-only) and LocalBackend (a local SQLite publish file, with vector side stores joined by content hash). Filters and the caller’s sensitivity ceiling are applied inside the branch queries — before any ranking — in both implementations.
  • run_search then fuses the pools: an FTS5 (BM25) ranked list and a cosine-distance ranked list, combined by reciprocal rank fusion and rendered as the one envelope every surface returns. The defaults are not scattered through the code: they are read from a single versioned contract file in atlas-proto, query-parameters-v1.json — final results k = 10, per-branch pool = 100, RRF constant = 10, branch weights 1.0 and 1.0, expansion 0. The same file is the source the CLI defaults are derived from, so the library, the CLI, and the service cannot quietly drift apart on what “a default search” means.

Around the engine sit three sibling crates, and the boundaries are the architecture:

CrateRole
atlas-coreSearch semantics as a library, plus the write-side machinery the tools expose: staging and the registry, the ingest gate, classification, traces, feedback, evaluation, and the shard fan-out. Synchronous; the backends are shareable across threads.
atlas-embedThe Snowflake embedder: a dynamically loaded ONNX Runtime session plus the model’s own tokenizer, reproducing the production Python embedding pipeline bit-identically (the Gate A parity contract). Output is the full 768 dimensions; query/document handling — the "query: " prompt on queries, prompt-free documents, CLS pooling, L2 normalisation — is pinned here and in atlas-core’s embed wrappers.
atlas-protoThe wire contract only: serde types for the service job protocol and the versioned query-parameter defaults. No HTTP, no storage, no search policy — the server and the via-service client both depend on it so their wire definitions cannot drift. Sensitivity clamping lives in the server; this crate merely carries the requested and effective ceilings.
atlas-searchThe binary crate: the atlas-search CLI, its via-service client, the service implementation, and fetch-model — plus the atlas-stage binary. The four remaining tools (atlas-classify, atlas-eval, atlas-sweep, atlas-github-comments) are binaries of atlas-core itself.

The engine is deliberately not a service and not a CLI: it is the library both are built from, which is what makes “the same search” a checkable claim rather than a hope. The library part of this book covers the crates in full, starting with The crates and atlas-core: the engine as a library.

Three access surfaces

Every caller reaches the engine through one of three surfaces. They share the engine, the envelope, and the ceiling rules; they differ in where the engine runs and what identity the caller carries.

1. The command line. The atlas-search binary (and its Python reference twin, atlas_search.py, which offers search and get-chunk only) runs the engine in its own process. fleet search is the same surface wearing the fleet binary’s routing: it either delegates to the standalone atlas-search artifact or speaks the job protocol to the service, and renders the same envelope either way.

2. The service HTTP API. atlas-search serve — in the live laptop unit, the same service rehomed as fleet serve search — runs the engine behind a loopback HTTP job protocol on 127.0.0.1:18760, exposed on the tailnet through a tailscale serve mapping. Its routes are a one-shot POST /v1/search; the job protocol proper (POST /v1/search/jobs returning 202 with a job id and a per-job capability token, then status, paged results, chunk fetch, and delete under that job); GET /health (no auth, no data: liveness, embedder state, queue depth); and two post-design additions, POST /v1/embed and the feedback routes. The point of serve mode is resident state: one lazy-loaded embedder session shared by every client (about a second to load, versus roughly 35 seconds of Python cold start), a connection pool, and the job registry. Clients are named in the service config, each with a bearer token and a ceiling cap; the server computes effective = min(requested, token cap) and reports the effective ceiling in the envelope.

3. The Worker: REST plus MCP. The Cloudflare Worker is the hosted surface: gated POST /v1/search, cache inspect and purge routes, and POST /mcp, a stateless MCP endpoint with one search tool. It contains no engine and no corpus access: it holds no Turso credentials and no shard list, pins its disclosure context to hosted-per-user and its ceiling to personal, and calls back to the laptop service — through its tunnel hostname, under a Cloudflare Access service token — for the query embedding and for the search fan-out itself. What it adds is placement and caching: it is reachable wherever an MCP client is, and it caches each query’s result in a per-query Durable Object. See The service and the Worker.

Two execution modes

Independent of the surface, a search executes in one of two modes:

  • Standalone (the default, and complete). The engine runs in the caller’s process: the query is embedded in-process and the backend is talked to directly. The CLI is never a thin client; a machine with no service running loses nothing but the service’s shared state.
  • Via-service. The caller submits the search to the service’s job protocol and pages the immutable fused ranking back. --via-service (or ATLAS_SEARCH_VIA=service, or the fleet seat default) expresses a preference, not a requirement: on any service failure the client falls back to standalone loudly — a warning on stderr and a note spliced into the envelope’s notes. Some requests cannot be served by the service at all — a local-backend request, a non-default vector table, or an experimental shard specification — and those take the same loud fallback without a service attempt being presented as a search failure. get-chunk is always standalone, in both clients, because chunk fetch in the protocol is scoped to an existing job.

The two-mode rule exists so that search semantics exist exactly once. The rejected alternative — separate client and server implementations — would have to pass the parity gate twice against two drifting codebases; with one engine, the service is a deployment shape of the CLI, not a second implementation of it.

Where the data lives

StoreWhat lives thereLifetime and rules
Canonical Turso storeThe published corpus: sessions, messages, chunks, session labels, the FTS5 index, and the vector table vec_snowflake_m_v2_768_f32. Read-only to every search path; no search component holds a write credential for it.The hot, served copy. The durable asset is the local canonical database it is published from (~/atlas/turso-atlas/data/atlas.db on the laptop); Turso never holds the only copy of anything.
ShardsTopic shards named atlas-core-&lt;tier&gt;-&lt;topic&gt;-&lt;nn&gt;, each self-describing through an atlas_manifest table (tier, topic, expected chunk count, embedding model). At the 2026-10-31 census: 28 internal shards and 1 secret shard. Per-tier content stores hold the messages/sessions half that scan shards lack, for hydrating hits.A shard joins the fan-out by existing and passing manifest discovery, never by a code change. Discovery is opened only up to the caller’s ceiling: a shard above the ceiling is never connected, probed, or scanned, and a shard whose embedding model disagrees with the consumer’s is refused — vectors from different models are not comparable. Shard fan-out for the vector branch is an experimental, off-by-default path in the CLI; FTS, details, and expansion stay on the monolith backend.
Stage databasesOne small SQLite file per unit of ingest work, plus the staging registry that maps unit ids to them. Staging databases store raw, un-embedded chunks and never store vectors, which makes them cheap to write and cheap to branch.Written freely by producers, classified at staging, then promoted — embed-at-promotion into a new scan shard — through the registry’s model gate, or not promoted at all. See Ingest today: staging, classification, promotion.
Service temp storeIn-memory job state: submitted jobs, their branch pools, and their fused rankings, plus the result cache keyed by query, corpus snapshot, and effective ceiling.Perishable by requirement: a completed job lives 600,000 ms (10 minutes) by default, with a 3,600,000 ms (60-minute) hard cap from submit, and nothing survives a service restart — job results hold ceiling-gated snippets, and persistence would be a liability.
Worker cacheOne Durable Object per (normalised query, k, ceiling, context, embedding space) key, holding the query’s embedding and then its result.Retained indefinitely in version 1 — no TTL and no eviction; the only deletion is the explicit per-key purge route. This is a different store from the service temp store, with the opposite TTL story, and the follow-up that owns revisiting it is issue #6805. A D1 tenant hot-cache storage layer also exists in the Worker package behind a flag committed as "false"; nothing in the request path reads or writes it today.
State directory~/.local/state/atlas-search/: the service config, the model snapshot, and the append-only query-trace and feedback JSONL stores.Traces are kept hot for 180 days before the retention pass moves them to a cold tier; the trace and feedback stores are themselves ingestible corpus sources (statistics and reports).

Two smaller caches sit inside the engine rather than beside it: an in-service query-embedding cache (a query vector is a pure function of the normalised query text, the model id, and the model revision, so it needs no TTL or invalidation), and the embedding cache’s optional shared Turso tier, enabled only when both of its environment variables are set.

The designed-versus-shipped discipline

Atlas accumulates design records faster than it ships code, so this book follows one rule everywhere: present tense means shipped, verified against the source; anything else is labelled. Concretely:

  • Chapters in the design part open by stating that they are designs, name their tracking issues, and end with a “what exists today” grounding. Designed behaviour is never written as if it works today, anywhere in the book.
  • Contract surface is not behaviour. The versioned query-parameter contract carries fields for a query planner, spell correction, and rewritten query variants; setting any of them is a validation error today (“not implemented yet”), and this book says so at the flag, not just in a design chapter.
  • Storage layers are not integrations. The Worker’s D1 hot cache exists as schema and store primitives with tests; with no caller in the request path, this book describes it as exactly that.
  • Ingest has two generations and the book labels them: the canonical script pipeline (collect, normalise, index, publish) is production today and is still substantially manual and script-driven, while the staging/registry/gate machinery in atlas-core is the built foundation the automatic-ingest design builds on. Neither is described as the other.
  • Where help text and source disagree — and they do, in named places, from a hidden experimental flag to a fleet help paragraph that calls a subset surface a mirror — the book documents the source behaviour and calls out the discrepancy until the help is fixed.

That discipline is also the book’s maintenance rule: a change to a command, flag, default, surface, or procedure updates the matching chapter in the same change, and a designed spelling is never promoted to a shipped claim without the code to back it. Architecture takes this shape and fills in the component detail.

Architecture

Source: https://github.com/developing-today/code/blob/main/pkgs/atlas-search/crates/atlas-core/src/lib.rs, https://github.com/developing-today/code/blob/main/pkgs/atlas-search/crates/atlas-core/src/backend.rs, https://github.com/developing-today/code/blob/main/pkgs/atlas-search/crates/atlas-core/src/shards/mod.rs, https://github.com/developing-today/code/blob/main/pkgs/atlas-search/worker/src/index.ts, https://github.com/developing-today/code/blob/main/pkgs/atlas-search/worker/src/service.ts, https://github.com/developing-today/code/blob/main/pkgs/fleet/crates/fleet-search/src/lib.rs

Atlas is a unified search index over every corpus Drew produces: AI-client conversations first, and — through the same staging discipline — notes, repo docs, GitHub comments, query traces, and research. One logical pipeline carries every source from raw material to a searchable chunk, and one retrieval core serves every consumer. This chapter draws the whole system on one map. The corpus itself is covered in The corpus: provenance and content addressing; the access rules that cut across every box on the map are covered in Sensitivity tiers and client ceilings.

One honesty note before the map: the pipeline below is the system’s logical shape. The left half of it is not yet an automatic, standing pipeline — ingest today is manual and script-driven, and the staging-to-core promotion path exists as tools a producer runs, not as a service that runs itself. Where a step is a tool rather than a daemon, this chapter says so.

The map

 SOURCES                    laptop, ~/atlas/ and client stores
   AI-client conversations (muse, chatgpt, claude, opencode, ...)
   GitHub comments - notes and repo docs - query traces - research
        |
        v
 STAGING                    per-unit atlas_stage v1 databases + registry
   one small DB per unit of work; free, unmediated writes;
   sensitivity recorded, not enforced; staging DBs never hold vectors
        |
        v
 CLASSIFICATION             scheme-1.0 labels + per-chunk records
   kind / topics / projects / sensitivity per session;
   chunks cut only at declared source boundaries
        |
        v
 PROMOTION                  the ingest gate + the aggregator
   write -> classify -> dedup -> provenance-check -> publish;
   chunks embedded document-side at promotion, one model only
        |
        +------------------------------+
        v                              v
 CANONICAL STORE                 SHARD SET
 laptop atlas.db:                atlas-core-<tier>-<topic>-<nn>
 sessions -> messages            scan shards + per-tier content
 -> chunks; Turso publish        stores, discovered by manifest
 monolith (read-only token)
        |                              |
        +--------------+---------------+
                       v
 EMBEDDING             Snowflake arctic-embed-m-v2.0, 768 dims,
                       in-process ONNX; queries get the "query: " prompt,
                       documents are embedded prompt-free
                       |
                       v
 RETRIEVAL CORE        atlas-core run_search: FTS branch + vector
                       branch, ceiling and filters inside the branch
                       queries (before ranking), RRF fusion, then a
                       disclosure check at the output boundary
                       |
        +--------------+---------------+
        v              v               v
 CLI              SERVICE          WORKER + MCP
 atlas-search /   fleet serve      Cloudflare Worker:
 fleet search     search, job      REST + one MCP search
 (standalone or   protocol on      tool, per-query cache;
 via-service)     loopback :18760  holds NO DB credentials
        |              |               |
        +--------------+---------------+
                       v
 CONSUMERS             Drew, fleet agents and sessions, hosted
                       agents via mcpx, offline evaluation

Stage by stage

Sources. A source is anything that produces text worth searching again: a client’s on-disk conversation store, a GitHub comment thread, a batch of notes. Sources are the truth; everything downstream is derived from them and can in principle be rebuilt. The extracts store that preserves source material content-addressed is part of this layer — see The corpus: provenance and content addressing.

Staging. Producers write into a staging unit: one small database per unit of work (a queue task, a session, an epic, a notes batch), provisioned with the versioned atlas_stage v1 schema — items, chunks_raw, notes, kv, and a schema-version row. A registry database maps each unit id to its staging database, owner, sensitivity, and state (open, closing, merged). Writes at this stage are deliberately free and unmediated: sensitivity is recorded on each item, not enforced, and a staging database never stores vectors, which keeps it cheap to write and cheap to branch.

Classification. Before anything is promoted, it is classified. Sessions carry scheme-1.0 labels — kind, topics, projects, and sensitivity — and classified artifacts carry a classification record per chunk. Chunking respects source boundaries: classification may change only at a declared boundary (a message or turn, an authored block, a code symbol, a log record), and text whose boundaries are undeclared or uncertain becomes a single secret-bearing chunk marked uncertain. The vocabulary and the enforcement are the subject of Sensitivity tiers and client ceilings.

Promotion. Promotion is the only door from staging into the searchable store, and it is gated twice. The batch ingest gate judges each batch through five ordered stages — write, classify, dedup, provenance-check, publish — recording verdicts, reason codes, and hashes, never content; a batch that fails stops at the failing stage or is quarantined. The aggregator then does the one embed-at-promotion step: it reads a staging unit’s raw chunks, embeds every chunk document-side with the mandated model, writes one new scan shard, stamps the unit’s provenance, and promotes it through the registry. A unit whose recorded embedding model is not the mandated one does not promote — vectors from different embedding models are not comparable.

Canonical store and shards. The canonical store is the laptop database ~/atlas/turso-atlas/data/atlas.db, shaped sessions -> messages -> chunks, with a published copy — the monolith — hosted on Turso. Beside it sits the shard set: scan shards named atlas-core-<tier>-<topic>-<nn>, each a small database holding chunks and their vectors for one tier and topic, plus one content store per tier holding the messages and sessions that shard-served results hydrate from. Shards join the serving set by existing and describing themselves in a manifest table, never by a code change; discovery cross-checks each candidate’s manifest against its name and records every rejection with its reason. Which of the monolith and the shard set serves a given query is a backend decision inside the retrieval core; the production default is still the monolith scan, with shard fan-out behind it.

Embedding. There is one production embedding model: Snowflake/snowflake-arctic-embed-m-v2.0, 768 dimensions, run in-process as a dynamically loaded ONNX session — nothing is downloaded at build or run time. The query side and the document side are deliberately asymmetric: documents are embedded prompt-free, at promotion; a query is embedded at search time with the query: prompt the model’s configuration specifies. The details and the bit-parity contract with the Python reference pipeline are in Embeddings: Snowflake Arctic and the parity contract.

Retrieval core. All search semantics live in one library function, run_search in atlas-core. A hybrid search runs a full-text branch (FTS5, BM25-ranked) and a vector branch (exact cosine scan) and fuses the two candidate pools with reciprocal rank fusion. The caller’s sensitivity ceiling and every filter are applied inside the branch queries, before any ranking — a chunk above the ceiling is never retrieved, counted, or leaked by its absence. After fusion, a disclosure check at the output boundary intersects the caller’s ceiling with the destination surface’s ceiling, and only the permitted set is rendered. Retrieval: hybrid full-text and vector search walks the pipeline in order.

The crates and their roles

The Rust workspace is pkgs/atlas-search/, four crates:

CrateRole
atlas-coreThe engine as a library: search orchestration and the result envelope, the FTS and vector branches and their fusion, filters and sensitivity ceilings, the Turso and local backends, staging, classification, the promotion aggregator, shards, evaluation, traces and feedback. It also carries the helper binaries atlas-classify, atlas-eval, atlas-github-comments, and atlas-sweep.
atlas-embedThe Snowflake embedder: dynamically loaded ONNX Runtime, the model’s own Unigram tokenizer, CLS pooling, full-768 output. It knows nothing about queries or prompts; that policy lives in atlas-core.
atlas-protoThe wire contract: serde types only — no HTTP, no storage, no search policy — shared by the service and the via-service CLI client so their definitions cannot drift. It also carries the versioned query-parameter defaults both sides read.
atlas-searchThe binary: the one-shot CLI, the via-service client, and serve mode, plus the atlas-stage staging tool.

Two further implementations shadow these. atlas_search.py, kept in the same package, is the production Python implementation the Rust was ported from; it remains the permanent evaluation and parity reference. And pkgs/fleet/crates/fleet-search/ is a flag-for-flag copy of the atlas-search client and service inside the fleet binary — fleet search and fleet serve search — held byte-for-byte against the original by a parity guard in CI. The Cloudflare Worker is TypeScript, not a crate; it is covered under surfaces below.

Three surfaces, one execution path each

The CLI (atlas-search, or fleet search) is standalone-capable: with a local or Turso backend and a local model it needs no service at all. It can also route through the service (--via-service). The seat decides the default: the sandbox seat prefers the service with a loud standalone fallback; the laptop seat — the serving host — defaults to standalone.

The service (fleet serve search, also reachable as atlas-search serve) is the same engine behind a loopback HTTP job protocol on port 18760: submit a job, poll its status, page its immutable fused ranking. Serve mode’s value is resident state — one lazily loaded embedder session shared by every job, instead of a model load per invocation. Its guarantees are covered in The service and the Worker.

The Worker and MCP surface is a Cloudflare Worker in pkgs/atlas-search/worker/. It exposes a gated REST search route and a stateless MCP endpoint with exactly one tool, search; both call a single execution function, so ceiling pinning and cache keying cannot drift between them. Results are cached per query in a Durable Object. The laptop’s mcpx connects to the MCP endpoint as its remote atlas server.

Where the trust boundaries sit

Atlas is a single-user system, but it is not a single-trust-zone system. The boundaries, in the order data crosses them:

  1. Source to staging. Staging writes are unmediated by design. Nothing in a staging database is trusted to be correctly classified, deduplicated, or safe to serve; that is what the next boundary is for.
  2. Staging to core. The promotion gate is the boundary: classification, dedup, and provenance verdicts, the embedding-model contract, and a gate record that holds counts, codes, and hashes — never content.
  3. Laptop to hosted publish. The canonical database lives on the laptop; the Turso monolith is a published copy, and Turso never holds the only copy of anything. The service reaches it with a read-only token and issues nothing but SELECT statements — it holds no write credential for any Turso database, and there is no write path to opt into.
  4. Caller to service. Every service client is a named identity presenting a per-client token. The server clamps the requested sensitivity ceiling to that identity’s cap; a client cannot widen its own access by asking.
  5. Service to shard set. Tier ceilings are physical: a shard above the ceiling, or of a tier with no credential, is never connected, never probed, never scanned. Each tier has its own read-only token, and the secret tier’s is never derived from another tier’s credential.
  6. The Worker boundary. The Worker holds no database credentials at all — no Turso token, no shard list. Fan-out, embedding, and merging live in the fleet search service, which the Worker calls over a tunnel hostname with a Cloudflare Access service token, presenting its own client token as the cf-worker identity (ceiling personal). The Worker pins that ceiling and its disclosure context as compile-time constants and verifies the service’s reported effective ceiling before any result enters its cache.
  7. The output boundary. Even after retrieval, results pass the disclosure check: the destination surface’s ceiling intersects the caller’s, and cached or paged payloads inherit the filter because the served set is collected from the rendered envelope.
  8. The embedder boundary. Embedding happens in-process, on hardware Drew controls. Secret-tier text is never sent to a hosted embedder — a rule stated in full in Sensitivity tiers and client ceilings.

Consumers sit outside every boundary above and inherit the strictest one they cross: Drew’s own CLI is the only identity granted the secret-bearing ceiling; agents on the sandbox seat search at personal; hosted callers arrive through the Worker at personal under the hosted-per-user disclosure context. Who consumes Atlas, and by which path, is the subject of Consumers: fleet, agents, memory and ID. How new material crosses the first three boundaries in practice is Ingest today: staging, classification, promotion.

The corpus: provenance and content addressing

Source: https://github.com/developing-today/code/blob/main/pkgs/atlas-search/crates/atlas-core/src/local.rs, https://github.com/developing-today/code/blob/main/pkgs/atlas-search/crates/atlas-core/src/stage.rs, https://github.com/developing-today/code/blob/main/pkgs/atlas-search/test-vectors/content-hash-v1.json, https://github.com/developing-today/code/blob/main/pkgs/atlas-search/fixtures/fixture_corpus.sql

Atlas exists to answer one question reliably: where have I seen this before, and where did it come from? The second half of that question is the provenance half, and it shapes the corpus’s data model. This chapter covers that model — sessions, messages, and chunks — the hash that identifies a chunk everywhere it appears, the content-addressed extracts programme that preserves the sources themselves, and the extra databases that still live beside the canonical store. The system the corpus sits in is drawn in Architecture; who may read which parts of the corpus is Sensitivity tiers and client ceilings.

Sessions, messages, chunks

Every conversation, whatever client produced it, is normalized into the same three-level shape in the canonical store:

  • A session is one conversation. Its row carries an id, a title, the client that produced it (the client column — muse, chatgpt, opencode, and so on), and its creation time.
  • A message belongs to a session and carries an id, a role, and its text.
  • A chunk belongs to a message and is the unit of search: an id, the message id, its position within the message (chunk_idx), its text, a content_hash, and a sensitivity. Messages are cut into chunks of roughly 3,500 characters in the original pipeline; chunking in the newer staging path is boundary-driven instead, and may change only at declared source boundaries.

Classification hangs off the session. A session_labels row per session records the scheme-1.0 classification: kind, topics and projects (each a JSON list), sensitivity, a confidence, and the scheme name. Sensitivity is also denormalized onto each chunk in the published store; a chunk’s effective sensitivity is its own value, falling back to its session label’s when the chunk carries none. Two derived structures make the chunks searchable: a chunks_fts FTS5 table over chunk text (its rowid is the chunk id), and one vector table per embedding space, keyed by chunk id — the production table is vec_snowflake_m_v2_768_f32.

A toy example, invented for this chapter: a session titled “porch roof quotes” from one client might hold four messages and nine chunks. Search never returns the session or the message as its unit — it returns chunks, each carrying enough provenance (session, client, time, labels) for the caller to judge and to fetch the surrounding message.

content_hash: the identity every store shares

Chunk ids are local to the database that assigned them. The same chunk text appearing in the canonical store, a staging database, a vector side store, and a shard will in general have four different ids — and the id spaces are not merely different, they are unrelated: joining two stores on chunk id would silently attach the wrong vectors to roughly 14,000 chunks (verified 2026-10-31). What every store shares is the chunk’s content_hash.

So content_hash is the join key, everywhere:

  • In the canonical and shard schemas it is a column of chunks, declared UNIQUE NOT NULL.
  • In a staging database it is a column of chunks_raw, with its own index.
  • The local backend resolves legacy vector side stores by it: it reads id, content_hash from the side store’s mapping corpus and from the main database, builds a hash-to-main-id map, and re-keys each stored vector to the main chunk id whose chunk has the same hash. The first store to supply a vector for an id wins, and coverage is reported as a note (“vector coverage: <have> of <total> chunks have vectors via content-hash mapping”). The one exception is an explicitly supplied vector database, which is assumed to be keyed by the corpus’s own chunk ids.
  • The golden-set corpus fingerprint is built from it: SHA-256 over the concatenation of the content_hash values of chunks with id % 997 = 0 — a cheap way to prove two corpora are the same corpus.
  • A promotion’s merge manifest records one, as the durable audit of what was promoted.

One caveat a careful reader should know: the hash’s producer is not yet pinned. The shared test-vector file (test-vectors/content-hash-v1.json, #10147) records chunk_content_hash with status producer_unavailable — algorithm, producer, and profile all null, no known-answer vectors, and interop claims explicitly forbidden until a producer is pinned there. The same file does pin a different hash — the classification manifest’s content hash, SHA-256 lowercase hex over the manifest’s canonical form — and says in terms that it is not the chunk content_hash, recorded precisely to keep the two apart. In practice the value is produced by the ingest pipelines and treated as opaque identity by everything downstream; treat any claim about how it is computed as unverified until the vector file says otherwise.

Deduplication follows from the same identity. Re-running an ingest adds only what is new, because a chunk whose hash is already present is the same chunk. But dedup has a known historical cost, and it is the reason the next section exists: the first ingest pipelines deduplicated by dropping repeated occurrences, silently losing roughly 127,000 records of where a chunk had been found — and 6,344 canonical sessions own zero chunks for exactly this reason. The bytes survived; the provenance did not.

The extracts programme: content-addressed sources (#3125)

Issue #3125 — the provenance registry, content-addressed extracts, and multi-database vector resolution programme — is the corrective. Its rules, set by Drew on 2026-10-31, are: keep all data (only byte-identical duplicates are cleaned; backups are kept); keep backups and plain extracts for every corpus; and record, for every chunk, every place it was found. That last rule is the chunk_occurrences table: one row per occurrence, mapping a chunk to a source locator with its byte span and the time it was observed (observed_at). Sources that are not files are pinned as repo@commit:path — a toy form would be some-repo@0123abc:docs/notes.md.

The programme has four phases. Phases 1 and 2 have landed; 3 and 4 are open.

Phase 1 — the occurrence and registry tables (landed 2026-11-22). The canonical database gained chunk_occurrences and a cas_registry (the registry of content-addressed objects), and ingest writes occurrence rows for new imports from then on. A further in-repo slice landed 2026-11-23: each chunk promoted through the staging path now gets a chunk_occurrences row recording its canonical text hash, source locator, byte span, and staged observation time. That slice is explicitly not the full criterion — historical occurrence recovery, canonical dedup identity, and the CAS/source-root registry remain open work.

Phase 2 — the extracts store and its backfill (landed 2026-11-23). The extracts store lives on the laptop under ~/atlas/extracts/. Objects are filed content-addressed, by SHA-256, under cas/&lt;ab&gt;/&lt;cd&gt;/&lt;sha256&gt; (the first two path components are the hash’s first two byte pairs); beside the objects sit manifests named manifests/<source>-<date>.json, each entry carrying the source, the extraction time, the hash, the byte count, and the destination. The tooling (atlas-extracts.py, in hatch-personal) can register objects into the canonical cas_registry, and its verify subcommand re-hashes every manifest-referenced object — a full-store verification prints ATLAS-EXTRACTS VERIFY OK. The daily atlas-backup now covers the store too, and each backup run proves recoverability by verifying against a restored copy.

The 2026-11-23 backfill run interned the sources still on disk, starting that morning from zero objects and no cas_registry table:

CorpusFiles internedBytes
chatgpt-export (the export archive, one file)1103,945,101
sandbox-agents12,0912,492,957,497
Total12,092~2.6 GB

The run recorded zero dedupe collisions — every interned file was unique content — and the full-store verification passed: ATLAS-EXTRACTS VERIFY OK.

Phase 3 — occurrence backfill (open). Recovering the historical occurrences from the now-interned extracts, and documenting the publish predicate, has not started as a completed slice.

Phase 4 — catalog and resolution as tools (open). A catalog database and a shard layout (collection × month) at the next publish growth, with resolution exposed as MCP tools — search to ids, resolve, fetch span — is designed direction, not built machinery.

Staged tiers beside the canonical store

The canonical store is not the only database a search may touch. Two kinds of side store sit beside it, and they must not be conflated.

Per-unit staging databases are the write side, covered as a pipeline stage in Architecture and in Ingest today: staging, classification, promotion. Each is a small atlas_stage v1 database holding one unit’s items and un-embedded chunks_raw — staging databases never store vectors — located through the staging registry, and read by the aggregator at promotion. Promotion is the terminal write: the promoted unit’s database is stamped with a manifest table, which closes it to further staging writes by design, and is branched as the unit’s archive.

Legacy topup and delta databases are the read side’s history. They were never merged into canonical identity; instead the search backends resolve them at query time, by content_hash, as described above. The local backend probes its known side-store pairs in a fixed order — a vector file plus the corpus file whose chunks map its ids:

Vector storeMapping corpus
~/atlas/v3/vec-bge-small.db~/atlas/v3/corpus.db
~/atlas/v3/vec-bge-small-topup.db (the topup DB)~/atlas/v3/topup-chunks.db
~/atlas/atlas-delta-chunks2.db (the delta DB)itself — vector file and mapping corpus are the same file
~/atlas/v3/vec-snowflake.db~/atlas/v3/corpus.db

The topup store alone accounts for roughly 14,000 chunks. This query-time, hash-keyed resolution is the working-today form of multi-database vector resolution; the general catalog-and-shard form is phase 4 of #3125, above.

Beside both sits the shard set — 29 topic shards next to the Turso monolith at the last verified layout — which is a serving layout of the same corpus, not a separate corpus. Schemas for every store named here are collected in Data stores and schemas.

The frozen census, and the growth since

Every corpus number in this book traces to one verified count, and it is a snapshot, not a live figure. The census of 2026-10-31 (recorded on #3125) counted the canonical store at:

LevelCount
Sessions18,325
Messages122,124
Chunks107,639

The tier split of the same census agrees with the total: 107,001 chunks in 28 internal shards and 638 chunks in 1 secret shard; there were no public-tier shards. The session labels were complete for all 18,325 sessions: personal 16,009, local-only 2,226, secret-bearing 90. The Turso publish at that date was 1.0 GB holding 100,698 chunks — 6,941 chunks of personal-client text were at that point held back from Turso by policy. That same day the hold-back was lifted: everything in canonical publishes, and privacy moved to query-time classification filters instead.

Since then the store has grown without a recount. Later records (2026-11-12) describe the Turso monolith as about 7.3 GB over the same 107,639 chunks plus the 29 topic shards, and state in terms that the canonical counts are frozen at the 2026-10-31 publish while the monolith grew without a verified recount. Read every number in the table above as “true on 2026-10-31”, not as today’s count; a fresh verified census is an open deliverable of the Atlas programme. For scale, the laptop’s ~/atlas/ directory overall was 12 GB at the census date, hash-verified to contain no consequential byte-identical duplicates — it is distinct versions and working sets, so no cleanup windfall exists there.

Sensitivity tiers and client ceilings

Source: https://github.com/developing-today/code/blob/main/pkgs/atlas-search/crates/atlas-core/src/filters.rs, https://github.com/developing-today/code/blob/main/pkgs/atlas-search/crates/atlas-core/src/disclosure.rs, https://github.com/developing-today/code/blob/main/pkgs/atlas-search/crates/atlas-core/src/manifest.rs, https://github.com/developing-today/code/blob/main/pkgs/atlas-search/crates/atlas-core/src/shards/mod.rs, https://github.com/developing-today/code/blob/main/pkgs/atlas-search/worker/src/space.ts

Atlas holds Drew’s own conversations, notes, and working records, and it serves them to callers that are not equally trusted: Drew himself, his agents, and hosted surfaces reachable from outside the laptop. Sensitivity is therefore not a label for tidiness — it is the access-control model, and it is enforced by the server, inside the search queries, before anything is ranked or rendered. This chapter defines the two ladders the model uses, the mapping between them, and the machinery that keeps material at the tier it was classified into. The corpus the ladders govern is described in The corpus: provenance and content addressing.

Two absolute rules frame everything below. Candidate secret content is never reproduced in issues, chat, or logs — findings are reported as counts, classes, and locations only. And secret text is never sent to a hosted embedder. This chapter follows both rules: it describes the shape of the secret tier and nothing of its content.

Two ladders, one model

The model has two vocabularies because it answers two different questions: where may this content live? and how much may this caller see?

Corpus tiers — where content lives. Three tiers, in ascending sensitivity: public, internal, secret. A tier is a physical placement as much as a classification: content of a tier lives in that tier’s databases. At the 2026-10-31 census the placement was 28 internal shards holding 107,001 chunks and 1 secret shard holding 638 chunks; there were no public-tier shards. The standing rule for the top tier is that secret material may exist only in the two secret databases (the secret scan shard and its secret content store). One recorded exception to that rule is stated at the end of this chapter.

Client ceilings — how much a caller may see. Four levels, in ascending order, named in code (SENS_ORDER) shareable < personal < local-only < secret-bearing. A ceiling is a maximum: a search run at ceiling personal may return chunks classified shareable or personal, and nothing above. The default ceiling is personal — a caller who asks for nothing gets personal, and local-only and secret-bearing material is excluded unless a ceiling above the default is both requested and granted.

The mapping between the ladders is fixed:

Client ceilingCorpus tier it reaches
shareablepublic
personalinternal
local-onlyinternal
secret-bearingsecret

Note the deliberate pinch in the middle: two ceiling levels map to the internal tier. The ceiling ladder is finer-grained than physical placement, because query-time filtering works per chunk while placement works per database. The two vocabularies are disjoint value sets in the schemas — a staging database’s sensitivity column speaks tier words and defaults to internal, while the published chunks and session_labels columns speak ceiling words — and the translation happens at promotion, in the aggregator, in one direction, and at shard selection, in the other. No schema declares the mapping; the two code points above are where it lives.

A third, related vocabulary appears at the output boundary: the disclosure context, which names the destination surface rather than the caller. Each context carries its own ceiling — fleet-internal allows up to local-only, hosted-per-user up to personal, public-surface up to shareable, and local-owner up to secret-bearing — and the effective ceiling for a response is the minimum of the caller’s granted ceiling and the context’s ceiling. Neither widens the other. An absent or unrecognized context fails closed to public-surface. One classification sits outside the ladders entirely: content marked excluded_personal_life is ineligible in every context, including local-owner.

Enforcement: server-side, per client identity

A ceiling requested by a client is a request, never a grant. The service holds a named identity for each client, each with a cap, and clamps: effective ceiling = min(requested, the identity’s cap). The clamp is recorded on the search job and reported back in the result envelope, so a caller can always see the ceiling it was actually served at. The named identities in service today:

Client identityWho it isCeiling cap
drew-cliDrew’s own CLI on the laptopsecret-bearing
sandbox-scriptsMuse lanes and scripts on the sandbox seat, via the tailnetpersonal
cf-workerThe Cloudflare Worker, calling the servicepersonal

The design of record’s v1 client set matches this shape: Drew’s CLI is the only identity capped above personal; OpenChamber sessions and fork / OpenCode agents were likewise specified at personal. Raising a cap is a local edit to the service configuration by Drew — there is no request a client can make that raises its own cap.

Enforcement happens at three depths, so that no single layer’s failure is sufficient to leak:

  1. Inside the branch queries. The ceiling is a clause in the SQL that gathers the full-text and vector candidate pools — {sensitivity} IN (allowed set) — applied before ranking. A chunk above the ceiling is never retrieved, never counted, and its existence is not leaked by a gap in the results. A chunk with NULL sensitivity never passes.
  2. At the shard set. Tier ceilings are physical: a shard above the caller’s ceiling — or of a tier for which no credential is held — is never connected, never probed, never scanned. Each tier has its own read-only token, and the secret tier’s token is never derived from another tier’s. Because the default ceiling personal maps to the internal tier, a default fan-out can never include the secret tier; it takes an explicit secret-bearing ceiling and the secret credential.
  3. At the output boundary. Retrieved details are checked again against the effective ceiling (caller grant intersected with disclosure context) before rendering, in every output shape — flat, grouped, and raw. The served set recorded in the query trace is collected from the rendered envelope, so cached and paged payloads inherit the filter.

Fail-closed defaults run through the model. Unknown, missing, or malformed sensitivity — in a classification record, a staged artifact, or a chunk’s stored value — resolves to SecretBearing, the most restrictive level. When several classification records cover one chunk, the effective classification composes conservatively: the sensitivity is the maximum over the records, and an exclusion, once recorded by any of them, sticks.

The Worker surface pins its side of this in code, not configuration: its ceiling (personal) and disclosure context (hosted-per-user) are compile-time constants with no request field, header, or environment variable able to change them, and it verifies the service’s reported effective ceiling before any result is allowed into its cache — a result computed above personal can never be cached, let alone served. That surface is covered in The service and the Worker.

The classification machinery

Classification is assigned at ingest and then defended by several independent passes, because a single classifier’s mistake at the secret boundary is the failure this whole model exists to prevent.

The classification manifest (#5410). A small table in the corpus database declares the filterable dimensions — kind, client, topics, projects, creation time — with their storage shapes and match semantics, and carries the per-source tier rules. Its safety invariant is narrow, never widen: the manifest schema has no sensitivity keys at all (the names sensitivity, max_sensitivity, ceiling, and sens are a reserved namespace the loader rejects), its column shapes bind only to code-known label columns, and any unknown shape, semantics, column, or key fails validation, in which case the caller falls back to the built-in manifest — loudly, and without widening anything. A manifest can change how content is filtered; it cannot change how much of it a caller may see.

Revalidation (#6021, closed). A corpus-wide revalidation programme checked that nothing sensitive sits at the wrong tier, combining three independent signals: deterministic secret-pattern scanning (gitleaks), a classifier pass, and a vector-neighbourhood check — internal chunks that embed close to secret chunks are candidates for review, a check that is only meaningful because one embedding model and pipeline serve every tier. The Layer-1 scan report (2026-11-15) records counts, classes, and ids only, ran gitleaks with redaction, and used private copies that were deleted after the scan.

The Layer-1 review (#10412, closed). The scan’s candidates were then reviewed one by one: 47 candidate chunks carrying 67 findings, plus 45 candidate messages, each ruled on and the review closed under Drew’s 2026-11-22 Atlas order. It is a review record, not a design statement — its value to this chapter is that the secret tier’s membership has had a human-scale pass over its boundary cases, not only automated scans.

The Presidio NER pass (#6048). A design record for a named-entity recognition pass over the corpus — recognizer set, tier scoping, cost, and a review queue — aimed at the personal and financial detail that pattern scanning for credential shapes does not catch. It is recorded as design only, with no code enabled; treat it as part of the machinery’s agenda, not as a pass that runs today. A revalidation-cadence design (#6051) similarly proposes rule-triggered rescans and sampled human audits as standing practice.

Boundary-safe classification. Where a source’s producer declares classification segments over byte offsets, staging composes them through the boundary splitter described in Ingest today: staging, classification, promotion: chunks are cut only at declared boundaries, never across one, and any text whose classification is undeclared, contradictory, or uncertain becomes a single secret-bearing chunk marked uncertain — doubt resolves upward, to the most restrictive tier.

The hosted-embedder rule

Embedding is the one step that would ordinarily send text to an outside service, so it has its own rule: secret text is never sent to a hosted embedder. Atlas’s production embedder runs in-process on Drew’s hardware, which satisfies the rule for the corpus as built; the rule’s teeth are in ingest. Until a dedicated local secret-tier embedder lands (#6059, designed but not built), secret-tier source classes are held out of automated ingest sweeps entirely — held, not rejected: held items form a queue that re-offers automatically once a compliant route exists. No sweep may route around the hold by embedding secret material anywhere else.

The open boundary defect: #8479

One defect is on the record, stated here in shape only. The shard set’s boundaries are clean — but the same 638 secret-bearing chunks also live in the production monolith and in a local replica, alongside pre-tiering unclassified snapshots. Outside the shard set, then, the standing claim that secret material exists only in the two secret databases does not currently hold: query-time ceiling enforcement still governs what any caller is served from those stores, but the physical placement boundary — the second layer of the defence above — is not intact there.

The remediation is filed (#12406: inventory, a verified destination copy and re-embed, a visibility switch, replica and cache purge, trace-safe tombstones, and post-run absence checks), but the threshold decision — purge the monolith copies, or reclassify — is Drew’s, and it is undecided. This book records the defect and the options; it does not pick one. Any claim that Atlas’s tier boundary fully holds should be read with #8479 attached until that decision is made and the migration has run.

Embeddings: Snowflake Arctic and the parity contract

Source: written from pkgs/atlas-search/crates/atlas-embed/src/lib.rs, pkgs/atlas-search/crates/atlas-core/src/embed.rs, pkgs/atlas-search/crates/atlas-core/src/types.rs, pkgs/atlas-search/crates/atlas-core/src/shards/mod.rs, pkgs/atlas-search/fixtures/embed-probes.json, and pkgs/atlas-search/atlas_search.py under https://github.com/developing-today/code/blob/main/pkgs/atlas-search/ — provenance only; this chapter is complete without following it.

An embedding is a list of numbers that stands in for a piece of text, placed so that texts with similar meaning sit near each other. Atlas search compares a query’s embedding with every chunk’s embedding; that comparison is one of the two branches described in Retrieval: hybrid full-text and vector search. This chapter is about the one embedding space production Atlas actually uses, why the Rust embedder is held to a bit-for-bit contract against the Python pipeline that built the corpus, and what other spaces exist at the edges.

The production model

The production model is Snowflake’s snowflake-arctic-embed-m-v2.0, a text embedding model. Every production chunk vector and every production query vector lives in its space. The stored width is 768 dimensions, full width, in 32-bit floats. The vector table is named for exactly that: vec_snowflake_m_v2_768_f32. That table name is the default everywhere the table is configurable, through --vec-table or the ATLAS_VEC_TABLE environment variable, and the model is likewise configurable through --model or ATLAS_SEARCH_MODEL — but naming another model on the Rust search surface does not create another working space. For vector and hybrid modes the Rust binary refuses any model other than the default Snowflake model; the alternatives live only in the Python reference, described below.

The pinned snapshot matters as much as the name. The model revision is 95c2741480856aa9666782eb4afe11959938017f. The loader expects tokenizer.json at the model directory root and the fp32 graph at onnx/model.onnx. atlas-search fetch-model downloads that revision into ~/.local/state/atlas-search/model/&lt;rev&gt;/ — the model is data, not code, and is not provisioned into the Nix store — verifies both files’ recorded SHA-256 hashes, and refuses the install on a mismatch; an already-verifying snapshot is a no-op. A missing or mismatched model is a loud error on any path that needs to embed. Full-text-only search and get-chunk keep working with no model present.

Three spellings of one model

The same model appears under three spellings in the tree, and they are not interchangeable strings. The book uses each spelling only where it is operative:

SpellingWhere it is operative
Snowflake/snowflake-arctic-embed-m-v2.0The Hugging Face identity: DEFAULT_MODEL in atlas-core, the default in atlas-proto, the Worker’s pinned model value, and the Python reference’s model constant. This is the spelling a --model flag carries.
snowflake-arctic-embed-m-v2.0The shard and staging identity: EMBEDDING_MODEL_ID in the shards module. This exact string is stamped into shard manifests and staging-database manifests, and it is the string discovery and fan-out compare against.
Snowflake arctic-embed-m-v2.0A shortened display spelling in the fleet CLI’s help text. It names the same model for a human reader and is not compared against anything.

A shard stamped by the aggregator can therefore never string-equal DEFAULT_MODEL, and no code converts between the spellings. Each subsystem compares only within its own spelling. That is a recorded wart, not a design feature: it works because the comparisons never cross, and any future code that compares across subsystems must normalise first or it will refuse every shard it is handed.

How a vector is made

The embedder is the crate atlas-embed: a native Rust implementation running the model’s ONNX graph — ONNX is the portable model format the graph is shipped in — with no Python and no sentence-transformers process in the path. Tokenization (splitting text into the model’s input units) uses the model’s own tokenizer.json: a SentencePiece Unigram tokenizer with a Metaspace pre-tokenizer, not BERT WordPiece. Getting this right is not a detail; a different tokenizer produces different input ids and therefore a different vector for the same text.

The steps, in order, are the parity contract:

  1. Tokenize with special tokens added, no truncation, no padding at this stage. The shipped tokenizer configuration carries a 512-token truncation default; the loader explicitly turns truncation off, because the model’s real context is 8192 tokens (MODEL_CONTEXT = 8192). An input longer than 8192 tokens is a loud TooLong error, never a silent cut.
  2. Batch with manual right-padding: pad token id 0, attention mask 0 for padded positions. Batch composition never changes a vector — the same text embedded alone and embedded in a batch produces the same result. Batch validation runs before any tensor is built: an empty batch is an error, and an empty entry in a batch is an error naming its index, because an empty entry previously returned, by accident of padding, a fabricated unit-norm embedding.
  3. Run the ONNX session with inputs input_ids and attention_mask. The output must have shape batch by sequence by 768 or the run fails with a shape error.
  4. Pool by CLS: take the hidden state at position 0, the model’s classification token, as the text’s vector. This follows the model’s shipped pooling configuration.
  5. L2-normalise in f32: divide the vector by its length, so cosine comparisons reduce to dot products. The sum of squares inside the norm replicates NumPy’s pairwise summation order exactly, through a helper that mirrors its block size and unrolled accumulators — because floating-point addition is not associative, a differently ordered sum can differ in the last bits, and the parity gate grants no tolerance for that.

One asymmetry is deliberate. Documents — the chunks that make up the corpus, whose provenance is covered in The corpus: provenance and content addressing — are embedded prompt-free, exactly as the production corpus was built. Queries pass through one extra step in atlas-core, not in atlas-embed: the string prefix "query: " is prepended before tokenization. That prefix is the prompt the model’s sentence-transformers configuration applies for queries under the name query; the Rust search layer replicates it as the constant QUERY_PROMPT. A query embedded without the prefix is a valid vector in the same space but a measurably worse search, and a document embedded with it would not match the stored corpus.

Width selection is a caller concern. The crate always produces the full 768 dimensions. A caller may truncate a query vector to fewer dimensions — Matryoshka truncation, using the model’s property that a prefix of the vector is itself a usable, coarser embedding — and then renormalise; --trunc 384 is the form the evaluation lineage uses. The stored table stays 768 wide regardless. Truncation happens after the raw query vector is produced, which is also why the query-embedding cache stores the raw full-dimension vector and applies truncation per request on both hits and misses.

A resident session is expensive: about 1.6 GB of memory, held for the session’s lifetime. Serve mode therefore holds one embedder, or a small pool, behind a mutex and shares it across searches; ONNX sessions take a mutable reference, so concurrent embedding through one session is not possible. Thread counts default to the recorded corpus-pass values: 8 intra-op threads and 2 inter-op threads.

Gate A: bit-identical parity

The corpus was embedded by a Python pipeline. If the Rust embedder produced vectors that differed even slightly, every Rust query vector would be compared against Python-made document vectors across an invisible seam, and no search-quality measurement could separate embedder drift from ranking behaviour. So the contract, called Gate A, is exact: atlas-embed must reproduce the production Python pipeline (~/atlas/v3/embed_onnx.py) bit-identically — token ids equal, output vectors with delta 0.0, singly and batched.

The reference is a fixture file, fixtures/embed-probes.json: 11 probes covering ordinary prose, a query-prefixed probe, a single character, Japanese text, an empty input, three real corpus chunks referenced by chunk id only, and a long probe past 512 tokens that exists specifically to catch the tokenizer truncation trap. The fixture records its own provenance: the model and revision above, the ONNX and tokenizer file hashes, ONNX Runtime 1.31.1, and the thread counts.

Gate A is version-matched, and this qualification is load-bearing. The gate reads the runtime version from the loaded library’s versioned name and refuses to render a verdict against a different runtime version: it fails as NOT APPLICABLE rather than reporting a parity failure or a pass. A different runtime build — the Nix closure’s 1.27.1 is the recorded example — produces deltas around 1e-7 on most components of every probe. That is numerical noise between builds of the same library, but Gate A grants no tolerance, so the honest answer against the wrong runtime is “not measured”, not “close enough”. The gate test is accordingly ignored in ordinary CI, which lacks the pinned snapshot and runtime; it runs where ATLAS_MODEL_DIR and ATLAS_ORT_LIB point at the pinned pair.

One recorded curiosity belongs here because a future maintainer will otherwise “fix” it: the tokenizer’s own configuration declares pad token id 1, and one neighbouring implementation pads with 1. The corpus pipeline pads with 0, so atlas-embed hard-codes pad id 0. A recorded diagnostic shows the two choices are bit-identical on this fp32 graph, including on a 1,272-token chunk, because masked positions never reach the CLS row that pooling reads. The proof is about this graph; a different graph voids it.

The ONNX Runtime loader lesson

ONNX Runtime is loaded dynamically, from a library path the caller supplies, through the ort crate built with its load-dynamic feature and default features off. Nothing is downloaded at build time or at run time. The default behaviour of the ort crate — fetching a prebuilt runtime — is forbidden in the Nix sandbox and is a reproducibility hole anywhere else: the runtime that produced the corpus is part of the parity contract, so the runtime must be a pinned input, not a network fetch.

Packaging mechanises the lesson. Since a 2026-11-08 ruling, the package vendors its own ONNX Runtime in-tree at pkgs/atlas-search/onnxruntime/ rather than taking whatever the ambient package set offers, compiles in a default library path pointing at that vendored libonnxruntime.so, and runs a smoke check at install time. The closure must also carry libstdc++.so.6 and libz.so.1; a packaged server without them fails loudly, so the packaging step verifies with closure inspection and a smoke run — one full-text-only query and one embedded query against a fixture database — instead of assuming. Callers resolve the library in a chain: the ATLAS_ORT_LIB environment variable first, then state-directory and local fallbacks, then the compiled-in default. atlas-embed itself reads no environment variables; resolution is always the caller’s job.

Vectors as plain BLOBs

In SQLite-shaped stores — the local publish files and the core scan shards described in Ingest today: staging, classification, promotion — a vector is stored as a plain binary blob: a table of chunk id and vec BLOB, the blob being the 768 f32 values in little-endian order, chunk after chunk. There is no index structure attached to that column in the shard schema the aggregator writes.

That storage shape decides which query primitives exist. vector_top_k is libSQL’s approximate-nearest-neighbour lookup, and it operates on a libSQL vector index — an index object built over a vector column. A bare blob column has no such index, so vector_top_k has nothing to query against the vectors as stored: it does not work on them. The working primitive is an explicit cosine computation over the blob values, vector_distance_cos on the hosted backend or an in-process cosine scan over a loaded matrix on the local backend. That is the Scan strategy of Retrieval: hybrid full-text and vector search: exact, and priced at a full pass over the allowed vectors. The index-based strategies exist in the code for stores that do carry the index; the plain-blob stores are why they are not the default.

The same plainness has an upside the local backend depends on. Because a vector is just bytes keyed by a chunk id in its own store, vector side stores can be joined to a corpus by content hash when their chunk-id spaces differ — and they do differ, which is why an id join would silently attach the wrong vectors to thousands of chunks. Content hash is the identity; the blob is interchangeable cargo.

The dormant BGE-small space

One other space exists in the publish: vec_bge_small_384_f32, 384 dimensions, from the model BAAI/bge-small-en-v1.5 through the fastembed embedder. It is the pre-Snowflake fallback, kept in the publish as a dormant set. Dormant means dormant: no Rust code names that table — the string appears only in the Python reference, atlas_search.py, which is the sole surface that can still query it, using the BGE query prefix "Represent this sentence for searching relevant passages: " in place of "query: ". Local side-store files from that era are still probed by the local backend when it looks for a configured vector table, joined by content hash like any other side store. The Cloudflare Worker states the boundary from the other side: it validates embeddings against the pinned Snowflake space and refuses a 384-dimension BGE-small vector as not comparable with the corpus. Nothing new is embedded into the BGE space, and no plan re-embeds it; it survives so the fallback publish remains readable, not as a second production option.

Model-versioned vectors, and the open second-embedder question

Vectors from different embedding models are not comparable — a cosine distance between a Snowflake vector and a vector from any other model is a number without meaning. Atlas therefore treats model identity as part of a vector’s provenance, and enforces it at the boundaries:

  • A shard’s manifest records its embedding model. Discovery refuses, in strict mode, a shard with no recorded model, and refuses a shard whose recorded model disagrees with the consumer’s expected identity. A fan-out over shards with mixed recorded models is a fatal error, with that reason stated.
  • Promotion from staging is gated on the same contract, as Ingest today: staging, classification, promotion describes.
  • Query traces record the embedding model of the query and, per candidate, the model recorded by the shard that produced it; two or more distinct candidate models in one search set a breach flag on the trace.
  • The query-embedding cache keys on model identity and revision together with the normalised query text, so a model change changes every key — there is no cache invalidation to forget.
  • The standing decision behind all of this, from 2026-11-08, is one embedding model for every Atlas tier, so cross-tier comparisons are comparable by construction.

Whether that remains one model forever is an open question, deliberately. Issue #9092 requires evaluating a second embedding approach alongside Snowflake — the candidates named there, explicitly not pre-picked, include BGE-M3, Voyage, OpenAI’s text-embedding-3, and Workers AI models — judged on evaluation-set quality, cost, and self-hostability, using the harness described in Evaluation: golden sets and gates. The requirement that makes it hard is also stated there: a second space must be supported without a flag-day re-embed of the corpus, which means per-corpus model identity everywhere a vector is stored or compared, tracked separately as #8623. Until that evaluation runs and lands, the shipped behaviour is the single Snowflake space above, and any chapter or tool that presents a second production embedder is describing a plan, not the system.

Retrieval: hybrid full-text and vector search

Source: written from pkgs/atlas-search/crates/atlas-core/src/search.rs, pkgs/atlas-search/crates/atlas-core/src/fusion.rs, pkgs/atlas-search/crates/atlas-core/src/filters.rs, pkgs/atlas-search/crates/atlas-core/src/turso.rs, pkgs/atlas-search/crates/atlas-core/src/shingles.rs, pkgs/atlas-search/crates/atlas-proto/query-parameters-v1.json, and pkgs/atlas-search/eval/gate-5733-results.md under https://github.com/developing-today/code/blob/main/pkgs/atlas-search/ — provenance only; this chapter is complete without following it.

Retrieval is the act of turning a query string into a ranked list of chunks. Atlas retrieval is hybrid: two independent branches each produce a candidate pool for the same query, and a fusion step merges the pools into one ranking. This chapter states the shipped behaviour — the constants, the order of operations, and the parts of the parameter surface that are accepted but do nothing yet. The embedding branch’s model contract is covered in Embeddings: Snowflake Arctic and the parity contract; how results are judged is covered in Evaluation: golden sets and gates.

The two branches

The full-text branch searches chunks_fts, an FTS5 virtual table over chunk text — FTS5 is SQLite’s full-text index, and its ranking function is BM25, the standard term-weighting score that rewards rare matching terms and penalises very long documents. The branch’s statement joins chunks to their messages, sessions, and session labels, applies the filter and ceiling clauses described below, orders by bm25(chunks_fts), and takes the pool.

Before that statement runs, the query string is turned into an FTS match expression by a heuristic builder. The rule, exactly as shipped in Rust: lowercase the query, split on anything that is not a lowercase letter or digit, keep words longer than 3 characters, and also keep short tokens of at least 2 characters that contain a digit — tokens like r2 or s3, which are short but discriminating. Kept tokens are OR-joined as quoted phrases. If nothing is kept, there is no FTS expression. In full-text-only mode that is fatal, with a message telling the caller to try vector mode; in hybrid mode the search proceeds on the vector branch alone.

The vector branch embeds the query — prompt, truncation, and renormalisation as Embeddings: Snowflake Arctic and the parity contract describes — and ranks chunks by cosine distance between the query vector and each stored chunk vector: smaller distance is nearer meaning. Its statement shape depends on the vector strategy, below.

The search mode selects the branches: hybrid (the default, both branches), fts (full-text only), or vector (vector only). The embedder is lazy: a full-text-only search never loads the model.

Filter before rank

Filters and the sensitivity ceiling are applied inside each branch’s SQL, before any ranking — never as a post-filter over a ranked list. This ordering is a security property, not an optimisation. A chunk above the caller’s ceiling does not merely get removed from the results; it never enters the candidate pool, so it cannot displace an allowed chunk from the pool, leak its existence through a rank gap, or influence fusion. The fixture corpus pins the point: a chunk carrying the query’s exact vector and exact terms must be absent at the default ceiling, not down-ranked, and present at the top when the ceiling is raised to include it.

The filter dimensions are kind, topic, project, and client (each a comma-separated list on the CLI), plus a date range over the session’s creation date: --since is inclusive, and --until is inclusive by being implemented as an exclusive bound one day later. The sensitivity ceiling is a rung on the ladder shareable, personal, local-only, secret-bearing, in that order; the default grant is personal, and a chunk passes only when its effective sensitivity — its own recorded sensitivity, falling back to its session label’s — is at or below the ceiling. A chunk with no recorded sensitivity never passes. The two branches construct this filtering differently in detail — the vector scan branch carries the session-level conditions as an allowed-id subquery rather than the full join, for cost — but the admitted set is the same set by construction.

A second, destination-side narrowing happens after fusion, when chunk details are resolved: the disclosure context of the surface the results are going to intersects its own ceiling with the caller’s, and only the permitted set is rendered in any output shape. That mechanism belongs to Sensitivity tiers and client ceilings; the retrieval point is that branch filtering is the first gate, not the only one.

Fusion: reciprocal rank fusion with the shipped constants

Each branch returns a pool of candidates: by default pool = 100 per branch. Fusion is reciprocal rank fusion (RRF), which scores a chunk by its ranks, ignoring the branches’ incompatible raw scores — a BM25 score and a cosine distance cannot be added, but ranks can. The shipped formula, per branch, is:

score += weight / (rrf_k + rank), with rank 1-based.

The shipped constants, from the versioned contract file query-parameters-v1.json that every default is read from, are: rrf_k = 10, fts_weight = 1.0, vector_weight = 1.0, pool 100, and final result count k = 10. Three worked decompositions are pinned in the fusion tests: a chunk ranked 1 in both branches scores 1/11 + 1/11 = 0.181818; FTS rank 2 with vector rank 1 scores 1/12 + 1/11 = 0.174242; a single-branch rank 1 scores 1/11 = 0.090909. The fused list is ordered by descending score, then by best (smallest) rank in any branch, then by chunk id, so the ordering is total and deterministic. Fusion also retains the per-chunk vector distance for every vector-pool chunk, not only the survivors, for later stages and traces.

One lineage warning, because the numbers recur in older records: the Python evaluation lineage — eval3.py and the scripts it was copied from — fuses at k=60, over branch pools of 30. That is the bake-off-era configuration in which several recorded golden-set numbers were measured. It is not the shipped configuration. Where this book states an RRF constant, it states the shipped behaviour, k=10; evaluation records that used k=60 are labelled with their own configuration in Evaluation: golden sets and gates, and comparing a k=60 number against a k=10 number as if they were one system is an error the records themselves invite and this chapter declines.

Every parameter above is settable per query through the versioned parameter contract — --rrf_k, --fts_weight, --vector_weight, --shard_top_k, --global_top_k and their siblings on the surfaces that expose them — with validation before any backend work: pool must be between 1 and 400, weights must be finite and non-negative and not both zero, and rrf_k must be between 1 and 10000.

Vector strategies

The vector branch has three strategies, selected by --vector-backend. They differ in how candidate distances are obtained, not in what they return: a pool of chunk ids with exact cosine distances, already filter-admitted.

  • Scan — the default, and the current production path. An exact cosine computation over the whole allowed set: vector_distance_cos over the hosted table, or an in-process scan over the loaded vector matrix on the local backend. Exact means exact — no approximation error is possible — and the price is a full pass, about 4 seconds at corpus scale for an unfiltered query, and more when session filters force the expensive form of the query. Scan is the default because the stored vectors are plain blobs without the index the other strategies need, as Embeddings: Snowflake Arctic and the parity contract explains.
  • IndexFixed — one fixed-depth lookup against the libSQL vector index: a single vector_top_k call at pool depth against the index named from the vector table, then the survivors are filtered to the allowed-id set, then exact distances are computed for the survivors. One lookup is the whole strategy; if filtering discards most of the depth, the pool comes back short.
  • IndexFill — the same index lookup with escalating depth until the pool fills after filtering: the depth starts at the pool size and doubles while it is below 3200, then stops at 3200. For a pool of 3 the depth sequence is 3, 6, 12, 24, 48, 96, 192, 384, 768, 1536, 3072, 3200, pinned in a test. IndexFill pays repeated lookups to avoid IndexFixed’s short-pool failure.

Both index strategies are fatal on a non-Turso backend — index modes need the Turso backend — and which strategy should become the default is a decision reserved for A/B evidence at the cutover that introduced them, not a settled fact. Scan remains the default in code.

A related composition exists behind an experimental, hidden flag: the vector branch can be served from the core scan shards, each shard scanned exactly, per-shard top-k merged by distance — exact overall, because the global top-k is contained in the union of the per-shard top-ks. Full-text, details, and expansion stay on the wrapped backend in that composition, because the TursoDB shards carry no chunks_fts; and a query carrying session-level filters stays on the monolith for both branches, with a diagnostic note, because shards carry no sessions or labels to filter on.

The optional Jaccard rescore — off by default

A third signal exists in the code, at rescore only: after fusion, the fused candidate union can be rescored by Jaccard similarity — the size of the overlap of two token-shingle sets divided by the size of their union — between the query and each candidate chunk. A shingle here is a run of 5 consecutive normalised tokens; query and chunk sides share one normaliser, versioned, and sets from different normaliser versions never compare. The rescore has two intended effects: a near-exact boost, promoting a candidate whose overlap passes the near-exact threshold (0.60 by default) decisively above every non-near-exact candidate, and a tie-break blend for the rest, final = 0.85 * rrf_norm + 0.15 * J at standard tier. It is bounded by depth: only the top jaccard_depth fused entries are considered, and shingle sets are computed from chunk text at query time in the shipped slice.

It ships off: jaccard_depth = 0 in the contract defaults, and 0 means no rescore runs. That default is a measured verdict, not an oversight. The held-out gate for this signal, gate 5733, ran on 2026-11-17 against a 54-query near-exact set and the 311-query general set, with the rescore pinned against the Rust implementation’s own test vectors before any number was trusted. The near-exact bar was a gain of at least +0.10 in MRR@10; the measured gain was +0.0361, from 0.5635 to 0.5997 — a fail. The general-set bar was met (nDCG@10 regressed by 0.0017 against an allowed 0.01), but the signal as designed cannot deliver its headline effect: against a long chunk’s full shingle set, a short passage’s Jaccard score is capped far below the 0.60 threshold by set-size geometry alone, and the near-exact tier fired in only 4 of the 54 near-exact queries. So the code stays, the flag stays, and the default stays 0. Turning it on is a per-query choice a caller can make knowingly; making it the default requires a redesigned signal and a new gate.

Accepted but unimplemented: the planner surface

The versioned parameter contract carries four controls that the implementation refuses to run. Setting any of them is a validation error, before any backend work, with a “not implemented yet” message:

  • --planner_enabled — a query planner/rewriter stage.
  • --spell_enabled — spell correction of the query.
  • --query_class_hint — a caller-supplied query-class hint, of any value.
  • --variant rewritten or --variant both — submitting a rewritten form of the query, or both forms. Only the shipped default, raw, runs.

These are not hidden gaps; they are a contract surface defined ahead of its implementation, carried in every request and every cache key so that landing the stages does not change the wire shape. The work is tracked as #5773 (the query-understanding front end: spell correction and an LLM query planner/rewriter as toggleable stages, with dual submission and provenance) and #5774 (the parameter surface itself). Until those land, the honest statement is the one the validator makes: the flags are accepted by the parser, representable in the contract, and rejected by validation. A related switch, --raw, is implemented: it marks the query as verbatim, with planner and spell stages and expansion disabled — and combining it with a non-zero --expand is likewise a validation error.

Output shapes: grouping, expansion, hydration

The fused ranking is rendered in several shapes, selected per query:

  • Flat — the default: the top k chunks in fused order, each with its provenance and, when requested with --with-message, its parent message text, truncated at 50,000 characters.
  • Grouped by session — --group-by-session rolls chunk hits up to their sessions: a session’s score is its best chunk’s score, with a hit count attached, and k then counts sessions, not chunks.
  • Expansion — --expand N attaches up to N neighbouring chunks from the same message around each hit, in chunk order. The ceiling is 100 (MAX_EXPAND_NEIGHBORS); asking for more is fatal. Expansion is context for reading a hit, not additional ranking.
  • Hydration — --hydrate N replaces the top N results with their full chunk and message content fetched from the content store. Hydration is not expansion: expansion walks neighbours in the corpus database, hydration fetches complete content from the tier content stores, and the two flags keep their separate meanings and limits (hydration is capped at 1000, and requesting it together with grouped output in the default raw mode is fatal, because grouped output has no flat top-N to hydrate).
  • Raw rows — an explicit raw mode can render the flat fused rows ungrouped, or the pre-fusion branch rows exactly as each branch produced them, each row tagged with its branch. No fusion is applied in the branch-rows form; it exists for diagnosis, and it is distinct from --raw, which concerns the query text, not the output.

Every executed search, in every shape, writes a query-trace record before its response is released, and a failure to write the trace fails the search. The served set recorded in the trace is collected from the rendered envelope, so the disclosure filtering described above is exactly what the trace attests to — a property Evaluation: golden sets and gates and the statistics built on traces rely on.

Ingest today: staging, classification, promotion

Source: written from pkgs/atlas-search/crates/atlas-core/src/stage.rs, pkgs/atlas-search/crates/atlas-core/src/gate.rs, pkgs/atlas-search/crates/atlas-core/src/aggregate.rs, pkgs/atlas-search/crates/atlas-core/src/sweep.rs, pkgs/atlas-search/crates/atlas-core/src/github_comments.rs, pkgs/atlas-search/schema/atlas_stage_v1.sql, pkgs/atlas-search/schema/stage_registry_v1.sql, pkgs/atlas-search/schema/gate_records_v1.sql, pkgs/atlas-search/tools/note_promotion_sweep.py, and the turso-atlas README record under https://github.com/developing-today/code/blob/main/pkgs/atlas-search/ — provenance only; this chapter is complete without following it.

Ingest is how text becomes part of the searchable corpus. This chapter separates two things that are easy to conflate: how data actually gets in today, which is manual and script-driven, and the in-repo machinery — staging databases, a registry, classification, and gated promotion — meant to replace the manual path piece by piece. Where a piece is designed but not automatic yet, this chapter says so plainly.

The reality first: a manual, script-driven pipeline

The production corpus was built, and is still extended, by scripts that live outside this repository, in the private hatch-personal tree — principally atlas-ingest.py and its companions in workspace/turso-atlas/scripts/. The pipeline those scripts drive has five steps:

  1. Collect. The ingest script runs on a machine and reads each AI client’s on-disk conversation store, through per-client adapters and a per-machine locations file. Nothing is uploaded by this step.
  2. Normalise. Every conversation becomes the same shape in one local SQLite file: sessions, then messages, then chunks of roughly 3,500 characters, deduplicated by content hash, so re-runs add only what is new. That file is the durable asset; everything downstream is derived.
  3. Index. Built from the chunks, locally: the FTS5 keyword index, and per-model vector sets — roughly 768 numbers per chunk for the current model, as Embeddings: Snowflake Arctic and the parity contract describes. Vectors are derived and disposable, stored per model so a better model means building a second set beside the first and keeping the winner.
  4. Publish. A copy of the hot index — keyword index plus the current-best vectors — is pushed to the hosted Turso database as distribution. The full store stays on the laptop; the hosted copy never holds the only copy of anything.
  5. Access. Agents search through the surfaces in The service and the Worker, not by writing SQL against the corpus.

The operational facts: ingestion is run by hand, or by an agent lane invoking the scripts. There is no ingest schedule; the only Atlas schedule on the laptop is the daily backup timer. Corpus counts are therefore a snapshot — last verified at the 2026-10-31 publish, as The corpus: provenance and content addressing records — with no verified recount of later growth. The migration moving these scripts into this repository is issue #5670, still open: the Python search reference and evaluation tooling have landed in-repo; the ingest-side scripts have not. Anything describing Atlas ingest as a running service is describing the design in Design: automatic ingest of all sources, not today’s system.

Staging: one small database per unit of work

The in-repo replacement for direct-to-core ingest starts with staging. A staging unit is one unit of work — a queue task, a session, an epic, a batch of notes — and each unit gets its own small database, provisioned by atlas-stage provision (or the atlas-core stage functions) with the versioned atlas_stage v1 schema. Many small databases, with free writes, is the design phrase: a producer can write to its own staging database without contending with the corpus’s single writer, and a staging database is cheap to create, cheap to branch, and cheap to discard.

The v1 schema is exactly five tables, applied once to an empty database; re-provisioning over an existing set is an error, and a schema check asserts the version row and the exact table set:

TableWhat it holds
_schema_versionOne row: the schema version, 1.
itemsOne row per staged item — a message, note, or document fragment — with its unit id, kind, source, text, recorded sensitivity, and an open JSON metadata bag.
chunks_rawThe item’s raw chunks: item id, position, text, and content hash. Raw and un-embedded, by design.
notesFree working notes against the unit, for the life of the unit.
kvKey/value scratch: cursors, checkpoints, producer bookkeeping. Last write wins.

Two properties carry the design. First, a staging database never stores vectors. Embedding happens once, at promotion, so staging stays write-cheap and no producer needs the model or the runtime described in Embeddings: Snowflake Arctic and the parity contract. Second, writes are unmediated: sensitivity is recorded on each item, not enforced at write time. Enforcement belongs to classification and the promotion gate, below — staging’s job is to accept work faithfully, not to judge it.

The staging vocabulary needs one warning. A unit’s recorded sensitivity, and an item’s default of internal, use the physical tier vocabulary — public, internal, secret — not the four-rung search ladder (shareable, personal, local-only, secret-bearing) of Sensitivity tiers and client ceilings. The same column name carries disjoint value sets in staging and in the publish. The aggregator translates tier to ladder when it writes a promoted chunk; nothing else declares that mapping in code.

Staging helpers bound producer shapes: an artifact at or below 32 KiB stages as one whole-file unit; a single raw chunk has a hard ceiling of 64 KiB, split at line boundaries, never mid-line. atlas-stage ingest stages one artifact file with repository, path, and commit SHA as its source, plus kind (prose, code, or config) and language.

The registry

Staging databases are found through the stage registry, its own store holding two tables. staging_units maps a unit id to its database location, owner, tier, schema version, and lifecycle state — open, closing, or merged. merge_manifests is the durable audit record of each successful promotion: rows in, rows promoted, content hash, embedding model, and timestamp, kept after the unit leaves the active states.

The lifecycle is short. A unit is provisioned open; producers write; when work is done it moves to closing, the signal that an aggregator may pick it up — atlas-stage units --state open and its siblings are the read-backs a poll would use. Promotion, below, is the terminal transition to merged. A promoted unit’s database is stamped and branched as its archive, and that stamp deliberately closes it to further staged writes: promotion is its last write.

Classification at staging time

Classification — deciding how sensitive each chunk is, under the model in Sensitivity tiers and client ceilings — can happen while staging, and for classified artifacts it must happen at source boundaries. A producer may declare the artifact’s source-native classification segments: a JSON array of byte ranges, each with a sensitivity from the four-rung ladder and an optional certainty flag. The segment file is parsed strictly; a missing or mistyped field, or an unknown sensitivity name, is an error, never a silent default.

Staging composes those declarations through the boundary splitter. Classification may change only at a declared content boundary — a message or turn boundary, an authored block, a code symbol, a log record, a source-native unit — and every declared boundary splits the chunking there, so chunks partition the source exactly and never straddle a classification change. Undeclared, contradictory, or uncertain text becomes one secret-bearing chunk marked uncertain: doubt resolves upward, to the most restrictive rung. One classification record per resulting chunk — exact source offsets plus the effective sensitivity — is persisted in the item’s metadata. Segment declaration stays with the producer; staging composes and persists, it does not originate the judgement. Read-back fails closed in the same direction: a malformed or unrecognised recorded sensitivity resolves to secret-bearing.

Separately, a remainder sweep exists for what classification missed: the atlas-classify procedure enumerates unclassified or unresolved chunks in a corpus database and, only when explicitly committed, writes one classification record per candidate. Its default is a dry run that prints its manifest and writes nothing.

Promotion: embed once, behind the M6 gate

Promotion is the merge-on-close step that turns a staging unit into searchable core. It has two halves.

The aggregator half does the embedding. It reads the unit’s items and raw chunks, embeds every chunk document-side — prompt-free, as the corpus contract requires — and writes one new core scan shard in the shard layout: chunks, their vectors as plain blobs in vec_snowflake_m_v2_768_f32, and a shard manifest recording the shard’s tier (the unit’s recorded tier), topic, part, expected chunk count, cosine metric, embedding model, engine, and source unit. Oversize chunks are split at line boundaries into pieces that fit the model’s context and partition the chunk text exactly, never crossing the classification boundary the chunk was cut on; identical piece texts are embedded once per run. Each promoted chunk’s recorded sensitivity is its persisted effective sensitivity when the item was classified, otherwise its item’s tier translated into ladder vocabulary.

The gate half decides whether any of that may land. Registry::promote enforces the embedding-model contract — gate M6 of the one-model decision: a unit promotes only when its database’s recorded embedding model equals the mandated model identity, snowflake-arctic-embed-m-v2.0 in the shard spelling. The refusals are all fatal and leave the unit unpromoted: a different model named (vectors from different embedding models are not comparable), no model recorded (provenance unknown), or an empty unit. On success the registry writes the merge manifest, archives the staging database, and moves the unit to merged. The atlas-stage promote verb runs both halves together: embed into a new shard in a given directory, stamp the unit’s model provenance, then promote through the gate. It needs the model and the ONNX Runtime, resolved exactly as the search binary resolves them.

The batch gate is a different gate

Do not conflate the promotion gate with the batch ingest gate in gate.rs. They guard different things. The M6 gate above is a single contract check at the moment a staging unit merges. The batch gate judges a whole batch — a staging unit, or one increment of a long-lived unit — through five ordered stages: write, classify, dedup, provenance-check, publish.

The gate module is the durable audit record and the rules that make later stages checkable; the stage checks themselves are separate follow-on work that records its verdicts through it. Its properties:

  • The batch state machine runs open, closing, gated, then published or quarantined, with a retry path from quarantined back to gated. No other transitions exist.
  • It fails closed. A stage with no recorded verdict has not passed, and verdicts are recorded strictly in order, so no stage can be judged before its predecessor passed. A skip is allowed only in two named cases — an empty batch at write, and a publish with zero survivors and no additions pending — always carries an enumerated reason, and never produces a publish manifest.
  • Quarantine is bounded. The same failure reason three times (the strike limit) marks the batch as needing review and stops automatic retries. A retry resumes at the failing stage; a failure in the write stage re-enters at write, because the producer must rewrite; and if an earlier stage’s input changed, every verdict from the earliest changed stage onward is discarded — changed bytes never inherit a verdict obtained for different content.
  • The record never carries content. A gate record holds counts, enumerated reason codes, row ids, content hashes, and the publish manifest id, so the record of a secret-tier batch can be read without reproducing the material that quarantined it. Quarantine is a state, not a deletion: the gate never touches the batch’s staging database.

Sweeps and dead letters

The sweep machinery in sweep.rs is the scheduling discipline for periodic source ingestion: candidate filtering, guardrails, headroom checks, run state, locking, and run reporting, driven by the atlas-sweep runner. Its constants state the posture: a candidate over 256 MiB is rejected as oversize; a run lock lives for 2 hours; a report carries at most 100 rows. Guardrail evaluation can throttle or pause a source class on measurements such as spend anomalies, and classes can be paused and resumed per host.

Failures accumulate as dead letters: a candidate that fails repeatedly — three strikes — is dead-lettered rather than retried forever, and the operator surface is list, retry one, or drop one. Cycle reports summarise runs.

What the runner does not do is run itself. It creates and enables no schedule; cadence is an operator decision, and the recurring sweep as a standing service — issue #7969 — is not built. It is a runner an operator invokes, not a daemon.

The two landed writers worth naming

Against that background, two continuous or repeatable writers have actually landed.

atlas-github-comments is the one landed continuous writer. It extracts GitHub comments — issue comments, review comments, and reviews — as corpus documents in the atlas-github-comment/v1 record shape, through the gh CLI’s API with pagination, sequentially, as rate-limit discipline. Its estate, with no repository restriction given, is the owner’s own: the developing-today and developing-today-forks organisations plus the dezren39 account. External repositories are never extracted by it; that ingestion is gated on separate licensing work, #6024. Extraction is incremental per repository through a stored watermark, and watermarks are persisted after every repository, so an interrupted run resumes where it stopped. A permanently access-blocked repository is logged, counted, and skipped while the run continues; any other failure stops the run with state saved. Its output is an append-only records file — a feed into staging, not a promotion — which is exactly the boundary this chapter has drawn throughout.

note_promotion_sweep.py, in the package’s tools/ directory, is a narrower repeatable writer. It implements the agent-note placement rule — move on next touch, never big-bang: it writes the note’s bytes to the new home unchanged, records the old-to-new mapping in a submission database, and only then, after hash verification, replaces the old location with a pointer stub naming the new home. An existing new home with different content is a refusal, never an overwrite; re-running a completed promotion is a no-op receipt; a pointer stub is never itself promoted. It is a notes-placement tool, not a corpus-ingest tool, and is named here so it is not mistaken for one.

What is not automatic yet

Stated once, plainly:

  • The aggregator exists as a promotion step an operator invokes per unit. The aggregator as a standing service polling closing units unattended is not built; it was deliberately out of scope for the staging foundation.
  • The session-close extraction hook — the trigger that would stage a session’s content automatically when it ends — is not built.
  • The recurring sweep is not scheduled, and continuous ingestion of all sources (#9097) has unmet acceptance.
  • The production ingest scripts still live in hatch-personal; #5670, their migration, is open.
  • The only automatic Atlas job on the laptop remains the daily backup.

The designed pipeline — source hooks and reconciliation crawls feeding detection, staging, classification, the five-stage gate, and per-batch attestation, with classification always before promotion and never after — is the programme recorded in Design: automatic ingest of all sources. What ships today is the manual pipeline at the top of this chapter, plus the staging, classification, and promotion machinery in the middle of it, waiting on the automation that connects them.

The service and the Worker

Source: written from pkgs/atlas-search/crates/atlas-search/src/server.rs, pkgs/atlas-search/crates/atlas-proto/src/lib.rs, pkgs/fleet/crates/fleet-search/src/serve.rs, and pkgs/atlas-search/worker/src/ (index.ts, search.ts, service.ts, cache_do.ts, hot_cache.ts, key.ts, space.ts, mcp.ts) in https://github.com/developing-today/code/blob/main/pkgs/atlas-search/, plus the binary/service design of record in doc/. Provenance only — this chapter is complete without following it.

Atlas has two serving halves, and they are not two copies of the same thing. The service is a long-lived process on Drew’s laptop that owns the corpus connection, the resident embedding model, and the search itself. The Worker is a small Cloudflare Worker that sits in front of that service as the hosted front door: it authenticates callers, caches whole query results, and forwards anything it has not seen before to the laptop. A local command-line search can bypass the Worker entirely; a hosted caller cannot bypass the service. Everything below keeps the two halves separate, because most confusion about Atlas serving — above all about caching — comes from merging them.

The laptop service

The service is the serve mode of the Atlas search binary: one process that holds the state a one-shot command would have to rebuild on every invocation. That state is a lazily loaded ONNX embedder session for the Snowflake model (about a second to load, a few hundred megabytes resident, against roughly 35 seconds of cold start for the old Python path), a connection pool to the corpus stores, a worker pool for branch execution, and the job registry described below. In production the systemd user unit atlas-search.service does not run the standalone binary: a home-manager flag re-points its ExecStart to fleet serve search, the serve half rehomed into the fleet binary. The unit name, the configuration, the port, and the wire protocol are unchanged by that rehoming, and rollback is the same single flag pointed back at atlas-search serve. The service binds 127.0.0.1:18760 on the laptop, with tailnet exposure layered in front of the loopback port; it is never a public listener in its own right.

Its configuration lives in ~/.local/state/atlas-search/service.json, a file with mode 0600 written by atlas-search init. That file holds the listen address and the per-client token table: each named client has its own bearer token and a ceiling cap, the highest sensitivity ceiling that client may ever search under. The clamp is the security property of the whole design, and it is computed server-side as effective = min(requested, token ceiling cap); the effective ceiling is recorded on the job and reported back in the result envelope, so a caller can always see the ceiling it actually got. Raising a cap is a local edit by Drew on the laptop, never something a request can do. The named clients and their caps are covered in Consumers: fleet, agents, memory and ID.

The job protocol: submit, wait, page

Search over a filtered corpus is slow enough — a filtered vector scan is seconds of server-side work — that the service speaks an asynchronous job protocol over HTTP and JSON, defined by the shared atlas-proto crate so the server and its clients cannot drift apart:

  1. The client submits with POST /v1/search/jobs and receives 202 with a job id and a per-job capability token. That token authorizes only that one job’s status, results, chunk, and delete endpoints; it is not a client credential.
  2. Workers inside the service run the full-text and vector branches concurrently, fuse the two pools once into a final ranking, and land that ranking in the temp store (below). Fetch-to-fill depth escalation, when the vector index path needs it, happens inside the job’s vector branch — never in client paging — precisely so that reciprocal rank fusion runs once, over complete branch pools.
  3. The client polls GET /v1/search/jobs/&lt;id&gt; for status, then pages the finished, immutable ranking with GET /v1/search/jobs/&lt;id&gt;/results using a cursor and a limit (default limit 100). GET /v1/search/jobs/&lt;id&gt;/chunk/&lt;chunk_id&gt; fetches one chunk from the job’s context, and DELETE /v1/search/jobs/&lt;id&gt; discards the job early.

There is also a one-shot POST /v1/search, which is the same machinery with the waiting done on the caller’s behalf, a POST /v1/embed endpoint that returns a query embedding in the pinned space (added for the Worker’s cache-miss path; any valid client may embed, because ceilings govern search, not embedding), feedback endpoints, and an open GET /health that reports liveness, embedder state, queue depth, and active job counts with no authentication and no corpus data. A client that only wants the finished answer — the command line’s one-shot mode sets the protocol’s wait flag — never has to handle the job states itself, but the states are the real protocol, not an implementation detail.

The temp store: ten minutes, in memory, gone on restart

A job’s fused ranking lands in a temp store that is deliberately perishable. It is in-memory only, held by the serve process. Entries carry a TTL of 10 minutes from completion, with a 60-minute hard cap from submit. Nothing in the temp store survives a restart, by requirement — a restart takes every in-flight and finished job’s stored ranking with it, and clients simply submit again.

That perishability is a security property, not a missing feature. Job results hold ceiling-gated snippets: text a particular client was allowed to see at a particular ceiling. The design considered and rejected the two obvious persistent alternatives on evidence. A scratch Turso or libsql database inherits the production writer’s stall behaviour (recorded at roughly 22 minutes per write in the incident that motivated the design). A local SQLite file would work mechanically, but its persistence is itself the liability — snippets would outlive the job, the session, and the reason they were fetched. In-memory storage with a short TTL is the only option that makes the snippets’ lifetime match their purpose. Backpressure follows the same bounded shape: a small number of concurrent branch executions globally, a per-client limit on concurrent jobs with a bounded queue behind it, and saturation answered with 429 and a retry hint rather than unbounded queueing; a job left queued far beyond its useful life fails as expired instead of running stale.

Hold this TTL story apart from the Worker’s, below. Both stores get called “the Atlas cache” in different documents. They are different stores, on different machines, with opposite lifetimes, for opposite reasons.

The Cloudflare Worker

The Worker (package name atlas-search, deployed on the fleet Cloudflare account’s workers.dev subdomain) is the hosted front door for callers that are not on the laptop: principally agents reaching Atlas through the MCP endpoint wired into mcpx, and any REST caller holding the gate token. Its public surface is five routes: GET /health (open, liveness only), POST /v1/search, GET /v1/cache/inspect, POST /v1/cache/purge, and POST /mcp. Everything else is a 404.

Two facts define what the Worker is not. First, it holds no database credentials at all — no Turso token, no shard list, no corpus connection. Shard discovery, fan-out, manifest reads, and merging all live in the laptop service; the Worker knows exactly one upstream, the service, reached through the tunnel hostname atlas-search.security.cab with a Cloudflare Access service token alongside its service token. If the laptop service is unreachable, the Worker degrades to 502 and caches nothing. Second, there is exactly one search execution path: a single executeSearch function that both the REST route and the MCP search tool call after their own gate and validation, so ceiling pinning and cache keying cannot drift between the two surfaces. An MCP search and a REST search for the same normalized query at the same depth are, by construction, the same search — and share one cache entry.

The gate, and the identity the Worker presents

Inbound, every gated route checks one shared secret, named GATE_TOKEN, presented as an Authorization: Bearer header. There are no per-route, per-caller, or per-agent tokens: a valid check yields a boolean and nothing else, so every gated caller is the same identity to the Worker. The comparison is built to be constant-time — both the presented token and the configured token are hashed with SHA-256, and the two 32-byte digests are XOR-folded; the tokens match exactly when the fold is zero. A missing token, a missing configuration, or any mismatch is a 401.

Outbound, the Worker presents exactly one client identity to the service: the cf-worker client, whose service-side ceiling cap is personal. This pinning is compile-time, not configuration. The Worker sends ceiling: "personal" and disclosure context hosted-per-user on every service search; no request field, header, or environment variable can change either value. After the service responds, the Worker verifies that the reported effective_ceiling is personal before anything is cached — a result computed above personal is refused with a 502 and can never enter the cache. The ceiling and context are also fields of the cache key itself, so a payload filtered for one ceiling could never be served to another even if the keying were reached by a different route. The embedding space is pinned the same way: model Snowflake/snowflake-arctic-embed-m-v2.0, 768 dimensions, one pinned model revision and vector table, validated on every cache miss before anything is stored. The full ceiling model is in Sensitivity tiers and client ceilings.

The Durable Object cache: check-and-fill, retained indefinitely

Each distinct query gets its own Durable Object (DO), a small single-threaded Cloudflare object with its own SQLite storage, named by the query’s cache key. The key is the lowercase hex SHA-256 of a versioned JSON material string (key schema KEY_SCHEMA = 2, carried in the material’s v field) containing the normalized query (Unicode NFC, trimmed, whitespace runs collapsed to one space; case preserved), the pinned ceiling, the pinned context, the model revision, the vector table, and the clamped result depth k (default 10, clamped to 1–50; only a JSON number is honoured). One DO therefore owns exactly one (query, depth, ceiling, context, space) combination and exactly one stored row.

That ownership is what makes the cache correct under concurrency: the whole check-and-fill runs inside the DO’s fetch handler, so concurrent misses for the same key serialize on the DO’s single thread and the expensive laptop fan-out executes once. The entry moves through three states — absent, embedded, complete. On a miss the DO inserts the row, asks the service to embed the query, and persists the embedding before the search runs; if the search then fails, the entry stays embedded, the error propagates, and the next request retries the search without paying for the embedding again. On success the result JSON, timestamps, and the measured embed and search times are written, and every later request is a hit: the stored result is returned verbatim and a hit counter is incremented. The operator routes fit the same shape — inspect returns metadata only (presence, embedding dimensions and validity, result size, hit count, timings; never the result body or the vector), and purge deletes exactly one key’s row. There is no prefix or enumeration purge, by design: the key is a digest, and enumeration would need a separate index nobody has built.

This cache has no TTL. Entries are retained indefinitely — no expiry, no eviction, nothing deleted except by an explicit operator purge — by Drew’s order, and tracked as issue #6805. Deferred triggers for revisiting that policy exist on the record (add a corpus generation to the key after a large same-space re-ingest or a stale-result complaint; add a sweeper at a stated size), but they are triggers, not code: today, a cached answer survives any corpus change underneath it. This is the opposite end of the TTL spectrum from the service temp store’s ten minutes, and it is a cost decision — the cache exists so repeated agent queries never re-pay the laptop fan-out — where the temp store’s perishability is a sensitivity decision.

The D1 hot cache: a store that is not wired in

The Worker contains a second cache mechanism, and stating its status precisely matters. The D1 hot-cache tier (D1 is Cloudflare’s hosted SQLite database) is a tenant-keyed store designed as a cheaper tier in front of the Durable Objects: one shared database, rows keyed by (tenant, cache key), each holding an opaque payload blob, a payload class, a source watermark, fill and last-hit timestamps, and a hit count, with an index supporting least-recently-hit eviction order. Its storage module is complete and tested: get, put, touch, and evict primitives all exist and behave as designed.

It is not on the request path. Nothing in the Worker’s routing, search, MCP, service, or cache code calls the store; its only callers are its own tests. The master flag HOT_CACHE_ENABLED (committed value "false"; only the literal string "true" would enable it, and only when the database binding also exists) therefore changes nothing today either way — turning it on would not make a single read or write happen. Freshness evaluation, admission, and an eviction sweep are separate follow-on work, and read-path integration is issue #13105. Like the DO cache, the D1 tier as implemented has no TTL and no automatic eviction, so it too retains entries indefinitely (#6805) — but the operative fact for any reader today is simpler: when you ask where a hosted Atlas answer was cached, the answer is always the Durable Object, never D1.

Timeouts

There are no application-level timeouts anywhere in the Worker. No abort controller, no signal, no deadline, and no setTimeout appears in its source: the outbound calls to the service, the Durable Object stub calls, and the gate’s digest computation all run unbounded, subject only to Cloudflare platform limits that live outside this code. The only time values the Worker handles are measurements — the Date.now() durations it records as embed and search milliseconds — and stored timestamps. A slow laptop service means a slow hosted answer, not a Worker-side cutoff.

How the two halves fit

A hosted query, end to end: the caller passes the gate; the Worker normalizes the query, clamps k, and derives the cache key; the key’s Durable Object either serves its complete entry or runs the fill — embed, then search — against the laptop service, presenting the cf-worker identity, verifying the personal ceiling on the way back, and storing the result indefinitely. A local query skips the Worker entirely: the client speaks the job protocol to fleet serve search on the laptop, whose results live for ten minutes in memory and vanish on restart. Same engine, same corpus, same ceiling discipline — Architecture draws the whole picture — but two front doors with deliberately different memories.

Consumers: fleet, agents, memory and ID

Source: written from pkgs/fleet/crates/fleet-search/src/ (cli.rs, client.rs, pyjson.rs, render.rs), pkgs/atlas-search/docs/memory-integration-design-8567.md, home/common/mcpx-settings.nix, and the consumer inventory in the Atlas programme research, in https://github.com/developing-today/code/blob/main/. Provenance only — this chapter is complete without following it.

Atlas exists to be asked questions by other systems. This chapter names every class of consumer, the surface each one actually uses, and the sensitivity ceiling each one gets — because in Atlas the ceiling is part of the consumer’s identity, not a per-query preference. A ceiling is the highest rung of the sensitivity ladder (shareable, then personal, then local-only, then secret-bearing) a search may touch; it is enforced inside the branch queries, before any ranking, and then clamped server-side to the calling client’s cap, so effective = min(requested, cap) and no consumer can widen its own access by asking. The full model is in Sensitivity tiers and client ceilings; the serving machinery behind every surface here is in The service and the Worker.

One caveat applies to every consumer equally: the corpus they search is the frozen 2026-10-31 publish (18,325 sessions, 107,639 chunks) until automatic ingest lands. Agents routinely assume the corpus is current. It is not, and that gap — not latency, not ranking — is the largest consumer-facing problem Atlas has.

The primary agent-facing consumer is the fleet itself. Every fleet agent and seat — Muse lanes, OpenCode sessions, other seats — looks up prior work through fleet search: past decisions, session evidence, “have we seen this before”, across all the corpora Atlas holds. Drew’s order of 2026-11-22 made fleet search the documented route for all agents and sessions.

fleet search is not a second implementation. It is the atlas-search client surface ported flag-for-flag into the fleet binary: the same hybrid full-text plus vector search (default mode hybrid; --mode fts or --mode vector), the same filters (--kind, --topic, --project, --client, --since/--until session dates, --max-sensitivity), the same shaping flags (--group-by-session, --expand for neighbouring chunks, --with-message, --hydrate, --pool per-branch candidates, --k final results), and a get-chunk verb that returns one chunk with its provenance. The fleet workspace deliberately carries no second embedder and no second backend; the search domain consumes the Atlas crates as they are.

Because the two binaries must print identical bytes for identical searches, the port is guarded. The fleet copies of the two output writers — pyjson.rs, the Python-shaped JSON writer, and render.rs, the envelope renderer — must stay byte-identical to the atlas-search originals outside their pinned parity headers. A repository script, check-fleet-search-parity.sh, compares exactly those two files, with its own contract test suite beside it. One honesty note: the guard workflow is dispatch-triggered only, so the check exists and is cheap, but nothing runs it automatically on every change to either copy — drift is detectable on demand, not yet gated on push.

Routing depends on where the caller sits. A sandbox seat defaults to via-service: the job protocol against the laptop service at http://127.0.0.1:18760, reached through the laptop SSH forward, with a loud fallback to standalone if the service route fails. A laptop seat defaults to standalone, which is a delegation rather than a reimplementation: the fleet verb runs the deployed atlas-search artifact with the caller’s arguments in atlas-search’s own shape and inherits its output byte-for-byte. Explicit flags beat environment, which beats fleet configuration, which beats the host default. Two details follow from the protocol’s shape: get-chunk is job-scoped in the protocol, so it always runs through the standalone artifact (with a loud note when via-service is in effect); and init and fetch-model are not fleet verbs at all — they stay on atlas-search, and asking fleet for them is a usage error. Ceilings on this surface are enforced by the service from the client identity read out of ~/.config/atlas-search/client.json: the sandbox-scripts identity is capped at personal, Drew’s own CLI identity at secret-bearing.

Agents: the MCP server in mcpx

The second live consumer class is agents speaking the Model Context Protocol (MCP), the standard tool protocol agents use to call external services. The Atlas MCP server is the Worker’s POST /mcp endpoint: a stateless Streamable HTTP MCP server exposing exactly one tool, search, running through the same single execution path as the Worker’s REST search — same pinned context, same ceiling, same Durable Object cache, so an agent’s MCP query and a REST query for the same text share one cache entry. Cache purge and inspect are deliberately not MCP tools: purge is a write, and inspect is an operator audit surface.

On the laptop, this server is wired into mcpx — the fleet’s MCP aggregation daemon — as a remote server named atlas, configured in the mcpx settings as a URL plus bearer authentication expanded from the daemon’s environment at runtime (the token value never lands in the configuration file or the Nix store). That wiring is what puts Atlas search in front of OpenClaw, OpenCode sessions, OpenChamber, and Muse lanes as one namespace among their other tools.

Here the book must state the source behaviour over the design’s ambition. The memory-integration contract for this endpoint says the MCP layer stamps the calling agent’s identity and enforces that agent’s own ceiling and corpus scoping. That is not what the shipped endpoint does. The Worker checks one shared gate token and extracts no caller identity from it; every MCP caller shares the one hosted identity — disclosure context hosted-per-user, ceiling personal. Per-agent identity stamping, per-agent ceilings and corpus scoping, and a query audit log are later slices of issue #8625, deliberately not improvised in the current code, and #8625 stays open on the cross-client acceptance verification (each named consumer querying the unified index with its own identity). What an agent gets today is real and useful — the full hybrid search at the personal ceiling, cached — but it is a shared door, not a per-agent one. The endpoint’s own reference is The Atlas MCP server.

Memory: the OpenClaw and agent-memory integration (design)

The third consumer is agent memory itself, and this one is a design, not shipped behaviour. The decision of record is pkgs/atlas-search/docs/memory-integration-design-8567.md (issue #8567, decided by Drew 2026-11-10 under parent #1300): fleet and agent memory integrates into Atlas — everything queryable across all agents and corpora — rather than living in local-only silos or in a separate new store.

The design indexes one unified index over five corpora, each keeping its existing owner and source of truth: agent memory (OpenClaw’s memory store), Muse memory files, the Zettelkasten/Emanote notes, repo docs, and research reports. Every indexed unit carries its corpus, agent, source reference, update time, sensitivity, and zone. The index lives inside Atlas as named corpora in the existing store, ingested through the same staging and registry path as every other source — no new vector store, and the index is always disposable while the corpora never are. Memory content gets no side door around the staging, classification, and promotion discipline described in Ingest today: staging, classification, promotion.

The access-pattern decision is MCP first, for four recorded reasons: one protocol all agents already speak; one policy-enforcement point instead of one per tool; identity travels with the protocol; and Atlas stays a service rather than becoming a library forked into every consumer. Native library access is reserved for Atlas-internal processes; per-tool native access was the rejected alternative, revisit-able only on a measured latency case with its own design record. The query surface itself is the same core run_search over the union, with ceiling and corpus filters applied inside the branch queries — before ranking, never after — and every hit naming its corpus and source reference.

What exists today is the MCP endpoint above and the decision. The connectors that would feed the five corpora into the unified index are not built: the corpus registry and memory connector are issue #8622, the remaining corpus connectors are #8626, and both are open. Until they land, memory recall still runs against per-agent silos — OpenClaw against its own local store, each agent against its own files — and the unified memory index this design describes does not exist to be queried.

ID: the designed consumer with no live query path

The fourth consumer, ID — the fleet’s identity and object-graph system — is likewise designed, with no live query path today. The designed relationship runs in both directions. Atlas corpus objects, with their provenance and lineage, publish into the ID graph in a defined publication format (issue #6062, with a projector set filed as #11182–#11186, all unstarted). In the other direction, ID content is automatically vectorized — Snowflake plus the second embedder from #9092 — feeding a built-in ID search over the object graph, with recommendation surfaces on top (issue #9109, Part C of the ID/Atlas federation programme). Neither direction is built: the publication format is undesigned-to-unbuilt, no projector runs, ID objects are not in the Atlas corpus as a searchable class, and there is no ID-side query surface to call. The full design, its substrate questions, and its issue map are in Design: search integration for fleet and ID; nothing in this chapter’s other sections should be read as ID search working.

Evaluation: the consumer that measures the rest

The final consumer is Atlas’s own quality loop. Evaluation consumes the same core as every other surface — the same run_search, the same corpus, the same embedding space — and scores what comes back against judged golden sets, so that a ranking change proposed for fleet or agents is measured before it is believed. It also consumes Atlas’s exhaust: every executed search can mint a query trace, and users and agents can attach feedback to a (query, chunk) result identity; both feed statistics and weekly reports. Evaluation gets no special ceiling and no special corpus — that is the point — and its instruments, gates, and recorded disagreements are the whole of Evaluation: golden sets and gates.

The ceilings, in one table

ConsumerSurfaceCeiling cap
Drew’s own CLI (drew-cli)fleet search / atlas-search, standalone or via-servicesecret-bearing
OpenChamber sessionsvia-servicepersonal
Fork / OpenCode agentsvia-servicepersonal
Sandbox scripts and Muse lanes (sandbox-scripts)via-servicepersonal
Hosted MCP callers (all agents, shared identity)Worker POST /mcp via mcpx atlaspersonal (context hosted-per-user)
The Worker itself (cf-worker)Worker to laptop servicepersonal
Evaluationlocal harness against the corpus and saved rankingsno client cap — it runs locally under Drew’s own access, not through the service

Two properties of this table matter more than any row. First, the caps are enforced where the consumer cannot reach them: in the service’s clamp, inside the branch queries, and — for the Worker — in a compile-time pin verified again before caching. Second, the table is short because the client set was kept short on purpose: Aster is explicitly not a client of this service, and there is no public or anonymous search surface at all. A new consumer joins Atlas by being named, tokened, and capped — never by finding an open door.

Evaluation: golden sets and gates

Source: written from pkgs/atlas-search/eval/ (README.md, eval3.py, gate5733.py, gate-5733-results.md, boundary_drift_6038.py, boundary-drift-6038.md, overlap-experiment.py, overlap-report-6039.md, fixtures/golden-311.json, fixtures/heldout-nearexact-54.json) and pkgs/atlas-search/crates/atlas-core/src/ (eval.rs, feedback.rs, feedback_normalise.rs, trace_stats.rs, shingles.rs) in https://github.com/developing-today/code/blob/main/pkgs/atlas-search/. Provenance only — this chapter is complete without following it.

Atlas makes ranking claims — hybrid beats either branch alone, a rescore helps, a chunking choice is safe — and evaluation is the part of the system whose job is to keep those claims honest. Its shape is deliberately conservative: a golden set (a fixed set of queries, each with judged relevant chunks, called qrels) is scored against saved rankings by an offline harness, and a proposed change earns adoption only by passing a gate: a pre-agreed numeric bar, on a held-out set, measured after the harness has first reproduced a known result exactly. This chapter covers the golden sets, the harness and its split discipline, the gates that have actually run — including the one that failed — and the feedback loop that exists beside them. The retrieval machinery being measured is in Retrieval: hybrid full-text and vector search.

Golden-311 v3: the standing yardstick

The corpus golden set is golden-311 v3: 311 queries, frozen on 2026-10-26, built against the merged corpus in data/atlas.db — 101,471 chunks across 18,116 sessions. The set is guarded by a corpus fingerprint so it can never be silently scored against a different corpus: take the chunks whose id is divisible by 997 (101 chunks), concatenate their content hashes, and SHA-256 the result; the recorded fingerprint begins 07b3e17b and any mismatch aborts the evaluator with exit code 2 before a single query is scored. The set itself is a checked-in fixture, byte-for-byte the v3 golden queries file from the bake-off that chose the production embedding model.

Construction matters for what the numbers mean. Each question was written from a one-to-two-sentence summary of its gold chunk or chunks — recorded on the query as its source summary — not mined by checking a hint string verbatim in the text first. The expected hint was chosen after the question was written and only then verified present. Scoring is by gold chunk ids: a query is a hit when one of its recorded chunk ids appears in the top-k ranked ids, and its reciprocal rank is the position of the first gold id. Queries carry a category (the header names an exact-fact versus non-exact distinction), all their gold chunk ids and session ids including cross-session cases, the originating client, and a verbatim-overlap audit (a 5-gram check) for the non-exact categories. Because questions were written from summaries rather than copied from chunks, golden-311 measures whether search finds the right material for a genuinely rephrased question — the thing agents actually ask.

The held-out 54: verbatim passages on purpose

Golden-311’s discipline has a complement built for a different question: can search surface a chunk when the query is a piece of it? The held-out near-exact set has 54 queries, built 2026-11-17. Its passages are verbatim: walk the corpus chunks whose ids are divisible by 997, in ascending order — the same every-997th sampling spine as the corpus fingerprint — keep chunks with at least 60 normalized tokens and at least 40 raw tokens, take raw whitespace tokens 10 through 40 (a 30-token passage) joined by single spaces as the query, and record the source chunk as the single gold. The first 54 qualifying chunks make the set. It is held out in the practical sense that matters here: it was built for one gate, after the signal it tested was already designed, and its queries test a property — near-exact overlap — that golden-311’s summary-written questions barely exercise.

The harness and split discipline

The Rust harness (atlas_core::eval, format atlas-eval/v1, issue #5741) was built before any new signal was adopted or rejected, so that the ablation matrix — dense alone, BM25 alone, SPLADE alone, dense+BM25 (today’s production shape), dense+SPLADE, all three, each with and without a Jaccard rescore — would be measured, not argued. It scores saved rankings offline against qrels; it generates no rankings itself, measures no latency, and makes no adoption decision. A document is relevant at grade 1 or above (grades are unsigned, capped at 30 because the gain formula is exponential), unjudged documents score zero, and a run that returns nothing for a query is scored as an empty ranking — incomplete runs are penalized, never skipped. Rank order is the whole contract, which is what lets dense, BM25, SPLADE, and fused rankings share one input format.

Per query, then averaged over the queries that have at least one relevant document, overall and per query class, the harness reports four metrics: nDCG@10 (graded gain, exponentially weighted and log-discounted, over the first ten ranks), Recall@100 and Recall@1000 (the fraction of relevant documents inside those depths), and MRR@10 (mean reciprocal rank of the first relevant document in the top ten). Reports are deterministic — sorted signals, queries, and classes, floats rounded to six places, byte-identical for identical input — and each per-query record preserves the run’s top-1000 ids and the judged grades, so any number in a report can be recomputed from the report alone.

The split discipline is the harness’s social contract. Every query belongs to a dev split or a test split. Dev is for iteration and parameter selection. Test is the held-out set: score it once, at decision time. The code enforces the sharpest edge of that rule — the best-signal selector refuses to run on a test-split report at all — because a held-out set consulted repeatedly during tuning quietly becomes a dev set, and its verdict stops meaning anything.

Two “production hybrid” rows, stated honestly

Golden-311 carries two recorded rows that are both labelled the production hybrid, and they do not agree. This book states both, with their configurations, rather than picking one:

RowConfigurationResult on golden-311
Bake-off best row, recorded in the Python reference’s header as the 2026-10-31 production decisionone-stage hybrid, reciprocal rank fusion at k=10, pool 100 per branch189 hits@10, MRR 0.3894
Row reproduced by the gate-5733 sanity check from the fused rerank evaluatorbranch depth 30, reciprocal rank fusion at k=60, query vectors truncated to 384 dimensions183 of 311 at recall@10, MRR 0.3640

These are different configurations, not a measurement error — pool 100 against depth 30, fusion constant 10 against 60, full-width against truncated vectors — both called themselves “production hybrid” and, until the #13283 reconciliation, neither source named the other’s row; the source records now cross-name the two configurations, so each row can be traced to the configuration that produced it. The shipped service’s fusion constant is 10 (the versioned query-parameters contract); the Python eval lineage, including the gate below, fuses at 60. Any future citation of a golden-311 production number that does not name its configuration is incomplete.

Gate 5733: the Jaccard gate, and its FAIL

The Jaccard rescore (issue #5733) proposes a third signal at rescore time only — never at retrieval: token-shingle overlap between query and chunk, computed over the fused candidate union, with a near-exact tier (overlap at or above 0.60) promoted decisively and a standard blend (0.85 of normalized fusion score plus 0.15 of overlap) beneath it. Its held-out gate was pre-agreed: on the held-out 54, near-exact MRR@10 must gain at least +0.10 with the rescore on; on golden-311, nDCG@10 must not regress by more than 0.01. Before any gate number was trusted, the gate’s base pipeline had to reproduce the recorded production-hybrid row exactly — it did, at the depth-30 configuration in the table above (183 of 311, MRR 0.3640). The rescore implementation itself was pinned against the shipped Rust test vectors before measuring. The gate ran on 2026-11-17.

Verdict: FAIL. Near-exact MRR@10 moved from 0.5635 to 0.5997 — a gain of +0.0361 against a +0.10 bar. The general-set guard passed comfortably (nDCG@10 regression 0.0017 against a 0.01 allowance), per-query MRR improved for seven queries and worsened for none, and the gold chunk was already inside the top-100 candidate union for 50 of the 54 queries — retrieval was not the problem. The near-exact tier simply almost never fired: 4 of 54 near-exact queries, 0 of 311 general queries. The recorded diagnosis is geometric, not incidental: a 30-token passage’s shingle set measured against a long chunk’s full shingle set has its overlap capped far below 0.60 by set-size ratio alone, so the signal as designed cannot deliver the required gain at that threshold on real chunk lengths. The consequence stands in the shipped defaults today: jaccard_depth is 0, the rescore is off, and no production ranking change was made. One disclosure belongs with the run: the laptop corpus file used held 101,339 of the frozen 101,471 chunks (132 ids absent, including one gold chunk); every golden-311 query retained other gold chunks and all 311 scored, but a rerun should use a bit-exact frozen corpus.

The boundary-drift and overlap experiments

Two experiments guard the chunking decisions underneath retrieval. Boundary drift (#6038) asks whether a span’s stored vector stays valid when the span is reused inside a new version of its document. It is not: across 50 sampled targets and 20 fixed queries, dropping a single sentence from the preceding paragraph — target byte-identical — flipped top-10 membership for 5.8% of query/target pairs, and replacing one neighbouring paragraph flipped 10.3 to 17.8%. The rule the experiment justifies is absolute: reuse only byte-identical windows; re-embed on any context change, and key stored vectors by the hash of the exact window text.

The overlap experiment (#6039) priced chunk overlap at a fixed 200-word window over prose documents and logs: 0%, 10%, and 20%. Ten percent captured essentially all the measurable boundary-coverage benefit for both source types; 20% cost roughly twelve points more index and embedding than 10% and bought no measurable recall; 0% failed exactly on boundary-straddling passages. The standing answer is 10%, and “do not default to 20%”. Its limits are recorded with it: BM25 only, a small repo slice, and a provisional golden set the script derived from that slice itself — not golden-311 — with reruns owed under the dense signal and the standing qrels when those land.

SPLADE: named, never gated

SPLADE — a learned sparse retrieval signal — appears in the ablation matrix above and as an example signal name in the harness’s documentation. That is the whole of its presence. There is no SPLADE encoder, no postings table, and no SPLADE run anywhere in the repository, and no SPLADE gate has ever run. The gate-5733 verdict explicitly does not transfer: it is a result about raw set-overlap geometry, which neither validates nor undermines the lexical signal family. SPLADE’s adoption decision rests on its own ablation through this harness, whenever the signal exists to be measured.

The truncation caveat

Every gate number above carries a dimension caveat. The eval lineage — eval3.py and the gate-5733 base pipeline — runs its vector branch at trunc-384: query vectors truncated to the first 384 of 768 dimensions and renormalized, a Matryoshka-style width reduction the Snowflake model supports. Production search defaults to trunc 0, the full 768 dimensions. The gate results are therefore 384-dimensional measurements of a system whose shipped configuration is 768-dimensional. They are valid comparisons between the arms of each experiment (both arms share the width), and they reproduced the recorded row they aimed at — but they are not, strictly, measurements of the production configuration, and this book does not present them as such.

Feedback: captured, normalized, and not fed back

Beside the golden sets sits a live signal: feedback capture, format atlas-feedback/v1 (issue #9976). A vote attaches to the (query id, chunk id) pair that identifies a result — never to a rank position, which would rot as rankings change — or, with a null chunk id, to the query as a whole. A record carries an up or down vote, an optional verbatim comment (the field supports at least 64 KiB; the capture ceiling is 256 KiB), whether the result was opened before voting, and the requester (kind: Drew, agent, user, or anonymous, plus an id). Records are append-only JSON lines in daily files under the Atlas state directory, never mutated; a later vote from the same requester on the same result supersedes the earlier one in a derived view, never by rewriting it. A normalization pass (atlas-feedback-normalised/v1) classifies active, commented records into eight categories (wrong content, stale content, right file wrong chunk, ranking too low or too high, missing result, duplicate, other), flags agent self-feedback at weight zero, and weights the rest (Drew and users at 1.0, agents at 0.25, anonymous at 0.1).

And there the signal stops — deliberately, and worth stating plainly: feedback has no ranking consumer. Nothing in the search, fusion, or rescore code reads feedback records. Its consumers are statistics (the weekly trace-and-feedback report, where weighted down-votes can nominate results for human review), retention (feedback references protect traced queries from compaction), and read-back by query and chunk. Feedback can nominate; it cannot re-rank. Closing that loop — letting judged user signal change what Atlas returns — is future design work, taken up in Design: the standing evaluation programme, alongside the standing programme this chapter’s one-off gates point toward.

atlas-search: search and get-chunk

Source: pkgs/atlas-search/crates/atlas-search/src/main.rs, pkgs/atlas-search/crates/atlas-proto/query-parameters-v1.json, pkgs/atlas-search/crates/atlas-core/src/filters.rs and pkgs/atlas-search/crates/atlas-core/src/disclosure.rs under https://github.com/developing-today/code/blob/main/pkgs/atlas-search/crates/atlas-search/src/main.rs — provenance only; this chapter is complete without following it.

atlas-search is the Atlas access layer: hybrid search over the corpus. This chapter covers its two query verbs, search and get-chunk. The remaining verbs are in atlas-search: serve, init, fetch-model, traces and feedback.

Standalone is the default and is complete: the query is embedded in-process and the tool talks to Turso (the hosted corpus database) or a local file directly. --via-service prefers a running service and falls back to standalone loudly on any service failure — a warning on stderr plus a note spliced into the result envelope’s notes. Routing details, including the requests that disqualify the service route without any help text saying so, are under “Via-service vs standalone” below.

Invocation

atlas-search search [OPTIONS] <QUERY>
atlas-search get-chunk [OPTIONS] <CHUNK_ID>

search takes one required positional, &lt;QUERY&gt;, a single string. get-chunk takes one required positional, &lt;CHUNK_ID&gt;, an integer: the id of one chunk (the corpus is sessions → messages → chunks, so a chunk is one searchable slice of one message).

There are no global flags before the subcommand on these verbs; backend and model flags live on the verbs that use them. The background vocabulary — the sensitivity ladder and disclosure contexts — is defined in Sensitivity tiers and client ceilings; the ranking machinery is in Retrieval: hybrid full-text and vector search.

search: modes, filters and the sensitivity request

Modes

--mode selects which retrieval branches run:

ModeMeaning
hybrid (default)Full-text (FTS) and vector branches both run; their candidate lists are fused with reciprocal-rank fusion (RRF).
ftsFull-text branch only. Never loads the embedding model.
vectorVector branch only.

Filters

--kind, --topic, --project and --client are classification filters. Each takes a comma-separated (CSV) string: the value is split on commas, entries are trimmed, and empty entries are dropped. --since and --until take a YYYY-MM-DD date and bound sessions.created_at, inclusive at both ends.

The sensitivity request: ceiling and context

Sensitivity is a caller ceiling, not a property you search for. The ladder is, in order:

shareable < personal < local-only < secret-bearing

--max-sensitivity names the highest tier a result may have; the default is personal. The top tier, secret-bearing, is never granted implicitly — it must be spelled out.

--context names the disclosure context of the destination surface (the surface the results will be shown on). Each context has its own ceiling:

ContextContext ceilingDefault for
fleet-internallocal-onlysearch
hosted-per-userpersonal—
public-surfaceshareable—
local-ownersecret-bearingget-chunk

The effective ceiling is the minimum of the --max-sensitivity grant and the context ceiling; neither widens the other. Content marked excluded_personal_life is ineligible in every context. An unknown --context value is a usage error, exit 2:

atlas-search: invalid --context "bogus": expected one of fleet-internal, hosted-per-user, public-surface, local-owner

An unknown --max-sensitivity is likewise never silently clamped: on the standalone path it is a validation fatal, and the via-service attempt is deliberately skipped so that exact fatal is produced (see “Via-service vs standalone”).

search: flag table

All 44 flags of search are listed below, in three groups: the verb’s own flags, the flattened backend group (shared with get-chunk), and the flattened vector group (search only). Defaults stated here are the literal defaults; the query-parameter defaults derive from the shared contract file query-parameters-v1.json.

Search flags

FlagArgumentDefaultMeaning
--kinteger10Final results. Validated: at least 1, no CLI upper bound.
--poolinteger100Per-branch candidates. Validated: 1..=400.
--modehybrid|fts|vectorhybridWhich retrieval branches run (see Modes).
--kindCSV string— (none)Classification kind filter.
--topicCSV string— (none)Topic filter.
--projectCSV string— (none)Project filter.
--clientCSV string— (none)Client filter.
--sinceYYYY-MM-DD— (none)Lower bound on sessions.created_at, inclusive.
--untilYYYY-MM-DD— (none)Upper bound on sessions.created_at, inclusive.
--max-sensitivityladder namepersonalSensitivity ceiling: shareable<personal<local-only<secret-bearing; secret-bearing must be spelled out.
--contextcontext namefleet-internalDisclosure context of the destination surface; its ceiling intersects --max-sensitivity.
--group-by-sessionswitchoffRoll chunk hits up to sessions (score = best chunk, plus hit count).
--expandinteger0Include N neighbouring chunks (same message) around each hit. Validated: 0..=100.
--parameters_versioninteger1Version of the shared query-parameter contract (currently 1). Validated: 1..=1. Note the underscore spelling.
--shard_top_kinteger100Candidates scanned per shard. Validated: 1..=400. Underscore spelling.
--global_top_kinteger100Candidates retained after shard fan-in. Validated: 1..=400. Underscore spelling.
--fts_weightfloat1Reciprocal-rank-fusion multiplier for FTS. Must be finite and ≥ 0; the two weights must not both be zero. Underscore spelling.
--vector_weightfloat1Reciprocal-rank-fusion multiplier for vectors. Same validation as --fts_weight. Underscore spelling.
--jaccard_depthinteger0Candidate depth for Jaccard rescoring over the fused union (0 = off). Validated: 0..=4000. Underscore spelling.
--jaccard_thresholdfloat0Near-exact Jaccard threshold in (0, 1]; 0 means the design default 0.60 when rescoring is on. Validated: finite, in [0, 1]. Underscore spelling.
--rrf_kinteger10Reciprocal-rank-fusion constant. Validated: 1..=10000. Underscore spelling.
--planner_enabledswitchoffEnable the query planner/rewriter. Not implemented: setting it is a validation error. Underscore spelling.
--spell_enabledswitchoffEnable spell correction. Not implemented: setting it is a validation error. Underscore spelling.
--query_class_hintstring— (none)Query-class hint. Not implemented: setting any value is a validation error. Underscore spelling.
--variantraw|rewritten|bothrawQuery variant: raw is supported; rewritten or both is a validation error.
--rawswitchoffUse the verbatim query with planner/spell and expansion disabled. Cannot be combined with a non-zero --expand.
--with-messageswitchoffInclude the parent message text (truncated at 50000 chars).
--no-cacheswitchoffBypass service cache reads; the fresh result still lands in the cache (a refresh). Service mode only: the local path has no result cache.
--waitswitchoff (the CLI implies wait)Block for the full fused result; the one-shot CLI implies --wait, this spells it out. Conflicts with --no-wait.
--no-waitswitchoffDo not block: print the service job handle plus an empty first page and return.
--hydrateinteger0Hydrate the top N results to full chunk + message content from the content store. This is not --expand, which keeps its neighbour-chunks meaning. Validated: at most 1000.
--raw-rowsoptional value: ungrouped|branches— (off)Ungrouped output rows: bare --raw-rows means ungrouped (flat fused rows); --raw-rows=branches means pre-fusion branch rows. Distinct from --raw (verbatim query), which is not repurposed.
--textswitchoffHuman-readable output instead of JSON.
--shardsstring— (off)Hidden in help (hide = true; it does not appear in --help output). Environment variable: ATLAS_SHARDS. EXPERIMENTAL, off by default: serve the vector branch from the Atlas core shard fan-out — dir:&lt;path&gt; for local shard files, or turso / turso:&lt;org&gt; for hosted shards. FTS, details and --expand stay on the backend. Skips --via-service entirely.

Backend flags (flattened, shared with get-chunk)

FlagArgumentDefaultMeaning
--backendauto|turso|localautoData backend. auto: Turso when a token resolves, else local.
--dbpathcanonical atlas.dbLocal backend: SQLite DB path. Resolution is covered in Configuration and environment (the ATLAS_DB variable is the first step).
--vecdbcomma-separated paths— (none)Local backend: vector DB path(s), if the corpus DB has no vector table.
--via-serviceswitchoffPrefer a running Atlas service; fall back to standalone, loudly.
--service-urlURLhttp://127.0.0.1:18760Service base URL for --via-service. Environment variable: ATLAS_SEARCH_URL.

Vector flags (flattened, search only)

FlagArgumentDefaultMeaning
--modelstringSnowflake/snowflake-arctic-embed-m-v2.0Embedding model. Environment variable: ATLAS_SEARCH_MODEL.
--vec-tablestringvec_snowflake_m_v2_768_f32Vector table name. Environment variable: ATLAS_VEC_TABLE.
--embedderauto|fastembed|stautoQuery embedder: fastembed (bge) or st = sentence-transformers with prompt_name='query' (Snowflake); auto picks by model name. See the embedder limits under Behaviour.
--truncinteger0Truncate query+doc vectors to N dims (Matryoshka; 0 = full). Validated: ≥ 0.
--vector-backendscan|index-fill|index-fixedscanTurso vector branch: scan = exact vector_distance_cos over the filtered set; index-fixed = one vector_top_k lookup at pool depth, filtered afterwards; index-fill = vector_top_k with escalating depth until the pool fills after filtering (cap 3200).

get-chunk: flag table

get-chunk fetches one chunk with its provenance (the session, client and sensitivity it came from). It has no vector flags and no --max-sensitivity — the sensitivity ceiling arrives through --context, whose default here is local-owner (context ceiling secret-bearing), because this is the owner’s explicit-id tool.

FlagArgumentDefaultMeaning
--neighborsinteger0Include N chunks either side in the same message. Validated: 0..=100.
--contextcontext namelocal-ownerDisclosure context of the destination surface: local-owner (default), fleet-internal, hosted-per-user, or public-surface.
--textswitchoffHuman-readable output instead of JSON.
--backendauto|turso|localautoBackend group, as in the search backend table above.
--dbpathcanonical atlas.dbBackend group, as above.
--vecdbcomma-separated paths— (none)Backend group, as above.
--via-serviceswitchoffBackend group, as above — but see the get-chunk routing note below.
--service-urlURLhttp://127.0.0.1:18760Backend group, as above. Environment variable: ATLAS_SEARCH_URL.

There is no via-service path for get-chunk in the job protocol: chunk reads are scoped to an existing job. Requesting --via-service therefore produces the loud fallback note (of the shape service at &lt;base&gt; unreachable; get-chunk served standalone) and the chunk is served standalone.

Behaviour

  • Validation happens first. All count, range and contract checks run before any backend or service work. Violations are exit 2 with the message prefixed atlas-search: . The full rule set: --k ≥ 1; --pool 1..=400 (--pool must be between 1 and 400 (design section 2)); --expand 0..=100; --trunc ≥ 0; --neighbors (get-chunk) 0..=100; --parameters_version 1..=1; --shard_top_k 1..=400; --global_top_k 1..=400; --jaccard_depth 0..=4000; --rrf_k 1..=10000; --fts_weight/--vector_weight finite, ≥ 0, and not both zero; --jaccard_threshold finite, in [0, 1]; --hydrate at most 1000 (hydrate must be at most 1000).
  • Reserved contract surface. --planner_enabled, --spell_enabled, any --query_class_hint, and --variant rewritten|both exist in the shared query-parameter contract but are not implemented; setting any of them is a validation error (planner/spell stages are not implemented yet, query_class_hint is not implemented yet, rewritten/both query variants are not implemented yet). --raw combined with a non-zero --expand is an error: raw mode cannot be combined with non-zero expand.
  • Traces. Every executed standalone search writes an atlas-query-trace/v1 record (to the trace sink’s default directory; see Configuration and environment) and returns its query_id in the result envelope. A trace-write failure fails the search — it is not a warning.
  • The embedder is lazy. FTS-only searches and get-chunk never load, or fail on, the embedding model.
  • Embedder and model limits in this binary. In the Rust binary, --embedder fastembed with vector or hybrid mode is a loud error (vector/hybrid modes with a fastembed embedder are not available in this binary … use --mode fts or the Python atlas-search), and any --model other than the default Snowflake model is likewise refused for vector/hybrid modes. The bge/fastembed fallback and arbitrary models live only in the Python implementation; see atlas_search.py: the Python reference implementation.

Via-service vs standalone

Standalone is the default route and needs no service. With --via-service, the client prefers a running service at --service-url (default http://127.0.0.1:18760); on any service failure it falls back to standalone loudly — a stderr warning plus a note in the result envelope’s notes. The service side of the protocol is described in atlas-search: serve, init, fetch-model, traces and feedback and The service HTTP API.

Three requests disqualify the service route. None of them appears in any help text; this is source behaviour:

RequestEffect on the service route
--backend localCannot be served by the service; forces the loud standalone fallback with an explanatory note.
A non-default --vec-tableCannot be served by the service; forces the loud standalone fallback with an explanatory note.
Any --shards spec (flag or ATLAS_SHARDS)Skips the via-service attempt entirely — no attempt, no fallback note; the search runs standalone with shard fan-out.

An unknown --max-sensitivity also skips the via-service attempt, for a different reason: so that the standalone path produces its exact validation fatal rather than a service-side clamp.

Output shapes

The default output is JSON on stdout: a result envelope carrying the hits and, for an executed search, the query_id of the trace record it wrote, plus a notes array (where a loud fallback note lands when one happened). With --no-wait on the service route, the output is instead the service job handle plus an empty first page. --raw-rows changes the row shape (flat fused rows, or pre-fusion branch rows with =branches) without changing the envelope. --group-by-session rolls chunk hits up to one row per session.

--text renders the same results human-readably instead of JSON. No partial JSON is printed on failure paths: failures are a single stderr line (the via-service fallback is the exception by design — it succeeds standalone and records the fallback in notes and on stderr).

Worked examples

Toy examples; the queries and ids are invented.

A plain hybrid search, five results, human-readable:

$ atlas-search search "toy example query" --k 5 --text

An FTS-only search over a date window — no model is loaded:

$ atlas-search search "release checklist" --mode fts --since 2026-11-01 --until 2026-11-30

A search that asks for the top tier explicitly, in the owner’s context:

$ atlas-search search "toy secret-adjacent note" --max-sensitivity secret-bearing --context local-owner

Fetch one chunk and its two neighbours on either side:

$ atlas-search get-chunk 424242 --neighbors 2 --text

Prefer the service, with the loud fallback if it is down:

$ atlas-search search "toy example query" --via-service

Failure shapes

  • Unknown subcommand or flag: a clap error with usage, exit 2 — e.g. atlas-search badverb gives error: unrecognized subcommand 'badverb'.
  • Validation failure: atlas-search: &lt;msg&gt; on stderr, exit 2 — e.g. atlas-search search --k 0 foo gives atlas-search: --k must be at least 1; --pool 401 gives atlas-search: --pool must be between 1 and 400 (design section 2).
  • Backend, transport or embedding failure: atlas-search: &lt;msg&gt; on stderr, exit 1.
  • get-chunk for a chunk that does not exist: atlas-search: chunk 999999999 not found, exit 1.
  • Service failure under --via-service: not a failure of the command — a stderr warning, a note in the envelope’s notes, standalone results, exit 0.

Exit codes

CodeMeaning
0Success (including a loud standalone fallback after a service failure).
1Backend/transport/embed failures; get-chunk not-found.
2Usage and validation failures: clap errors, count/parameter/context validation.

atlas-search: serve, init, fetch-model, traces and feedback

Source: pkgs/atlas-search/crates/atlas-search/src/main.rs, pkgs/atlas-search/crates/atlas-search/src/server.rs, pkgs/atlas-search/crates/atlas-search/src/service.rs and pkgs/atlas-search/crates/atlas-search/src/fetch_model.rs under https://github.com/developing-today/code/blob/main/pkgs/atlas-search/crates/atlas-search/src/main.rs — provenance only; this chapter is complete without following it.

This chapter covers the non-query verbs of atlas-search: serve (run the service), init (generate its config), fetch-model (provision the embedding model), the five traces sub-verbs (the query-trace corpus) and feedback (thumbs votes on served results), plus --version. The query verbs are in atlas-search: search and get-chunk.

Invocation

atlas-search --version
atlas-search serve [OPTIONS]
atlas-search init [OPTIONS]
atlas-search fetch-model
atlas-search traces <COMMAND>
atlas-search feedback [OPTIONS] --query <QUERY>

-V, --version prints atlas-search 0.1.0 and exits 0. -h, --help prints help. An unknown subcommand is a clap error, exit 2.

serve: the Atlas service

atlas-search serve [OPTIONS]

serve runs the Atlas service: a loopback HTTP job protocol on port 18760 by default. Clients submit a search as a job rather than holding a request open: the submit returns a job handle, the caller waits for the full fused result (the one-shot CLI implies waiting; --no-wait returns the handle plus an empty first page instead), and completed jobs are retained for a TTL so their pages and chunk reads can be fetched by job scope — which is why get-chunk has no standalone service route of its own (see atlas-search: search and get-chunk). Callers authenticate with a per-client bearer token; the service clamps each caller’s requested --max-sensitivity to that client’s ceiling cap from the config’s client table. The wire contract in full is The service HTTP API; running the service in production is covered in Running the service and the Worker.

FlagArgumentDefaultMeaning
--configpath~/.local/state/atlas-search/service.jsonService config path. Environment variable: ATLAS_SEARCH_SERVICE_CONFIG (honoured by the program, not by clap — the help text names it, the mechanism is a manual lookup).
--listenaddressfrom the config (127.0.0.1:18760)Listen address override. Loopback only.
--job-ttl-msinteger (milliseconds)600000Completed-job TTL override: how long a finished job is retained.
--hard-ttl-msinteger (milliseconds)3600000Submit hard-cap override: the longest a submitted job may run.

Behaviour:

  • serve always uses the Turso backend and the default model/embedder; there are no backend or model flags on this verb.
  • A shards spec in the service config enables serve-mode shard fan-out, with periodic re-discovery of the shard set (default refresh 60 s, DEFAULT_SHARD_REFRESH_SECONDS).
  • Config-load failures — missing config, config not mode 0600, empty client table, duplicate client names, a bad ceiling_cap — exit 2, with run atlas-search init first guidance where applicable. Runtime serve failures (for example, the port is already bound) exit 1.

init: generate the service config

atlas-search init [OPTIONS]

init generates the service config (mode 0600) with the v1 client table: one named identity per expected caller, each with a freshly generated token and a ceiling cap — the highest sensitivity that identity may request (token values are secrets: they are generated into the config and never printed; this book names the identities and caps only).

ClientCeiling cap
drew-clisecret-bearing
openchamberpersonal
fork-serverpersonal
sandbox-scriptspersonal

The config document body is {"listen": "127.0.0.1:18760", "vec_table": &lt;default vec table&gt;, "clients": [...]} — the default vec table is vec_snowflake_m_v2_768_f32.

FlagArgumentDefaultMeaning
--configpath~/.local/state/atlas-search/service.jsonService config path. Environment variable: ATLAS_SEARCH_SERVICE_CONFIG (honoured manually, as on serve).
--forceswitchoffReplace an existing config. This rotates every client token: all existing callers must be re-provisioned with the new tokens.

Without --force, an existing config is an exit-2 error. On success the output prints the config path and each client’s cap — never token values.

fetch-model: provision the pinned model

atlas-search fetch-model

fetch-model has no options (only -h, --help). It downloads and verifies the pinned embedding model into the state dir, at ~/.local/state/atlas-search/model/&lt;rev&gt;/:

FactValue
RepositorySnowflake/snowflake-arctic-embed-m-v2.0
Revision95c2741480856aa9666782eb4afe11959938017f
Filestokenizer.json and onnx/model.onnx
VerificationEach file’s sha256 is checked against the pinned hash (tokenizer.json begins f1cc44ad…, onnx/model.onnx begins c0c53d7f…; hashes are named here in abbreviated form only).

An already-verifying snapshot is a no-op. A hash mismatch refuses the install. Failures exit 2. Model and runtime resolution at search time (including the ATLAS_MODEL_DIR and ATLAS_ORT_LIB variables) is covered in Configuration and environment.

traces: the statistics-and-reports corpus

atlas-search traces <COMMAND>

Every executed standalone search writes an atlas-query-trace/v1 record (see atlas-search: search and get-chunk). The traces verbs ingest those records as a statistics-and-reports corpus and run retention and reporting over the store. Bare atlas-search traces with no subcommand is a clap error, exit 2.

FlagArgumentDefaultMeaning
--dirpaththe trace sink’s default dir, ~/.local/state/atlas-search/tracesTraces directory. Present on all five sub-verbs.
--todayYYYY-MM-DDtoday, UTCThe day the pass is computed for (retention, stats, report, normalise). Strictly calendar-validated.
--feedbackpath— (none)A feedback JSONL file naming referenced query ids. Repeatable (retention, stats, report).
--querystring— (none)ingest only: only print documents matching this corpus query.
--window-daysinteger7stats only: rolling window length in days.
--feedback-dirpaththe feedback sink’s default dirnormalise only: the raw feedback store to read.
--out-dirpath&lt;feedback store&gt;/normalisednormalise only: where the normalised output is written.

The five sub-verbs:

Sub-verbBehaviour
ingestIngest trace JSONL into the statistics-and-reports corpus. With --query, only print the documents matching that corpus query.
retentionRun the 180-day hot retention pass: move older traces to the cold tier (directory name cold) and write a compaction aggregate (schema atlas-trace-compaction/v1). Takes --dir, --today, --feedback.
statsDaily batch aggregation over stored traces, over a rolling window ending at --today (--window-days, default 7). Takes --dir, --today, --window-days, --feedback.
reportWeekly statistics report into the statistics-and-reports source set. Takes --dir, --today, --feedback. See the undocumented files below.
normaliseAgent normalisation pass over the raw feedback store, using the traces directory for query requester identities. Takes --dir, --feedback-dir, --out-dir, --today.

The report files the help text never mentions. traces report’s help says only “weekly statistics report into the statistics-and-reports source set”. The source behaviour is more: the verb also writes the report JSON file and a Markdown file, atlas-statistics-report-&lt;day&gt;.md, into the traces dir, and reports both paths in its JSON output as report_file and markdown_file. This is source behaviour, stated here because the help text does not state it.

--today values are strictly calendar-validated in retention, stats, report and normalise: an invalid date is exit 2, --today must be a valid YYYY-MM-DD date, got &lt;value&gt;. The retention horizon is 180 days (HOT_RETENTION_DAYS).

feedback: thumbs votes on served results

atlas-search feedback [OPTIONS] --query <QUERY>

feedback casts a thumbs vote on a served result, or retrieves the feedback recorded for a query. Records use the atlas-feedback/v1 schema and land in the local feedback store (default ~/.local/state/atlas-search/feedback), which the traces verbs above consume — the feedback files passed with --feedback to retention, stats and report, and the store normalise reads. Feedback is recorded data only: no ranking consumer reads it today (see Evaluation: golden sets and gates).

--query &lt;QUERY&gt; is required: it is the query id the search response envelope carried.

FlagArgumentDefaultMeaning
--querystring— (required)The query_id the search response envelope carried.
--chunkinteger— (none)The result’s chunk_id; omit for a per-query vote.
--upswitchoffThumbs up. Conflicts with --down.
--downswitchoffThumbs down. Conflicts with --up.
--commentstring— (none)Optional comment, verbatim; @file reads the comment from a file. Comment size cap 256 KiB (MAX_COMMENT_BYTES).
--openedswitchoffThe result was opened/expanded before this vote.
--requester-kindstringuserRequester kind: drew, agent, user or anonymous (the REQUESTER_KINDS constant).
--requester-idstringcliStable requester id.
--getswitchoffRetrieve the feedback for --query (and --chunk, when given) instead of casting a vote.
--dirpaththe feedback sink’s default dir, ~/.local/state/atlas-search/feedbackFeedback store directory.
--via-serviceswitchoffGo through a running service instead of the local store.
--service-urlURLthe default service URLService base URL for --via-service. Environment variable: ATLAS_SEARCH_URL.

The vote-shape rule the help text does not state. Without --get, exactly one of --up / --down is required — but neither flag is marked required in the help, and the rule is enforced only at runtime: casting with neither is exit 2, atlas-search: feedback needs exactly one of --up / --down (or --get to retrieve). Passing both is a clap conflict error, also exit 2. A @file comment whose file cannot be read is exit 1.

Worked examples

Toy examples; paths and days are illustrative.

Provision a fresh service — config first, then the model, then serve:

$ atlas-search init
$ atlas-search fetch-model
$ atlas-search serve

Rotate every client token (existing callers must be re-provisioned afterwards):

$ atlas-search init --force

Run the retention pass as of a stated day, against a toy traces dir:

$ atlas-search traces retention --dir /tmp/toy-traces --today 2026-11-23

Produce the weekly report and its Markdown rendering:

$ atlas-search traces report --dir /tmp/toy-traces --today 2026-11-23
# writes the report JSON and /tmp/toy-traces/atlas-statistics-report-2026-11-23.md

Cast a thumbs-down vote on one chunk of a served result, then read the feedback back:

$ atlas-search feedback --query q-toy-1 --chunk 42 --down --requester-kind agent --requester-id cli
$ atlas-search feedback --query q-toy-1 --chunk 42 --get

Check the version:

$ atlas-search --version
atlas-search 0.1.0

Failure shapes

  • serve before init: a config-load error, exit 2, with run atlas-search init first guidance.
  • serve with a config that is not mode 0600, has an empty client table, duplicate client names, or a bad ceiling_cap: exit 2.
  • serve runtime failure (for example the loopback port is already in use): exit 1.
  • init when a config already exists and --force is absent: exit 2.
  • fetch-model download or verification failure, including a hash mismatch (which refuses the install): exit 2.
  • traces with no subcommand: clap error, exit 2.
  • traces … --today with an invalid date: atlas-search: --today must be a valid YYYY-MM-DD date, got &lt;value&gt; shape, exit 2.
  • feedback with neither --up nor --down (and no --get): atlas-search: feedback needs exactly one of --up / --down (or --get to retrieve), exit 2; with both: clap conflict, exit 2.
  • feedback --comment @file where the file cannot be read: exit 1.

Exit codes

CodeMeaning on these verbs
0Success. --version also exits 0.
1serve runtime failures; a feedback @file comment that cannot be read.
2Usage errors; serve config-load failures; init failures (including an existing config without --force); fetch-model failures; traces validation failures such as an invalid --today; feedback vote-shape errors (neither or both of --up / --down).

atlas-stage

Source: pkgs/atlas-search/crates/atlas-search/src/bin/atlas-stage.rs, with the staging DDL in pkgs/atlas-search/schema/atlas_stage_v1.sql and pkgs/atlas-search/schema/stage_registry_v1.sql, under https://github.com/developing-today/code/blob/main/pkgs/atlas-search/crates/atlas-search/src/bin/atlas-stage.rs — provenance only; this chapter is complete without following it.

atlas-stage provisions Atlas staging units and reads the staging registry. A staging unit is one writer’s isolated staging database: artifacts are staged into it first, classified there, and only later promoted into the core corpus. The registry is the store file that records every unit, its owner and its lifecycle state. The staging schema version is 1 (STAGE_SCHEMA_VERSION). The place of staging in the ingest flow is described in Ingest today: staging, classification, promotion.

Where the source header disagrees with the source, the source wins. The binary’s own source header opens by describing “two verbs” and later says all of them are offline. Both framings are stale. The binary has six verbs — provision, lookup, ingest, items, promote, units — and promote is not offline in the header’s sense: it needs the embedding model and the ONNX runtime, resolved over the filesystem (and potentially a local virtualenv path; see promote below). The header’s verb list itself is complete; only its counts and framing are wrong. This chapter documents the six real verbs.

Invocation

atlas-stage <COMMAND>

Commands:
  provision  Create a staging DB, apply the v1 schema, and register the unit
  lookup     Print one unit's registry record as JSON
  ingest     Stage one code/config artifact file as an embedding entry
  items      List the items staged in a unit's staging DB
  promote    Embed a unit's staged chunks into a new core scan shard and promote the unit to merged
  units      List units in a lifecycle state (open|closing|merged)

There is no --version / -V on this binary: its command definition sets only a name and an about text, so both spellings are clap errors, exit 2. -h, --help works as usual for a clap binary.

All output is one JSON object per line on stdout. Errors print atlas-stage: &lt;msg&gt; on stderr.

A vocabulary warning: --sensitivity on this binary takes the staging tier vocabulary — public|internal|secret — which is not the four-level sensitivity ladder (shareable < personal < local-only < secret-bearing) used by search. The two vocabularies meet at classification and promotion time, not in these flags.

provision

atlas-stage provision --db <DB> --unit <UNIT> --owner <OWNER> --registry <REGISTRY> [--sensitivity <SENSITIVITY>]

Creates the staging DB, applies the v1 schema, and registers the unit as open. Prints the unit record as JSON: unit_id, db_uri, owner, sensitivity, state, schema_version, created_at, updated_at.

FlagArgumentDefaultMeaning
--dbpath— (required)The staging database file to create.
--unitstring— (required)The staging-unit id (queue task id, session id, epic id, …).
--ownerstring— (required)The unit’s owner (the writer whose token may write here).
--sensitivitypublic|internal|secretinternalPhysical sensitivity level — the staging tier vocabulary, not the search ladder.
--registrypath— (required)The registry store file (created if missing).

lookup

atlas-stage lookup --unit <UNIT> --registry <REGISTRY>

Prints one unit’s registry record as JSON. Both flags are required, with no defaults and no help prose.

FlagArgumentDefaultMeaning
--unitstring— (required)The staging-unit id to look up.
--registrypath— (required)The registry store file.

An unknown unit is an error: no staging unit "&lt;unit&gt;" in the registry, exit 1.

ingest

atlas-stage ingest --db <DB> --unit <UNIT> --repo <REPO> --path <PATH> --file <FILE> --commit <COMMIT> [OPTIONS]

Stages one code/config artifact file as an embedding entry in an already-provisioned unit. Prints {"item_id":…, "unit":…, "source":"&lt;repo&gt;:&lt;path&gt;@&lt;commit&gt;"}.

FlagArgumentDefaultMeaning
--dbpath— (required)The unit’s staging database file (already provisioned).
--unitstring— (required)The staging-unit id the entry belongs to.
--repostring— (required)The repository the artifact came from.
--pathstring— (required)The artifact’s path inside the repo.
--filepath— (required)The local file whose bytes are staged.
--commitstring— (required)The commit SHA the bytes were read at.
--kindprose|code|configconfigThe entry kind.
--languagestring"" (see note)The artifact language (yaml, toml, rust, …). Source behaviour the help does not state: an empty language is silently replaced by the staged file’s extension before the entry is built — the help’s [default: ""] is therefore misleading.
--sensitivitypublic|internal|secretinternalStaging tier vocabulary, as in provision.
--segmentspath— (none)Optional JSON file declaring the artifact’s source-native classification segments: an array of {"start": &lt;byte&gt;, "end": &lt;byte&gt;, "sensitivity": shareable|personal|local-only|secret-bearing, "certain": &lt;bool, default true&gt;} — note the segment sensitivities use the four-level ladder, not the tier vocabulary. When given, the artifact is staged classified: boundary-safe chunks plus one persisted classification record per chunk. Segment files are parsed strictly — missing or mistyped fields, or an unknown sensitivity name, are errors, never defaults.

items

atlas-stage items --db <DB> [--unit <UNIT>]

Lists the items staged in a unit’s staging DB, one JSON object per item: id, unit_id, kind, source, sensitivity, chunks, meta.

FlagArgumentDefaultMeaning
--dbpath— (required)The staging database file to read.
--unitstring— (all units in the DB)Only this unit’s items.

promote

atlas-stage promote --registry <REGISTRY> --unit <UNIT> --shard-dir <SHARD_DIR> [--topic <TOPIC>]

Embeds the unit’s staged chunks with the mandated model (the default Snowflake model, Snowflake/snowflake-arctic-embed-m-v2.0) into a new core scan shard — the aggregator embeds at promotion time — stamps embedding-model provenance on the shard, and promotes the unit to merged through the registry gate. Prints {"unit":…, "shard":…, "shard_path":…, "items":…, "chunks":…, "dims":…}.

FlagArgumentDefaultMeaning
--registrypath— (required)The registry store file.
--unitstring— (required)The staging-unit id to promote.
--shard-dirpath— (required)Directory the new core scan shard is written into (created if missing).
--topicstringcodeconfigShard topic for the promoted entries.

promote requires the embedding model and the ONNX runtime, resolved exactly as atlas-search resolves them (the ATLAS_MODEL_DIR / ATLAS_ORT_LIB variables; see Configuration and environment) — plus one extra fallback the search binary does not have: the ORT library at ~/atlas/v3-venv/lib/python3.14/site-packages/onnxruntime/capi/libonnxruntime.so.1.31.1. A missing model or runtime is a loud exit-1 error, never a silent skip. This is the sense in which the source header’s “all offline” framing is wrong: promote is a model-dependent verb.

units

atlas-stage units --registry <REGISTRY> [--state <STATE>]

Lists units in a lifecycle state, one unit-record JSON object per line.

FlagArgumentDefaultMeaning
--registrypath— (required)The registry store file.
--stateopen|closing|mergedopenThe lifecycle state to list. An unknown value is an error: unknown state "…" (want open|closing|merged), exit 1.

Worked example

Toy example; all names and paths are invented.

$ atlas-stage provision --db /tmp/toy-unit.db --unit toy-1 --owner toy-writer --registry /tmp/toy-registry.db
{"unit_id":"toy-1","db_uri":"/tmp/toy-unit.db","owner":"toy-writer","sensitivity":"internal","state":"open","schema_version":1,"created_at":"…","updated_at":"…"}

$ atlas-stage ingest --db /tmp/toy-unit.db --unit toy-1 --repo toy/repo --path config/toy.yaml --file /tmp/toy.yaml --commit 0000000000000000000000000000000000000000
{"item_id":1,"unit":"toy-1","source":"toy/repo:config/toy.yaml@0000000000000000000000000000000000000000"}

$ atlas-stage items --db /tmp/toy-unit.db --unit toy-1
{"id":1,"unit_id":"toy-1","kind":"config","source":"toy/repo:config/toy.yaml@0000000000000000000000000000000000000000","sensitivity":"internal","chunks":1,"meta":{}}

$ atlas-stage promote --registry /tmp/toy-registry.db --unit toy-1 --shard-dir /tmp/toy-shards
{"unit":"toy-1","shard":"…","shard_path":"/tmp/toy-shards/…","items":1,"chunks":1,"dims":768}

$ atlas-stage units --registry /tmp/toy-registry.db --state merged
{"unit_id":"toy-1","db_uri":"/tmp/toy-unit.db","owner":"toy-writer","sensitivity":"internal","state":"merged","schema_version":1,"created_at":"…","updated_at":"…"}

Failure shapes

  • Missing required flags or an unknown verb: a clap usage error, exit 2 — e.g. bare atlas-stage lookup fails on its required arguments.
  • --version / -V: a clap error: unexpected argument, exit 2 — this binary has no version surface.
  • Unknown unit in lookup: atlas-stage: no staging unit "&lt;unit&gt;" in the registry, exit 1.
  • Unknown sensitivity tier or unknown unit state: atlas-stage: &lt;msg&gt;, exit 1.
  • A malformed --segments file (missing/mistyped field, unknown sensitivity name): an error, exit 1 — never a defaulted segment.
  • promote with the model or ONNX runtime missing: a loud error, exit 1.
  • Registry or staging-DB errors, file read failures: atlas-stage: &lt;msg&gt;, exit 1.

Exit codes

CodeMeaning
0Success.
1All runtime errors: unknown sensitivity/state, missing unit, file reads, embedder/model absence, registry/DB errors.
2Clap usage errors only: unknown verb, missing required flags, and --version/-V.

atlas-classify

Source: pkgs/atlas-search/crates/atlas-core/src/bin/atlas-classify.rs, with defaults in pkgs/atlas-search/crates/atlas-core/src/classify.rs, under https://github.com/developing-today/code/blob/main/pkgs/atlas-search/crates/atlas-core/src/bin/atlas-classify.rs — provenance only; this chapter is complete without following it.

atlas-classify is the classification operating procedure tool: it sweeps a corpus database for chunks that still carry only a default or unresolved classification and writes a real classification record for each, and it manages changes to the classification schema itself (review a schema change, then apply a reviewed one). Its place in the ingest flow is described in Ingest today: staging, classification, promotion.

Two facts govern everything about this binary, and both are stated plainly here because its own help states neither:

  • Exit code 2 is the only failure code — for everything. Usage errors and runtime/classification failures all exit 2. This binary has no exit-1 path. That includes --help: there is no successful help path (see below).
  • The help text states no defaults. The usage text shows only invocation shapes. Every default in the tables below exists only in source and is marked source-only as such.

Invocation and the strict parser

The parser is hand-rolled and strict — not clap. The whole command line is declared in the source header and parsed before any file is opened; anything unaccounted for is a usage error. The complete help text, verbatim (it is also the source header’s contract):

usage:
  atlas-classify --db CORPUS run [--commit] [--window-days N] [--actor A] [--now TS] [--schema-version N] [--max-decisions N] [--manifest-out PATH]
  atlas-classify --db CORPUS schema-review --old-schema F --new-schema F [--reviewer-model M] [--reviewer-model-version V] [--manifest-out PATH]
  atlas-classify --db CORPUS schema-apply --review F --dispositions F [--now TS] [--manifest-out PATH]

There is no --help. Every invocation shape other than the three documented actions — bare invocation, --help, run --help, unknown flags, unknown actions, a flag given twice, a missing flag value — prints the usage text to stderr and exits 2.

The global flag:

FlagArgumentDefaultMeaning
--dbpath— (required)The corpus database. Required, and must be given exactly once (--db given twice is an error). It may appear anywhere in the argv: the parser extracts it before dispatching on the first remaining token as the action.

Counting the global --db, the three actions’ surfaces total 17 flags; the per-action tables below list each action’s own flags, with --manifest-out counted in each action that carries it, as it is a separate flag slot in each.

On success, all three actions print their document — run manifest, review batch, or apply report — as pretty JSON on stdout, and also write it to --manifest-out when that flag is given.

run: the remainder sweep

atlas-classify --db CORPUS run [--commit] [--window-days N] [--actor A] [--now TS] [--schema-version N] [--max-decisions N] [--manifest-out PATH]

run is a dry-run unless --commit is given. Without --commit it enumerates only unclassified, default-state, or unresolved embeds, prints the run manifest as JSON, and writes nothing. With --commit, it writes one classification record per candidate into the corpus’s classification_records table; chunks and vectors are never modified. Runs are deterministic and resumable. The manifest format is atlas-classify-run/1; the method is remainder-sweep, method version 1.

FlagArgumentDefaultMeaning
--commitswitchoffCommit the run: write one classification record per candidate. Without it, the run is a dry-run that only prints the manifest.
--window-daysinteger (i64, ≥ 0)90 — source-only (the DEFAULT_WINDOW_DAYS constant; the help states no default)The relatedness window, in days.
--actorstringatlas-classify/remainder-sweep — source-only (the run configuration’s default)The actor name recorded for the run’s decisions.
--nowstring (timestamp)current time as ISO-8601 — source-onlyThe run’s notion of now.
--schema-versioninteger (u64)1 — source-only (the CURRENT_SCHEMA_VERSION constant)The classification schema version to classify under.
--max-decisionsinteger (u64)none (run to completion) — source-onlyCap the run at N decisions.
--manifest-outpath— (none)Also write the manifest to this file. The manifest is always printed to stdout as pretty JSON regardless.

Non-integer or negative values are exit-2 errors naming the flag, e.g. --window-days must be an integer, --window-days must not be negative.

schema-review: compare two schema documents

atlas-classify --db CORPUS schema-review --old-schema F --new-schema F [--reviewer-model M] [--reviewer-model-version V] [--manifest-out PATH]

Compares two schema documents section by section — changed sections only, unless the new document declares a breaking-change event — and prints the review batch: proposals plus model/config/schema provenance, in format atlas-classify-schema-review/1. It writes nothing to the DB.

FlagArgumentDefaultMeaning
--old-schemapath— (required)The current schema document.
--new-schemapath— (required)The proposed schema document.
--reviewer-modelstringatlas-classify — source-onlyThe reviewing model name recorded in the batch’s provenance.
--reviewer-model-versionstring0.1.0 — source-only (the crate version, from the build environment)The reviewing model version recorded in the batch’s provenance.
--manifest-outpath— (none)Also write the review batch to this file; it is always printed to stdout as pretty JSON.

schema-apply: apply a reviewed schema change

atlas-classify --db CORPUS schema-apply --review F --dispositions F [--now TS] [--manifest-out PATH]

Applies a review batch’s proposals. Each proposal is applied only with a reviewed disposition naming a reviewer and a rationale; lowerings (proposals that lower a classification) without one are refused. The report format is atlas-classify-schema-apply/1.

FlagArgumentDefaultMeaning
--reviewpath— (required)The review batch file produced by schema-review.
--dispositionspath— (required)The dispositions file: one reviewed disposition per proposal to apply.
--nowstring (timestamp)current time — source-onlyThe apply’s notion of now.
--manifest-outpath— (none)Also write the report to this file; it is always printed to stdout as pretty JSON.

Worked examples

Toy examples; the corpus and files are invented.

Preview a sweep of a toy corpus without writing anything (no --commit):

$ atlas-classify --db /tmp/toy-corpus.db run
{
  "format": "atlas-classify-run/1",
  "method": "remainder-sweep",
  "…": "…"
}

Commit the same sweep, capped at ten decisions, and keep the manifest:

$ atlas-classify --db /tmp/toy-corpus.db run --commit --max-decisions 10 --manifest-out /tmp/toy-manifest.json

Review a toy schema change, then apply it with reviewed dispositions:

$ atlas-classify --db /tmp/toy-corpus.db schema-review --old-schema /tmp/toy-schema-old.json --new-schema /tmp/toy-schema-new.json --manifest-out /tmp/toy-review.json
$ atlas-classify --db /tmp/toy-corpus.db schema-apply --review /tmp/toy-review.json --dispositions /tmp/toy-dispositions.json

Asking for help demonstrates the parser contract — usage on stderr, exit 2:

$ atlas-classify --help
usage:
  atlas-classify --db CORPUS run [--commit] [--window-days N] [--actor A] [--now TS] [--schema-version N] [--max-decisions N] [--manifest-out PATH]
  …
$ echo $?
2

Failure shapes

All failures print atlas-classify: &lt;msg&gt; (or, for usage errors, the usage text) to stderr and exit 2. There are no other failure shapes.

  • Bare invocation, --help, run --help, an unknown action, an unknown flag, a duplicated flag, or a missing flag value: the usage text on stderr, exit 2.
  • --db missing, or given twice (--db given twice): exit 2.
  • A required action flag missing (e.g. schema-review without --new-schema): exit 2.
  • A malformed numeric value: an error naming the flag (--window-days must be an integer, --window-days must not be negative), exit 2.
  • A lowering in schema-apply with no reviewed disposition naming a reviewer and rationale: refused, exit 2.
  • Runtime and classification failures — an unreadable corpus, a failed classification write: exit 2, exactly like a usage error. There is no way to distinguish the two classes by exit code; read the message.

Exit codes

CodeMeaning
0Success: the manifest, review batch, or apply report was printed (and written to --manifest-out when given).
2Everything else — usage errors, --help, and runtime/classification failures alike. This binary has no exit-1 path.

atlas-eval

Source: pkgs/atlas-search/crates/atlas-core/src/bin/atlas-eval.rs and pkgs/atlas-search/crates/atlas-core/src/eval.rs (issue #5741).

atlas-eval is a single-verb binary with no subcommands: the offline ranking-evaluation runner for Atlas. It scores saved rankings — lists of document ids produced earlier by any retrieval signal, against a corpus — against judged relevance data, and prints a report. It generates no rankings itself: it loads no embedding model, opens no database, and makes no network calls. The same input therefore produces a byte-identical report on every run.

Invocation

atlas-eval <eval.json> <dev|test>

There are no flags. --help, -h, and help are not recognised: each falls into the wrong-arity path, prints the one-line usage text to stderr, and exits 2.

FlagArgumentDefaultMeaning
(none)——This binary takes no --flag options at all.
&lt;eval.json&gt; (positional 1)path to an atlas-eval/v1 documentrequiredThe evaluation input: queries, qrels, and saved rankings (see below).
&lt;dev|test&gt; (positional 2)dev or testrequiredWhich split of the input document to score. Any other value is an error: atlas-eval: unknown split "…" (want dev|test).

Inputs: the golden set, the qrels, and the saved rankings

The input is one JSON document of format atlas-eval/v1. A golden set is the judged query set for a corpus: a fixed list of queries, each with human judgements — qrels (query relevance judgements) — naming which corpus documents are relevant to it, and how strongly. The document carries three arrays:

  • queries: each has an id, a class (the query class, for example code, documentation, error, or concept), a split (dev or test), and the query text.
  • qrels: each names a query, a doc (a document id, such as a chunk id from the corpus the rankings were produced against), and a grade. Grades are unsigned integers up to a maximum of 30 (MAX_GRADE); a document counts as relevant when its grade is at least 1, and unjudged documents score grade 0.
  • runs: each names a signal (for example dense, bm25, or a fusion such as fused:dense+bm25) and, per query, the ranked list of document ids that signal returned. Rank order is the whole contract — raw scores are not needed by any metric — which is what lets dense, BM25, SPLADE, and fused rankings share one format. A run with no entry for a query scores that query as an empty ranking: incomplete runs are penalised, never skipped.

Validation rejects, before any scoring: a wrong format version, duplicate query ids, qrels or runs naming unknown queries, duplicate (query, doc) qrels, grades above 30, duplicate documents inside one ranking, duplicate result keys inside one run, and duplicate signal names.

Behaviour: what is scored and reported

For the requested split, the runner scores every run in the document and prints one atlas-eval-report/v1 JSON report to stdout. Four metrics are computed per query, then averaged over the queries that have at least one relevant document (queries_scored), both overall and per query class:

MetricMeaning
nDCG@10Normalised discounted cumulative gain over the top 10 ranks, with graded gains 2^grade − 1 and a log2 discount (the gain at 0-based rank i is divided by log2(i + 2)).
Recall@100The fraction of the query’s relevant documents that appear in the top 100 ranks.
Recall@1000The same fraction over the top 1000 ranks.
MRR@10Mean reciprocal rank: 1 / rank of the first relevant document, counting only the top 10 ranks (0 when none appears there).

Each per-query record in the report preserves the run’s top-1000 document ids (field top1000) and the query’s judged grades, so any number in the report can be recomputed from the report alone. Reports are deterministic: signals, queries, and classes are sorted, and floats are rounded to 6 decimal places.

Dev/test discipline

The two splits exist to keep measurement honest:

  • The dev split is for iteration and parameter selection. Compare signals on dev, and pick the winner on dev — the library function select_best_signal does exactly this.
  • The test split is the held-out set: score it once, at decision time, for the single final scoring pass the protocol allows. Parameter selection on the test split is refused inside the library: select_best_signal rejects a test-split report outright. The binary will print a test report — that final pass is legitimate — but nothing in the harness will help you tune against it.

See Evaluation: golden sets and gates for how golden sets and gates fit the wider programme.

Worked example

A toy input, toy-eval.json (invented ids and grades; two queries, two signals):

{
  "format": "atlas-eval/v1",
  "queries": [
    { "id": "q-toy-1", "class": "code", "split": "dev", "text": "toy queue lease" },
    { "id": "q-toy-2", "class": "concept", "split": "test", "text": "toy vector index" }
  ],
  "qrels": [
    { "query": "q-toy-1", "doc": "chunk-toy-1", "grade": 2 },
    { "query": "q-toy-1", "doc": "chunk-toy-2", "grade": 1 },
    { "query": "q-toy-2", "doc": "chunk-toy-9", "grade": 1 }
  ],
  "runs": [
    { "signal": "dense", "results": { "q-toy-1": ["chunk-toy-2", "chunk-toy-1"], "q-toy-2": ["chunk-toy-9"] } },
    { "signal": "bm25", "results": { "q-toy-1": ["chunk-toy-1"], "q-toy-2": [] } }
  ]
}

Scoring the dev split (only q-toy-1 is scored; the bm25 run is not penalised for the test query, and the empty bm25 ranking for q-toy-2 would count against it on the test split):

$ atlas-eval toy-eval.json dev
{ "format": "atlas-eval-report/v1", "split": "dev", … }

The report’s per-signal means carry the four metrics above — ndcg10, recall100, recall1000, and mrr10 — overall and per class.

Failure shapes

  • Wrong number of arguments, or an unrecognised split: the usage line (or the unknown split message) on stderr, exit 2. This includes every spelling of a help request.
  • The input file cannot be read: atlas-eval: cannot read &lt;path&gt;: &lt;error&gt;, exit 1.
  • The input parses but is invalid atlas-eval/v1 data (any validation rule above), or evaluation itself fails: atlas-eval: &lt;error&gt;, exit 1. No partial report is printed.

Exit codes

CodeMeaning
0Success: the report for the requested split was printed to stdout.
1Runtime failure: unreadable input file, invalid evaluation data, or an evaluation failure.
2Usage failure: wrong arity (including --help/-h/help) or an unknown split value.

atlas-sweep

Source: pkgs/atlas-search/crates/atlas-core/src/bin/atlas-sweep.rs and pkgs/atlas-search/crates/atlas-core/src/sweep.rs (issue #7969).

atlas-sweep is the operator tool for the ingestion sweep: the periodic pass that walks a source class on a host, filters the candidates it finds, applies guardrails, and records what it did. The binary exposes the complete operator set for that core — pausing and resuming classes, running one sweep from a request file, managing the dead-letter store (items that failed repeatedly), and reading run reports. It creates and enables no schedule: cadence is an operator/platform decision, gated on Drew’s go-ahead on #7969. State lives in a state directory the operator names on every invocation.

There is no help output at all. The complete surface exists only in the source header; an unrecognised first token — including --help and -h — is an unknown action error.

Invocation

atlas-sweep --state-dir DIR pause-class --class CLASS --host HOST
atlas-sweep --state-dir DIR resume-class --class CLASS --host HOST
atlas-sweep --state-dir DIR run-once REQUEST.json
atlas-sweep --state-dir DIR dead-letter list
atlas-sweep --state-dir DIR dead-letter retry REF
atlas-sweep --state-dir DIR dead-letter drop REF
atlas-sweep --state-dir DIR report [--run RUN_ID]

Those are all seven command forms. --state-dir is global and required; it is extracted from anywhere in the argument list before the action is read.

FlagArgumentDefaultMeaning
--state-dirdirectory pathrequired, no defaultThe sweep state directory (lock, pause state, dead-letter store, report rows). Missing: atlas-sweep: missing --state-dir DIR, exit 2.
--classsource class namerequired for pause-class/resume-classOne of boot-records, session-logs, chat-logs, statistics, reports, code-repo. Unknown: unknown source class "…", exit 2.
--hosthost namerequired for pause-class/resume-classThe host half of the class/host pair being paused or resumed.
--runrun id— (whole cycle report)For report only: print that one run’s row instead of the whole cycle report.
REQUEST.json (positional)pathrequired for run-onceAn atlas_core::sweep::RunRequest JSON file (shape below).
REF (positional)dead-letter referencerequired for dead-letter retry/dropThe dead-letter entry to retry or drop.

Behaviour

Pausing and resuming a class

pause-class and resume-class act on a (class, host) pair, identified by its class_host_key. Each prints one confirmation line, pause-class &lt;class&gt;@&lt;host&gt; or resume-class &lt;class&gt;@&lt;host&gt;. A run for a paused class ends with status PausedClass. Missing --class or --host is missing --class / missing --host, exit 2; any unknown extra argument is unknown argument "…", exit 2.

Running one sweep: run-once

run-once reads and parses the request file, then runs one sweep over its candidates. The RunRequest JSON carries: run_id, batch_id, source_class (a class name from the table above), host, at (ISO-8601), now_unix (lock freshness), candidates (an array of candidate facts: source_ref, bytes, an optional content_address, secret_tier, terminal, has_substance, bot_or_heartbeat, allowlisted, final_version, partial_write), item_failures (default []), measurements, envelope, embed_usd (default 0), and an optional embed_usd_median.

Each candidate is filtered on its facts before any work is spent on it, and guardrails over the run’s measurements can pause the run. Constants from the core: candidates over 256 MiB are rejected as oversize (OVERSIZE_BYTES); the run lock’s time-to-live is 2 hours; an item is dead-lettered after 3 strikes; reports keep at most 100 rows. Run statuses are Completed, OverlapSkip, PausedClass, Aborted, and GuardrailPaused.

On success the outcome is printed as one JSON document: {"status":…, "records":…, "report":…, "alerts":…}. One overlap shape is not a failure: if a live run already holds the lock, run-once prints the bare line overlap-skip and exits 0.

The secret-content holdout. A candidate whose facts mark it as secret-tier is held out of the sweep: secret content is not embedded by the ordinary route. Secret candidates stay held out until the local embedder of #6059 — the secret-tier local embedder, designed so secret material is embedded locally with no egress — lands. Until then the sweep processes the non-secret candidates and leaves the secret ones for that route.

The dead-letter store

Items that fail repeatedly (3 strikes) land in the dead-letter store, keyed by reference (REF):

  • dead-letter list prints the stored refs, one per line. An empty store prints nothing and exits 0.
  • dead-letter retry &lt;REF&gt; returns an entry to the sweep. Silent on success.
  • dead-letter drop &lt;REF&gt; discards an entry. Silent on success.
  • dead-letter with anything else — or with nothing — is atlas-sweep: dead-letter needs list|retry REF|drop REF, exit 2. retry/drop without a ref are dead-letter retry needs a REF / dead-letter drop needs a REF, exit 2.

Reports

report with no --run prints the whole cycle report as one JSON array; an empty store prints [], exit 0. report --run &lt;RUN_ID&gt; prints that run’s row as one JSON object; an unknown id is no report row for run &lt;id&gt;, exit 2, and --run without a value is report --run needs a RUN_ID, exit 2.

See Ingest today: staging, classification, promotion for where sweeps sit in the ingest pipeline.

Worked example

Pausing one class on one host, checking the dead-letter store, and reading the cycle report (toy names throughout):

$ atlas-sweep --state-dir /tmp/toy-sweep-state pause-class --class chat-logs --host toy-host
pause-class chat-logs@toy-host

$ atlas-sweep --state-dir /tmp/toy-sweep-state dead-letter list
$

$ atlas-sweep --state-dir /tmp/toy-sweep-state report
[]

The empty dead-letter list output and the [] cycle report are both successes (exit 0): the store is empty, not broken.

Failure shapes

Every failure in this binary goes through one path: atlas-sweep: &lt;message&gt; on stderr, exit 2. That includes missing --state-dir, a missing action (missing action (pause-class|resume-class|run-once|dead-letter|report)), an unknown action (including --help), an unknown source class, missing --class/--host/REF/RUN_ID values, an unreadable or unparseable REQUEST.json, and I/O and core errors from inside a run. There is no exit-1 path.

Exit codes

CodeMeaning
0Success — including an empty dead-letter list, an empty ([]) cycle report, and a run-once that printed overlap-skip.
2Everything else: every usage error and every runtime failure.

atlas-github-comments

Source: pkgs/atlas-search/crates/atlas-core/src/bin/atlas-github-comments.rs and pkgs/atlas-search/crates/atlas-core/src/github_comments.rs (extraction feed #6023; the writer is #10688).

atlas-github-comments is a one-verb writer: it extracts GitHub comments — issue comments, pull-request review comments, and pull-request reviews — from the repositories Drew controls, and appends them as atlas-github-comment/v1 records to a JSONL file, so the comments become a corpus source (source class github comments, source id github-comments). There are no subcommands and no other mode; the single invocation below is the whole tool.

There is no help output at all. The complete surface exists only in the source header, and — stated plainly, because it surprises everyone — every failure in this binary exits 1, including pure argument errors. --help is not a help path; it is an unknown argument, exit 1. There is no exit-2 path.

Invocation

atlas-github-comments --state <watermarks.json> --out <records.jsonl> [--repo <owner/name>]... [--skip-reviews] [--observed-date <YYYY-MM-DD>]
FlagArgumentDefaultMeaning
--statepath to a JSON watermark storerequiredPer-repo progress: the stored updated_at watermark for each repository already extracted. Missing flag: --state is required, exit 1.
--outpath to a JSONL filerequiredAppend target for the emitted atlas-github-comment/v1 records. Missing flag: --out is required, exit 1.
--repo&lt;owner&gt;/&lt;name&gt;— (whole estate)Restrict the run to these repositories. Repeatable. With no --repo, the estate is enumerated from the GitHub API: the developing-today and developing-today-forks organisations plus the dezren39 account — the #6023 our-repos estate. External repositories are never extracted here; that is gated on #6024.
--skip-reviews(switch)offSkip the per-PR reviews walk (issue comments and review comments are still extracted).
--observed-dateYYYY-MM-DDtoday, UTC (via date -u +%F)The observation date stamped on the emitted documents.

Any other argument — including --help, -h, and the literal word help — is atlas-github-comments: unknown argument: &lt;arg&gt;, exit 1. A flag missing its value is named the same way, for example --state needs a path, exit 1.

Behaviour

Extraction is done with the gh CLI only (gh api, with --paginate), and repositories are walked sequentially, as rate-limit discipline. For each repository the tool collects its issue comments, its review comments, and (unless --skip-reviews) its reviews, shapes them into comment documents, and appends one atlas-github-comment/v1 record per document to --out. Each record carries its provenance — repository, thread number, comment id, and the observed date — so a record in the corpus names the exact comment it came from.

Progress is reported on stdout as it goes: an opening estate: &lt;n&gt; repos line, one line per repository — &lt;repo&gt;: issue_comments=N review_comments=N reviews=N documents=N — and a closing totals: … line.

Idempotency and dedupe shape

Re-running the tool is the normal case, and it is safe by construction:

  • Extraction is incremental per repository via the watermark: the state file stores each repo’s updated_at watermark, and a run only extracts what is newer than the stored mark. Already-extracted comments are not emitted again.
  • Watermarks are persisted after every repository, not at the end of the run. An interrupted run therefore resumes where it stopped: rerun the same command and the repos already done are skipped by their watermarks, with their records already in --out.
  • A gh failure stops the run, but with state saved: the error carries the suffix (state saved; rerun resumes), and the rerun picks up from the last persisted watermark rather than starting over.

The HTTP 451 exception

One failure does not stop the run: a repository that is permanently access-blocked (HTTP 451, for example a DMCA block) is logged as &lt;repo&gt;: skipped — repository access blocked (HTTP 451), counted in a final skipped_repos: N (repository access blocked, HTTP 451) line, and the run continues with the next repository. If nothing else failed, the run still exits 0.

See Ingest today: staging, classification, promotion for how an extracted source like this one proceeds through staging and classification.

Worked example

Extracting one toy repository into a fresh state and records file:

$ atlas-github-comments --state /tmp/toy-watermarks.json --out /tmp/toy-records.jsonl --repo toy-owner/toy-repo
estate: 1 repos
toy-owner/toy-repo: issue_comments=2 review_comments=1 reviews=1 documents=4
totals: …

Running the identical command again appends nothing for that repository unless new comments have appeared since the stored watermark — the second run is the resume/idempotency check, not a duplicate import.

Failure shapes

  • Missing --state or --out, an unknown argument (including --help), or a flag missing its value: atlas-github-comments: &lt;message&gt; on stderr, exit 1.
  • A gh failure mid-run: the run stops, watermarks saved so far stay saved, the error notes (state saved; rerun resumes), exit 1.
  • File errors on the state or output paths: exit 1.
  • The one non-failure: HTTP 451 repositories are skipped and counted, and do not by themselves change the exit code.

Exit codes

CodeMeaning
0Success — including runs in which HTTP 451 repositories were skipped.
1Everything else: argument errors, gh failures, and file errors alike. This binary has no exit-2 path.

fleet search and fleet serve search

Source: pkgs/fleet/crates/fleet-search/src/cli.rs, pkgs/fleet/crates/fleet-search/src/serve.rs, and pkgs/fleet/crates/fleet-search/src/client.rs.

This chapter covers the fleet domain surface over Atlas, from the Atlas side. The fleet binary registers a search domain (argv0 alias atlas-search) that presents the Atlas corpus search to fleet seats, and a serve role that runs the Atlas service itself. The same surface is covered from the fleet side in the fleet book; here the emphasis is on how the two verbs route, what they deliberately omit relative to atlas-search: search and get-chunk, and where fleet’s behaviour differs from the standalone binary’s.

There are two client verbs and one service verb:

  • fleet search — hybrid full-text + vector search over the Atlas corpus, with classification filters.
  • fleet search get-chunk — fetch one chunk with its provenance.
  • fleet serve search — run the Atlas service in the foreground (the loopback HTTP job protocol over one shared Snowflake embedder and a read-only Turso backend; the atlas-search service rehomed, #5604 — same config, same wire, same port 18760).

Invocation

fleet search <query> [options]
fleet search search <query> [options]        (atlas-search's own shape; the leading `search` token is consumed)
fleet search get-chunk <chunk-id> [--neighbors N] [--text]
fleet serve search [options]

The query is a single positional: fleet search &lt;query&gt; … and fleet search search &lt;query&gt; … are the same surface. A second positional is a usage error: unexpected extra argument "…" (the query is one positional), exit 2. fleet search with no arguments prints the usage text (the shared SEARCH_USAGE text) to stderr and exits 2; --help/-h anywhere in the search arguments prints it and exits 0. Bare fleet search --version (or -V) prints fleet search 0.1.0 and exits 0 — any trailing argument after --version is a usage error, exit 2.

Parser mechanics worth knowing: for search flags, only the space-separated spelling --flag value is parsed — there is no --flag=value handling in the search parser, so --k=5 is an unknown option error (the serve parser, below, accepts both spellings). Every value flag requires a following token (&lt;flag&gt; needs a value, exit 2); a non-integer value for an integer flag is &lt;flag&gt;: invalid integer "…", exit 2; any unrecognised --prefixed token is unknown option "…", exit 2.

The search flags

FlagArgumentDefaultMeaning
--kinteger10Final results. Validated ≥ 1.
--poolinteger100Per-branch candidates, validated 1..=400.
--modehybrid|fts|vectorhybridWhich retrieval branches run.
--kindCSV—Classification kind filter (CSV split, trimmed, empties dropped).
--topicCSV—Topic filter.
--projectCSV—Project filter.
--clientCSV—Client filter.
--sinceYYYY-MM-DD—Sessions created on/after the date (inclusive). Passed through unvalidated by this parser.
--untilYYYY-MM-DD—Sessions created on/before the date (inclusive). Passed through unvalidated.
--max-sensitivityladder namepersonalCaller ceiling on the ladder shareable &lt; personal &lt; local-only &lt; secret-bearing. The server clamps it to the client identity’s ceiling (see Provisioning). An unrecognised name is not clamped here: the via-service attempt is declined and the standalone artifact produces atlas-search’s exact validation fatal.
--group-by-session(switch)offRoll chunk hits up to sessions.
--expandinteger0Include N neighbouring chunks around each hit. Fleet validation differs from atlas-search’s — see below.
--with-message(switch)offInclude the parent message text.
--no-cache(switch)offBypass service cache reads; the fresh result still lands in the cache.
--no-wait(switch)offDo not block: print the service job handle and return. There is no --wait flag on this surface; waiting is implied (wait = !no_wait).
--hydrateinteger0Hydrate the top N results to full chunk + message content. Fleet validation differs — see below.
--raw-rows[=branches]optional valueoffUngrouped rows: bare --raw-rows for flat fused rows, --raw-rows=branches for pre-fusion branch rows. Any other =value is a usage error.
--text(switch)offHuman-readable output instead of JSON.
--modelnameSnowflake/snowflake-arctic-embed-m-v2.0Embedding model. (The fleet help text abbreviates this to “Snowflake arctic-embed-m-v2.0”; the parser’s default is the full name given here — source wins.)
--embedderauto|fastembed|stautoQuery embedder selection.
--truncinteger0Truncate vectors to N dims (0 = full). Validated ≥ 0.
--vector-backendscan|index-fill|index-fixedscanTurso vector branch strategy.
--via-service(switch)offPrefer the Atlas service (job protocol). Conflicts with --standalone: giving both is a usage error, exit 2.
--standalone(switch)offRun standalone via the atlas-search artifact. This flag is fleet-only; atlas-search has no --standalone.
--service-urlURLresolution chain belowService base URL (env ATLAS_SEARCH_URL; default http://127.0.0.1:18760).

get-chunk documents two flags: --neighbors &lt;N&gt; (include N chunks either side in the same message) and --text (human-readable output). In fact the fleet verb parses none of its arguments: after answering --help itself, it forwards every argument after the get-chunk token verbatim to atlas-search get-chunk …. So the artifact’s full get-chunk surface — --context, --backend, --db, --vecdb, --via-service, --service-url — also works through this verb, undocumented in the fleet help; conversely, a mistyped flag is caught, if at all, by the artifact, with atlas-search’s wording and exit codes.

The 21 atlas-search flags fleet omits

The fleet help calls its surface “mirroring atlas-search search”; the source is more accurate — the fleet struct holds the subset of atlas-search’s arguments that translates to the wire request or to routing. The omitted flags fall in these categories:

  • Disclosure: --context.
  • Backend and storage selection (standalone-only engine knobs): --backend, --db, --vecdb, --vec-table, --shards.
  • The query-parameter contract group: --parameters_version, --shard_top_k, --global_top_k, --fts_weight, --vector_weight, --jaccard_depth, --jaccard_threshold, --rrf_k.
  • Unimplemented-stage and variant controls: --planner_enabled, --spell_enabled, --query_class_hint, --variant, --raw.
  • Wait control: --wait (fleet implies waiting and offers only --no-wait).

This is a hard boundary, not a pass-through gap: on the standalone route the caller’s raw argv is delegated to the atlas-search artifact with --via-service, --standalone, and --service-url &lt;value&gt; stripped — but the fleet parser runs first, so a flag it rejects never reaches the artifact. It is a usage error at the fleet layer.

--expand and --hydrate validation differences

Two defaults are validated more loosely by fleet than by atlas-search:

  • --expand: atlas-search validates 0..=100. Fleet’s via-service request builder validates only ≥ 0 — the cap is not applied here. On the via-service route the server validates on submit; on the standalone route the delegated artifact re-validates with its own cap.
  • --hydrate: atlas-search additionally caps the value at 1000 in parameter validation. Fleet’s parser checks only ≥ 0.

Routing: which route a search takes

A search runs one of two ways: via-service (submitted to a running Atlas service over the job protocol) or standalone (delegated to the atlas-search artifact, which embeds the query in-process and talks to the backend directly). Resolution order, highest first:

  1. Flags: --via-service → via-service; --standalone → standalone.
  2. Environment: ATLAS_SEARCH_VIA=service → via-service. (Only the exact value service counts.)
  3. fleet.toml [search]: via = "service" or via = "standalone". Any other value is ignored and resolution falls through.
  4. Seat default (Atlas Q3): if the serving-host marker exists — the service config file, resolved via ATLAS_SEARCH_SERVICE_CONFIG else ~/.local/state/atlas-search/service.json — the seat is the laptop seat and defaults to standalone. Otherwise the seat is a sandbox seat and defaults to via-service.

The service URL resolves on its own chain: --service-url flag → fleet.toml [search] url → ATLAS_SEARCH_URL → http://127.0.0.1:18760.

The sandbox seat’s via-service preference comes with a loud standalone fallback: a via-service failure of any kind prints fleet search: warning: --via-service: &lt;detail&gt;; falling back to standalone on stderr and delegates to the artifact. The delegation strips ATLAS_SEARCH_VIA from the child’s environment, so an ambient value cannot silently re-route the standalone run. If no standalone artifact is available on PATH either, that is exit 3 (see Exit codes).

get-chunk never takes the service route: chunk reads are job-scoped in the protocol, so the verb always runs standalone. When via-service was requested — a --via-service token in the raw arguments, ATLAS_SEARCH_VIA=service, or fleet.toml [search] via = "service" (the seat default alone does not count) — fleet first prints its loud fallback warning, then delegates.

Provisioning: the via-service token and the server-side clamp

A via-service client presents a per-seat bearer token, resolved in this order:

  1. The ATLAS_SEARCH_TOKEN environment variable.
  2. The JSON file at ~/.config/atlas-search/client.json (path overridable via ATLAS_SEARCH_CLIENT_CONFIG): a JSON object with one token string field, expected mode 0600.

Identities are named in the service config, and the server clamps --max-sensitivity to the identity’s ceiling — the client cannot widen its own grant by asking. Named examples: drew-cli is capped at secret-bearing; sandbox-scripts at personal. A seat with no client.json cannot use the service route and falls back to standalone.

fleet serve search: the service role

usage: fleet serve search [options]

  --config PATH         service config (default ~/.local/state/atlas-search/service.json; env ATLAS_SEARCH_SERVICE_CONFIG)
  --listen ADDR         listen address override (loopback only)
  --job-ttl-ms N        completed-job TTL override, milliseconds (default 600000)
  --hard-ttl-ms N       submit hard-cap override, milliseconds (default 3600000)
  -h, --help            this help

The serve parser accepts both --flag value and --flag=value spellings (unlike the search parser). -h/--help/help print the help and exit 0; unknown flags and stray positionals are unexpected argument '&lt;raw&gt;', exit 2; a non-numeric TTL or a non-socket --listen value exits 2 naming the value. init (the client table) and fetch-model stay on the standalone atlas-search artifact. The role’s server code is a copy of atlas-search’s server.rs, parity-checked in CI; config, wire, port (18760), and client table are identical to atlas-search serve.

Source-wins note: fleet search serve

fleet help search lists serve among the domain’s commands, while the client parser in cli.rs contains a branch that rejects serve (with init and fetch-model) as “an atlas-search service verb, not part of the fleet search client surface”. The source comment and the live behaviour agree that the rejection branch is dead for serve: the fleet binary routes search serve to the serve role before the client parser sees it, so fleet search serve actually starts the service — probed live, it attempted to bind 127.0.0.1:18760 and failed with Address already in use, exit 1. The branch is still live for init and fetch-model, which do produce the usage error, exit 2. This chapter states the routed behaviour: fleet search serve is fleet serve search.

Worked examples

$ fleet search 'toy queue lease' --k 5 --text
$ fleet search search 'toy build failure' --mode fts --since 2026-11-01
$ fleet search get-chunk 112081 --neighbors 2 --text

The first uses the short shape on whatever route the seat resolves; the second spells the leading search token (atlas-search’s own shape) and restricts the search to the FTS branch; the third fetches one chunk and its two neighbours on each side, rendered as text — always via the standalone artifact, per the routing rules above.

Failure shapes

  • Usage errors — unknown option, missing flag value, invalid integer, --via-service with --standalone, a second positional, trailing arguments after --version, and the rejected init/fetch-model verbs: message plus usage on stderr, exit 2.
  • Via-service failure with a standalone artifact available: the loud warning on stderr, then the standalone result — the command succeeds; the fallback is reported, not hidden.
  • A service-job or backend failure surfaced without a fallback, and a delegated artifact’s exit 1, propagate as exit 1. The serve role’s runtime failures (backend token, bind) are also exit 1.
  • No service route and no standalone artifact on PATH: fleet search: the standalone atlas-search artifact is not available on PATH (…), exit 3.
  • A fleet build that cannot serve the search domain at all answers with a stub and exit 69, the fleet-wide convention.

Exit codes

CodeMeaning
0Success — including --help and bare --version. (A running fleet serve search service does not exit 0; 0 there is help only.)
1Runtime failure: a service-job/backend failure with no fallback, the delegated artifact’s exit 1, or a serve-role runtime failure such as a bind error.
2Usage/validation: unknown options, missing values, conflicts, rejected verbs, and serve-role usage/config errors.
3Routing unavailable: no service route and the standalone atlas-search artifact is not on PATH.
69Domain stub: this fleet build cannot serve the search domain.

The service HTTP API

Source: crates/atlas-search/src/server.rs and its server/ submodules, crates/atlas-proto/src/lib.rs, crates/atlas-core/src/feedback.rs — provenance only; this chapter is complete without following it.

The service is the laptop half of Atlas: a loopback HTTP service, run by atlas-search serve or by its rehomed twin fleet serve search (see fleet search and fleet serve search), that holds one shared Snowflake embedder and a read-only backend and serves search as a job protocol — submit a search, then pull its immutable fused ranking in pages. It binds 127.0.0.1:18760 and nothing else; wider reach is a tailscale serve mapping in front of the loopback port, never a public listener of its own. The Cloudflare Worker described in The Worker HTTP API is a separate, hosted surface that calls this service; the two are not the same API.

GET    /health
POST   /v1/search
POST   /v1/search/jobs
GET    /v1/search/jobs
GET    /v1/search/jobs/<job_id>
GET    /v1/search/jobs/<job_id>/results?cursor=<cursor>&limit=<n>
DELETE /v1/search/jobs/<job_id>
GET    /v1/search/jobs/<job_id>/chunk/<chunk_id>
POST   /v1/embed
POST   /v1/feedback
GET    /v1/feedback

Every route except GET /health requires a per-identity bearer token (see “Identity, tokens and the ceiling clamp” below). Request and response bodies are JSON. The wire types are shared by the service and its clients through the atlas-proto crate, so the definitions cannot drift between them.

Route summary

Method and pathAuthSuccessMeaning
GET /healthnone200Liveness, embedder state and queue depth. No corpus data.
POST /v1/searchclient token200One-shot search: submit, wait, and return the first page in one call.
POST /v1/search/jobsclient token202Submit a search job; returns the job handle.
GET /v1/search/jobsclient token200List the calling identity’s own jobs, metadata only.
GET /v1/search/jobs/&lt;job_id&gt;client token or job token200One job’s status.
GET /v1/search/jobs/&lt;job_id&gt;/resultsclient token or job token200One page of a job’s ranking.
DELETE /v1/search/jobs/&lt;job_id&gt;client token or job token200Delete a job and its stored ranking.
GET /v1/search/jobs/&lt;job_id&gt;/chunk/&lt;chunk_id&gt;client token or job token200One chunk, scoped to an existing job.
POST /v1/embedclient token200Embed one query text in the pinned Snowflake space.
POST /v1/feedbackclient token201Cast a feedback vote (atlas-feedback/v1); returns the stored record.
GET /v1/feedbackclient token200Retrieve feedback by query (and optionally chunk).
any other route—404not_found in the shared error envelope.

/v1/feedback also answers at the unversioned alias /feedback, for both POST and GET.

GET /health

No authentication, no parameters, no corpus data:

{
  "status": "ok",
  "embedder_state": "ready",
  "queue_depth": 0,
  "active_branch_executions": 0,
  "active_jobs": 0
}

embedder_state is the shared embedder’s load state (design vocabulary: cold, warming, ready). queue_depth, active_branch_executions and active_jobs describe the job machinery at the moment of the call.

Identity, tokens and the ceiling clamp

Two kinds of token exist, and they are not interchangeable:

Token kindWhere it comes fromWhat it authorises
Client tokenOne per named identity in service.json (see Configuration and environment); the client presents the matching value from its own client.json.Every authenticated route, for that identity only.
Job tokenMinted by the service and returned once, in the 202 response that creates a job.Only that one job’s status, results, chunk and delete routes. A job token cannot list jobs and cannot touch any other job.

Presentation is the same for both: the header Authorization: Bearer &lt;token&gt;. Token values are never printed or logged by any tool; this book names tokens only.

Each client identity carries a ceiling cap — the highest sensitivity ceiling that identity may ever search under. Sensitivity is a ladder, lowest to highest: shareable < personal < local-only < secret-bearing. A search request names a requested ceiling; the service clamps it:

effective_ceiling = min(requested_ceiling, calling identity's ceiling_cap)

The clamp is the security property: no request field, header or client-side flag can widen it. The effective ceiling is recorded on the job and reported in every status, page and envelope response, so a caller can always see the ceiling its results were actually computed under. See Sensitivity tiers and client ceilings for the ladder and what each rung admits.

The v1 client table written by atlas-search init is:

IdentityCeiling capIntended caller
drew-clisecret-bearingDrew’s own CLI on the laptop.
openchamberpersonalOpenChamber sessions.
fork-serverpersonalFork / OpenCode agents.
sandbox-scriptspersonalSandbox scripts and Muse lanes, over the tailnet.

One later identity exists beyond the init table: cf-worker, cap personal, whose token the Cloudflare Worker presents when it calls this service (see The Worker HTTP API). Raising any cap is a local edit to service.json by Drew; there is no API for it.

A missing or invalid bearer token fails with an unauthorised error in the shared error envelope (see “Errors”), on every authenticated route, in the same shape.

The search request

Both search submissions — one-shot and job — take the same request body, the atlas-proto SearchRequest:

{
  "query": "queue broker lease expiry",
  "mode": "hybrid",
  "filters": { "kind": [], "topic": [], "project": [], "client": [] },
  "ceiling": "personal",
  "k": 10,
  "pool": 100,
  "group_by_session": false,
  "expand": 0,
  "with_message": false,
  "model": "Snowflake/snowflake-arctic-embed-m-v2.0",
  "embedder": "auto",
  "trunc": 0,
  "vector_backend": "scan",
  "context": "fleet-internal"
}
FieldTypeDefaultMeaning
querystring— (required)The query text.
modehybrid | fts | vectorhybridWhich branches run.
filtersobjectemptyClassification filters: kind, topic, project, client (string lists) and since, until (session dates, inclusive).
ceilingladder namepersonalThe requested ceiling; the service clamps it to the caller’s cap.
kinteger10Final results wanted.
poolinteger100Per-branch candidates; the service enforces the design maximum of 400.
group_by_sessionbooleanfalseRoll chunk hits up to sessions.
expandinteger0Neighbouring chunks to include around each hit (0–100).
with_messagebooleanfalseInclude the parent message text.
modelstringSnowflake/snowflake-arctic-embed-m-v2.0Embedding model name; the pinned space (see below).
embedderstringautoEmbedder selection.
truncinteger0Truncate vectors to N dimensions; 0 = full width.
vector_backendscan | index-fixed | index-fillscanVector branch strategy.
page_limitinteger or nullnullOne-shot endpoint only: page size for the first page.
contextstring or nullnullDisclosure context spelling: fleet-internal, hosted-per-user, public-surface or local-owner. Absent or unknown values fail closed under the receiving surface’s rule; the context intersects the ceiling and neither widens the other.

Flattened onto the same object are the versioned query parameters (parameters_version, shard_top_k, global_top_k, fts_weight, vector_weight, jaccard_depth, jaccard_threshold, rrf_k, planner_enabled, spell_enabled, query_class_hint, variant, raw, no_cache, wait, hydrate, raw_mode), whose defaults are the contract in query-parameters-v1.json — see Configuration and environment. Two of them steer the protocol itself: wait (protocol default false; the one-shot CLI sets it unless told not to) and no_cache (bypass the service’s result-cache reads; the fresh result still lands in the cache).

POST /v1/search — the one-shot

The one-shot submits the search, waits for the job to complete, and returns the first page in a single response, with status 200. Its body is a SearchPage (below). This is the form the Worker uses, with page_limit unset. A caller that wants the handle instead of the wait — or wants to page at its own pace — uses the job routes.

The job protocol

Submit: POST /v1/search/jobs → 202

{
  "job_id": "<job id>",
  "job_token": "<per-job capability token>",
  "status": "queued",
  "effective_ceiling": "personal",
  "queue_depth": 1,
  "queue_position": 0,
  "submitted_at_ms": 1763832000000,
  "expires_at_ms": 1763832600000
}

Keep both halves of the handle: job_id names the job in every later path, and job_token is the capability that authorises those calls without exposing the client token. expires_at_ms is when the job’s stored ranking leaves the temp store (see “The temp store and job lifetime”).

Status: GET /v1/search/jobs/&lt;job_id&gt;

Job statuses are queued, running, done, failed and expired. The status response reports both branches separately — branch_states holds an fts and a vector state, each pending, running, done, failed or skipped — because a filtered vector scan is seconds of server-side work and the branches do not finish together.

FieldMeaning
job_id, statusThe job and its lifecycle state.
branch_states{ "fts": &lt;state&gt;, "vector": &lt;state&gt; }.
effective_ceilingThe clamped ceiling the job runs under.
poolThe per-branch candidate depth in force.
queue_depth, queue_positionBacklog at the time of the call; queue_position is null once running.
notesStrings the service attached while running the job (fallbacks, cache notes, degradations).
errorThe failure message when status is failed; otherwise null.
result_countTotal results in the fused ranking once known; otherwise null.
submitted_at_ms, started_at_ms, completed_at_ms, expires_at_msMillisecond timestamps; start and completion are null until they happen.

Results: GET /v1/search/jobs/&lt;job_id&gt;/results?cursor=&lt;cursor&gt;&amp;limit=&lt;n&gt;

Results are pulled, not pushed — pull-until-satisfied. The ranking is computed once, fused once, and is immutable for the life of the job; paging never re-runs ranking, and fetch-to-fill depth escalation lives inside the job’s vector branch, never in client paging.

ParameterDefaultMeaning
cursor— (first page)The previous page’s next_cursor, passed back verbatim. Cursors are opaque: do not parse, construct or store them beyond the life of the job.
limit100Page size.
{
  "job_id": "<job id>",
  "status": "done",
  "effective_ceiling": "personal",
  "envelope": { "results": ["<this page's slice of the search envelope>"] },
  "results": ["<hit objects, in fused rank order>"],
  "next_cursor": "<opaque cursor>",
  "total_results": 37
}

next_cursor is the whole continuation contract: pass it back as cursor to get the next page, and stop when it comes back null — null means the ranking is exhausted, not that a page was empty by accident. envelope is the ordinary search envelope with its results replaced by this page’s slice, so a client that renders envelopes needs no second code path. total_results is the full ranking’s size, the same on every page.

List: GET /v1/search/jobs

Returns { "jobs": [ &lt;summaries&gt; ] }, oldest first, containing only the calling identity’s own jobs. A summary is metadata only — job_id, status, query, mode, pool, effective_ceiling, submitted_at_ms, expires_at_ms, queue_position — never result content and never a job token. Job capability tokens cannot call this route at all.

Chunk: GET /v1/search/jobs/&lt;job_id&gt;/chunk/&lt;chunk_id&gt;

Chunk reads are scoped to an existing job: there is no free-standing chunk route, because a chunk’s disclosure is judged against the job that surfaced it. The query parameter neighbors asks for that many chunks either side in the same message, at most 100.

Delete: DELETE /v1/search/jobs/&lt;job_id&gt;

Deletes the job and its stored ranking immediately, ahead of expiry. Response: { "job_id": "&lt;job id&gt;", "status": "&lt;status string&gt;" }.

POST /v1/embed

Embeds one query text and returns the vector, for callers — in practice the Worker, on its cache-miss path — that need the embedding itself:

{ "query": "queue broker lease expiry", "trunc": 0 }
{ "model": "Snowflake/snowflake-arctic-embed-m-v2.0", "dims": 768, "vector": [0.012, -0.034] }

(The vector above is a toy two-number stand-in; a real response carries 768 numbers.) trunc is optional; absent or 0 means full width. The response names its space — model and dimensions — so a caller can refuse a vector from the wrong space, and callers do: the Worker validates every embed response against the pinned space (model Snowflake/snowflake-arctic-embed-m-v2.0, 768 dimensions, every component finite) and refuses anything else before storing it. See Embeddings: Snowflake Arctic and the parity contract.

Any valid client token may embed. Ceilings govern search, not embedding: an embedding of a query text discloses nothing from the corpus, so no cap applies to this route.

POST and GET /v1/feedback

Feedback is a thumbs vote on a served result, captured under the schema string atlas-feedback/v1. A vote attaches to the (query_id, chunk_id) result identity — never to a rank position — and a vote with chunk_id null is a per-query vote.

Submission (POST, returns 201 with the stored record):

{
  "query_id": "<the query_id the search envelope carried>",
  "chunk_id": 112081,
  "vote": "up",
  "comment": "right session, wrong chunk",
  "requester": { "kind": "agent", "id": "lane-3" },
  "opened": true
}
FieldRule
query_idRequired, non-empty.
chunk_idA chunk id, or null for a per-query vote.
voteExactly up or down.
commentOptional, stored verbatim, at most 256 KiB.
requester.kindOne of drew, agent, user, anonymous; empty means anonymous.
requester.idStable requester id; may be empty for anonymous.
openedWhether the result was opened or expanded before the vote.

The stored record adds schema (atlas-feedback/v1), a minted feedback_id, and ts (RFC 3339, UTC). Records are append-only and never mutated; a later vote from the same requester on the same (query_id, chunk_id) supersedes the earlier one in the derived view, never by rewriting it.

The client token is this surface’s credential — the requester named in the body may be anonymous, because the token already identifies the calling surface. GET /v1/feedback retrieves the records for a query (and, when given, a chunk), each with its supersede state.

The temp store and job lifetime

Job results live in an in-memory temp store inside the service process. Two lifetimes bound every job, both overridable at serve time (see Configuration and environment):

LifetimeDefaultMeaning
Completed-job TTL600000 ms (10 minutes)How long a completed job’s ranking stays pageable after completion. expires_at_ms on the handle and status is this deadline.
Submit hard cap3600000 ms (60 minutes)The outer bound from submission, however the job’s run goes.

Nothing in the temp store survives a service restart, by requirement: job results hold ceiling-gated snippets, and persistence would be a liability, not a feature. A durable-store design (a scratch database) was rejected on exactly that ground, and on the evidence of the corpus writer’s stall behaviour. When a job passes its deadline its status reads expired and its pages are gone; re-running the search is the recovery, and the service’s result cache may make that cheap.

Backpressure is part of the protocol shape: the service bounds concurrent branch executions and per-client queued jobs, and saturation is answered with the rate_limited error (below) carrying retry_after_seconds and queue_depth, rather than with unbounded queueing.

Errors

Every error uses the shared envelope — the same shape the Worker uses, defined in atlas-proto:

{ "error": { "code": "<code>", "message": "<message>" } }

The envelope may also carry retry_after_seconds and queue_depth when the code is rate_limited; both are absent otherwise.

StatusCodeWhen
200 / 201 / 202—Success: reads and one-shot search (200), feedback submission (201), job submission (202).
401unauthorizedMissing or invalid bearer token, client or job, on any authenticated route. One shape for every route, so a caller cannot probe which token kind a route expected. (Status and code verified in crates/atlas-search/src/server.rs: ServerError::unauthorized is HTTP 401 with code unauthorized.)
404not_foundUnknown route. A chunk the caller may not see — or that does not exist — is also 404, with code chunk_not_found; an expired or unknown job is 404 with code job_expired_or_unknown, and a job that expired before its results were read is 410 with code job_expired.
429rate_limitedSaturation: the error carries retry_after_seconds and queue_depth; wait the stated interval rather than retrying immediately.

Worked example

Submit without waiting, poll, then page — the toy session a client library performs on a caller’s behalf:

POST /v1/search/jobs
Authorization: Bearer <client token>
Content-Type: application/json

{ "query": "onnx build failure", "ceiling": "secret-bearing", "k": 10 }

A drew-cli caller (cap secret-bearing) gets 202 with effective_ceiling: "secret-bearing"; the same body from sandbox-scripts (cap personal) gets 202 with effective_ceiling: "personal" — the clamp, visible on the handle, is the only difference. Then:

GET /v1/search/jobs/<job_id>
Authorization: Bearer <job token>

until status is done, then:

GET /v1/search/jobs/<job_id>/results?limit=10
Authorization: Bearer <job token>

and repeat with each returned next_cursor as cursor until next_cursor is null.

Exit codes

This is an HTTP surface; it has no process exit codes of its own. The serving processes do: config-load failures under serve (missing config, config not mode 0600, empty client table, duplicate client names, a bad ceiling_cap) exit 2 with run atlas-search init first guidance where applicable, and runtime serve failures exit 1 — see atlas-search: serve, init, fetch-model, traces and feedback.

The Worker HTTP API

Source: worker/src/index.ts, worker/src/search.ts, worker/src/cache_do.ts, worker/src/body.ts, worker/src/key.ts — provenance only; this chapter is complete without following it.

The Worker is the hosted half of Atlas: a Cloudflare Worker named atlas-search, reached at https://atlas-search.developing-today.workers.dev, that fronts the laptop service described in The service HTTP API with a per-query cache and a pinned disclosure context. Routing is a hand-written fetch handler — exact method plus exact path matches, no router library, no trailing-slash handling, and no CORS handling anywhere.

GET  /health
POST /v1/search
GET  /v1/cache/inspect?query=<query>&k=<k>
POST /v1/cache/purge
POST /mcp

That is the whole public surface: 5 public routes, plus a catch-all 404 for everything else. Three further routes exist inside the Worker’s cache Durable Object; they are internal and marked as such below.

The shared gate

Every route except GET /health sits behind one shared gate:

AspectRule
Secret nameGATE_TOKEN (named only; never valued in this book).
PresentationHeader Authorization: Bearer &lt;GATE_TOKEN&gt;. The prefix check is the exact, case-sensitive string Bearer ; anything else presents an empty token and fails.
ComparisonBoth the presented and the configured token are SHA-256 digested, and the 32 digest bytes are XOR-folded; equal if and only if the fold is 0. Digests are fixed-size, so the comparison is length-safe and constant-time by construction.
FailureMissing presented token, or GATE_TOKEN unset → the gate fails → 401.

The gate failure shape is the shared error envelope (below) with code unauthorized and message missing or invalid gate token.

One token serves all gated routes — /v1/search, /v1/cache/inspect, /v1/cache/purge and /mcp. There are no per-route, per-caller or per-agent tokens in the Worker, and no caller identity is extracted from the token: a passed gate yields a boolean, nothing else. Every gated caller is therefore the same identity to the Worker. What that identity is — disclosure context hosted-per-user, ceiling personal, both pinned at compile time — is covered in The Atlas MCP server and Sensitivity tiers and client ceilings; no env var, request field or header can change either value.

Where the gate sits in each route’s validation order matters and differs by route; each route below states it.

The shared error envelope and the body limit

Every Worker-generated error uses one envelope:

{ "error": { "code": "<code>", "message": "<message>" } }

Two exceptions: the MCP endpoint answers with JSON-RPC error objects (see The Atlas MCP server), and upstream failures on the search path pass through the Durable Object’s query_failed envelope (see “Upstream failures” below).

Request bodies are capped at 64 KiB (MAX_SEARCH_BODY_BYTES = 64 * 1024). A declared Content-Length over the cap is refused without reading; an undeclared body is read incrementally and cancelled at the cap. Over-cap → 413, code payload_too_large, message body is larger than the 64 KiB limit.

GET /health

Open — no gate, checked before it. No body, no parameters read. The only response this route produces:

{ "status": "ok", "service": "atlas-search-worker" }

with status 200. It is liveness only; it says nothing about the laptop service behind the Worker.

POST /v1/search

The gated search route. Validation order is fixed — the gate is checked before the body is read, then the body chain runs:

OrderCheckFailure
1Gate token401, unauthorized, missing or invalid gate token
2Body ≤ 64 KiB413, payload_too_large, body is larger than the 64 KiB limit
3Body parses as JSON400, bad_request, body must be JSON
4Parsed body is an object (JSON null parses, then fails here)400, bad_request, body must be a JSON object
5query is a string400, bad_request, query must be a string
6query non-empty after normalization400, bad_request, query must not be empty

Normalization is NFC, trim, and collapse of every whitespace run to one space — so a whitespace-only query passes check 5 and fails check 6. Case is preserved; the fan-out is case-sensitive. Content-Type is not checked: the body is read as text and parsed regardless of header.

Request:

{ "query": "queue broker lease expiry", "k": 10 }

k is optional and clamped by clampK (below). Success is 200 with the search envelope:

{
  "cache": "miss",
  "key": "<64-hex-char SHA-256 cache key>",
  "query": "queue broker lease expiry",
  "result": { "<the service's search result, passed through verbatim>" },
  "meta": {
    "created_at": "<ISO-8601>",
    "searched_at": "<ISO-8601>",
    "hit_count": 0,
    "embed_ms": 41,
    "search_ms": 6123,
    "dims": 768,
    "model": "Snowflake/snowflake-arctic-embed-m-v2.0"
  }
}

cache is miss when this call ran the fan-out and hit when the Durable Object cache served it. result is whatever the laptop service returned — the Worker treats it as opaque and does not validate its inner shape beyond the effective_ceiling check described in The service and the Worker. (The service’s own result shape carries fields such as status, effective_ceiling, total_results, job_id and next_cursor; those are the service’s fields, passed through inside result, not the Worker’s — the Worker has no job protocol of its own.)

GET /v1/cache/inspect

The operator and audit surface: metadata readback for one cache entry, without running a search. Gated (failure → the same 401 as above). Parameters arrive in the query string:

ParameterRequiredRule
queryyesMissing or empty parameter → 400, bad_request, query parameter is required. After normalization, empty → 400, bad_request, query must not be empty.
knoRead as a number, then clampK. Absent → 10; non-numeric → 10 (see clampK).

The route computes the cache key, opens the cache object for that key, and merges its metadata into the response. When no entry exists, the whole answer is:

{ "key": "<cache key>", "query": "<normalized query>", "exists": false }

When an entry exists, the forwarded metadata is:

{
  "exists": true,
  "query": "<stored query>",
  "k": 10,
  "has_embedding": true,
  "embedding_dims": 768,
  "embedding_valid": true,
  "has_result": true,
  "result_bytes": 12345,
  "created_at": "<ISO-8601>",
  "searched_at": "<ISO-8601 or null>",
  "embed_ms": 41,
  "search_ms": 6123,
  "hit_count": 3
}

embedding_dims is 0 when there is no embedding or it does not parse; embedding_valid means exactly: dimensions equal 768 and every component is finite. Metadata only — inspect never returns the result body or the embedding vector, only presence, dimensions, validity and byte size.

POST /v1/cache/purge

Gated, with the gate checked before the body is read, and a validation chain identical to POST /v1/search (413, then the four 400s, in the same order with the same codes and messages). Body:

{ "query": "queue broker lease expiry", "k": 10 }

The route computes the cache key and deletes that one entry. Response, 200:

{ "key": "<cache key>", "query": "<normalized query>", "purged": true }

purged is true if and only if an entry existed. Purge is exact-key only: there is no prefix or enumeration purge, deliberately — the key is a SHA-256 digest, and enumeration would need a separate index.

POST /mcp

The path /mcp matches regardless of method, and the method check runs before the gate: a non-POST request gets 405 — code method_not_allowed, message the MCP endpoint accepts POST only, plus the response header Allow: POST — even without a token. A POST without a valid gate token gets the shared 401. A gated POST is delegated to the MCP handler, whose full protocol is The Atlas MCP server.

clampK: how k is read on every surface

One function clamps the result depth on every Worker surface — REST search body, REST purge body, inspect query parameter, and MCP tool arguments:

InputResult
A JSON numberFloored (10.9 → 10), then clamped to [1, 50]: 0 and negatives → 1, over 50 → 50.
A non-finite number (NaN, Infinity — reachable through the inspect route’s numeric coercion)10
Anything that is not a JSON number — a numeric string such as "20", a boolean, null, or an absent field10

The defaults behind the table: DEFAULT_K = 10, MAX_K = 50. Because the clamped k is a field of the cache key, different clamped values are different cache entries.

Upstream failures: the query_failed passthrough

Search execution runs inside the cache Durable Object. Any exception inside it is caught and returned as:

{ "error": { "code": "query_failed", "message": "<the error's message>" } }

with HTTP status taken from the error when it carries one, else 500. The two error kinds the service client raises both carry 502 — an unreachable or misbehaving laptop service, and an embed response that fails validation against the pinned Snowflake space — so in practice a REST search failure is 502 query_failed, and only a genuinely unexpected internal error surfaces as 500. The status and payload pass through the search execution path unchanged to the REST caller. (MCP callers see the same payload differently: wrapped in an isError: true result over HTTP 200 — see The Atlas MCP server.) One failure detail worth knowing: a failed search caches nothing beyond a possibly stored embedding, so a retry after the service recovers does not re-embed.

Status codes, all of them

StatusCodeProduced by
200—Health, search success, inspect, purge.
400bad_requestUnparseable JSON body; non-object body; query not a string; query empty after normalization; missing or empty inspect query parameter.
401unauthorizedGate failure on any gated route.
404not_foundThe catch-all: any other method/path combination, including GET /v1/search and POST /health — method is part of the match for every route except /mcp. Message: no route.
405method_not_allowedNon-POST to /mcp, with Allow: POST.
413payload_too_largeBody over the 64 KiB cap, on any route that reads a body.
500query_failedUnexpected error inside the cache object, with no status of its own.
502query_failedUpstream service or embedding-space failure, passed through from the cache object.

Internal routes: the QueryCache Durable Object

Internal — not reachable from the public internet. These three routes exist only on synthetic https://do/… URLs, invoked by the Worker itself through the QUERY_CACHE binding, one object instance per cache key. No gate token is checked inside the object; the public routes above are the only gate.

Method and pathCallerBehaviourResponse
POST /queryThe search execution pathBody { "query": …, "k": … }. Runs the check-and-fill: serve a complete entry as a hit, otherwise embed, persist the embedding, search, persist the result.200 with the outcome, or the query_failed envelope.
GET /inspectGET /v1/cache/inspectMetadata readback for the entry.200 with the metadata object.
POST /purgePOST /v1/cache/purgeDeletes the object’s single entry row.200 with { "purged": &lt;bool&gt; }.
anything else——404 with { "error": { "code": "not_found", "message": "no route" } }

Worked example

A gated search, then the audit readback for the same entry:

POST /v1/search
Authorization: Bearer <gate token>
Content-Type: application/json

{ "query": "  queue   broker lease  " }

The query normalizes to queue broker lease, k defaults to 10, and the answer carries cache: "miss" the first time and cache: "hit" on every repeat — including a repeat that arrives through the MCP search tool, because both surfaces share this execution path and this cache. Then:

GET /v1/cache/inspect?query=queue%20broker%20lease
Authorization: Bearer <gate token>

returns the entry’s metadata with hit_count counting the hits so far.

Exit codes

None: the Worker is a hosted HTTP surface with no process interface. Its deploy and test commands (wrangler dev, vitest run, the cf versions flow) belong to Configuration and environment and the operations chapters.

The Atlas MCP server

Source: worker/src/mcp.ts, worker/src/index.ts (the gate and the method branch), home/common/mcpx-settings.nix (the client wiring) — provenance only; this chapter is complete without following it.

The Atlas MCP server is the Model Context Protocol surface of the Cloudflare Worker described in The Worker HTTP API: a stateless Streamable HTTP MCP server at POST /mcp on the Worker, exposing exactly one tool, search, over the same execution path, the same pinned identity and the same Durable Object cache as the Worker’s REST search. An MCP search and a REST search for the same normalized query and k share one cache entry.

POST /mcp
Authorization: Bearer <gate token>
Content-Type: application/json

{ "jsonrpc": "2.0", "id": 1, "method": "tools/list" }

Transport shape

PropertyBehaviour
Session handlingNone. No session id is issued, required or read; there is no Mcp-Session-Id header handling in the code.
Message framingEach HTTP request is one JSON-RPC message, or a batch: a JSON array of messages. The response is a plain JSON body (Content-Type: application/json); batch responses preserve request order and contain one response per non-notification item.
StreamingNone. There is no SSE or streaming response mode, and no GET endpoint: GET /mcp is 405 (see The Worker HTTP API).
NotificationsA message with no id property at all is a notification: it is never executed and never answered — this explicitly includes a tools/call sent as a notification. A single notification, or a batch of only notifications, gets HTTP 202 with an empty body. In a mixed batch, notifications are simply omitted from the response array.
The id: null edgeA message whose id property is present but null is a request, not a notification — the test is whether the property exists, not whether it is null. It is executed and answered with id: null.
Body limitThe same 64 KiB cap as every Worker route (see the error table below for its JSON-RPC shape).
Server identityname: "atlas-search", version: "0.1.0".
Protocol versionsSupported (SUPPORTED_VERSIONS): 2024-11-05, 2025-03-26, 2025-06-18. Fallback when negotiation cannot echo the client’s version: 2025-03-26. The server identity (SERVER_INFO) is name atlas-search, version 0.1.0.

The gate and the pinned identity — read this plainly

The endpoint is gated by the Worker’s one shared gate token (secret name GATE_TOKEN, presented as Authorization: Bearer &lt;token&gt;), checked once before dispatch; the MCP handler itself never sees the token. Method is checked before the gate, so an unauthenticated GET /mcp gets 405, and an unauthenticated POST gets the shared 401 envelope — { "error": { "code": "unauthorized", "message": "missing or invalid gate token" } } — which is a plain HTTP error, not a JSON-RPC error, because it happens before the MCP layer runs.

There is no per-client identity on this endpoint. No client name, agent credential or per-agent ceiling exists in the protocol as implemented. All MCP callers share the one hosted identity: disclosure context hosted-per-user, sensitivity ceiling personal. A caller cannot request a different ceiling or context — neither the tool schema nor any method parameter has a field for either. Per-agent identity stamping, per-agent ceilings and corpus scoping, and a query audit log are later slices of the MCP work (#8625) and are deliberately not improvised in this endpoint.

Methods

Exactly four methods are handled; everything else gets JSON-RPC error -32601.

MethodBehaviour and result
initializeNegotiates the protocol version: echoes params.protocolVersion if it is a string in the supported list, otherwise returns 2025-03-26. Result: { protocolVersion, capabilities: { tools: {} }, serverInfo: { name: "atlas-search", version: "0.1.0" }, instructions: "Atlas search: one tool, \search`, over Drew’s unified Atlas index at the personal ceiling. Results are cached per query; a repeat query is served from cache.“ }. No client identity or capabilities from params` are stored or used.
pingResult {}.
tools/listResult { tools: [ &lt;the search tool&gt; ] } — exactly one tool, below.
tools/callExecutes the search tool, below.

params is used only when it is a non-null object, and otherwise treated as {}; the same rule applies to a tools/call arguments value.

The full definition, exactly as tools/list returns it:

{
  "name": "search",
  "description": "Search the unified Atlas index — all of Drew's Atlas databases — for a natural-language query. Runs under the hosted surface's pinned disclosure context (hosted-per-user) and sensitivity ceiling (personal). Returns the search envelope: cache status, the result list with per-hit provenance, and the effective ceiling the service enforced.",
  "inputSchema": {
    "type": "object",
    "properties": {
      "query": { "type": "string", "description": "The query text." },
      "k": {
        "type": "integer",
        "minimum": 1,
        "maximum": 50,
        "default": 10,
        "description": "Maximum number of results to return."
      }
    },
    "required": ["query"]
  },
  "annotations": {
    "readOnlyHint": true,
    "destructiveHint": false,
    "idempotentHint": true,
    "openWorldHint": false
  }
}

Input rules: query is required and must be a string, non-empty after normalization (NFC, trim, collapse whitespace runs — the same normalization as the REST surface). k is an integer in the schema, 1–50, default 10; at execution it passes through the Worker’s one clampK, so a non-number becomes 10, a number is floored, and the result is clamped to [1, 50] — see The Worker HTTP API.

Execution validates the tool name, validates and normalizes the query, then calls the same search execution path as POST /v1/search. Output, on success:

{
  "content": [{ "type": "text", "text": "<the search envelope, as a JSON string>" }],
  "structuredContent": { "cache": "miss", "key": "<cache key>", "query": "<normalized query>", "result": {}, "meta": {} },
  "isError": false
}

The text content and structuredContent carry the identical payload — parsing the text yields the structured object. The envelope itself is the REST search envelope (cache, key, query, result, meta) specified in The Worker HTTP API.

On search failure (the underlying search returns a non-200 status, in practice the 502 query_failed passthrough), the result is { content: [{ type: "text", text: "&lt;the error payload, as a JSON string&gt;" }], isError: true } — no structuredContent, and the HTTP status stays 200; the failure is carried only by isError and the embedded payload.

Deliberately not MCP tools: cache purge (a write) and cache inspect (an operator and audit surface). Both exist only as gated REST routes.

JSON-RPC error codes

Framing and dispatch errors are returned as { "jsonrpc": "2.0", "id": &lt;id or null&gt;, "error": { "code": …, "message": … } }.

ConditionHTTPCodeMessage
Body over 64 KiB413-32600body is larger than the 64 KiB limit (id null)
Body not parseable JSON400-32700parse error: body must be JSON (id null)
Body is a JSON array of length 0400-32600invalid request: empty batch
Batch item not an object200, in the batch array-32600invalid request: batch items must be objects (that item’s response id is null)
Body neither object nor array (JSON null, a string, a number)400-32600invalid request: body must be a JSON object or batch
Message method not a string200-32600invalid request: method must be a string
Unknown method200-32601method not found: &lt;method&gt;
tools/call with an unknown tool name200-32602unknown tool: &lt;name&gt;
tools/call arguments.query not a string200-32602arguments.query must be a string
tools/call arguments.query empty after normalization200-32602arguments.query must not be empty

In code terms: -32700 is parse error, -32600 is invalid request, -32601 is method not found, and -32602 is invalid params — the last covering both the unknown-tool and bad-query cases on tools/call.

How mcpx wires it: the remote atlas server

The known production client is the laptop’s mcpx daemon, which connects to this endpoint as its remote atlas server. The wiring is data, not code: an entry under "mcpServers" in home/common/mcpx-settings.nix — a pure data file rendered by the mcpx Nix module, to which ~/.config/mcpx/config.json is now a link, so editing a JSON file in a checkout no longer reaches the daemon.

"atlas" = {
  url = "https://atlas-search.developing-today.workers.dev/mcp";
  auth = {
    type = "bearer";
    token = "\${ATLAS_SEARCH_GATE_TOKEN}";  # environment expansion, expanded by the daemon at runtime
  };
};

The shape is: remote URL plus bearer auth whose token is expanded from the daemon’s environment at runtime (the daemon’s environment file is wired through services.mcpx.environmentFile in the home configuration). The token value never lands in the settings file or in the Nix store; this book names the expansion variable, ATLAS_SEARCH_GATE_TOKEN, and nothing more. The token it expands to is the Worker’s shared gate token — the same credential the REST routes use, because there is only one gate.

Worked example

A minimal session — initialize, list, call — as three separate POSTs (or one batch):

{ "jsonrpc": "2.0", "id": 1, "method": "initialize", "params": { "protocolVersion": "2025-06-18" } }
{ "jsonrpc": "2.0", "id": 2, "method": "tools/call", "params": { "name": "search", "arguments": { "query": "queue broker lease expiry", "k": 5 } } }

The first answers with protocolVersion: "2025-06-18" echoed, the server identity and the instructions string. The second answers with isError: false and the search envelope in both text and structured form — cache: "miss" the first time this query runs at k 5, cache: "hit" thereafter, whoever asks, through whichever Worker surface. A batch of [ping, a notification, tools/list] answers 200 with exactly two responses, for the ping and the list, in request order; the notification is silently dropped from the array.

Exit codes

None: this is a hosted HTTP protocol surface. Client-side failures surface as the HTTP and JSON-RPC shapes tabulated above.

Configuration and environment

Source: the environment-variable call sites across pkgs/atlas-search/crates/ and pkgs/fleet/crates/fleet-search/, worker/wrangler.toml and worker/cloudflare.config.ts, crates/atlas-proto/query-parameters-v1.json — provenance only; this chapter is complete without following it.

Every Atlas configuration surface, in one place: the environment variables the binaries read, the client and service config files, the fleet config keys, the Worker config files and bindings, and the versioned query-parameter defaults. Secrets are named, never valued, throughout: for token variables this chapter gives the name and the resolution order only, because that is all any tool ever prints.

Environment variables: all 24

CLI-facing variables (named in help or flag definitions)

NameUsed byDefault / fallback
ATLAS_SEARCH_MODELclap env for --model (atlas-search; the Python CLI’s argparse default)Snowflake/snowflake-arctic-embed-m-v2.0 when unset.
ATLAS_VEC_TABLEclap env for --vec-table (atlas-search; Python)vec_snowflake_m_v2_768_f32 when unset.
ATLAS_SEARCH_URLservice::base_url / fleet client::base_url, when the --service-url flag is absenthttp://127.0.0.1:18760 (DEFAULT_SERVICE_URL); trailing / trimmed; empty string ignored. Fleet’s chain is longer: flag → fleet.toml [search] url → this env → default.
ATLAS_SEARCH_SERVICE_CONFIGresolve_service_config_path (serve/init; the fleet serve/client host marker), when --config is absent~/.local/state/atlas-search/service.json; empty string ignored.
ATLAS_SHARDSclap env for the hidden --shards flag (search)Unset = monolith backend, no shard fan-out. Grammar: dir:&lt;path&gt; (local atlas-core-*.db files) or turso / turso:&lt;org&gt; (default org dezren39).
ATLAS_SEARCH_VIAservice::via_env / fleet client::via_envOnly the exact value service requests the via-service route; anything else, including unset, = not requested. Fleet delegation explicitly removes it from the standalone child’s environment.
ATLAS_SEARCH_TOKENclient_token() (via-service clients: atlas-search and fleet)First source tried; if unset or empty, resolution falls to the client-config file (ATLAS_SEARCH_CLIENT_CONFIG, below). Never printed or logged.
ATLAS_SEARCH_CLIENT_CONFIGclient_token() file-path overrideDefault path ~/.config/atlas-search/client.json — a JSON object with one token string field, expected mode 0600.

Path, model and runtime variables (source-only, not in help)

NameUsed byDefault / fallback
ATLAS_DBdefault_db_path() (atlas-search; Python)If set and non-empty, it wins. Else ~/atlas/turso-atlas/data/atlas.db if it exists, else the binary/script directory’s ../data/atlas.db if it exists, else the laptop path — which then errors as not found on the local backend.
ATLAS_VEC_DBLocalBackend::new, when --vecdb is absent or empty (atlas-core; Python)Comma-separated vector DB paths, id-keyed. Else the known side-store pairs are probed (for example ~/atlas/v3/vec-snowflake.db paired with ~/atlas/v3/corpus.db, and ~/atlas/atlas-delta-chunks2.db). If the corpus DB itself has the vec table, neither is consulted.
ATLAS_MODEL_DIRModel-dir resolution (atlas-search, atlas-stage promote, fleet serve)If set, non-empty and an existing directory, it wins. Else ~/.local/state/atlas-search/model/&lt;rev&gt; if a directory, else the HuggingFace cache snapshot ~/.cache/huggingface/hub/models--Snowflake--snowflake-arctic-embed-m-v2.0/snapshots/&lt;rev&gt; if a directory, else a model-not-found error. &lt;rev&gt; is 95c2741480856aa9666782eb4afe11959938017f.
ATLAS_ORT_LIBONNX Runtime library resolution (same three surfaces)If set, non-empty and an existing file, it wins. Else ~/.local/state/atlas-search/ort/libonnxruntime.so if a file. atlas-stage promote additionally probes the ~/atlas/v3-venv/…/libonnxruntime.so.1.31.1 path. Else an ORT-not-found error.
ATLAS_SEARCH_ORT_LIB_DEFAULTCompile-time option_env! (packaged builds only)Baked by default.nix to the build’s onnxruntime store path; consulted after ATLAS_ORT_LIB and the state-dir candidate. Dev builds never set it and never reach the branch.
HOMEEvery binary’s home resolutionMust be set and non-empty. atlas-search, atlas-core and fleet-search panic naming HOME rather than substituting a directory — except the trace and feedback sink default_dir() functions in atlas-core, which fall back to . (the working directory) when HOME is missing or empty.

Credential and backend variables (source-only)

Token values are never reproduced here — names and resolution order only.

NameUsed byDefault / fallback
ATLAS_TURSO_TOKENresolve_turso_token() (atlas-core; Python mirrors it)First source tried. Full chain, in order: this env → Bitwarden Secrets Manager names turso.atlas-ro-token, turso.atlas-read-only-token, atlas-ro (via the bws CLI) → the cached mint at ~/.cache/atlas-search/turso-token.json if it names db atlas and is under 20 hours old → a fresh read-only mint via turso db tokens create atlas --read-only -e 7d (cached at mode 0600). Total failure is a fatal error naming all three routes. The Turso host is a constant, not env: atlas-dezren39.aws-us-east-1.turso.io, db atlas.
BWS_ACCESS_TOKENThe bws_secret() helperIf unset or empty, obtained by running source ~/tools/bws-env.sh under bash (30-second timeout) and reading the variable from that environment. Still empty → the Bitwarden source silently yields nothing and token resolution moves on.
ATLAS_TURSO_TOKEN_PUBLICShard discovery, Tier::token_env() — the public tier’s read-only Turso tokenUnset or empty = that tier is simply not connected. Discovery is opened only at the caller’s own ceiling, so the default personal caller never needs the secret-tier variable.
ATLAS_TURSO_TOKEN_INTERNALShard discovery — the internal tier’s read-only Turso tokenAs above.
ATLAS_TURSO_TOKEN_SECRETShard discovery — the secret tier’s read-only Turso tokenAs above, with one extra rule: the secret-tier token is never derived from another tier’s token.
TURSO_API_TOKENShard discovery, TursoApiLister::from_env (the constant naming the variable is TURSO_API_TOKEN_ENV)Required for turso[:&lt;org&gt;] shard specs; unset or empty → fatal shard discovery: TURSO_API_TOKEN is not set.
ATLAS_EMBED_CACHE_TURSO_URLQuery-embedding cache, QueryEmbeddingCache::from_envBoth this and the token below must be set and non-empty to enable the shared Turso cache tier; otherwise the cache is memory-only (about 10,000 entries). Cache writes are async and best-effort and never fail a search.
ATLAS_EMBED_CACHE_TURSO_TOKENQuery-embedding cache, QueryEmbeddingCache::from_envThe other half of the pair above; named only.
ATLAS_OWNER_INVENTORY_SECRET_NAMEOwnerInventory::load_runtime (the constant holding the variable’s name is SECRET_REFERENCE_ENV)Names the one Bitwarden secret key holding the owner-inventory document (atlas-owner-inventory/v1). The value itself is never taken from env — only the key name is. Unset or invalid → fatal owner inventory unavailable. Library surface; no CLI flag exposes it.
ATLAS_SEARCH_QVEC_FILEEmbedder load (atlas-search; fleet serve)Test hook: path to a JSON array of floats substituted as a fixed query vector. Meaningless in production, per the source. An unreadable or bad-JSON file fails embedder load.

Ambient variables honoured indirectly: the proxy family (ALL_PROXY, HTTPS_PROXY, http_proxy, NO_PROXY and friends) — the via-service HTTP client is built from the process proxy environment, so service requests honour it, with NO_PROXY bypasses. The Python CLI additionally normalises a bracketed NO_PROXY/no_proxy to localhost,127.0.0.1.

client.json — the client token file

Path: ~/.config/atlas-search/client.json (override: ATLAS_SEARCH_CLIENT_CONFIG). Expected mode 0600. The entire format is one field:

{ "token": "<the client token for this seat's identity>" }

Resolution, in client_token(): ATLAS_SEARCH_TOKEN first; if unset or empty, this file. The token names the seat’s identity to the service — the identity itself (its name and ceiling cap) lives server-side in service.json; the file carries no identity name and no ceiling, and nothing a client edits here can widen what the service will serve it. A seat with no client.json and no ATLAS_SEARCH_TOKEN cannot use the service route at all and falls back to standalone. See The service HTTP API for what the token authorises.

service.json — the service config

Path: ~/.local/state/atlas-search/service.json (flag --config, env ATLAS_SEARCH_SERVICE_CONFIG). Written by atlas-search init at mode 0600; serve refuses a config that is not mode 0600. Shape (token values shown as placeholders — init generates them fresh, and --force rotates every one):

{
  "listen": "127.0.0.1:18760",
  "vec_table": "vec_snowflake_m_v2_768_f32",
  "clients": [
    { "name": "drew-cli", "token": "<generated>", "ceiling_cap": "secret-bearing" },
    { "name": "openchamber", "token": "<generated>", "ceiling_cap": "personal" },
    { "name": "fork-server", "token": "<generated>", "ceiling_cap": "personal" },
    { "name": "sandbox-scripts", "token": "<generated>", "ceiling_cap": "personal" }
  ]
}
FieldMeaning
listenThe loopback listen address. A --listen serve flag overrides it, loopback only.
vec_tableThe vector table the service searches.
clients[].nameThe identity name, unique in the table.
clients[].tokenThat identity’s bearer token (value never printed by any tool).
clients[].ceiling_capThe identity’s ceiling cap: the service clamps every requested ceiling to min(requested, ceiling_cap). The ladder is shareable < personal < local-only < secret-bearing.

Serve-time validation failures — missing config, config not mode 0600, an empty client table, duplicate client names, a bad ceiling_cap — are config-load failures: exit 2, with run atlas-search init first guidance where applicable. A shards spec in this config additionally enables serve-mode shard fan-out with periodic re-discovery (default refresh 60 seconds). Serve-time lifetime overrides --job-ttl-ms (default 600000 — the 10-minute completed-job TTL) and --hard-ttl-ms (default 3600000 — the 60-minute submit hard cap) live here in effect though they are flags, not file fields; see The service HTTP API.

fleet.toml [search] — the fleet client’s keys

The fleet binary’s own config file carries one Atlas section, with exactly two keys:

KeyValuesMeaning
viaservice | standaloneThe seat’s preferred route. Any other value is ignored and route resolution falls through.
urlA service base URLThe service address for the via-service route.

Where they sit in resolution: for the URL, --service-url flag → fleet.toml [search] url → ATLAS_SEARCH_URL → the default http://127.0.0.1:18760. For the route itself: explicit --via-service/--standalone flag → ATLAS_SEARCH_VIA=service → fleet.toml [search] via → the seat default (standalone on the serving host — detected by the presence of service.json — via-service elsewhere). No ATLAS_* env var overrides fleet.toml except as listed here. See fleet search and fleet serve search.

The Worker: wrangler.toml, bindings and vars

Two files describe the Worker, and they must be kept in step: wrangler.toml drives local dev and tests, and cloudflare.config.ts is the deploy source of truth — it mirrors wrangler.toml in the cf config DSL (same worker name, compatibility date, entrypoint, bindings and vars). Secrets are in neither file: a deploy uploads them with the new version, so no version deploys without its gate and service tokens.

Header facts: worker name atlas-search, entrypoint src/index.ts, compatibility date 2025-09-15, workers_dev = true (deployed to the fleet Cloudflare account’s workers.dev subdomain).

Plain vars ([vars]):

NameValue in filePurpose
SERVICE_BASEhttps://atlas-search.security.cabBase URL of the fleet search service, at its Cloudflare Tunnel hostname. Every service call is a fetch to this base plus the path.
HOT_CACHE_ENABLED"false"The D1 hot-cache master flag; see “The D1 master flag” below.

Bindings:

Binding nameKindTargetPurpose
QUERY_CACHEDurable ObjectClass QueryCache in this Worker (SQLite-backed; migration tag v1, new_sqlite_classes = ["QueryCache"])The per-query cache object namespace — one instance per cache key.
HOT_CACHED1 databaseDatabase name atlas-hot-cache; the id committed in both config files is a local placeholder (00000000-0000-0000-0000-000000000001), replaced with the real id when the database is created at deploy time; migrations_dir = "migrations"The D1 tenant hot cache.

Secrets (names only; set via wrangler secret put or the cf versions secrets file):

NamePurpose
GATE_TOKENThe inbound bearer gate for all of the Worker’s gated routes, REST and MCP.
SERVICE_TOKENThe fleet search service’s cf-worker client token (service-side ceiling_cap: personal), presented by the Worker on every service call.
ACCESS_CLIENT_IDCloudflare Access service token, id half, for the atlas-search.security.cab tunnel hostname.
ACCESS_CLIENT_SECRETCloudflare Access service token, secret half, for the same hostname.

Per the Worker README’s deploy section, the fleet-secrets names these are assembled from at deploy time are atlas.search-worker-gate-token, atlas.search-cf-worker-token, cloudflare.access-atlas-search-client-id and cloudflare.access-atlas-search-client-secret (names only), plus cloudflare.api-token-account-wide for the cf CLI itself.

The complete list of environment members the Worker code reads is the Env interface: QUERY_CACHE (required), HOT_CACHE (optional — declared optional so a deploy without the database provisioned still runs the pre-cache path), HOT_CACHE_ENABLED (optional string), GATE_TOKEN, SERVICE_BASE, SERVICE_TOKEN, ACCESS_CLIENT_ID, ACCESS_CLIENT_SECRET. There are no other env reads anywhere in the Worker source; all configuration arrives via the env argument. Narrower views are used per module: the search and MCP code sees only { QUERY_CACHE }, and the service client sees only { SERVICE_BASE, SERVICE_TOKEN, ACCESS_CLIENT_ID, ACCESS_CLIENT_SECRET }.

The D1 master flag: HOT_CACHE_ENABLED

HOT_CACHE_ENABLED is the Worker’s one feature flag: the D1 hot-cache master flag. Its semantics are literal — only the exact string "true" enables it; "false", unset, or any other value is off. Even then, the store exists only when the flag is on and the HOT_CACHE binding is present; otherwise the caller’s signal is to use the pre-cache (Durable Object) path. The committed value in both config files is "false".

Source-wins note. Where the README’s flag phrasing implies that turning the flag on activates D1 reads and writes, the source says otherwise, and the source wins: in the current code, nothing in the request path calls the hot-cache store at all — its only callers are its own tests. The flag therefore currently changes nothing in the request path, on or off; read-path integration is follow-on work, not a flag flip. The D1 store as implemented is a storage layer only, with no TTL and no automatic eviction sweep; see Data stores and schemas.

query-parameters-v1.json — the defaults contract

One file is the single source for every search-parameter default shared by the CLI, the service and their clients: crates/atlas-proto/query-parameters-v1.json. It is embedded into atlas-proto at build time and parsed for every default — a missing or invalid default panics at first use, so a broken contract fails loudly instead of silently changing ranking. Its verbatim contents:

{
  "k": 10,
  "pool": 100,
  "expand": 0,
  "parameters_version": 1,
  "shard_top_k": 100,
  "global_top_k": 100,
  "fts_weight": 1.0,
  "vector_weight": 1.0,
  "jaccard_depth": 0,
  "jaccard_threshold": 0.0,
  "rrf_k": 10,
  "planner_enabled": false,
  "spell_enabled": false,
  "query_class_hint": null,
  "variant": "raw",
  "raw": false,
  "no_cache": false,
  "wait": false,
  "hydrate": 0,
  "raw_mode": "off"
}

Read it as the contract, not as a sample: k 10 and pool 100 are the depths every surface starts from; rrf_k 10 is the shipped reciprocal-rank-fusion constant (the Python eval harness lineage uses 60 — a different system, not this contract); jaccard_depth 0 keeps Jaccard rescoring off; planner_enabled and spell_enabled false are not merely defaults but the only legal state — setting either is a validation error, as is a non-null query_class_hint or a variant other than raw. wait false is the protocol default — the one-shot CLI sets it unless --no-wait is given. Validation bounds that travel with these defaults: parameters_version must be 1, shard_top_k and global_top_k in 1–400, rrf_k in 1–10000, weights finite and non-negative with at least one positive, jaccard_threshold in [0, 1], hydrate at most 1000.

Default directories (env-independent, HOME-rooted)

PurposeDefault path
Service config~/.local/state/atlas-search/service.json
Client config (token file)~/.config/atlas-search/client.json
Model snapshot~/.local/state/atlas-search/model/&lt;rev&gt;/
ORT runtime (staged)~/.local/state/atlas-search/ort/libonnxruntime.so
Trace sink~/.local/state/atlas-search/traces (one atlas-traces-&lt;day&gt;.jsonl per day)
Feedback sink~/.local/state/atlas-search/feedback
Turso token cache~/.cache/atlas-search/turso-token.json (mode 0600)
Default local corpus (preferred candidate)~/atlas/turso-atlas/data/atlas.db

Worked example

Provisioning a fresh seat, end to end, using only surfaces named in this chapter:

atlas-search init            # writes service.json (0600) with the v1 client table
atlas-search fetch-model     # stages the pinned model under the state dir
atlas-search serve           # reads service.json; binds 127.0.0.1:18760

On the client seat, place that identity’s token in ~/.config/atlas-search/client.json at mode 0600 (or export it as ATLAS_SEARCH_TOKEN), and searches route to the service with --via-service, ATLAS_SEARCH_VIA=service, or fleet.toml [search] via = "service" — with the requested ceiling clamped, server-side, to that identity’s ceiling_cap whatever the client asks for.

Data stores and schemas

Source: schema/atlas_stage_v1.sql, schema/stage_registry_v1.sql and schema/gate_records_v1.sql, fixtures/fixture_corpus.sql, crates/atlas-core/src/{stage,gate,manifest,embed_cache,aggregate,feedback,shards}.rs and worker/migrations/0001_hot_cache.sql and worker/src/cache_do.ts in https://github.com/developing-today/code/blob/main/pkgs/atlas-search/ — provenance only; this chapter is complete without following it.

Atlas has no single database. It has a canonical publish store, a set of per-shard scan stores, a family of small write-side staging stores, two cache stores, and two file stores. This chapter names every one of them, says where it lives, and gives its schema as the code defines or uses it. Where no CREATE TABLE file exists in the repository — the canonical publish store is the main case — the schema below is the shape the code issues SQL against and the fixture corpus mirrors, and the chapter says so.

Two vocabularies recur and must not be confused. The sensitivity ladder — shareable, personal, local-only, secret-bearing — is the value set of the publish store’s sensitivity columns. The physical tier vocabulary — public, internal, secret — is the value set of the staging, gate and shard stores. The aggregator translates tier to ladder at promotion; no schema encodes that mapping.

The stores at a glance

NameWhere it livesWhat it holds
Canonical Turso DB (atlas)Hosted libSQL database atlas on the Atlas Turso host, read over the HTTPS pipeline API with a read-only token; a local publish file (atlas.db) has the same shape for the local backendSessions, messages, chunks, session labels, the FTS5 index, the classification manifest, generic labels, and the production vector table
Vector tablesInside the canonical DB, inside each scan shard, and in local side-store filesOne row per chunk: the chunk id and its embedding vector in one named model space
Scan shards (atlas-core-&lt;tier&gt;-&lt;topic&gt;-&lt;nn&gt;)One Turso database (or one local .db file) per shardThat shard’s chunks, its vector table, and its atlas_manifest self-description; no sessions, messages or labels
Content stores (atlas-core-&lt;tier&gt;-content)One Turso database per tierThe messages and sessions half of the corpus for that tier, reused from the publish tables, for hydrating shard-served hits
Staging DB (v1)One local SQLite/libSQL file per staging unitRaw, un-embedded staged items and chunks for one unit of work; never any vectors
Registry DB (v1)One local SQLite/libSQL file, owned by the staging registryWhich staging units exist, where their DBs are, their state, and the audit record of each promotion
Gate records (v1)A table inside the registry DBOne audit row per ingest batch: stage verdicts, strikes and state — counts, codes and hashes only, never content
Query-embedding cache DBA separate Turso database, configured only by environment variablesRaw query vectors keyed by a hash of model identity and normalised query text
Feedback storeJSONL files under ~/.local/state/atlas-search/feedback/Append-only feedback records, one file per day, plus derived normalised files
D1 hot cache (atlas-hot-cache)A Cloudflare D1 database bound to the Atlas WorkerOpaque cached payloads keyed by tenant and cache key; storage layer only, not wired into the request path
Worker Durable Object entrySQLite storage inside one QueryCache Durable Object instance per cache keyOne row: the normalised query, its embedding, its search result and hit bookkeeping

The canonical Turso DB

There is no CREATE TABLE file for the publish DB in the repository. The tables below are the publish shape as the branch, detail and neighbour SQL in atlas-core uses them, and as fixtures/fixture_corpus.sql — a miniature publish-shaped database — defines them.

TableColumns and shapeWhat it holds
sessionsid TEXT PRIMARY KEY, title TEXT, client TEXT, created_at TEXTOne row per conversation session; client and created_at are filter dimensions
messagesid TEXT PRIMARY KEY, session_id TEXT, role TEXT, text TEXTOne row per message in a session
chunksid INTEGER PRIMARY KEY, message_id TEXT NOT NULL, chunk_idx INTEGER, text TEXT NOT NULL, content_hash TEXT UNIQUE NOT NULL, sensitivity TEXTOne row per searchable chunk. content_hash is the chunk identity every other store joins on. Sensitivity is denormalised onto the chunk; the effective sensitivity is the chunk’s own value, falling back to its session label’s
session_labelssession_id TEXT PRIMARY KEY, client TEXT, kind TEXT, topics TEXT, projects TEXT, sensitivity TEXT, confidence TEXT, scheme TEXTThe classification of one session. topics and projects hold JSON list text. The production classification scheme recorded by the Python header is scheme-1.0
chunks_ftsVirtual table: CREATE VIRTUAL TABLE chunks_fts USING fts5(text), with rowid equal to chunks.idThe FTS5 (BM25) branch’s index over chunk text
classification_manifestRows read as manifest_version, content_hash, name, shape, semantics, label_columnThe manifest declaring the filterable dimensions: each dimension’s name, storage shape, match semantics and label column. Loaded when a backend opens; an absent or invalid manifest falls back to the built-in manifest, loudly. The manifest schema carries no sensitivity keys, by a safety invariant enforced at load
generic_labelssession_id TEXT, dimension TEXT, values_json TEXT, primary key (session_id, dimension)Values for manifest dimensions declared with the generic_list shape. Not part of the base publish fixture; created from atlas_core::manifest::GENERIC_LABELS_DDL when that shape is in use

Behaviour notes:

  • The search backends only read this store. The Turso backend issues SELECT statements over the pipeline API and resolves a read-only token; it holds no write credential for the canonical DB.
  • The ceiling and the filters are applied inside the branch SQL, before any ranking. A chunk whose sensitivity is NULL never passes the ceiling clause.
  • Corpus size anchors are frozen snapshots, not live counts: the census recorded on 2026-10-31 is 18,325 sessions / 122,124 messages / 107,639 chunks, and the frozen v3 corpus behind the golden-311 set is 101,471 chunks / 18,116 sessions. See Backup, restore and the census.

Vector tables

Every vector table has the same row shape in SQLite-shaped stores — chunk_id INTEGER PRIMARY KEY, vec BLOB NOT NULL, the vector stored as little-endian f32 values. In the live Turso publish the vector column is typed F32_BLOB(768) and carries a libsql_vector_idx index named after the table (the table name plus _idx).

TableModel spaceDimensionsStatus
vec_snowflake_m_v2_768_f32Snowflake snowflake-arctic-embed-m-v2.0, pinned revision 95c2741480856aa9666782eb4afe11959938017f768The production table and the default everywhere. A query may be truncated to fewer dimensions at query time and renormalised; the stored table stays at 768
vec_bge_small_384_f32BAAI/bge-small-en-v1.5, via the fastembed embedder in the Python implementation only384Dormant legacy fallback. It remains in the publish and in local side-store files; no Rust code names it, and the Worker refuses this space as not comparable with the corpus

No other vector tables are named anywhere in the tree. The two spaces are never comparable with each other: a vector from one must never be scored against the other. See Embeddings: Snowflake Arctic and the parity contract.

Local side stores: when a local publish file has no vector table of its own, the local backend probes known side-store files and joins them to the corpus by content_hash, never by raw chunk id — the id spaces differ between stores, and an id join would silently attach the wrong vectors. An explicitly given vector DB file is the one exception: it is assumed keyed by the corpus DB’s own chunk ids.

Scan shards and content stores

The core tier can also be served as a set of scan shards. A shard’s name is atlas-core-&lt;tier&gt;-&lt;topic&gt;-&lt;nn&gt;, where the tier is one of public, internal or secret, the topic is non-empty, and the part number has at least two digits. Local shard files are the shard name plus .db.

Each scan shard holds exactly three tables:

CREATE TABLE chunks (id INTEGER PRIMARY KEY, message_id TEXT NOT NULL,
  chunk_idx INTEGER, text TEXT NOT NULL, content_hash TEXT UNIQUE NOT NULL,
  sensitivity TEXT);
CREATE TABLE vec_snowflake_m_v2_768_f32 (chunk_id INTEGER PRIMARY KEY, vec BLOB NOT NULL);
CREATE TABLE atlas_manifest ("key" TEXT PRIMARY KEY, value TEXT);
  • chunks — the shard’s chunks. Chunk ids in a newly written shard are assigned sequentially from 1 in piece order. message_id is the staged item’s source pointer, or unit:&lt;unit_id&gt; when the item has none. Chunk sensitivity is written in ladder vocabulary.
  • The vector table — the shard’s vectors, in the production 768-dimension space only.
  • atlas_manifest — the shard’s self-description as key/value pairs. The aggregator writes exactly nine keys: shard, tier, topic, part, expected_chunks, metric (the value cosine), embedding_model, engine (the value tursodb) and source_unit. Discovery reads this table and cross-checks it against the shard’s name. A shard whose manifest names a different embedding model than the consumer’s, or none in strict mode, is refused: vectors from different embedding models are not comparable.

Tier assignment: a shard’s tier is the staging unit’s recorded sensitivity at promotion, and its topic is the unit’s topic string. The sensitivity ladder maps onto tiers as shareable to public, personal and local-only to internal, and secret-bearing to secret — so a caller at the default personal ceiling can never fan out to a secret-tier shard, and a tier above the caller’s ceiling is never connected, probed or scanned.

Scan shards carry no sessions, messages or session_labels tables, and TursoDB shards have no chunks_fts. That is why queries carrying session-level filters stay on the canonical DB for both branches.

Content stores reuse the publish tables instead of defining new ones: one database per tier, named atlas-core-&lt;tier&gt;-content, holding the messages and sessions half of the corpus in publish shape. A shard-served search hydrates its top hits from the content store for the chunk’s tier, running the canonical details SQL against it. A store above the discovery ceiling, or without a credential, is rejected without any connection attempt; a hydration failure names the store and never falls back silently to another tier’s store.

Staging v1

Every staging DB carries the v1 schema from schema/atlas_stage_v1.sql, applied exactly once to an empty database — there is no IF NOT EXISTS, and re-provisioning over an existing set is an error. A staging DB is promoted by being read, never by being migrated; a schema change means a new versioned DDL artifact, never an edit to v1.

TableColumns and shapeWhat it holds
_schema_versionversion INTEGER NOT NULL, seeded with the single row 1The schema version of this staging DB
itemsid INTEGER PRIMARY KEY, unit_id TEXT NOT NULL, kind TEXT NOT NULL, source TEXT, text TEXT NOT NULL, sensitivity TEXT NOT NULL DEFAULT 'internal', created_at TEXT NOT NULL, meta TEXT; index on (unit_id, kind)One row per staged item (a message, note or document fragment). meta is an open JSON bag. Writes are unmediated: sensitivity is recorded, not enforced, at write time. The default value internal is a tier word
chunks_rawid INTEGER PRIMARY KEY, item_id INTEGER NOT NULL REFERENCES items(id) ON DELETE CASCADE, idx INTEGER NOT NULL, text TEXT NOT NULL, content_hash TEXT NOT NULL, created_at TEXT NOT NULL; indexes on (item_id, idx) and on (content_hash)The item’s raw, un-embedded chunks. A staging DB never stores vectors, which is what makes it cheap to write and cheap to branch
notesid INTEGER PRIMARY KEY, unit_id TEXT NOT NULL, body TEXT NOT NULL, created_at TEXT NOT NULL, meta TEXT; index on (unit_id)Free working notes against the unit
kvkey TEXT PRIMARY KEY, value TEXT NOT NULL, updated_at TEXT NOT NULLCursor and checkpoint scratch space for producers; last write wins

The code-side check asserts the version row is 1 and the table set is exactly these five. Promotion adds one more table — the atlas_manifest stamp — to the unit’s DB, which deliberately closes it to further staged writes.

Registry v1

The registry’s own store, from schema/stage_registry_v1.sql, created and owned by the staging registry in atlas-core. Both tables are created with IF NOT EXISTS.

TableColumns and shapeWhat it holds
staging_unitsunit_id TEXT PRIMARY KEY, db_uri TEXT NOT NULL, owner TEXT NOT NULL, sensitivity TEXT NOT NULL, state TEXT NOT NULL CHECK (state IN ('open','closing','merged')), schema_version INTEGER NOT NULL, created_at TEXT NOT NULL, updated_at TEXT NOT NULL; index on (state)One row per staging unit: where its DB lives (db_uri is a local file path today), who owns it, its tier, and its lifecycle state
merge_manifestsunit_id TEXT PRIMARY KEY, rows_in INTEGER NOT NULL, rows_promoted INTEGER NOT NULL, content_hash TEXT NOT NULL, embedding_model TEXT NOT NULL, promoted_at TEXT NOT NULLThe durable audit record of each successful promotion, kept after the unit leaves the active states

Gate v1

One table, from schema/gate_records_v1.sql, kept in the registry DB beside staging_units.

TableColumns and shapeWhat it holds
gate_recordsbatch_id TEXT PRIMARY KEY, unit_id TEXT NOT NULL, tier TEXT NOT NULL CHECK (tier IN ('public','internal','secret')), state TEXT NOT NULL CHECK (state IN ('open','closing','gated','published','quarantined')), stage_reached TEXT, verdicts_json TEXT NOT NULL, strikes_json TEXT NOT NULL, needs_review INTEGER NOT NULL CHECK (needs_review IN (0,1)), publish_manifest_id TEXT, updated_at TEXT NOT NULL; indexes on (unit_id) and on (state)One row per ingest batch: the five gate stages’ verdicts as JSON, the per-reason strike counts as JSON, and the batch state. Written at the sensitivity of its batch, it holds only counts, enumerated reason codes, row ids, content hashes and the publish manifest id — never content

The query-embedding cache

A query vector is a pure function of the normalised query text, the model id and the model revision, so the cache needs no time-to-live and no invalidation: a model change changes the key. There are two tiers — an in-service in-memory cache of about 10,000 entries, always on, and a shared Turso cache DB that exists only when both of its environment variables are set. Its single table is created by atlas-core’s embed-cache module:

CREATE TABLE IF NOT EXISTS query_embedding_cache (
  key BLOB PRIMARY KEY, vector BLOB NOT NULL, created_unix INTEGER NOT NULL)

The key is a SHA-256 hash over the length-prefixed model id, model revision and normalised text. The stored vector is the raw full-dimension vector, before any per-request truncation; truncation is applied after retrieval, on hit and on miss alike. Shared-tier writes are best-effort: an outage of the cache DB never fails a search.

The feedback JSONL store

Feedback is not a database. The raw store is a directory of append-only JSONL files under ~/.local/state/atlas-search/feedback/:

  • One file per day, named atlas-feedback-&lt;YYYY-MM-DD&gt;.jsonl, the day taken from each record’s own timestamp. One atlas-feedback/v1 record per line: a feedback id, the query id and chunk id the vote attaches to (the chunk id is null for a per-query vote), the vote, an optional verbatim comment, the requester and the timestamp.
  • Raw records are never mutated. A later vote from the same requester on the same result supersedes an earlier one only in the derived active view, never by rewriting the file.
  • Normalised derivatives live in the normalised subdirectory by default, as atlas-feedback-normalised-&lt;YYYY-MM-DD&gt;.jsonl files in the atlas-feedback-normalised/v1 schema. A derivative file is rewritten, not appended, when the normalisation pass is re-run, so derivatives can always be regenerated from the raw store.

The query-trace store beside it follows the same one-file-per-day JSONL layout under ~/.local/state/atlas-search/traces/. See atlas-search: serve, init, fetch-model, traces and feedback.

The D1 hot cache (Worker)

The migration worker/migrations/0001_hot_cache.sql creates one table in one shared D1 database (binding name HOT_CACHE, database name atlas-hot-cache); the tenant is carried in the key, never in a per-tenant database. Summarised:

TableColumns and shapeWhat it holds
hot_cachetenant_id TEXT NOT NULL, cache_key TEXT NOT NULL, class TEXT NOT NULL (one of A, B or C), payload BLOB NOT NULL, payload_bytes INTEGER NOT NULL, source_watermark TEXT NOT NULL, filled_at INTEGER NOT NULL (unix seconds), last_hit_at INTEGER NOT NULL, hit_count INTEGER NOT NULL DEFAULT 0; primary key (tenant_id, cache_key); one index, hot_cache_eviction on (tenant_id, last_hit_at)Opaque payloads supplied by a future filler, with their byte length, an opaque source watermark, and hit bookkeeping. The eviction index orders rows by least-recent hit per tenant

There is no expiry column and no freshness check: an entry lives until it is explicitly evicted or replaced, and no automatic eviction sweep exists. As shipped, this is a storage layer only — no code on the Worker’s request path reads or writes it, whether or not its enabling flag is set. Do not confuse it with the live Durable Object cache below, or with the service’s in-memory job store: three different stores, on different machines, with different retention reasoning. See The Worker HTTP API.

The Worker Durable Object entry table

The live Worker cache is one QueryCache Durable Object instance per cache key — the instance name is the cache key — with SQLite-backed storage. Its constructor creates a single table:

CREATE TABLE IF NOT EXISTS entry (
  id INTEGER PRIMARY KEY CHECK (id = 1),
  query TEXT NOT NULL,
  k INTEGER NOT NULL,
  embedding_json TEXT,
  result_json TEXT,
  created_at TEXT NOT NULL,
  searched_at TEXT,
  embed_ms INTEGER,
  search_ms INTEGER,
  hit_count INTEGER NOT NULL DEFAULT 0
)

One object holds exactly one row (id = 1): the normalised query text and its k, the query’s embedding as a JSON array in the pinned Snowflake space, the search result stored verbatim as JSON, the creation and search timestamps, the embed and search timings in milliseconds, and the hit count. The entry moves through the states absent, then embedded (the embedding is persisted before the search runs, so a failed search is retried without re-embedding), then complete. Entries are retained indefinitely — no time-to-live and no eviction in v1 — and the only deletion is an explicit operator purge of that one key, which deletes the row and returns the object to the absent state.

Failure shapes

  • A staging DB whose version row is not 1, or whose table set is not exactly the five v1 tables, fails the schema check and is not read as a staging DB.
  • A shard whose atlas_manifest disagrees with its name, or whose embedding model disagrees with the consumer’s expected model, is rejected at discovery with the reason recorded — degradation is explicit, never a silent omission from the fan-out.
  • A unit promotes only when its recorded embedding model equals the mandated model. A wrong model, no recorded model, or an empty unit are all fatal refusals that leave the unit unpromoted.
  • The chunk content_hash is the identity every store joins on, but its producer is not pinned in the repository: the content-hash test vectors record it as producer-unavailable, with no algorithm and no known-answer vectors, and forbid interop claims until a producer is pinned. Treat the hash as an opaque identity, not as a recomputable value.

atlas_search.py: the Python reference implementation

Source: pkgs/atlas-search/atlas_search.py, eval/README.md, crates/atlas-search/src/main.rs (the Rust port’s header), crates/fleet/crates/fleet-search/src/{pyjson,render}.rs and .github/scripts/check-fleet-search-parity.sh in https://github.com/developing-today/code/blob/main/pkgs/atlas-search/ — provenance only; this chapter is complete without following it.

atlas_search.py is the original Atlas search implementation, written in Python, and the parity reference the Rust implementation was certified against. It lives at the root of the pkgs/atlas-search/ package. The Rust binary is described in its own source header as a surface-parity port of this file’s front end over atlas-core and atlas-embed: wording, defaults, fatal-message texts and exit codes were all taken from the Python. The Python also remains the permanent evaluation instrument — the parity gates and the golden-set scoring run through its lineage — and it is retained, not retired: the migration plan renames and keeps it.

It is also still the only surface with two capabilities the Rust binary refuses: the fastembed/bge embedder path, and non-default embedding models for vector and hybrid search. In the Rust binary, a vector or hybrid search with a fastembed embedder or a non-Snowflake model is a loud error pointing back at the Python.

Invocation

python3 atlas_search.py search &lt;query&gt; [options]
python3 atlas_search.py get-chunk &lt;chunk_id&gt; [options]

Output is JSON by default; --text renders a human-readable form. FTS-only search and get-chunk need nothing beyond the Python standard library. The module header records the corpus model it searches: every conversation normalised into one canonical store (sessions, then messages, then chunks), every session classified under scheme-1.0, every chunk embedded with Snowflake snowflake-arctic-embed-m-v2.0 at the full 768 dimensions, and a hot copy published to Turso. The production search shape it records — decided 2026-10-31 — is one-stage hybrid search: an FTS5 (BM25) branch and a vector (cosine) branch fused with reciprocal rank fusion at k = 10, with a pool of 100 candidates per branch. Sensitivity is a caller ceiling, enforced before ranking, with default personal.

The two commands and their flags

The surface is 2 commands and 25 flags in the survey’s count, plus the two positionals &lt;query&gt; and &lt;chunk_id&gt;. There are no other verbs: no serve, init, fetch-model, traces or feedback — those exist only in Rust.

FlagArgumentDefaultMeaning
--kinteger10Final results
--poolinteger100Per-branch candidates
--modehybrid, fts or vectorhybridWhich branches run
--kindCSV stringnoneClassification kind filter
--topicCSV stringnoneTopic filter
--projectCSV stringnoneProject filter
--clientCSV stringnoneClient filter
--sinceYYYY-MM-DDnoneSessions created on or after the date (inclusive, on sessions.created_at)
--untilYYYY-MM-DDnoneSessions created on or before the date (inclusive)
--contextstringlocal-ownerDisclosure context of the destination surface. Free-form and unvalidated in the Python; an unknown value fails closed inside the disclosure logic
--max-sensitivityladder namepersonalCaller ceiling, in shareable, personal, local-only, secret-bearing order
--group-by-sessionswitchoffRoll chunk hits up to sessions
--expandinteger0Include that many neighbouring chunks around each hit
--with-messageswitchoffInclude the parent message text
--textswitchoffHuman-readable output instead of JSON
--backendauto, turso or localautoData backend
--dbpaththe canonical atlas.db (resolution: the ATLAS_DB environment variable, then the turso-atlas data path, then a script-relative data path)Local backend database
--vecdbcomma-separated pathsnone (environment fallback ATLAS_VEC_DB)Local backend vector DB path(s)
--modelstringSnowflake/snowflake-arctic-embed-m-v2.0 (environment ATLAS_SEARCH_MODEL)Embedding model
--vec-tablestringvec_snowflake_m_v2_768_f32 (environment ATLAS_VEC_TABLE)Vector table name
--embedderauto, fastembed or stautoQuery embedder: fastembed (bge) or sentence-transformers with the query prompt (Snowflake)
--truncinteger0Truncate query and document vectors to this many dimensions (0 = full width)
--vector-backendscan, index-fill or index-fixedscanVector branch strategy on the Turso backend

get-chunk

FlagArgumentDefaultMeaning
--neighborsinteger0Neighbouring chunks to include, either side in the same message
--textswitchoffHuman-readable output instead of JSON
--contextstringlocal-ownerDisclosure context of the destination surface
--max-sensitivityladder namesecret-bearingCaller ceiling for this explicit-id lookup — note the default differs from search
--backend, --db, --vecdbas searchas searchThe shared backend argument group

Worked example — the documented dormant fallback, which only this implementation can run:

python3 atlas_search.py search "queue broker lease" \
  --model BAAI/bge-small-en-v1.5 \
  --vec-table vec_bge_small_384_f32 --embedder fastembed

A second example, at the defaults a parity run uses:

python3 atlas_search.py search "onnx build failure" --mode hybrid --k 10
python3 atlas_search.py get-chunk 112081 --neighbors 2 --text

(The chunk id is a toy example, not corpus content.)

The parity contract

Parity runs in both directions, and both are guarded by recorded fixtures rather than by reading the two implementations side by side:

  • The Rust port is certified against the Python. The embedder must reproduce the Python corpus pipeline bit-identically on a fixed probe set (Gate A), and the search core must reproduce envelopes and SQL strings recorded from the production Python module (the core-expectations fixture, recorded by its generator from atlas_search.py itself). Fatal messages mirror the Python’s die() texts; a die() prints atlas-search: &lt;message&gt; to stderr.
  • The fleet port’s writers are byte-parity guarded. The fleet binary’s search surface carries copies of the Rust binary’s Python-JSON writer (pyjson.rs) and envelope renderer (render.rs). A parity guard script compares the fleet copies against the atlas-search originals byte for byte outside each copy’s pinned parity header, so a fleet service-mode search renders its envelope byte-identically to atlas-search. Note the limit, stated plainly: the guard workflow is dispatch-only — nothing runs it automatically when either copy changes. The guard exists; automatic gating does not.
  • The in-repo copy is a recorded copy. The eval/ documentation records that the in-repo atlas_search.py was copied byte for byte from the turso-atlas scripts tree, with its SHA-256 recorded there. If the two copies ever diverge, that record is how the divergence is detected.

Where parity breaks — source wins

The following are recorded disagreements between the Python and the shipped Rust. In each case the book states the source behaviour of the implementation named; neither side is silently corrected here.

  1. search --context default and validation. The Python defaults --context to local-owner for both verbs, hardcoded in its shared disclosure-arguments builder, and does not validate the value — an unknown context fails closed inside the disclosure logic. The Rust atlas-search search defaults to fleet-internal (validated; an unknown value is a usage error, exit 2), and only its get-chunk defaults to local-owner. The Rust header’s surface-parity claim does not hold for this flag.
  2. get-chunk --max-sensitivity. The Python’s get-chunk has the flag, defaulting to secret-bearing. The Rust get-chunk has no --max-sensitivity flag at all — passing one is a usage error — and the equivalent ceiling arrives through --context local-owner, whose context ceiling is secret-bearing. (For search, both implementations default --max-sensitivity to personal.)
  3. Reciprocal rank fusion k: 60 versus 10. The shipped Rust fuses at k = 10, from the versioned query-parameter contract, and the Python production header likewise records k = 10 for the production shape. But the Python evaluation lineage — eval3.py’s hybrid, copied from the earlier vector evaluation script, and the Jaccard gate built on it — fuses its top-30 branches at k = 60. Evaluation numbers from that lineage are therefore not measurements of the production configuration, whatever their surrounding prose calls them. See Evaluation: golden sets and gates.
  4. The header points at a README that is not there. The file’s header says “(see README.md in this directory)”. There is no README.md in pkgs/atlas-search/; the README matching that description is the turso-atlas README in the laptop and hatch-personal tree. A reader who follows the pointer inside the repository will not find it.
  5. Two copies, two lengths. The design of record describes the Python as 1,177 lines — true of the hatch-personal copy in the turso-atlas scripts tree. The in-repo copy at pkgs/atlas-search/atlas_search.py is 1,629 lines. The two copies are not the same file version, so “the Python reference” needs a which-copy qualifier wherever a line count or a specific behaviour is cited.

There are also deliberate, documented non-parities on the Rust side — for example the Rust filter builder escapes topic and project matching so a value matches only a whole JSON element, where the Python’s unescaped pattern has a wildcard bug that remains unfixed in the Python. Those are recorded in the fixtures documentation as intentional deviations, not breaks discovered after the fact.

Exit codes and failure shapes

CodeMeaning
0Success
1get-chunk for a chunk that does not exist (a die() call with code 1); unhandled backend failures surface as tracebacks, also exit 1
2Argument errors, and die()’s default: validation failures, token resolution failures, and backend HTTP or SQL errors raised through die()

One shape worth knowing before scripting against either implementation: in the Python, die() calls inside worker threads raise SystemExit there and are ferried to the calling thread, so the observable behaviour — message plus exit 2 — matches the Rust port even though the mechanism does not. The Rust binary prints the message where the Python’s backend failures could surface as a traceback; that difference is intentional and recorded in the Rust header.

For the Rust surface this file is the reference for, see atlas-search: search and get-chunk. For the stores both implementations read, see Data stores and schemas.

The crates

Source: pkgs/atlas-search/Cargo.toml, crates/atlas-embed/Cargo.toml, crates/atlas-core/Cargo.toml, crates/atlas-proto/Cargo.toml, crates/atlas-search/Cargo.toml, flake.nix and default.nix in https://github.com/developing-today/code/blob/main/pkgs/atlas-search/ — provenance only; this chapter is complete without following it.

Atlas is one Cargo workspace of four crates, in pkgs/atlas-search/crates/. The workspace is the whole dependency story: the embedder knows nothing about search, the wire contract knows nothing about either, the engine composes the two, and the binary crate composes the engine into commands and a service. Nothing outside the workspace is needed to build any of it — the package is self-contained, with its own flake, on the same pattern as the pkgs/id package.

pkgs/atlas-search/Cargo.toml      workspace: edition 2024, rust-version 1.96
  crates/atlas-embed/             the Snowflake embedder (ONNX + tokenizer)
  crates/atlas-core/              search semantics, backends, ingest, eval
  crates/atlas-proto/             the service wire contract + query parameters
  crates/atlas-search/            the binaries: CLI, service, stage tool

Workspace facts, common to all four crates: edition 2024, rust-version 1.96, version 0.1.0, licence MIT OR Apache-2.0. The release profile deliberately carries no fast-math-style flags: embedder numerics are a parity contract, and a compiler flag that changed floating-point summation order would break it silently.

The map

CrateRoleWhat depends on itWhere its binaries live
atlas-embedThe Snowflake snowflake-arctic-embed-m-v2.0 embedder: dynamically loaded ONNX Runtime, the model’s own Unigram tokenizer, CLS pooling, full 768-dimension outputatlas-coreNone — library only. It ships a Gate A test and a timing example instead
atlas-coreThe engine: search semantics, both backends, shard fan-out, staging, classification, the ingest gate, evaluation, traces and feedbackatlas-search; also the fleet binary’s search domain, which consumes the workspace crates as-isFour binaries in its own src/bin/: atlas-classify, atlas-eval, atlas-github-comments, atlas-sweep
atlas-protoThe shared HTTP job-protocol types for the service and its via-service clients, plus the versioned query-parameter contractatlas-core and atlas-search; the server and the CLI client both depend on it so their wire definitions cannot driftNone — serde types only: no HTTP, no storage, no search policy
atlas-searchThe process surface: the one-shot CLI, the via-service client, the loopback HTTP service, model fetching, and the staging toolNothing in the workspace; it is the top of the graph. Outside the workspace, the fleet binary re-homes its serve halfatlas-search from src/main.rs, and atlas-stage from src/bin/atlas-stage.rs

Dependency direction is one-way throughout: atlas-search depends on atlas-core and atlas-proto; atlas-core depends on atlas-embed and atlas-proto; atlas-embed and atlas-proto depend on no sibling crate. A change to the wire contract therefore recompiles everything above it, and a change to the embedder recompiles nothing below the engine.

atlas-embed

One file (src/lib.rs), two load-bearing dependencies: the ort crate built with dynamic loading and no default features — so it never downloads a prebuilt ONNX Runtime at build time, which the Nix sandbox forbids — and the tokenizers crate for the model’s own tokenizer. Construction is explicit and eager: loading takes a model directory and a runtime library path, resolved by the caller, never read from the environment by this crate. Its whole public surface is the Embedder type, its tokenise and embed methods, and a pairwise-summation helper that replicates NumPy’s summation order bit for bit, because the parity gate grants no tolerance for a differently ordered accumulation. See atlas-embed: embeddings as a library.

atlas-core

The large crate: 33 public modules and about 26,000 lines in src/, including the shard subpackage. It is a semantics-exact port of the Python reference implementation — see atlas_search.py: the Python reference implementation — with the search ceiling and filters applied inside the branch queries, before any ranking. It owns both data backends (the Turso HTTPS pipeline backend and the local SQLite publish-file backend), the staging and registry machinery, the classification operating procedure, and the offline evaluation harness. Four operator binaries are auto-discovered from its src/bin/, and its examples include a live smoke test, a retrieval proof and a shard benchmark. The full module map is atlas-core: the engine as a library.

atlas-proto

Serde types only. It defines the job protocol — search requests, job creation and status, result pages, error and health responses, and the embed request and response — and it embeds the versioned defaults file query-parameters-v1.json, which is the single source the CLI defaults are derived from (k = 10, pool = 100, RRF k = 10, and the rest of the v1 contract). Sensitivity clamping does not live here: this crate carries the requested ceiling and the server’s reported effective ceiling, and the server does the clamping. One wart to know: its Sensitivity, SearchMode and VectorBackend types are wire duplicates of atlas-core’s types of the same names — same spellings and orderings, defined independently in both crates. See atlas-proto: the wire contract.

The binary crate. Its modules are the CLI entry point (main.rs), the service (server.rs with its server/ submodules), the via-service client (service.rs), model fetching (fetch_model.rs), and the two output writers (pyjson.rs, the Python-JSON writer, and render.rs, the envelope renderer) whose byte parity the fleet port is guarded against. It builds two binaries: atlas-search itself — the access layer with the search, get-chunk, serve, init, fetch-model, traces and feedback verbs — and atlas-stage, the staging-unit tool. The fleet binary’s serve role is a maintained copy of this crate’s server.rs, and its search client delegates standalone searches to the installed atlas-search artifact; neither fact changes this crate’s place at the top of the workspace graph.

The self-contained sub-flake

pkgs/atlas-search/ is a self-contained package on the pkgs/id pattern: its own Cargo workspace, its own flake.nix and default.nix, and its own rust-toolchain.toml, from which consumers read the toolchain. It also carries, as siblings of crates/, everything the crates need at build or test time: schema/ (the versioned staging, registry and gate DDL), fixtures/ (the parity fixtures), eval/ (the Python evaluation lineage), worker/ (the Cloudflare Worker), onnxruntime/ (the vendored ONNX Runtime package the build pins and points the binary at, rather than an ambient system runtime), the book itself, and atlas_search.py at the package root.

Two consequences follow. First, the workspace can be built, tested and vendored without the rest of the repository: the fleet package path-depends on this package’s crates, workspace manifest and schema directory, and reuses its vendored ONNX Runtime, precisely because the package is self-contained. Second, the model is not part of the package: the Snowflake model snapshot is data, provisioned into a state directory by the fetch-model verb and verified against hashes recorded in the repo — see Installation and provisioning.

Worked example — building one crate and running one binary’s tests from the package root:

cargo build -p atlas-core
cargo test -p atlas-search --all-targets
nix build .#atlas-docs        # this book

Failure shapes

  • A missing chapter file is a book build failure, never a stub: the book configuration sets create-missing = false.
  • The embedder’s Gate A parity test is ignored in ordinary CI: it requires the pinned model snapshot and a version-matched ONNX Runtime, and against a different runtime version it reports not-applicable rather than a parity verdict.
  • Because atlas-proto and atlas-core define their shared vocabulary types independently, a spelling change made in only one crate compiles cleanly and drifts the wire. The contract file and the parity tests are the guards; there is no shared definition to lean on.

atlas-core: the engine as a library

Source: crates/atlas-core/src/lib.rs and the module files under crates/atlas-core/src/ (including src/shards/), with call sites in crates/atlas-search/src/main.rs, in https://github.com/developing-today/code/blob/main/pkgs/atlas-search/ — provenance only; this chapter is complete without following it.

atlas-core is Atlas with the process removed. Everything the binaries do that is not argument parsing, printing or HTTP lives here: the search pipeline, both data backends, the shard fan-out, staging and promotion, classification, evaluation, traces and feedback. Its crate documentation states the shape plainly: a SearchBackend — the Turso HTTPS pipeline API, or a local SQLite publish file — gathers a full-text pool and a vector pool with the caller’s sensitivity ceiling and filters applied inside the branch queries, before any ranking, and run_search fuses the pools with reciprocal rank fusion under the versioned query-parameter contract.

The library is synchronous. Backends are Send + Sync behind interior locks. The query embedder is the one exception: ONNX sessions take a mutable reference, so serve mode holds one embedder, or a small pool, behind a mutex — a loaded session is about 1.6 GB of resident memory, and it is shared state, not per-request state.

The crate is a semantics-exact port of the Python reference — see atlas_search.py: the Python reference implementation. JSON shapes, field order, note placement and fatal messages mirror the Python, and the parity tests diff rendered envelopes and SQL strings against fixtures recorded from the production Python module.

The 33 public modules, grouped by job

lib.rs declares 33 public modules. Grouped by the job they do:

Retrieval

ModuleJob
searchSearch orchestration and envelope rendering: run_search, run_get_chunk, the search options and modes
fusionThe FTS match expression and reciprocal rank fusion over the two branch pools
filtersThe filter set, the sensitivity ceiling type, and the branch and detail SQL builders. The SQL strings are the contract with the database; parity fixtures record them byte for byte
joinThe span join and reconstruction assembler: assembling a paragraph of a version from its span occurrences, byte for byte, with cold and retired (tombstone) rendering

Embedding

ModuleJob
embedQuery and document embedding at the library boundary: the query: prompt, truncation and renormalisation on the query side; prompt-free embedding on the document side
embed_cacheThe query-embedding cache: an in-memory tier plus an optional shared Turso tier, keyed by model identity and normalised query text. See Data stores and schemas

Corpus

ModuleJob
shardsThe core tier as a set of scan shards: discovery, naming, tiers, manifests, fan-out scan, content stores and the local-file transport (submodules shards::scan, shards::content, shards::local)
tursoThe Turso backend: the libsql HTTPS pipeline against the hosted DB with a read-only token. Every statement it builds is a SELECT
localThe local backend: a SQLite publish file, schema-normalising temporary views, and vector side stores joined by content hash with an in-process cosine scan
backendThe SearchBackend seam both backends implement: branch pools, chunk details, neighbours and message reads, with the ceiling enforced inside branch construction
manifestThe classification manifest: schema, validation and loader for the table that declares the filterable dimensions, with the built-in manifest as fallback and validation reference
boundarySource-boundary-safe embed splitting: the splitter and the classifier share source offsets, every declared boundary splits, and uncertain text becomes one secret-bearing chunk
disclosureDisclosure contexts: the destination-side half of the classification model. The caller ceiling and the destination context’s ceiling intersect; neither widens the other, and enforcement happens at the final output boundary in search

Ingest

ModuleJob
stageStaging databases and the staging-unit registry: provisioning, staged artifacts, classified staging, and the promotion transition
gateThe staging-shard ingest gate’s durable record and state machine: five ordered stages (write, classify, dedup, provenance check, publish), enumerated reason codes, and a strike limit of 3 per reason before a batch needs review
sweepThe source sweep: candidate filtering, guardrails, headroom, state, locking and run reporting for periodic ingest scheduling
github_commentsGitHub comments as a corpus source: comment documents, provenance marks and watermarks
trace_ingestQuery traces as a searchable corpus source, plus trace retention and compaction

Classification

ModuleJob
classificationThe classification record model: records, provenance, and the effective classification composed from records. Unknown, missing or malformed sensitivity fails closed to secret-bearing. The one module with no module-doc header and no lib.rs re-export — reach it as atlas_core::classification
classifyThe classification operating procedure: the unclassified-remainder sweep and schema-change review. The atlas-classify binary is its front end
detectSource detection: passes over plain trees, git trees and row stores, producing a versioned ledger of per-path and per-table verdicts
c8_fingerprintThe C8 error-investigation fingerprint core: error-string normalisation, fingerprints, occurrence grouping and evidence bundles. Pure types and derivations; no telemetry search
c8_profileThe C8 report and page metadata profile: source and page records, typed links and URL sanitising. Likewise seam-independent

Quality

ModuleJob
evalThe offline retrieval evaluation harness: saved rankings from any signal scored against judged qrels (nDCG@10, Recall@100, Recall@1000, MRR@10), with dev/test split discipline
feedbackFeedback capture in the atlas-feedback/v1 schema: votes attached to a query and chunk identity, the append-only JSONL sink, and the derived supersede view
feedback_normaliseThe normalisation pass over raw feedback: categories, summaries, self-feedback detection and requester weighting, emitted as derived records — the raw store is never rewritten
traceQuery-trace capture in the atlas-query-trace/v1 schema. Every executed search mints a query id and persists one trace record before the response is released; a sink failure is a search failure
trace_statsTrace statistics and the weekly report: windowed aggregation over traces and feedback votes, with the requester weights (the owner and users at 1.0, agents at 0.25, anonymous at 0.1)

Support

ModuleJob
typesThe shared value and row model between the Turso pipeline encoding and rusqlite: values, rows, statements, branch hits and pools, chunk details, and the canonical defaults (the default model and the default vector table, vec_snowflake_m_v2_768_f32)
errorThe error type and the crate’s Result alias; see the error vocabulary below
aggregateThe staging aggregator: embed-at-promotion. It reads one staging unit, embeds every chunk document-side, writes one new core scan shard, stamps provenance and promotes the unit through the registry
owner_inventoryThe owner inventory matcher (atlas-owner-inventory/v1): a narrow, fail-closed component whose findings carry a class and an opaque record id, never a matched value
shinglesToken shingles and the Jaccard rescore signal: a third signal applied only at rescore time over the fused candidate union, never a retrieval scorer. Off by default in the shipped parameters

Four binaries live in this crate’s src/bin/ — atlas-classify, atlas-eval, atlas-github-comments and atlas-sweep — each a thin front end over the module of the same job. Three examples (live_smoke, retrieval_proof, shard_bench) exercise the library against live stores.

Key public types

The types a caller actually constructs or matches on:

TypeModuleWhat it is
SearchOptionssearchOne search request: the query, the mode, k (default 10), the per-branch pool (default 100), grouping, expand (default 0), the model, the truncation width (0 = full), the vector backend (default scan), the query parameters, and the disclosure context (default PublicSurface — fail-closed at the library layer). Built with SearchOptions::new(query)
SearchModesearchFts, Vector or Hybrid (the default)
FiltersfiltersThe classification filters and the caller ceiling: kind, topic, project and client lists, the maximum sensitivity, and the since/until dates. Construction validates, with the Python’s fatal texts
SensitivityfiltersThe ceiling ladder Shareable &lt; Personal &lt; LocalOnly &lt; SecretBearing; the ordering is the security ordering. Default Personal
DisclosureContextdisclosureThe destination context — FleetInternal, HostedPerUser, PublicSurface, LocalOwner — each with its own ceiling; effective_ceiling(grant) is the minimum of the two
SearchBackend (trait)backendThe data-source seam: branch_pools, chunk_details, neighbors, message_chunks, message. Implementations: TursoBackend and LocalBackend
QueryEmbedder / DocEmbedder (traits), AtlasEmbedderembedThe embedding seam. AtlasEmbedder wraps the atlas-embed embedder behind a mutex and implements both traits; fixed-vector embedders stand in for tests and fixtures
BranchPools, BranchHit, ChunkDetailtypesWhat a backend returns: the FTS and vector pools (a vector hit carries its cosine distance; an FTS hit carries none), and the resolved detail row for a chunk, including its effective sensitivity
Error, ResulterrorThe error vocabulary, below
Manifest, LoadedManifestmanifestThe classification manifest and its loaded form, with the source it came from
Registry, StagingUnitstageThe staging registry handle and one unit’s record
GateRecordgateOne batch’s gate audit record. The gate types are public in their module but are not re-exported at the crate root

Most workhorse types are re-exported at the crate root (atlas_core::run_search, atlas_core::Filters, atlas_core::TursoBackend and so on). The recorded exceptions are classification, the gate types, github_comments, sweep and the shards types, which are reached through their module paths.

Two crate-level constants bound every caller: MAX_EXPAND_NEIGHBORS = 100, the ceiling on neighbour expansion and on get-chunk neighbours, and the message text cap of 50,000 characters applied to message payloads.

The error vocabulary

The library has exactly three errors, in atlas_core::Error:

VariantMeaningExit code at the atlas-search binary
Error::Fatal(String)A fatal that mirrors a Python die() text: validation failures, unresolvable configuration, a missing model or token. Constructed with Error::fatal(...)2
Error::Backend(String)A backend or transport failure: the pipeline request, the database, the local file. Constructed with Error::backend(...)1
Error::Embed(String)An embedding failure: the model, the runtime, a zero query vector1

atlas_core::Result&lt;T&gt; is the crate-wide alias over this error. The exit-code column is the binary crate’s mapping, not the library’s — the library returns the variant and the caller decides what it costs. One special case rides on top of it in the binary: a get-chunk not-found arrives as a Fatal with the exact message chunk &lt;id&gt; not found and is remapped to exit 1, matching the Python.

Embedding a search in another binary

The shape of the call, taken from the real call sites in the atlas-search crate’s main.rs: open a backend, build the filters, build the options, call run_search, and print or serve the returned JSON envelope. The envelope — not a result struct — is the return value: a serde_json::Value whose shape, field order and notes mirror the Python exactly.

#![allow(unused)]
fn main() {
use atlas_core::{Filters, LocalBackend, SearchOptions, TursoBackend, run_search};

// Standalone shape: a backend, an embedder, filters, options.
// The Turso backend resolves its read-only token itself:
let backend = TursoBackend::new(vec_table)?;
// …or the local publish file:
// let backend = LocalBackend::new(db_path, vecdb_arg, vec_table, trunc)?;

let filters = Filters::new(/* kind, topic, project and client lists,
    the max-sensitivity ceiling, and the since/until dates */)?;
// construction validates, and its fatals carry the Python's texts

let mut opts = SearchOptions::new(query.to_string());
opts.k = 10;          // defaults already: k 10, pool 100, expand 0,
opts.context = ctx;   // hybrid mode, scan vector backend

let envelope = run_search(&backend, &embedder, &filters, &opts)?;
// envelope is the JSON result document, ready to print or return.
}

What the call sites around that shape add:

  • The embedder is lazy. FTS-only searches and get-chunk never load the model. The binary builds the real embedder only when the mode uses the vector branch; library callers follow the same rule, passing a fixed or absent embedder where no vector work can occur.
  • One chunk, by id: run_get_chunk(&backend, chunk_id, neighbors) returns the chunk envelope with that many same-message neighbours attached (at most 100). run_get_chunk_with_context is the form that also applies a disclosure context.
  • Traced searches: run_search_traced (and run_search_with_executor_traced for a custom branch executor) take a TraceJob carrying the trace sink, the trace context and the query id, and persist the trace before the envelope is released. The one-shot binary always searches traced, through a JSONL sink; a sink failure fails the search.
  • Custom branch execution: run_search_with_executor accepts any BranchPoolExecutor in place of the backend’s own branch pools — the seam the shard fan-out composition uses, serving the vector branch from the shard set while the wrapped backend keeps FTS, details and neighbours.

Worked example — the smallest complete embedding, in the shape of the crate’s own examples: open a LocalBackend on a publish file, construct Filters with no dimension filters at the default personal ceiling, construct SearchOptions::new("backup retention"), and call run_search with a fixed embedder for an FTS-only mode so no model is needed. The returned envelope names the backend, the filters in force and the ranked results, exactly as the CLI would print it.

Failure shapes

  • expand above 100, a non-scan vector backend on a non-Turso backend, and hydration combined with grouped output are all Fatal before any branch runs.
  • In FTS mode, a query with no FTS-searchable terms (every word too short) is Fatal; in hybrid mode the same query simply runs the vector branch alone.
  • A shard fan-out in which the scanned shards carry mixed embedding models is Fatal: vectors from different embedding models are not comparable. A failing shard likewise fails the whole query — a partial answer that silently omits a shard is treated as worse than an error.
  • A missing or empty HOME environment variable panics loudly in the path expansion used by the Turso and local backends, by design; it is never silently replaced with a relative path.

For the workspace this crate sits in, see The crates. For the stores its backends read, see Data stores and schemas.

atlas-embed: embeddings as a library

Source: crates/atlas-embed/src/lib.rs, crates/atlas-embed/tests/gate_a.rs, crates/atlas-embed/examples/timing.rs, fixtures/embed-probes.json, and the wrapper in crates/atlas-core/src/embed.rs.

atlas-embed is a single-file crate (crates/atlas-embed/src/lib.rs) that turns text into embedding vectors — fixed-length lists of floats that place texts with similar meaning near each other — for exactly one model. It wraps ONNX Runtime (a runtime for running neural-network models from .onnx files) and the model’s own tokenizer (the component that splits text into the integer token ids the model consumes). Everything else in Atlas that needs a vector — the search engine, promotion at ingest — goes through this crate or through the thin wrapper in atlas-core: the engine as a library, so there is exactly one place where a vector can be produced. That singularity is deliberate: vectors from different models, or from the same model handled differently, are not comparable, and the crate’s whole design is a parity contract (see Gate A, below) with the Python pipeline that embedded the production corpus.

#![allow(unused)]
fn main() {
use std::path::Path;
use atlas_embed::Embedder;

let mut embedder = Embedder::load(Path::new(model_dir), Path::new(ort_lib))?;
let vectors = embedder.embed(&["a toy note about ballast and sailboats"])?;
assert_eq!(vectors[0].len(), 768);
}

The pinned model identity

The model is Snowflake snowflake-arctic-embed-m-v2.0, at the pinned revision 95c2741480856aa9666782eb4afe11959938017f. The crate itself carries no model-id string constant — identity strings live one layer up, in atlas-core (DEFAULT_MODEL = "Snowflake/snowflake-arctic-embed-m-v2.0") and in the Gate A fixture provenance. What the crate pins is the snapshot layout load expects, and the numeric constants:

ConstantValueMeaning
MODEL_CONTEXT8192the model’s real context length, in tokens
EMBED_DIM768output width, full width — no Matryoshka truncation (dimension-shortening) happens in this crate; width selection is a caller’s concern
PAD_ID0the token id used for batch padding

A model snapshot directory must contain tokenizer.json at its root and onnx/model.onnx, the fp32 graph. The pinned files are hash-verified at install time by the fetch-model verb: onnx/model.onnx has SHA-256 c0c53d7f49a2db60761b92b7bbf5be87a7b3cf5d92dbbd7f1b5028bd5a40aa39 and tokenizer.json has SHA-256 f1cc44ad7faaeec47241864835473fd5403f2da94673f3f764a77ebcb0a803ec. For how the snapshot gets onto a machine, see Configuration and environment.

The public API

The whole surface is one struct, three entry points around it, one helper, and one error type.

Entry pointShapeMeaning
Embedder::load(model_dir, ort_lib)(&Path, &Path) -> Result<Embedder>load the tokenizer and ONNX session eagerly, with the recorded corpus-pass thread counts (intra-op 8, inter-op 2)
Embedder::load_with_threads(model_dir, ort_lib, intra, inter)(…, usize, usize) -> Result<Embedder>same, with explicit ONNX Runtime thread counts
Embedder::tokenize(&self, text)(&str) -> Result<Vec<u32>>token ids for one text, with special tokens added, no truncation, no padding
Embedder::embed(&mut self, texts)(&[&str]) -> Result<Vec<[f32; 768]>>document-mode embedding: prompt-free (see below)
Embedder::embed_ids(&mut self, id_lists)(&[Vec<u32>]) -> Result<Vec<[f32; 768]>>the core path: embed pre-tokenized inputs; batch composition never changes a vector
pairwise_sum_f32(a)(&[f32]) -> f32NumPy’s pairwise summation, replicated bit-for-bit (block size 128, 8-way unrolled accumulators)

An Embedder holds one ONNX Session, the model’s Tokenizer, and the ORT Environment for the session’s lifetime. Construction is explicit and eager — there is no lazy loading inside the crate; serve mode’s lazy, once-only initialisation is the caller’s once-cell, and because ONNX sessions take &mut self, callers share an embedder behind a mutex. Loading a session costs roughly 1.6 GB of resident memory, which is why it is shared state rather than per-request state.

How a vector is produced

Every point in this pipeline is load-bearing for parity:

  • Tokenizer. The model’s own tokenizer.json — a SentencePiece Unigram tokenizer with a Metaspace pre-tokenizer and a precompiled normalizer, using a &lt;s&gt;/&lt;/s&gt; template. It is not BERT WordPiece. It is loaded through the tokenizers crate.
  • Truncation is off. load explicitly disables the tokenizer’s truncation and padding. The shipped tokenizer config carries a 512-token truncation default, but the model’s real context is 8192 tokens; padding is built manually instead (below). An input longer than 8192 tokens is a loud TooLong error, never a silent cut.
  • Batching. Batches pad on the right with pad token id 0 and attention mask 0 — replicating the corpus pipeline’s manual np.zeros padding. (A fork sidecar elsewhere pads with id 1; a recorded fixture diagnostic shows the two are bit-identical on this fp32 graph, max delta 0.0 on every probe including a 1,272-token chunk, because masked positions never reach the CLS row. The crate replicates the corpus pipeline’s 0.)
  • Validation before tensors. Batch validation runs before any tensor is built: an empty batch is EmptyBatch, and any empty entry is EmptyEntry { index }. This check exists because, before it, an empty entry in a mixed batch silently returned a fabricated unit-norm embedding of pure padding.
  • Session shape. Session inputs are input_ids and attention_mask; output 0 must have shape [batch, seq, 768] or the call fails with BadShape.
  • Pooling. Pooling is CLS pooling: the vector is row 0 of the model’s hidden states (hidden[:, 0, :], per the model’s shipped 1_Pooling config), then L2-normalized in f32. The norm’s sum of squares uses pairwise_sum_f32, replicating NumPy’s summation order exactly, because Gate A grants no tolerance for a differently ordered accumulation.

The query: prompt — and who applies it

atlas-embed deliberately does not apply any prompt. The pinned model expects query-side text to be prefixed with the literal string query: (the sentence-transformers prompt_name="query" convention, from the model’s config_sentence_transformers.json), and documents to be embedded with no prefix at all. Applying the prefix is the search layer’s job, in atlas-core’s embed module:

  • QUERY_PROMPT = "query: " lives in atlas-core, not in this crate.
  • atlas-core’s AtlasEmbedder::embed_raw(text) formats "{QUERY_PROMPT}{text}" and calls Embedder::embed; its embed_doc_raw(text) calls the same crate entry point with the bare text.
  • The query path then finishes the vector: slice to the requested truncation width if one is set (default 0 = full width), then L2-renormalize with pairwise_sum_f32. A zero vector at that point is fatal (query embedding produced a zero vector). The document path does no truncation and no renormalization — that is the shape the production corpus was embedded in, and cosine distance is scale-invariant, so the query side owns all three adjustments.

The practical rule for library callers: call embed with document text as-is; never pass a query through it without adding query: yourself, or — better — use the atlas-core wrapper, which makes the distinction for you. See Embeddings: Snowflake Arctic and the parity contract for why this asymmetry matters.

ONNX session loading

The ort crate is built with default-features = false and the load-dynamic feature, so ONNX Runtime is loaded at run time from a caller-supplied library path via ort::init_from(ort_lib), under the environment name atlas-embed. Nothing is downloaded at build time or at run time — downloading a prebuilt onnxruntime at build time is forbidden in the Nix sandbox, and the crate honours that by construction.

The crate reads no environment variables itself. Callers resolve two paths and pass them in:

  • Model directory — resolved from ATLAS_MODEL_DIR.
  • ONNX Runtime library — resolved from ATLAS_ORT_LIB (a path to libonnxruntime.so).

The atlas-search binary’s full resolution chain, which the other callers (the Gate A test, the crate’s examples/timing.rs, the atlas-core examples) follow in shorter form, is:

  1. ATLAS_MODEL_DIR, if set, non-empty, and an existing directory; otherwise ~/.local/state/atlas-search/model/&lt;rev&gt; if it is a directory; otherwise the Hugging Face cache snapshot at ~/.cache/huggingface/hub/models--Snowflake--snowflake-arctic-embed-m-v2.0/snapshots/&lt;rev&gt;; otherwise a model-not-found error. &lt;rev&gt; is the pinned revision above.
  2. ATLAS_ORT_LIB, if set, non-empty, and an existing file; otherwise ~/.local/state/atlas-search/ort/libonnxruntime.so if it is a file; otherwise the v3 virtualenv’s libonnxruntime.so.1.31.1; otherwise the compiled-in default, the build-time ATLAS_SEARCH_ORT_LIB_DEFAULT (a compile-time value baked into packaged builds, pointing at the build’s onnxruntime store path; development builds never set it).

The parity contract: Gate A

Gate A (developing-today/code#5351) is the contract that this crate reproduces the production Python corpus pipeline (embed_onnx.py in the corpus workspace) bit-identically: token ids equal, output vectors at delta 0.0, for single inputs and for batches. The release profile of the whole workspace carries no fast-math-style flags for the same reason — embedder numerics are the contract.

The reference data is fixtures/embed-probes.json: 11 probes (spike_fox, spike_query_prefix, spike_semantic, spike_single_char, spike_japanese, spike_empty, corpus_6359, corpus_15202, corpus_39430, corpus_long, query_style), recorded by fixtures/gen_fixtures.py on 2026-11-04 with onnxruntime 1.31.1, transformers 5.21.0, and python tokenizers 0.23.3, at intra-op 8 / inter-op 2 threads. Three probes and the long probe are real corpus chunks referenced by chunk id only; their text is not in the repository, and none is reproduced here.

The claim is version-matched. The gate reads the runtime version from the versioned library filename (libonnxruntime.so.1.31.1 gives 1.31.1) and refuses to run against a different version: a different runtime produces deltas around 1e-7 on most components of every probe, so against one the gate reports NOT APPLICABLE rather than a parity verdict. The Gate A test is ignored in ordinary CI because it needs ATLAS_ORT_LIB set and the pinned snapshot present.

Worked example

Following the pattern of the crate’s own examples/timing.rs and the Gate A test — resolve the two paths from the environment, load once, embed a small batch of toy documents:

use std::path::PathBuf;
use atlas_embed::Embedder;

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let model_dir = PathBuf::from(std::env::var("ATLAS_MODEL_DIR")?);
    let ort_lib = PathBuf::from(std::env::var("ATLAS_ORT_LIB")?);

    let mut embedder = Embedder::load(&model_dir, &ort_lib)?;

    let docs = [
        "toy note: a model sailboat stays upright because of its ballast",
        "toy note: watering the garden before noon",
    ];
    let vectors = embedder.embed(&docs)?;
    for (doc, vector) in docs.iter().zip(&vectors) {
        println!("{doc:?} -> {} dims, first = {:.6}", vector.len(), vector[0]);
    }
    Ok(())
}

Each returned vector is a [f32; 768], L2-normalized, document-side (no query: prefix — these are documents). Embedding the same two texts in a different batch composition, or one at a time, returns bit-identical vectors; that is the property Gate A pins.

Failure shapes

The crate’s Error enum is the complete failure vocabulary; there are no panics on bad input and no partial results.

VariantWhen
Ort(String)ONNX Runtime failed to load, or the session run failed
Tokenizer(String)the tokenizer failed to load, or tokenization failed
TooLong { tokens }an input exceeds the 8192-token context
EmptyBatchembed / embed_ids was called with no inputs
EmptyEntry { index }the entry at index tokenized to nothing
BadShape(Vec&lt;i64&gt;)session output 0 was not [batch, seq, 768]

One layer up, atlas-core wraps embedding failures as its own Error::Embed(String), alongside Fatal and Backend — so a search caller sees one error type for the whole engine. As a library, atlas-embed has no exit codes; exit-code mapping belongs to the binaries built on it. The wire types its vectors travel in are covered in atlas-proto: the wire contract.

atlas-proto: the wire contract

Source: crates/atlas-proto/src/lib.rs and crates/atlas-proto/query-parameters-v1.json.

atlas-proto is the shared wire contract between the Atlas search service and every client that talks to it over HTTP — the atlas-search CLI in its via-service mode, the fleet search client, and anything else that speaks the job protocol. It is serde types only (serde is Rust’s serialization framework): no HTTP, no storage, no search policy. The server and the CLI’s via-service client both depend on this one crate so their wire definitions cannot drift apart — a field renamed here is renamed on both sides in the same build. The engine behind the server is atlas-core: the engine as a library; the endpoints that carry these types are The service HTTP API.

One boundary to hold throughout: sensitivity clamping lives in the server, not here. This crate merely carries the ceiling a client requests and the effective ceiling the server reports back. A client that treats its request as the guarantee has misunderstood the contract.

The defaults contract: query-parameters-v1.json

Every default in the query-parameter contract lives in one file, crates/atlas-proto/query-parameters-v1.json, embedded into the crate at compile time and parsed for every default value. Its complete contents:

{
  "k": 10,
  "pool": 100,
  "expand": 0,
  "parameters_version": 1,
  "shard_top_k": 100,
  "global_top_k": 100,
  "fts_weight": 1.0,
  "vector_weight": 1.0,
  "jaccard_depth": 0,
  "jaccard_threshold": 0.0,
  "rrf_k": 10,
  "planner_enabled": false,
  "spell_enabled": false,
  "query_class_hint": null,
  "variant": "raw",
  "raw": false,
  "no_cache": false,
  "wait": false,
  "hydrate": 0,
  "raw_mode": "off"
}

Its role is to be the single source the defaults are derived from — the CLI’s own defaults come from this file, not from a second table in the CLI’s source. A missing or invalid default in the file panics at first use rather than falling back to a guessed value: a contract whose defaults are silently invented is worse than a crash. Field meanings, in brief: k is the final result count; pool is the per-branch candidate count; expand is neighbouring chunks included around a hit; shard_top_k / global_top_k bound the shard fan-out; fts_weight / vector_weight and rrf_k parameterize reciprocal rank fusion (the score-combining method for the full-text and vector branches); jaccard_depth / jaccard_threshold control an optional token-overlap rescore (off at depth 0); hydrate is top-N hydration to full content from the content store, distinct from expand; raw_mode selects pre-fusion output shapes. wait: false is the wire default — the one-shot CLI implies waiting and sets it unless told otherwise.

The shared value types

TypeValues (wire spelling)Notes
Sensitivityshareable < personal < local-only < secret-bearingkebab-case; the ordering is the security ordering; default personal; clamped_to(cap) is min(self, cap)
SearchModefts, vector, hybridlowercase; default hybrid; branch_demand() is 2 for hybrid, 1 otherwise — deliberately conservative, since a hybrid query whose full-text expression is empty may still use only the vector branch
VectorBackendscan, index-fixed, index-fillkebab-case; default scan (exact scan)
RawModeoff, ungrouped, brancheslowercase; default off
QueryVariantraw, rewritten, bothlowercase; default raw; the other two are not implemented and are refused at validation

These types are wire duplicates of atlas-core’s own Sensitivity, SearchMode, and VectorBackend — same names, same spellings, same orderings, defined independently in both crates. The duplication is intentional: the wire crate must not force every client to depend on the engine.

FilterSpec carries the classification filters — kind, topic, project, client (each a list of strings), and since / until (optional date strings) — each field omitted from the JSON when empty or absent. The sensitivity ceiling is deliberately not a member of FilterSpec; it is a sibling field on SearchRequest, because it is clamped by a different rule than the filters are applied by.

SearchParametersV1 and SearchRequest

SearchParametersV1 is flattened onto the wire — serialized inline into the request object, not nested — so each JSON name matches its CLI spelling exactly. Its fields are the contract file’s fields: parameters_version (1), shard_top_k (100), global_top_k (100), fts_weight (1.0), vector_weight (1.0), jaccard_depth (0), jaccard_threshold (0.0), rrf_k (10), planner_enabled (false), spell_enabled (false), query_class_hint (null), variant (raw), raw (false), no_cache (false — bypass cache reads; the fresh result still lands in the cache), wait (false), hydrate (0), and raw_mode (off).

validate(expand) is part of the contract, and a conforming client runs the same checks before sending: parameters_version must be 1; shard_top_k and global_top_k in 1..=400; rrf_k in 1..=10000; both weights finite and at least 0, with at least one positive; jaccard_threshold finite in [0, 1]; hydrate at most 1000; raw combined with a non-zero expand is an error. Three settings are validation errors rather than quiet no-ops: planner_enabled or spell_enabled set (planner/spell stages are not implemented yet), any query_class_hint (not implemented yet), and a variant other than raw (rewritten/both query variants are not implemented yet).

SearchRequest is the request envelope for a search:

FieldDefaultMeaning
query— (required)the query text
modehybrida SearchMode
filtersemptya FilterSpec
ceilingpersonalthe requested Sensitivity; the server clamps it to the authenticated client’s cap
k10final results (default read from the contract file)
pool100per-branch candidates; the server enforces the design maximum of 400
group_by_sessionfalseroll chunk hits up to sessions
expand0neighbouring chunks per hit (contract-file default)
parameterscontract defaultsa SearchParametersV1, flattened
with_messagefalseinclude parent message text
modelSnowflake/snowflake-arctic-embed-m-v2.0the embedding model identity (see atlas-embed: embeddings as a library)
embedderautoembedder selection spelling
trunc0truncate vectors to N dimensions (0 = full width)
vector_backendscana VectorBackend
page_limitnoneone-shot endpoint only
contextnonethe disclosure-context spelling — fleet-internal, hosted-per-user, public-surface, or local-owner; absent or unknown fails closed under the receiving surface’s rule

The crate also defines how a result is cache-keyed: canonical_key_material(expand, group_by_session, with_message) is a fixed-order labelled string covering every parameter plus those three request-level shaping controls, and result_cache_key(query, snapshot_id, ceiling, expand, group_by_session, with_message) is the hex SHA-256 of atlas-result-cache/v1|query={query}|snapshot={snapshot_id}|ceiling={ceiling}|{canonical material}. Note which ceiling goes into the key: the effective (clamped) one. Two clients requesting different ceilings above the same cap share a cache entry only at the ceiling both were actually served at.

The job protocol types

Search over the service is a job protocol: submit, poll, page, delete. The types:

TypeCarries
JobCreatedthe 202 response to a job submission: job_id, job_token, status, effective_ceiling, queue_depth, queue_position, submitted_at_ms, expires_at_ms
JobStatusqueued (default), running, done, failed, expired — lowercase
BranchState / BranchStatesper-branch state for fts and vector: pending (default), running, done, failed, skipped
JobStatusResponsejob_id, status, branch_states, effective_ceiling, pool, queue_depth, queue_position, notes, error, result_count, submitted_at_ms, started_at_ms, completed_at_ms, expires_at_ms
SearchPageone page of results: job_id, status, effective_ceiling, envelope (the search envelope with its results replaced by this page’s slice), results, next_cursor, total_results
JobSummary / JobListResponsethe job-list rows, oldest first: metadata only — job_id, status, query, mode, pool, effective_ceiling, timestamps, queue_position. Never result content, never the capability token
JobDeletedjob_id, status

The job_token in JobCreated is a per-job capability token: it authorizes only that job’s status, results, chunk, and delete endpoints. It is not a client credential and must never appear in a job list — the JobSummary type makes that structural, by having no field for it.

Two smaller envelopes complete the surface:

  • Errors. ErrorResponse { error: ApiError }, where ApiError is { code, message, retry_after_seconds, queue_depth } (the last two optional). The constructor ErrorResponse::rate_limited(message, retry_after_seconds, queue_depth) fixes the code rate_limited. A client must branch on code, not on the message text.
  • Health and embedding. HealthResponse answers the unauthenticated health endpoint: { status, embedder_state, queue_depth, active_branch_executions, active_jobs }. EmbedRequest { query, trunc } (absent or 0 truncation = full width) and EmbedResponse { model, dims, vector } serve the embed endpoint: the response names its embedding space — model and dimensions — so a caller can refuse a vector from the wrong space. EmbedResponse is serialize-only; it is produced, never parsed, by the service side.

A toy submission and its created response, in shape only:

{ "query": "toy sailboat ballast", "mode": "hybrid", "ceiling": "personal",
  "k": 10, "pool": 100, "parameters_version": 1, "rrf_k": 10 }
{ "job_id": "toy-job-0001", "job_token": "&lt;per-job token&gt;",
  "status": "queued", "effective_ceiling": "personal",
  "queue_depth": 0, "queue_position": 0,
  "submitted_at_ms": 0, "expires_at_ms": 0 }

Versioning posture

Versioning is by name, not by negotiation. The contract file is query-parameters-v1.json; the parameter type is SearchParametersV1; parameters_version must equal 1 and validation rejects anything else; the result-cache key carries its own atlas-result-cache/v1 prefix. A future v2 is a new contract alongside this one, not a reinterpretation of it — a v1 client and a v1 server can never silently disagree about what a field means, because a mismatched version is an error at validation, before any search runs. The same posture appears across the wider system: stage, gate, trace, and feedback records all carry v1 format names of their own.

What a conforming client must honour

  1. Build requests as SearchRequest. Parameters flattened, JSON names matching the CLI spellings, defaults taken from the contract — not from a private copy that can drift.
  2. Validate before sending. The SearchParametersV1::validate rules above; in particular, do not send planner, spell, hint, or rewritten-variant settings and expect them to be ignored — they are refused.
  3. Treat the ceiling as a request. Read effective_ceiling from JobCreated, JobStatusResponse, and every SearchPage, and present results as served at that ceiling. The server clamps to the authenticated client’s cap; neither the request nor the context widens the other.
  4. Keep the job_token scoped. Present it only to its own job’s endpoints; never log it, list it, or reuse it for another job.
  5. Page honestly. Follow next_cursor until it is absent; total_results is the whole result set, results is only the page in hand, and the page’s envelope has already had its results replaced by that slice.
  6. Branch on error code. Honour retry_after_seconds and queue_depth on a rate_limited error instead of retrying immediately.
  7. Check the embedding space. On an EmbedResponse, refuse a vector whose model or dims is not the space you asked in — vectors from different spaces are not comparable.
  8. Fail closed on context. Send a recognized context spelling; an absent or unknown one is resolved by the receiving surface’s fail-closed rule, which may serve you at a lower ceiling than you expected — by design.

The hosted Worker surface that consumes this same contract — including its MCP tool — is covered in The Atlas MCP server, and a worked end-to-end use of all three client shapes is Tutorial: search the corpus three ways.

Tutorial: search the corpus three ways

This tutorial runs one toy question through the three client surfaces that search the Atlas corpus (the searchable body of classified, embedded chunks): the standalone atlas-search binary, the fleet search domain surface, and the hosted MCP server (MCP is the Model Context Protocol; the hosted surface is a Cloudflare Worker in front of the search service). All three end at the same engine and the same result envelope — what differs is routing, identity, and ceiling. The worked reference for the verbs is atlas-search: search and get-chunk; the wire types underneath are atlas-proto: the wire contract.

The toy query, used verbatim in every step so the results are comparable:

how does a toy sailboat stay upright

All output below is schematic, with invented toy hits — field names and shapes are real, chunk ids and text are made up for this tutorial.

Standalone is the default and is complete: the query is embedded in-process and the backend (hosted Turso, or a local file) is talked to directly.

  1. Run the search, asking for five results in human-readable form first if you want to skim, or as JSON (the default) to work with:

    atlas-search search 'how does a toy sailboat stay upright' --k 5
    
  2. Read the envelope. Its shape (trimmed):

    {
      "query_id": "&lt;uuidv7 minted for this search&gt;",
      "notes": [],
      "results": [
        { "chunk_id": 900001, "score": 0.181818,
          "text": "toy note: a model sailboat stays upright because its ballast sits low…" }
      ]
    }
    

    Two things to notice: the envelope carries a query_id — every executed search writes a trace record under that id, and a trace-write failure fails the search — and notes is where the surface confesses anything non-standard (a fallback, a missing vector store, a rescore it applied).

  3. Open the hit you care about with get-chunk, asking for one neighbouring chunk (a chunk from the same message, either side of the hit) for context:

    atlas-search get-chunk 900001 --neighbors 1
    

    get-chunk returns the one chunk with its provenance — session, client, sensitivity — plus the neighbours. It never loads the embedding model (there is no query to embed), it has no via-service path in the job protocol (chunk reads are scoped to an existing job), and a chunk id that does not exist exits 1. Its default disclosure context is local-owner — it is the owner’s explicit-id tool — where search defaults to fleet-internal.

fleet search is the fleet domain surface over the same client: the same flags for the common subset, plus routing.

  1. Run the identical query:

    fleet search 'how does a toy sailboat stay upright' --k 5
    
  2. Compare the output. It is the same envelope from the same engine — same query_id discipline, same result shape, the same hit for the same query at the same ceiling. If your seat routed via the service, the result was produced by the loopback service’s job protocol (atlas-proto: the wire contract); if it ran standalone, the fleet client delegated your arguments to the atlas-search artifact.

  3. Note the routing rule, because it decides which of those happened: the sandbox seat prefers the service, with a loud standalone fallback (a warning on stderr plus a note in the envelope’s notes) on any service failure; the laptop seat — the serving host — defaults to standalone. --via-service and --standalone force a route and are mutually exclusive. Requesting a ceiling above your client identity’s cap does not fail: the server clamps --max-sensitivity to the identity’s ceiling (drew-cli may reach secret-bearing; sandbox-scripts is capped at personal).

  4. Fetch the same hit through the fleet surface:

    fleet search get-chunk 900001 --neighbors 1
    

    This always runs standalone, even on a service-preferring seat: get-chunk is job-scoped in the protocol, so the fleet client delegates the verb verbatim to the atlas-search artifact, with a loud note when via-service was in effect. Full detail: fleet search and fleet serve search.

Way 3: the same question through the MCP search tool

The hosted Worker exposes exactly one MCP tool, search, over stateless Streamable HTTP at POST /mcp. There are no sessions: each HTTP request is one JSON-RPC message (or a batch), answered with plain JSON. The endpoint is gated by a bearer gate token (named, never valued, here).

  1. (Optional, once) Confirm the tool list with a raw JSON-RPC call:

    curl -s -X POST '&lt;worker-base&gt;/mcp' \
      -H 'Authorization: Bearer &lt;gate-token&gt;' \
      -H 'Content-Type: application/json' \
      -d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}'
    

    The result lists exactly one tool, search, with required argument query and optional k (integer, 1–50, default 10). Cache purge and cache inspect are deliberately not MCP tools — one is a write, the other an operator surface.

  2. Call the tool with the toy query:

    curl -s -X POST '&lt;worker-base&gt;/mcp' \
      -H 'Authorization: Bearer &lt;gate-token&gt;' \
      -H 'Content-Type: application/json' \
      -d '{"jsonrpc":"2.0","id":2,"method":"tools/call",
           "params":{"name":"search",
                     "arguments":{"query":"how does a toy sailboat stay upright","k":5}}}'
    
  3. Read the result. On success the JSON-RPC result carries the search envelope twice — as JSON text in content[0].text and as the object itself in structuredContent — with isError: false:

    {
      "jsonrpc": "2.0", "id": 2,
      "result": {
        "content": [{ "type": "text", "text": "{ …the same envelope, as JSON text… }" }],
        "structuredContent": {
          "cache": "miss",
          "key": "&lt;64-hex-char cache key&gt;",
          "query": "how does a toy sailboat stay upright",
          "result": { "…": "the service's search result, passed through" },
          "meta": { "hit_count": 1, "dims": 768,
                    "model": "Snowflake/snowflake-arctic-embed-m-v2.0" }
        },
        "isError": false
      }
    }
    

    Run it again and cache flips to hit: an MCP search and a REST search for the same normalized query and k share one cache entry, because both go through the single executeSearch path. On failure the HTTP status stays 200 and the failure is carried by isError: true with the error payload as the text content — check isError, not the HTTP status.

  4. Note what you could not ask for. There is no per-client identity on this endpoint and no argument for a ceiling or a context: every MCP caller shares the one hosted identity, pinned in the Worker to the hosted-per-user disclosure context and the personal ceiling, and the Worker verifies the service’s reported effective ceiling matches before anything is cached. The toy hit above is returned only because it is visible at personal; a hit classified above that ceiling would simply not be in the results. Full surface: The Atlas MCP server.

How the three relate

All three ways run the same hybrid search — full-text and vector branches, filters and ceiling applied inside the branch queries before ranking, fused with the versioned parameter contract — and all three return the same envelope at the core. The differences are only in the wrapper: standalone returns the bare envelope with its query_id; the fleet surface adds routing (service-preferred or standalone, decided per seat) and per-identity ceiling clamping; the MCP surface wraps the envelope in a cache-reporting Worker envelope (cache, key, meta) and a JSON-RPC result, at a pinned ceiling you cannot raise.

Which surface when

  • Standalone atlas-search — you are on a machine with the binary and the model, you want the full flag surface (the query-parameter contract knobs, --shards, local backends, traces and feedback verbs), or you are debugging and want no intermediary. Also the only route for get-chunk at full fidelity.
  • fleet search — you are working inside fleet tooling and want the seat’s routing decided for you: service when it is up, loud standalone fallback when it is not, your identity’s ceiling applied by the server. The common search flags only — engine-only knobs are deliberately not on this surface.
  • The MCP search tool — an agent or a hosted client needs search with no local install and no corpus credentials: one tool, one pinned personal ceiling, cached results. Accept its limits as features: no ceiling above personal, no filters, no get-chunk — if you need any of those, drop to one of the other two.

Tutorial: stage, classify and promote a source

This tutorial walks one tiny toy source — three invented notes about model sailboats — through the ingest path that exists today for staged content: a staging unit (a per-unit staging database registered in the staging registry), classification declared at staging time, inspection, and promotion through two distinct gates into a new core scan shard (a searchable shard of embedded chunks). The concepts are in Ingest today: staging, classification, promotion; the verb reference is atlas-stage. Everything here is toy content invented for this tutorial; no real corpus material is used.

Two gates will be named, and they are not the same gate:

  • The M6 model gate (#7648, part M6 of the #6060 one-model decision): a unit promotes only when its recorded embedding model is the mandated model, snowflake-arctic-embed-m-v2.0.
  • The batch gate (#6057 design, #7709 record and state machine): five ordered stages — write, classify, dedup, provenance check, publish — judged per batch, with a durable audit record.

Names used throughout: unit toy-sailboats-001, owner tutorial, registry file toy-registry.db, staging database toy-sailboats.db, shard directory toy-shards/. All atlas-stage output is one JSON object per line on stdout; errors print atlas-stage: &lt;message&gt; on stderr and exit 1 (usage errors exit 2).

Step 1: write the toy source

  1. Create three small note files. Keep each well under 32 KiB — at or below that size an artifact stages as one whole-file unit.

    mkdir -p toy-notes
    printf 'Toy note one: a model sailboat stays upright because its ballast sits low in the hull.\n' > toy-notes/ballast.md
    printf 'Toy note two: a loose rudder makes the sailboat wander off course on the pond.\n' > toy-notes/rudder.md
    printf 'Toy note three: waxing the hull before a race is a superstition, not a technique.\n' > toy-notes/hull-wax.md
    

Step 2: create the stage unit

  1. Provision the staging database, apply the v1 staging schema, and register the unit as open:

    atlas-stage provision --db toy-sailboats.db --unit toy-sailboats-001 \
      --owner tutorial --registry toy-registry.db
    

    The default physical sensitivity tier is internal (the staging tier vocabulary is public | internal | secret — not the four-level sensitivity ladder). The command prints the unit record: unit_id, db_uri, owner, sensitivity, state (open), schema_version (1), and timestamps. Staging databases are vector-free by design: they hold items and raw, un-embedded chunks_raw, never vectors.

Step 3: add the items

  1. Stage each note as an item. Every ingest names the artifact’s origin — repository, path inside it, the local file, and the commit the bytes were read at:

    atlas-stage ingest --db toy-sailboats.db --unit toy-sailboats-001 \
      --repo toy/sailboats --path notes/ballast.md --file toy-notes/ballast.md \
      --commit 0000000000000000000000000000000000000001 --kind prose
    

    Repeat for rudder.md and hull-wax.md. Each prints {"item_id": …, "unit": "toy-sailboats-001", "source": "toy/sailboats:notes/ballast.md@0000…"}. Writes at this stage are unmediated — sensitivity is recorded, not enforced — because nothing staged is searchable yet. Enforcement happens at classification and at the gates.

Step 4: run classification

Classification in this surface is declared by the producer and composed by staging: you supply the source-native classification segments — byte ranges of the artifact, each with a sensitivity from the four-level ladder — and staging splits the artifact at those boundaries and persists one classification record per chunk. Classification may only change at a declared boundary; undeclared or uncertain text fails closed.

  1. Write a segments file for the ballast note. This toy file declares its whole text as one personal segment (byte offsets are illustrative; a real producer computes them from its own boundary detection):

    [ { "start": 0, "end": 86, "sensitivity": "personal", "certain": true } ]
    

    Save it as ballast.segments.json. Segment files are parsed strictly: a missing or mistyped field, or an unknown sensitivity name, is an error — never a silent default.

  2. Re-stage the note as a classified artifact by adding --segments:

    atlas-stage ingest --db toy-sailboats.db --unit toy-sailboats-001 \
      --repo toy/sailboats --path notes/ballast.md --file toy-notes/ballast.md \
      --commit 0000000000000000000000000000000000000001 --kind prose \
      --segments ballast.segments.json
    

    The chunks are now boundary-safe — they partition the source exactly and never cross the boundary the classification was cut on — and each chunk carries its persisted classification record (actor atlas-stage, method boundary-split). A record that later reads back malformed or unrecognized resolves to secret-bearing: fail closed, every time. The corpus-wide remainder sweep that classifies unclassified content in an existing corpus database is a different tool — atlas-classify — and is not run against a staging database.

Step 5: inspect what is staged

  1. List the unit’s items:

    atlas-stage items --db toy-sailboats.db --unit toy-sailboats-001
    

    One JSON object per item: id, unit_id, kind, source, sensitivity, chunks, meta. Check the chunk counts and sensitivities are what you declared before going further — promotion is the point of no return for this unit.

  2. Check the registry’s view, and which units are still open:

    atlas-stage lookup --unit toy-sailboats-001 --registry toy-registry.db
    atlas-stage units --registry toy-registry.db --state open
    

    An unknown unit in lookup is an error (no staging unit "&lt;unit&gt;" in the registry, exit 1) — check the spelling against units output rather than re-provisioning.

Step 6: promote through the gates

Promotion is the aggregator’s embed-at-promotion step, and it is gated twice over.

  1. Run the promote verb. It needs the embedding model and the ONNX runtime, resolved exactly as atlas-search resolves them (ATLAS_MODEL_DIR / ATLAS_ORT_LIB); a missing model or runtime is a loud exit-1 error, before anything is written:

    atlas-stage promote --registry toy-registry.db --unit toy-sailboats-001 \
      --shard-dir toy-shards --topic codeconfig
    

    What happens, in order: the unit’s staged chunks are read in staging order; oversize chunks are split at line boundaries into context-fitting pieces that partition the text exactly (identical piece texts are embedded once); every piece is embedded document-side, prompt-free, with the mandated model; a new core scan shard is written into toy-shards/ with its self-describing manifest stamped with the embedding-model identity; and the unit’s own database is stamped with that provenance. Default --topic is codeconfig; pass your own for a notes batch.

  2. Understand the M6 model gate, which the registry transition then applies: the unit promotes only when its database’s recorded atlas_manifest.embedding_model equals the mandated model (EMBEDDING_MODEL_ID = snowflake-arctic-embed-m-v2.0). This is the one-model rule — vectors from different embedding models are not comparable, so a shard of unknown or wrong-model provenance must never join the searchable set. On success the registry writes the merge manifest (rows in, rows promoted, content hash, embedding model, timestamp — the durable audit record), branches the staging database as the unit’s archive, and moves the unit to merged. The promote verb prints {"unit": …, "shard": …, "shard_path": …, "items": …, "chunks": …, "dims": …} — expect dims 768.

  3. Understand the batch gate, the second gate, which judges a batch (a staging unit, or one increment of a long-lived unit) through five ordered stages: write → classify → dedup → provenance check → publish. Its record — persisted in the registry’s gate_records table — holds per-stage verdicts with input hashes, row counts, and row ids, never content. The rules that matter here:

    • A stage with no recorded verdict has not passed, and verdicts are recorded strictly in order — no stage can be judged before its predecessor passed.
    • Each failure carries exactly one enumerated reason code, bound to its stage: write_invalid / write_bypass (write), classify_unresolved (classify — this is where undeclared or contradictory classification stops a batch), dedup_undispositioned (dedup), provenance_unresolvable (provenance check), publish_partial (publish). A skip verdict exists only where the design allows it (write on an empty batch; publish with zero survivors and nothing pending), always with its own reason, and never yields a publish manifest.
    • Batch states run open → closing → gated → published, or quarantined. The same reason code three times (STRIKE_LIMIT = 3) marks the batch needs_review and stops automatic retries. A retry resumes at the failing stage — except a write failure, which re-enters at write — and if an earlier stage’s input changed, every verdict from the earliest changed stage on is discarded: changed bytes never inherit a verdict obtained for different content.

Step 7: verify the content is searchable

  1. Confirm the unit left the active states:

    atlas-stage units --registry toy-registry.db --state merged
    

    The unit appears here, and no longer under --state open. Promotion also closed the staging database to further writes: the provenance stamp adds the manifest table, so the database no longer passes the exact five-table v1 schema check — staging into it again is refused by design.

  2. Search for the toy content against the new shard. The shard fan-out is experimental and off by default; point atlas-search at the shard directory explicitly, in vector mode (the fan-out serves the vector branch from the shards; full-text stays on the monolith backend, which has never seen these notes):

    atlas-search search 'how does a toy sailboat stay upright' \
      --shards dir:toy-shards --mode vector --k 5
    

    The ballast note’s chunk should be the top hit. In production the promoted shard joins the service’s discovered shard set by existing — discovery reads each candidate shard’s manifest and cross-checks its model identity — after which the same query through the ordinary surfaces finds it too. See Tutorial: search the corpus three ways.

What a refused promotion looks like

A refused promotion is loud and leaves the unit unpromoted — there is no partial state in which some chunks became searchable. atlas-stage promote exits 1 with atlas-stage: &lt;message&gt; on stderr. The M6 refusals are: a wrong model recorded (the message is the comparability rule — vectors from different embedding models are not comparable), no model recorded (provenance unknown), and an empty unit. A batch-gate refusal instead leaves a gate record: the batch sits in quarantined with the failing stage’s reason code recorded, its staging database untouched (quarantine is a state, not a deletion), and after three strikes on one reason code it is flagged needs_review for a human. Fix the cause — re-declare the classification, repair the provenance, re-stage the content — and retry; the gate resumes at the failing stage.

What dead letters look like

Dead letters belong to the sweep surface (atlas-sweep), not to atlas-stage: in the periodic source sweep, a candidate that fails three times (DEAD_LETTER_STRIKES = 3) is dead-lettered rather than retried forever. They are operated on directly:

atlas-sweep --state-dir &lt;state-dir&gt; dead-letter list
atlas-sweep --state-dir &lt;state-dir&gt; dead-letter retry &lt;ref&gt;
atlas-sweep --state-dir &lt;state-dir&gt; dead-letter drop &lt;ref&gt;

list prints one reference per line (an empty store prints nothing and exits 0); retry and drop are silent on success. The distinction to keep: a gate quarantine is a batch held before publish with its audit record attached, resumable at the failing stage; a sweep dead letter is a source candidate set aside by the scheduler after repeated failure, resumable only by an explicit retry. Neither deletes anything.

Tutorial: give an agent the Atlas MCP server

Source: pkgs/atlas-search/worker/src/index.ts, pkgs/atlas-search/worker/src/mcp.ts, pkgs/atlas-search/worker/src/space.ts, and home/common/mcpx-settings.nix (issue #8625). Provenance only — this chapter is complete without following it.

This tutorial wires one agent to Atlas through MCP (the Model Context Protocol, the protocol agents use to call external tools). By the end the agent can call one tool, search, over Drew’s unified Atlas index. There is no per-agent account to create and no second search path to configure: the MCP endpoint and the Worker’s REST search share one execution path, one cache, and one pinned ceiling. For the underlying surfaces see The Atlas MCP server and The Worker HTTP API.

What you are connecting to

The endpoint is the Atlas Cloudflare Worker’s MCP route:

POST https://atlas-search.developing-today.workers.dev/mcp
  • Transport: stateless Streamable HTTP. There is no session to open or keep: no session id is issued, required, or read, and there is no streaming (SSE) response mode. Each HTTP request carries one JSON-RPC message, or a batch (a JSON array) of messages, and is answered with a plain JSON response.
  • Methods: POST only. A GET to /mcp returns 405 with an Allow: POST header — and that method check runs before the gate, so an unauthenticated GET gets 405, not 401.
  • Server identity: name atlas-search, version 0.1.0. Supported protocol versions are 2024-11-05, 2025-03-26, and 2025-06-18; an unsupported version in initialize falls back to 2025-03-26.
  • Tools: exactly one, search. Cache purge and cache inspect are deliberately not MCP tools — purge is a write, and inspect is an operator and audit surface. Both stay on the gated REST routes.

The Worker itself holds no corpus credentials. On a cache miss it forwards the search to the laptop service through its tunnel hostname, presenting its own service identity. If that service is unreachable the Worker returns 502 and caches nothing beyond a possibly stored embedding.

Step 1 — Present the gate token

Every gated Worker route — /mcp, /v1/search, /v1/cache/inspect, and /v1/cache/purge — checks the same shared secret. Its name on the Worker side is GATE_TOKEN. No token value appears in this book, in the mcpx configuration, or in the Nix store.

Present it on every request as an exact bearer header:

Authorization: Bearer <GATE_TOKEN>

The prefix check is the exact, case-sensitive string Bearer followed by a space. Anything else is treated as no token presented. The comparison is constant-time by construction: both the presented token and the configured token are SHA-256 digested and the two 32-byte digests are XOR-folded; they match only when the fold is zero. A missing token, an unset GATE_TOKEN on the Worker, or any mismatch returns 401 with code unauthorized and message missing or invalid gate token.

Where a client keeps the token depends on the client:

  • A direct HTTP client keeps it in its own secret store or environment, never in a checked-in config file, a prompt, or a tool argument.
  • The known production client, the laptop’s mcpx daemon, keeps it in the daemon’s environment. The mcpx configuration contains only an environment expansion (next step); the daemon expands it at runtime from the environment supplied through its environment file, so the value never lands in the rendered configuration or the Nix store. On the client side that expansion is named ATLAS_SEARCH_GATE_TOKEN in the mcpx settings — it is the client-side name for the same gate token, not a second credential.

There are no per-route, per-caller, or per-agent tokens on this endpoint. A valid gate check yields a boolean and nothing else, so every MCP caller is the same identity to the Worker (see Step 5 for what that identity can see).

Step 2 — Register the server in mcpx as the remote atlas server

mcpx is the MCP aggregation daemon on the laptop: agents talk to mcpx, and mcpx talks to each registered server. The Atlas entry is a remote (URL) server, not a local process. Its shape in home/common/mcpx-settings.nix — a pure data file that the mcpx Nix module renders to the daemon’s configuration — is:

"atlas" = {
  url = "https://atlas-search.developing-today.workers.dev/mcp";
  auth = {
    type = "bearer";
    token = "\${ATLAS_SEARCH_GATE_TOKEN}"; # shape only: env expansion
  };
};

Read the shape, not the spelling of any value:

  • The server name is atlas. Agents address the tool through that namespace.
  • url is the Worker /mcp endpoint above. There is no local command, working directory, or environment block for the server process, because there is no local process.
  • auth.type is bearer, and auth.token is an expansion reference, not a literal. Do not replace the expansion with a pasted value, and do not edit the rendered configuration file by hand — it is a link to the file rendered from the Nix settings, so a hand edit does not reach the daemon durably.

After changing the settings, apply them the normal home-configuration way for the laptop and restart or reload mcpx as that configuration requires, then confirm the daemon started with the expansion present in its environment. If the expansion is missing, expect every Atlas call to fail at the gate with 401; that is the gate working, not a search failure.

For a client that is not mcpx, register the same three facts in that client’s own remote-server format: the /mcp URL, bearer auth, and the token supplied from the client’s secret or environment store.

Step 3 — Make a first tools/list call

Before searching, ask the server what it offers. Send an initialize first if your client does not do it for you, then tools/list:

{ "jsonrpc": "2.0", "id": 1, "method": "initialize",
  "params": { "protocolVersion": "2025-03-26" } }
{ "jsonrpc": "2.0", "id": 2, "method": "tools/list", "params": {} }

Both go as POST bodies to the /mcp URL, with the gate header from Step 1. A message with no id property at all is a notification: it is never executed and never answered, and a request made only of notifications returns 202 with an empty body. That rule includes tools/call — a search sent as a notification does nothing.

A correct tools/list result contains exactly one tool:

{ "tools": [ {
  "name": "search",
  "inputSchema": {
    "type": "object",
    "properties": {
      "query": { "type": "string", "description": "The query text." },
      "k": { "type": "integer", "minimum": 1, "maximum": 50, "default": 10,
             "description": "Maximum number of results to return." }
    },
    "required": ["query"]
  },
  "annotations": { "readOnlyHint": true, "destructiveHint": false,
                   "idempotentHint": true, "openWorldHint": false }
} ] }

The description returned with the tool states the operating facts in one place: it searches the unified Atlas index, runs under the hosted surface’s pinned disclosure context (hosted-per-user) and sensitivity ceiling (personal), returns the search envelope with per-hit provenance and the effective ceiling the service enforced, and serves a repeat query from cache. If tools/list returns more than this one tool, you are not talking to the Atlas Worker described here.

Common failures at this step: no gate header or a malformed bearer prefix gives 401; a non-POST request gives 405; a body over 64 KiB gives a JSON-RPC -32600 error; an unknown method gives -32601.

Step 4 — Make a first tools/call

Call the search tool with a toy query of your own — pick words you expect to occur in your own recent work, not text copied from anyone else’s corpus:

{ "jsonrpc": "2.0", "id": 3, "method": "tools/call",
  "params": { "name": "search",
              "arguments": { "query": "queue broker lease", "k": 5 } } }

Behaviour to expect:

  • query is required and must be a string. It is normalized before use (Unicode NFC, trimmed, every whitespace run collapsed to one space; case is preserved). A query that is empty after normalization fails with JSON-RPC -32602 and message arguments.query must not be empty; a non-string query and an unknown tool name also fail with -32602.
  • k is clamped, not rejected: only a JSON number is honoured, it is floored, and the result is clamped to 1–50. An absent, non-numeric, or non-finite k becomes the default, 10.
  • On success the JSON-RPC result has isError: false, a structuredContent field carrying the search envelope verbatim, and a content array whose single text item is that same envelope as a JSON string. The envelope carries cache (miss on the first call, hit on an identical repeat), the cache key, the normalized query, the result list with per-hit provenance, and meta with the embedding model Snowflake/snowflake-arctic-embed-m-v2.0, dims: 768, timings, and hit count.
  • On a search failure the HTTP status stays 200; the failure is carried only by isError: true and the embedded error payload, with no structuredContent. Do not treat HTTP 200 alone as a successful search.

Run the identical call a second time. The second result should report cache: "hit" and return the same result list. That is not a coincidence of this tool: an MCP search and a REST POST /v1/search for the same normalized query and same clamped k share one Durable Object cache entry, because both call the same execution path.

Step 5 — Understand the pinned personal ceiling

The ceiling is the highest sensitivity a search may return. The ladder, lowest to highest, is shareable, personal, local-only, secret-bearing. What this surface may ever search under is pinned in the Worker’s source as a compile-time constant:

  • Ceiling: personal.
  • Disclosure context (the destination-surface half of the model, which intersects with the ceiling and can only narrow it): hosted-per-user, whose ceiling is also personal.

No environment variable, request field, or header can change either value. Neither the REST body nor the MCP tool schema has a field for a ceiling or a context, so an agent cannot ask for more and cannot be granted more through this door. In practical terms:

  • The agent can see shareable and personal material, with sensitivity and disclosure filters applied inside the branch queries, before any ranking — not filtered out of a finished ranking afterwards.
  • It cannot see local-only or secret-bearing material at all through this surface: such chunks are not returned, counted, or down-ranked into visibility. Content marked excluded_personal_life is ineligible in every context.
  • The pin is enforced twice. The Worker states personal and hosted-per-user on every call to the laptop service, whose cf-worker client cap is also personal; then, before anything is cached, the Worker verifies the service reported effective_ceiling as personal and refuses with 502 if it did not. A result computed above personal can therefore never enter the cache. The ceiling and context are also fields of the cache key itself.
  • All MCP callers share this one hosted identity. Per-agent identity stamping, per-agent ceilings, corpus scoping, and a query audit log are later slices of #8625 and are deliberately not improvised in the current endpoint. If an agent needs a higher ceiling, the answer is a different, named surface with its own cap — for example a local client identity on the laptop service — not a flag on this one. See Sensitivity tiers and client ceilings.

Step 6 — Verify with /v1/cache/inspect

Verification uses the operator route, not an MCP tool. After the two identical searches in Step 4, inspect that query:

GET https://atlas-search.developing-today.workers.dev/v1/cache/inspect?query=queue%20broker%20lease&k=5
Authorization: Bearer <GATE_TOKEN>

The query parameter is required; k is optional, defaults to 10, and is clamped the same way as everywhere else, so pass the same k you searched with — a different k is a different cache entry. The route is gated: without a valid token it returns 401. A missing query parameter, or one that is empty after normalization, returns 400.

A healthy verification after one miss and one hit returns metadata like this (values are the shape, with a toy query):

{ "key": "<64-hex-character cache key>", "query": "queue broker lease",
  "exists": true, "k": 5,
  "has_embedding": true, "embedding_dims": 768, "embedding_valid": true,
  "has_result": true, "result_bytes": 1234,
  "hit_count": 1, "embed_ms": 0, "search_ms": 0 }

Check four things:

  1. exists: true and has_result: true — the fill completed and a result is stored.
  2. has_embedding: true, embedding_dims: 768, and embedding_valid: true — the stored embedding is in the pinned Snowflake space (768 finite components). A wrong-space embedding is refused before storage, so a stored invalid embedding should never appear here.
  3. hit_count matches the number of repeat calls you made — 1 after the second identical search above. It counts hits served from this entry, and it is the proof the repeat did not re-run the laptop fan-out.
  4. The key is the same key the search envelope reported. Inspect returns metadata only: it never returns the result body or the embedding vector, only their presence, dimensions, validity, and byte size.

If exists is false, the query and k you inspected do not name the entry you searched — most often because the raw query normalized differently than you expected, or because k differed. Search again, copy the key and normalized query from that envelope, and inspect those exact values. If inspect shows an embedding but no result, the last fill stored the embedding and then failed at the search step; the next identical search will retry the search without re-embedding.

You are done when tools/list shows the single search tool, a tools/call returns isError: false with a personal effective ceiling in its envelope, a repeat returns a cache hit, and inspect confirms the entry as above. For how this surface fits the other consumers, see Consumers: fleet, agents, memory and ID and The service and the Worker.

Tutorial: run the golden set and read a gate

Source: pkgs/atlas-search/crates/atlas-core/src/eval.rs, pkgs/atlas-search/crates/atlas-core/src/bin/atlas-eval.rs, pkgs/atlas-search/eval/README.md, pkgs/atlas-search/eval/eval3.py, and pkgs/atlas-search/eval/gate-5733-results.md (issues #5741, #5733). Provenance only — this chapter is complete without following it.

This tutorial runs Atlas’s offline evaluation twice: once with the atlas-eval harness over saved rankings, and once with the recorded Jaccard gate script, whose correct verdict is FAIL. A golden set is a fixed, judged query set for a corpus — queries whose relevant documents (the qrels, query relevance judgements) are recorded in advance, so a ranking can be scored without asking a human each time. The point of the tutorial is not the numbers themselves. It is the discipline the numbers enforce, stated at the end: a change ships on its eval result, not on being finished. The programme behind this is in Evaluation: golden sets and gates; the command surface is in atlas-eval.

Before you start: two runners, two jobs

Atlas has two evaluation runners, and confusing them produces meaningless comparisons.

  • atlas-eval (the #5741 harness) scores saved rankings offline. It generates no rankings, loads no model, opens no database, and makes no network calls. Dense, BM25 (the full-text ranking function), SPLADE (a learned sparse signal), and fused rankings all enter it in the same format, so the ablation matrix — each signal alone and in combination, with and without a rescore — is measured, not argued.
  • eval3.py (the Python reference runner) produces rankings against a real corpus for the golden-311 set and scores them by gold chunk ids. The gate script in Step 4 is built on its functions. Its hybrid configuration is a bake-off-era configuration (see Step 3), not the shipped service configuration.

Golden-311 itself: 311 queries in pkgs/atlas-search/eval/fixtures/golden-311.json, frozen 2026-10-26 against the merged corpus of 101,471 chunks and 18,116 sessions. Its corpus fingerprint is the SHA-256 of the concatenation of content_hash values for chunks with id % 997 = 0. Each query records its text, a category (for example exact-fact), all its gold chunk ids, and its session ids. Questions were written from a short summary of the gold chunk, not mined by checking a hint verbatim first. Treat the set and its corpus as frozen: if the corpus guard below aborts, you are not looking at the corpus the set was judged against, and no score from that run is comparable to any recorded row.

Step 1 — Run atlas-eval on an eval document

The invocation has two positionals and no flags:

atlas-eval <eval.json> <dev|test>

--help, -h, and help are not recognised; each prints the usage line to stderr and exits 2. An unreadable file, invalid data, or an evaluation failure exits 1. Success prints one atlas-eval-report/v1 JSON report to stdout and exits 0, byte-identical on every run for the same input.

The input is one atlas-eval/v1 document:

{ "format": "atlas-eval/v1",
  "queries": [{ "id": "q1", "class": "code", "split": "dev", "text": "..." }],
  "qrels":   [{ "query": "q1", "doc": "chunk-1", "grade": 2 }],
  "runs":    [{ "signal": "dense", "results": { "q1": ["chunk-2", "chunk-1"] } }] }

Grades are unsigned, maximum 30; a document is relevant when its grade is at least 1, and an unjudged document scores 0. Rank order is the whole contract — no raw scores are needed. A run with no entry for a query scores that query as an empty ranking: incomplete runs are penalised, never skipped. Validation rejects a wrong format version, duplicate query ids, qrels or runs naming unknown queries, duplicate (query, doc) qrels, grades above 30, duplicate documents inside one ranking, duplicate result keys inside one run, and duplicate signal names, before any scoring happens.

To score golden-311 with this harness, first produce an eval document whose queries and qrels are golden-311’s gold chunk ids (binary gains in the gate’s use: a gold id is relevant, everything else is not) and whose runs are the saved rankings you want compared — for example the current production hybrid’s ranking per query, saved from a retrieval run. Then score the split you are iterating on:

atlas-eval golden-311-eval.json dev

Score dev while iterating. The test split is the held-out set: score it once, at decision time. The library’s select_best_signal function — the supported way to pick a winner — refuses a test-split report outright, because picking parameters against the held-out set destroys what it is held out for.

Step 2 — Read the report: nDCG@10, Recall@100, MRR@10

The report carries, per signal, means over the queries that have at least one relevant document (reported as queries_scored), overall and sliced per query class (code, documentation, error, concept, and so on). Each per-query record preserves the run’s top-1000 document ids and the query’s judged grades, so any number in the report can be recomputed from the report alone.

FieldMetricHow to read it
ndcg10nDCG@10Normalised discounted cumulative gain over the top 10 ranks. Gains are graded, 2^grade − 1, discounted by log2(i + 2) at 0-based rank i, and normalised against the ideal ordering. This is the ranking-quality number: it rewards putting highly relevant documents early.
recall100Recall@100The fraction of the query’s relevant documents found in the top 100 ranks. This is the retrieval number: a document outside the candidate pool can never be ranked, fused, or rescored into the answer.
recall1000Recall@1000The same fraction over the top 1000 ranks. The gap between Recall@100 and Recall@1000 shows how much relevant material exists deep in the ranking that a wider pool or a reranker could in principle recover.
mrr10MRR@10Mean reciprocal rank over the top 10: 1 / rank of the first relevant document, 0 when none appears in the top 10. This is the first-answer number: it moves only when the first relevant result moves.

Read them in that order of causation, not in order of size. If Recall@100 fell, the problem is retrieval — pool depth, the branch signals, the filters — and no ranking change downstream will fix it. If recall held and nDCG@10 or MRR@10 fell, retrieval found the material and ranking buried it. Always read the per-class slices before the overall mean: an overall gain bought by a collapse in one class (for example error queries) is not a gain the overall number is entitled to claim, and the class slices are where a planner or signal change is supposed to prove itself.

A worked reading, with invented toy numbers: signal A reports ndcg10: 0.410, recall100: 0.82, mrr10: 0.390; signal B reports ndcg10: 0.425, recall100: 0.82, mrr10: 0.401, with no class slice down. Same recall, better ordering — B is a ranking improvement over A on this split. If B instead reported recall100: 0.79, the higher nDCG would not rescue it: B retrieves less, and on queries where the relevant document never enters the pool its ranking quality is irrelevant.

Step 3 — Compare against the recorded production rows

Golden-311 has two recorded production-hybrid rows. They are both real, they differ, and they differ because their configurations differ. A comparison that does not name its configuration is invalid.

RowConfigurationRecorded result
Bake-off best row, 2026-10-31One-stage hybrid, reciprocal rank fusion (RRF) at k = 10, pool 100 per branch — the configuration the shipped service uses189 hits@10 / MRR 0.3894
Gate sanity row (see Step 4)Python reference hybrid at branch depth 30, RRF k = 60, query vectors truncated to 384 dimensionsRecall@10 183/311, MRR 0.3640

Three naming traps sit inside that table, and the sources themselves fall into them in places:

  • RRF k is 10 in the shipped service and 60 in the Python eval lineage. eval3.py’s hybrid fuses top-30 branches at k = 60. A score produced by the eval lineage is not a score of the production configuration, even when a document calls it the production hybrid.
  • Hits@10 / Recall@10 over 311 is a count, not one of the harness metrics. 189 hits@10 means 189 of the 311 queries had a gold chunk in the top 10. It is comparable to the gate row’s 183/311, and to nothing in an atlas-eval report until you convert deliberately.
  • Truncation differs. The shipped default is full width (768 dimensions); the gate row is a 384-dimension number. Dimension count is part of the configuration.

So the comparison procedure is: state your run’s mode, pool or branch depth, RRF k, and truncation; pick the recorded row with the matching configuration; compare like with like. If no recorded row matches your configuration, your run establishes a new row — record it with its configuration, and do not claim it beats or matches production.

Step 4 — Run the gate-5733 script and read its FAIL

The gate script pkgs/atlas-search/eval/gate5733.py is the held-out gate for the Jaccard rescore (#5733): a third signal that compares token-shingle overlap (sets of 5-token shingles, hashed and compared by Jaccard similarity, the size of the intersection over the size of the union) between the query and each fused candidate, applied only as a rescore over the fused candidate union — never as a retrieval scorer. The gate asks whether turning that rescore on meets two bars agreed before measuring.

Its shape, in outline:

python3 pkgs/atlas-search/eval/gate5733.py
# constants in the script: corpus ~/atlas/v3/corpus.db,
# vectors ~/atlas/v3/vec-snowflake.db, table vec_snowflake_m_v2_768_f32,
# query cache ~/atlas/v3/qcache-snowflake.npy,
# rescore depth 100, near-exact threshold 0.60,
# output /tmp/gate5733-results.json; recorded runtime ~19 min on the laptop

Do not skip the sanity gate inside it. Before any gate number was trusted, the script’s base pipeline — the Python reference hybrid: Snowflake truncated-384 cosine plus FTS BM25, RRF k = 60, using eval3.py’s own functions — was run at branch depth 30 and reproduced the recorded production-hybrid numbers for golden-311 exactly (Recall@10 183/311, MRR 0.3640, the second row in Step 3). A gate whose base pipeline cannot reproduce a known row measures nothing. The rescore implementation in the script is likewise a port of the shipped Rust rescore_fused, pinned against the Rust test vectors before measuring.

The two test sets are the general golden-311 and a held-out near-exact set, eval/fixtures/heldout-nearexact-54.json: 54 queries, each a verbatim 30-token passage sampled deterministically from a corpus chunk, with that chunk as its single gold. The recorded run (2026-11-17) disclosed its corpus caveat in its own results file: the local corpus copy held 101,339 of the frozen 101,471 chunks, with 132 chunk ids absent including one gold chunk — every golden-311 query kept other gold chunks present, so all 311 scored, but a future rerun should use a bit-exact frozen corpus. Copy that habit: a gate run that does not disclose its corpus state has not finished reporting.

The recorded verdict table:

SetMetricRescore offRescore onBarResult
Near-exact (54)MRR@100.56350.5997Gain at least +0.10+0.0361 — FAIL
General (311)nDCG@100.40970.4080Regression at most 0.010.0017 — pass

Read the verdict correctly:

  • The gate’s verdict is the conjunction of its bars. One bar passed and one failed, so the gate failed. The correct summary is not “the rescore helps a bit” and not “it passed on the general set”. It is: FAIL — the near-exact bar was not met.
  • The consequence was mechanical, not a matter of taste: jaccard_depth stays 0 in the versioned query parameters, which is off, and no production ranking change was made. The shipped default still records that outcome today.
  • The diagnostics explain the failure and are part of the verdict: the near-exact tier (Jaccard at least 0.60) fired in only 4 of 54 near-exact queries and 0 of 311 general queries; the gold chunk was already in the top-100 candidate union for 50 of 54 near-exact queries and in the top 10 for 43 both ways; per-query MRR improved for 7 queries and worsened for none. The standard blend did quiet good, but a 30-token passage compared against a long chunk’s full shingle set is capped far below 0.60 by set-size geometry alone — the signal as designed cannot deliver a +0.10 gain at that threshold on real chunk lengths. A failed gate with a diagnosed reason is a successful experiment; shipping anyway would have been the failure.
  • The verdict is about raw set-overlap geometry, not about the lexical signal family. It neither validates nor undermines SPLADE, whose adoption rests on its own ablation through the #5741 harness — and no SPLADE gate has run: there is no SPLADE encoder, postings table, or run in the repo to score.

If you rerun the gate, expect the same discipline: reproduce the sanity row first, keep depth 100 and threshold 0.60 unless the change under test is exactly one of those, and report both bars with their arithmetic (0.5997 − 0.5635 = 0.0361, against a bar of 0.10) rather than a bare pass or fail.

Step 5 — Apply the shipping rule

The rule this tutorial exists to teach, in the programme’s own terms: a model, chunker, fusion, reranker, or planner change makes its cutover on eval result, not on completion.

  • Finished code is not evidence. “The implementation is done” is a statement about work, not about quality, and it carries no weight in a shipping decision.
  • The evidence is a gate run: a named golden set, a named configuration, pre-agreed bars, a sanity reproduction of a recorded row, and a disclosed corpus state. Bars are set before measuring; a bar moved after seeing the numbers is not a bar.
  • A FAIL verdict has a mechanical consequence — the feature stays off, the default stays unchanged, the change does not ship — as jaccard_depth: 0 records for #5733. Filing the diagnosis and moving on is the correct outcome of a failed gate.
  • A PASS is scoped to what was measured: that signal, that configuration, that corpus, those query classes. It is not a general claim about the technique, and it does not transfer to a different model, threshold, or corpus without a new run.
  • The held-out discipline is part of the rule: iterate on dev, score test once at decision time, and never tune against the set you will cite as proof.

When you write up any Atlas ranking change, write the gate table first — set, metric, off, on, bar, result — and let the shipping sentence be whatever that table forces it to be. For the reference details of the runner itself, see atlas-eval.

Design: automatic ingest of all sources

Design — not shipped. This chapter describes a target system that does not exist yet. Nothing in it should be read as working behaviour. Tracking: #9097 Workstream E (automatic ingest, open and blocked), #5670 (migration of the ingest scripts into the code repo, open), #7969 (the recurring sweep runner, unbuilt). The pipeline stages it builds on are tracked separately: ingest-gate promotion #6057, per-batch attestation #6045, ID publication #6062. What actually exists today is stated only in the final section, What exists today, and in Ingest today: staging, classification, promotion.

Atlas today is a snapshot: a corpus collected by hand-run scripts and frozen at its last publish. The design goal is the opposite property — a corpus that stays current by itself, because every source Drew produces flows in continuously, under the same classification and promotion discipline, with deletions propagating as reliably as additions. “All sources” means the target list below, not a rhetorical all: a source is in scope when it is named here or added by the sources-inventory pass, and each source enters only under the tier machinery — classification before promotion, never after.

The target source list

Queue and project-management data

The fleet queue and broker data (tasks, sessions, claims, parks, dispositions) and the project-management stack data (aggregator state, boards, reconcile records). Holder: the queue broker’s database and the PM stack on the laptop. Designed shape: event hooks where the source supports them, scheduled sweeps otherwise, delta-only via broker watermarks. Content is operational data, internal tier by default; a session transcript attached to a task inherits the session classification rules, not the task’s.

All GitHub, for all orgs

All issues, pull requests, commits, and files, for all orgs and repos in scope — the estate is 102 admin orgs by fleet records, accessed only through the gh CLI and REST (the GitHub connector is banned by standing rule).

State against that target, precisely: comments are in — the extraction for issue and pull-request comments across the estate is done (#6023 closed, the ingestion writer #10688 landed, and the atlas-github-comments binary ships in atlas-core). What is missing is everything else as first-class objects — issues and pull requests themselves, not only their comments; commits; repo files beyond a partial first pass — and any continuous delta mechanism in place of one-shot extraction (the designed shape is webhook-driven where possible, or ETag and since-cursor sweeps otherwise).

The external half of GitHub — repos Drew interacts with but does not own — is gated, and the gate is policy, not engineering: licensing research #6024 and the three-zone external-content policy #6052, both open. A candidate external set has been enumerated (31 candidate repos, from fork upstreams, account activity, and dependency manifests), and per-repo licence capture at ingest is already built — but no external content is ingested until the licensing and zone questions are answered. Design may proceed; external ingestion may not be built ahead of the gate.

All Muse data

All Muse conversations and data: the main chat and side chats, the memory tree, and artifacts and documents produced for Drew. No connector issue exists for this source yet, and no export or API mechanism is recorded on any issue — designing that mechanism is part of this workstream, not a detail to assume. Until the mechanism is designed, Muse material reaches Atlas only insofar as transcripts happen to land in stores the existing client adapters already read. The sources-inventory pass (below) is where the mechanism gets decided.

All OpenCode sessions

All OpenCode sessions from the laptop’s session store, plus OpenChamber session data, which shares that store. Designed shape: the session-close hook (a designed trigger that stages a session when it ends — not built today) or a sweep over the session store. One question inside this source is explicitly undecided and must not be silently decided by an implementer: whether to ingest thinking traces — the model’s internal reasoning recorded with a session. #9097 files it as an investigation requiring a recommendation covering volume, value, and classification implications. Drew decides it; this design records it as open.

All ID objects

All objects from the ID system (Drew’s identity and object-graph programme), whose stores are its own laptop and hosted databases. The designed direction today runs the other way — Atlas objects publishing into the ID graph, via the #6062 publication format and the projector set #11182–#11186, all open and unstarted. This workstream asks for the reverse flow as well: ID objects into Atlas search, with automatic vectorization of ID content feeding ID’s own search. Neither direction is built. See Design: search integration for fleet and ID.

The sources-inventory pass

A standing inventory whose job is to make “all” checkable: anything it finds that is missed gets its own connector issue. The first pass must disposition at least:

  • Zettel / notes — the two Zettelkasten repos (Emanote-based) and Drew’s notes generally.
  • Fleet Reports — the Fleet Reports Space records.
  • The ask-ledger — the ledger logs of questions asked and answered across the fleet.
  • Quota and burn records — provider quota and usage records, which are also the statistics source class in embryo.
  • Laptop state stores — the state directories of the laptop’s services and agents, inventoried store by store rather than swept wholesale.

Two memory connectors from the memory-integration programme belong to this pass’s family and are already filed: #8622 (corpus registry plus the memory-lancedb connector — OpenClaw’s local memory store as the first external corpus connector) and #8626 (the remaining corpus connectors: memory files, notes, repo docs, research reports).

Gmail — a future source only

Gmail is named here for exactly one reason: so that its absence from the pipeline is a recorded decision, not an oversight. Drew has paused all Gmail background checks (2026-11-22), regardless of connection state. This design therefore does not design a Gmail pipeline — no collection shape, no cadence, no classification rule beyond naming it a future source that would be personal or local-only tier by default if it were ever unpaused. Any future mail ingest needs both reconnection and Drew lifting the pause, as its own decision.

Standing constraints on every source

  • Tier assignment happens at ingest, per source class, under the classification manifest; a manifest can narrow access, never widen it.
  • Secret-tier content is held out of automated sweeps entirely until the local secret-tier embedder (#6059) lands. Secret text is never sent to a hosted embedder. A held source class is a queue, not a rejection — held items re-offer automatically once the route exists.
  • The keep-all rule: keep all data; only byte-identical duplicates are cleaned. Every chunk records every place it was found (its occurrences); deduplication must never silently drop provenance.
  • Adding a source class, loosening a class’s inclusion test, or running a bulk backfill beyond the runbook bound is always a human decision, even inside an otherwise automatic system.
  • Sweeps never delete. Retirement is a report a sweep surfaces; erasure happens only through the deletion mechanism below or a human decision.

The pipeline shape

Every source, whatever its holder, flows through the same pipeline. The shape is the contract; a source-specific shortcut around any stage is a defect in the source’s connector, not a simplification.

Capture: source-of-record CDC/hooks plus a reconciliation crawl

Each source is captured from its source of record — the system that owns the data — by change-data capture (CDC: consuming the source’s own change stream) or hooks where the source emits them: session-close for session stores, webhooks for GitHub, broker watermarks for queue data. Hooks alone are not trusted to be complete, so every hooked source also gets a periodic reconciliation crawl: a full or watermark-bounded re-read that finds anything a missed hook, a crashed consumer, or a restored backup would otherwise lose. The crawl is the correctness floor; the hooks are the latency optimisation.

Detection: the ladder

A crawl or hook does not mean reprocessing everything. Each candidate passes a detection ladder, cheapest test first, and stops at the first rung that settles it:

  1. Metadata — size, modification time, source watermark, or version marker unchanged: skip, at metadata cost only.
  2. SHA-256 — content hash unchanged: skip the parse and embed, at hashing cost only. This is the rung that makes continuous ingest affordable.
  3. Full process — the content actually changed: parse, chunk, classify, and embed as below.

Delta detection is span-anchored where the source supports it: a small edit re-embeds the one changed chunk, not the document. Stored vectors are keyed by the hash of the exact window text they were computed from, because the boundary-drift evidence is that a vector is a function of its exact window — reuse only byte-identical windows, and re-embed on any context change.

Per-document processing: parser, chunking, and model stamps

A changed document is parsed by its source class’s parser, chunked under the chunk-boundary policy (structural boundaries first; every declared classification boundary splits; uncertain text becomes one secret-bearing chunk rather than a guessed split), and stamped, per document and per chunk, with the parser version, the chunking policy version, and the embedding model identity and revision used. Chunk-level hashing gives each chunk its stable identity (content_hash is the join key across stores), so occurrences of the same chunk in different sources or versions are recognised as one chunk with many occurrences, never as silent duplicates.

Staging, classification, gate promotion, attestation

Processed material does not write to the corpus. It lands in a staging unit (a per-unit staging database, vectors not yet stored), where:

  1. Classification assigns each chunk its effective sensitivity and disposition. Unknown, missing, or malformed classification fails closed to secret-bearing. This happens here, in staging — classification before promotion, never after is the pipeline’s non-negotiable ordering, because promotion is the moment material becomes searchable and a post-promotion classification pass would leave a window in which unclassified material is served.
  2. Gate promotion (#6057) judges the batch through five ordered stages — write, classify, dedup, provenance-check, publish — recorded as a durable, content-free audit record (counts, enumerated reason codes, row ids, hashes; never content). A stage with no recorded verdict has not passed; verdicts are recorded strictly in order; a batch that fails the same reason three times is quarantined for human review and stops auto-retrying. Quarantine is a state, not a deletion.
  3. Attestation (#6045) binds the promoted batch to its sources with a per-batch, in-toto-shaped statement: which source versions produced which chunks, under which parser, chunker, classifier, and model stamps. The attestation is what makes a later “where did this chunk come from, and under what processing?” answerable without re-deriving it.

Only a batch that passes the gate and carries its attestation becomes corpus: embedded at promotion under the one mandated embedding model (vectors from different models are not comparable, and a unit that names the wrong model — or none — is refused), written as a new scan shard, and registered with its merge manifest.

Deletion: tombstones that propagate as one operation

Deletion is a first-class flow, the mirror of ingest. When a source deletes an item — or a repo is made private, which is a deletion for access purposes — the pipeline writes a tombstone: a durable record that this content is gone, keyed by the same content identity ingest used. The tombstone propagates across every store that can serve or recommend the content, as one operation, not four eventual cleanups:

  • the content-addressed store (CAS),
  • the full-text index (FTS),
  • the vector store,
  • the recommender’s tables.

A purge that removes a chunk from the vector store but leaves it findable by full-text search, or recommendable from a stale table, has not deleted it. Propagation covers replicas and caches on the same principle, and is policy-governed and distinct from ordinary retention retirement: retention decides how long Atlas keeps what it may keep; a tombstone records what it may no longer serve at all. The gate record and attestation for a deleted batch are not deleted — they are the audit trail that the deletion happened.

What exists today

Grounding, so the design above is never mistaken for the present:

  • Ingestion today is manual and script-driven. The only Atlas schedule on the laptop is the daily backup timer. The ingest scripts still live outside the code repo (#5670 migration open), and the recurring sweep runner is unbuilt (#7969: a runner core exists in atlas-core, but it creates and enables no schedule — cadence is an operator decision gated on Drew’s go-ahead).
  • The production pipeline is the older five-step shape — collect, normalize, index, publish, access — driven by atlas-ingest.py with per-client adapters, normalizing conversations into one local database that is the durable asset, building the FTS and vector indexes from it, and publishing a hot copy to Turso as distribution. Corpus counts consumers see are frozen at the 2026-10-31 census — 18,325 sessions, 122,124 messages, 107,639 chunks, in a monolith plus 29 topic shards (28 internal shards holding 107,001 chunks and 1 secret shard holding 638 chunks; zero public-tier shards) — while the store has since grown without a verified recount.
  • GitHub comments are the one completed new source. Extraction and the ingestion writer landed (#6023, #10688); GitHub objects, commits, files, and continuous delta have not.
  • The staging foundation is built. Per-unit staging databases with a versioned schema, a staging-unit registry, classification-at-staging with boundary-safe chunking, the batch gate’s audit record and state machine (#7709, the record half of #6057), and a one-shot embed-at-promotion command all exist in atlas-core. What does not exist is the standing machinery around them: the aggregator as a service, the session-close extraction hook, and the gate’s stage checks beyond the record they write into are later slices, not running code.
  • Traces are already a corpus source. Atlas’s own query traces, statistics, and weekly reports are ingested as a statistics-and-reports source class inside atlas-core. That is the one place where something like automatic ingest — system output flowing back into the corpus by construction — already happens.
  • Nothing else in the target list is connected. No queue/PM connector, no Muse connector, no ID projector, and no memory connector (#8622, #8626) is built; no source is captured by hooks or CDC; deletions do not propagate as tombstones. The freshness gap this design closes is, today, the single largest consumer-facing gap in Atlas: every consumer in Consumers: fleet, agents, memory and ID searches a frozen corpus.

Design: query planning

Design — not shipped. This chapter describes a query planner that does not exist yet. Nothing in it should be read as working behaviour. Tracking: #9092 (the search build-out that owns the planner), #5773 (the query front-end), #5774 (the full parameter surface). The API surface the planner would occupy already exists and already refuses to run it — see What exists today. Any behaviour described below is a design target, to be adopted only through the evaluation discipline in the final sections.

A query planner is the stage between the query as typed and the retrieval as executed. Atlas today has none: the query string goes to the full-text branch as a mechanically derived match expression and to the vector branch as an embedding of the raw text, and the two pools are fused. That works for a well-formed, self-contained query aimed at the whole corpus. It fails predictably on the queries agents and humans actually ask: a follow-up that only makes sense inside its conversation (“and what about the second one?”), a question whose words do not match the corpus’s words, a request that names a project and a date range in prose while the corresponding filters sit unused, and a compound question that is really three questions wearing one question mark. The planner is the API the current contract already pretends to have — the design below is the planner that would make that pretence true.

The pipeline shape

The planner is one stage in a longer pipeline, and its position is fixed:

query → classifier → conditional transforms → routed retrieval → fuse → rerank
         (<10 ms)      (only those selected)    (per route)        (RRF)   (separate stage)
  • Classifier first, and fast. A lightweight classifier reads the raw query (plus conversation context where the surface supplies it) and assigns a query class, an intent, and the signals the later stages need. Its budget is under 10 milliseconds: it is a small, local decision — heuristics and a small model, never a hosted call and never a large language model round-trip on the critical path. A planner whose first stage costs more than the retrieval it optimises has inverted its purpose.
  • Transforms are conditional. Each transform below runs only when the classifier’s output calls for it (see Adaptive selection). The default path for a simple, self-contained query is no transform at all.
  • Retrieval is routed. The (possibly transformed) query is sent to the branches and shards its route selects — not broadcast everywhere by default.
  • Fuse and rerank are not the planner’s job. Fusion is reciprocal rank fusion over the branch pools, as today; reranking is a separate stage with its own design (Design: the reranking stage). The planner decides what to retrieve and how to ask; it does not reorder the final ranking, and conflating the two makes both unmeasurable.

Every stage emits its decision into the query trace — the class assigned, the transforms applied, the routes taken, the filters extracted — so that any result can be explained after the fact and every strategy can be evaluated per class (below).

Components

Conversational rewriting

A follow-up query is rewritten into a self-contained query using the conversation history: pronouns and ellipses are resolved, and the topic established by earlier turns is carried into the rewrite. “What did it cost?” after a discussion of one named system becomes a query naming that system. The rewrite replaces the query for retrieval; the original text is retained in the trace, and the rewrite is a transform of the query, never of the corpus. This component is first-wave (see Minimum viable planner) because agent surfaces are conversational by default — a planner that cannot handle a follow-up fails the most common agent query shape there is.

Expansion

The query is widened with related terms — synonyms, abbreviations and their expansions, and corpus vocabulary for the query’s concepts — so the full-text branch can match documents that express the same idea in different words. Expansion feeds the lexical side in particular; the vector branch already generalises across wording, which is one reason expansion is conditional rather than universal: on a query whose terms are already corpus terms, expansion adds noise, not recall.

Multi-query and RAG-Fusion

The query is restated as several distinct queries — different phrasings, different angles on the same information need — each is retrieved separately, and the resulting rankings are fused (reciprocal rank fusion over the per-variant rankings; this fusion-of-variants pattern is RAG-Fusion). It buys recall and robustness against any single phrasing’s blind spots, at the price of one retrieval per variant. It is therefore a selected strategy for queries where phrasing risk is high, not a default multiplication of every query’s cost.

HyDE, gated to underspecified queries

HyDE (hypothetical document embeddings) generates a short hypothetical document that would answer the query, embeds that document, and retrieves by its vector — document-to-document similarity instead of question-to-document similarity. It is powerful exactly where the query is too short or too vague to embed well, and wasteful or actively misleading where the query is already specific (a generated answer to a precise factual question invents details the corpus never claimed). The design therefore gates HyDE to underspecified queries: the classifier must judge the query underspecified — few content terms, no named entity, no filterable structure — before HyDE may run. It never runs by default, and its gate is part of what its evaluation slice must prove.

Decomposition

A compound query is split into sub-queries, each retrieved on its own, with the results combined for the caller. “Which system replaced X, and what did its first release break?” is two retrievals; forcing it through as one query retrieves documents about neither half well. Decomposition is selected when the classifier detects genuinely independent information needs in one query — multiple questions, or a comparison whose sides live in different parts of the corpus — and each sub-query then flows through the same routed retrieval and fusion as a top-level query.

Step-back

The query is generalised one level — from the specific incident to the class of problem, from the named version to the system — and the generalised query is retrieved alongside the specific one. Step-back helps when the corpus answers the general question (a design record, a post-mortem pattern) but no document matches the specific phrasing. It is a supplement, never a replacement: the specific query always runs, and the step-back ranking joins it at fusion.

Routing by source, intent, and tier

The classifier’s route decides where retrieval happens:

  • By source and corpus — a query about code goes to the code shards, a memory-recall query to the memory corpora, a statistics question to the statistics source. Routing is a recall and a cost decision: shards outside the route are not scanned.
  • By intent — an exact-fact lookup, an error investigation, and a conceptual question demand different branch weights, pool depths, and transforms. The route carries those choices; the branches themselves stay generic.
  • By sensitivity tier — routing respects the caller’s ceiling as a hard boundary, exactly as retrieval does today: filters and ceilings are applied inside the branch queries, before ranking. The planner may narrow a route below the caller’s ceiling (a public-surface answer routes only to shareable material); it may never widen one. The planner is not a place where tier discipline can leak — it inherits the ceiling from the request and can only intersect with it.

Structured filter extraction

The filters the search surfaces already expose are extracted from the query text itself. fleet search and atlas-search already accept kind, topic, project, and client filters, plus since and until session dates and the max-sensitivity ceiling. Today a caller must supply them as flags; a query that says “the queue broker decision from last month in the fleet project” carries the project and the date range in prose and gets neither applied. The planner extracts them:

  • a named project, topic, kind, or client becomes the corresponding filter value;
  • a date expression (“last month”, “before the November rewrite”, a literal date) becomes a since or until bound;
  • an extracted filter is applied with the same semantics as the flag — inside the branch queries, before ranking — and is recorded in the trace as extracted, with its source span, so a wrong extraction is diagnosable as a planner error rather than a corpus mystery;
  • extraction never invents a filter the text does not support, and an ambiguous extraction (two projects named, a date that could bound either end) is left unapplied rather than guessed. A missing filter costs recall; a wrong filter costs the correct results entirely, by filtering them out before ranking.

Filter extraction is first-wave: it is cheap, deterministic enough to test exhaustively, and it converts information already in the query into the filter language the engine already speaks.

Adaptive per-query strategy selection

The failure mode this design exists to avoid is stacking: running every transform on every query because each one helped somewhere. Stacked transforms multiply latency and cost, interact in ways no single component’s evaluation predicted, and make a regression unattributable — when a stacked pipeline gets worse, nothing says which layer did it.

Selection is therefore per-query and driven by the classifier:

  • The classifier’s class, intent, and underspecification judgements select a strategy: the set of transforms to apply, the routes to take, and the branch parameters to use. A simple exact-fact query selects no transforms. A conversational follow-up selects rewriting. An underspecified query may select HyDE or expansion. A compound query selects decomposition.
  • Strategies are named, versioned configurations, not emergent behaviour — so a strategy can be evaluated, compared, and rolled back as a unit.
  • Every transform is individually defeasible: if a selected transform produces an empty or degenerate output (a rewrite that drops the query’s only named entity, a decomposition with one part), the pipeline falls back to the raw query for that branch rather than retrieving on a broken transform.
  • The trace records the strategy and each transform’s input and output identity, so the evaluation below can attribute a win or a loss to the strategy that caused it.

Evaluation sliced by query class

A planner evaluated only on an overall mean will be adopted on evidence that does not support it: a transform that helps one class and hurts another can net out positive while damaging exactly the queries it was built for. The evaluation discipline is therefore:

  • Every measurement is sliced by query class — the same classes the evaluation harness already carries on its queries (code, documentation, error, concept, and the golden set’s own categories) — and a strategy is judged on the classes it targets. HyDE is judged on underspecified queries; rewriting on conversational follow-ups; decomposition on compound queries. A gain on any other class is a side effect to be reported, not the evidence for adoption.
  • Retrieval effects and ranking effects are read separately, with the harness’s metrics in their causal order: Recall@100 and Recall@1000 gate retrieval (did the planner’s query find more of the relevant material?), and nDCG@10 and MRR@10 judge the resulting ranking. See Tutorial: run the golden set and read a gate for how those numbers are read.
  • Each strategy ships on its slice’s result, under the programme’s standing rule: a change ships on eval result, not on completion. A strategy with no slice that proves it does not ship, however elegant its design.
  • The classifier itself is evaluated as a component: its class and underspecification judgements against judged examples, with its latency measured against the 10 ms budget. A misclassification is not a neutral event — it selects the wrong strategy — so classifier accuracy bounds everything downstream of it.

Minimum viable planner, and the second wave

First wave — the minimum viable planner. Three components, in this order:

  1. Routing by source, intent, and tier — the cheapest component and the one every later component depends on for its scope.
  2. Structured filter extraction matching the existing filter surface — deterministic, exhaustively testable, immediately useful on flag-free agent queries.
  3. Conversational rewriting — the component the dominant consumer (agents in conversation) needs first.

The minimum viable planner also includes the classifier that selects among these, the trace emission that makes them attributable, and the per-class evaluation slices that judge them. A planner without its measurement is not a smaller planner; it is an unaccountable one.

Second wave. HyDE (with its underspecification gate), decomposition, multi-query / RAG-Fusion, step-back, and term expansion — each adopted individually, on its own slice, in no fixed order beyond its evidence. Second-wave status is not a judgement that these are worth less; it is a judgement that their value is conditional in ways the first wave’s is not, and conditional value is exactly what per-class evaluation exists to settle.

What exists today

Grounding, so the design above is never mistaken for the present:

  • There is no planner. Retrieval today is hybrid full-text plus vector search with reciprocal rank fusion over the two pools, and no transform stage of any kind. The query front-end and parameter surface are tracked as #5773 and #5774; the planner as part of #9092.
  • The contract already names the planner, and the code refuses it. The versioned query-parameters contract (query-parameters-v1.json in atlas-proto) carries planner_enabled: false, spell_enabled: false, query_class_hint: null, and variant: "raw" as first-class parameters, included in every result-cache key. Setting any of them to a non-default value is rejected at validation: planner and spell stages are “not implemented yet”, a query-class hint is “not implemented yet”, and a rewritten or combined query variant is “not implemented yet”. The API pretends to have a planner in its parameter file and says so, honestly, the moment anyone asks it to plan.
  • The filter surface the planner would extract into already exists. Kind, topic, project, and client filters, since and until dates, and the sensitivity ceiling are live flags on the search surfaces and are enforced inside the branch queries today — extraction is a new producer for an existing, tested consumer.
  • The measurement substrate already exists. The evaluation harness scores per query class, the query-trace store records every executed search, and the golden sets are in place — the sliced evaluation this design requires needs no new infrastructure, only planner strategies to measure.
  • The fusion the planner feeds is the shipped one: RRF at k = 10, pool 100 per branch by default, with the optional Jaccard rescore present in code but gated off by its own failed evaluation (jaccard_depth: 0). Nothing in this chapter changes any of those defaults; a planner strategy that wants a different pool or fusion setting must prove it on its slice, like everything else.

Design: layered search characteristics on Snowflake

Design — not shipped behaviour. This chapter describes a proposed design. Nothing in it should be read as how Atlas works today; the final section, “What exists today”, states the shipped behaviour it would build on. Tracking: the Atlas programme epic #13241 and book issue #13251; the second-embedder evaluation is #9092; SPLADE and the signal ablation matrix belong to #5741; the Jaccard rescore is #5733.

Source: written from pkgs/atlas-search/crates/atlas-core/src/search.rs, fusion.rs, filters.rs, turso.rs, shingles.rs and crates/atlas-proto/query-parameters-v1.json (paths under https://github.com/developing-today/code/blob/main/pkgs/atlas-search/), plus the programme’s search-technology research survey. Figures quoted from that survey are research figures, not measurements of this system, unless a section says otherwise.

The idea: the embedding is the base, not the whole

Atlas’s dense signal comes from one embedding model, Snowflake snowflake-arctic-embed-m-v2.0 (768 dimensions) — see Embeddings: Snowflake Arctic and the parity contract. “More search characteristics on top of Snowflake” means treating that vector as the base signal and layering complementary signals over it, each of which catches failures the layer below misses:

  1. Lexical — BM25 over full-text search (FTS5). Exact on identifiers, error codes, names and rare strings; blind to paraphrase.
  2. Dense — the Arctic vector. Handles paraphrase and cross-lingual queries; weak on exactly the rare tokens the lexical leg is best at.
  3. Learned sparse and late interaction — the in-between signals (§ below), which recover part of each leg’s blind spot.
  4. Metadata and structure — source, kind, time, sensitivity tier, provenance and graph neighbourhood, applied as routing and pre-filtering, not decoration.
  5. Behavioural — what the user actually opened, re-found and worked with (the raw material of Design: the single-user recommender).
  6. A precision stage — cross-encoder reranking over the fused candidates, covered in Design: the reranking stage.

The discipline that makes this a design rather than a wish list: every layer is independently measurable on the golden set — see Evaluation: golden sets and gates — and a layer is adopted only where that measurement shows a win on Atlas’s own queries. The current pipeline, which already fuses the first two layers, is described in Retrieval: hybrid full-text and vector search.

Layer 0: use the resolution the base model already has

The cheapest layer costs no new model at all. Arctic Embed 2.0 is trained with Matryoshka Representation Learning (MRL — the model is trained so that a prefix of its vector is itself a usable embedding) with a truncation point at 256 dimensions: truncating the stored 768-dimension vector to its first 256 dimensions retains roughly 98% of the model’s MTEB Retrieval score. That figure is from the model’s own published evaluation (research survey §1), not a measurement on Atlas’s corpus.

That gives a two-resolution index from the vectors Atlas already stores:

  • a cheap first pass at 256 dimensions over the whole permitted set, then
  • a full-quality rescore at 768 dimensions over the first pass’s survivors.

Atlas’s query side already supports the mechanics — a query vector can be truncated and renormalised per request (the shipped --trunc parameter) — but the stored corpus is served today as a single-resolution scan. The design step is to make the two resolutions a deliberate serving shape: first-pass depth and rescore depth become named parameters, and the recall cost of the 256-dimension pass is measured against the full-width scan on the golden set before it becomes a default. If the measured cost is near the published ~2%, this is close to a free 3× reduction in first-pass vector work, and it stacks with the ANN work below rather than competing with it.

The in-between signal: learned sparse (SPLADE)

SPLADE (learned sparse retrieval) is a BERT-style model whose output is a weight for every term in a ~30k-term vocabulary, including terms not present in the text: a chunk about a “connection reset” also lights up for drop and socket. The result is still a sparse vector served from an ordinary inverted index, so it keeps BM25’s infrastructure and exact-match behaviour while recovering much of dense retrieval’s paraphrase handling.

In this design SPLADE is a third retrieval leg, fused by rank with the existing two:

  • an encoder pass at ingest time produces the sparse vector per chunk (a stored postings table, keyed like the other derived indexes);
  • at query time the sparse leg returns its own ranked pool, and reciprocal rank fusion (RRF) merges three lists instead of two;
  • BGE-M3’s sparse head (§ “The second-embedder decision”) is the alternative source of the same signal, if that evaluation favours it — the leg’s place in the pipeline is identical either way.

Adoption is gated, not assumed. The failure taxonomy from the golden set has to show paraphrase-miss failures that both existing legs miss; if it does not, the leg is cost without benefit. See “What exists today” for SPLADE’s current gate status: it has never been gated.

The mid-stage: late interaction (ColBERT) over the top ~100

ColBERT-style late interaction gives every token its own embedding and scores a pair by MaxSim — for each query token, its best-matching document token, summed. Quality sits between bi-encoders (one vector per text) and cross-encoders (joint scoring of the pair, Design: the reranking stage), at roughly 10–100× bi-encoder compute (research survey §2, directional figures from the cited decomposition: BEIR nDCG@10 ≈ 0.50 for ColBERT against ≈ 0.43 for BM25 and ≈ 0.47 for SPLADEv2).

That cost profile decides its placement: a mid-stage over the top ~100 fused candidates, never a first-stage retriever. The fused pool is rescored by late interaction, and the rescored order feeds the reranker (or the result list, if no reranker is enabled). ColBERTv2-style centroid-plus-residual compression (~20–36 bytes per token-vector, research figure) is what makes storing per-token vectors for a corpus of Atlas’s size a serious option rather than an absurd one; the storage estimate for Atlas’s chunk count is part of the design work, not a number this chapter asserts. As with SPLADE, BGE-M3 is the alternative supplier — it emits ColBERT multi-vectors in the same pass as its dense and sparse outputs.

Metadata is routing, never a post-filter

A filter applied after retrieval — take the top k, then discard what does not match — starves recall: the retriever returns k results, the filter throws most of them away, and the relevant item at rank k + 1 never surfaces. Worse, in Atlas one of the “filters” is the sensitivity tier, which is a security boundary: a tier check that is merely post-hoc is a leak waiting for the one consumer path that forgets it.

So in this design, metadata — source, kind, topic, project, client, time range, and above all sensitivity tier and the caller’s ceiling — is part of the query plan:

  • Pre-filter inside the retrieval layer. Each leg’s query is constructed with the permitted set already applied, so every candidate any leg returns is already permitted. (This is the direction the shipped code already takes for the ceiling and filters — see “What exists today”.)
  • Partition and route. Where the corpus is physically partitioned — per-tier shards, per-source collections — the planner routes the query to the partitions it is allowed and intended to search, and filtering becomes routing. A query that cannot touch the secret tier is never sent to the secret partition, rather than sent and trimmed afterwards.
  • Over-fetch where the engine forces it. An approximate index that cannot filter internally (the DiskANN path below) is queried deeper than the pool size, the survivors are joined against the permitted set, and the over-fetch factor is tuned per filter selectivity and validated on the golden set — the permitted-set check still happens inside the retrieval layer, before fusion, never in a consumer.

Behavioural signals

The last retrieval layer is evidence from use: which results were opened, which documents are re-found repeatedly, which items co-occur in the user’s sessions. In this design those signals enter as a bounded adjustment over the fused candidates — a boost with a named cap, never a replacement for the content signals — and they are the same signals the recommender is built from, designed as one loop: see Design: the single-user recommender. Two cautions are part of the design, not afterthoughts: behavioural boosts are exactly the kind of change that flatters easy queries while collapsing the tail, so they are golden-set-gated per query class like every other layer; and any learning from behaviour waits on the feedback loop described in Design: the reranking stage — impressions and clicks without recorded judgements are not training data.

Fixing the serving physics: from exact scan to an ANN path

Today the vector leg is an exact cosine scan over the permitted set — correct by construction, and slow: the programme record puts it at roughly 4 seconds per query against the production store, and the stored vectors are plain BLOBs on which vector_top_k does not work. Exactness is a fine correctness reference and a poor serving plan. The design replaces the scan with an approximate nearest-neighbour (ANN) path, in preference order:

  1. libSQL native vectors where the store supports them — type the vector column F32_BLOB(768) with a DiskANN-backed libsql_vector_idx, and retrieve with vector_top_k. This keeps one store, one SQL surface, and the pre-filter discipline above (with over-fetch where the index path needs it).
  2. An embedded-replica strategy — libSQL’s embedded replicas sync a local file from the remote primary, so the same FTS5 + native-vector SQL runs on the laptop offline and against the hosted store online with no code change. This is also the offline story for fleet and ID consumers.
  3. A dedicated index — a separate ANN store beside libSQL, only if the first two fail the measurements; it costs a second system to keep in agreement with the corpus, so it has to win clearly, not marginally.

Whichever path is chosen, the acceptance test is the same: recall of the ANN path measured against the exact scan on the golden set. The exact scan is the oracle — for each golden query, the ANN path’s top-k is compared with the scan’s top-k, and the recall loss is a named, budgeted number, traded explicitly against the latency it buys. An ANN default that has not been measured against the scan does not ship; the scan remains available as a backend option and as the eval oracle.

The second-embedder decision (#9092)

Staying on Arctic is defensible — per the research survey it leads its size class on English retrieval, and it is not the weak link. The one challenger with a structural argument is BGE-M3: a single encoder pass that emits all three signals this chapter layers separately — a dense vector, a learned-sparse vector, and ColBERT multi-vectors. If BGE-M3 wins on Atlas’s golden set, adopting it collapses the SPLADE and ColBERT layers from separate components into properties of the embedding pass. If it does not win, the layered design above stands on the Arctic base unchanged. (On the survey’s published numbers the two are close and split by benchmark — Arctic ahead on English retrieval and CLEF, BGE-M3 ahead on the MIRACL average — which is precisely why the decision belongs to Atlas’s own set, not to a leaderboard.)

Any model change follows migration discipline, because vectors from different models are not comparable and mixing them degrades results silently:

  1. Every stored vector is tagged with its model_id (and dimension), so no query ever fuses candidates from two spaces unknowingly.
  2. The new model is built into a shadow index — a new table or collection, backfilled incrementally, with unchanged chunks suppressed by the content-hash dedupe cache.
  3. Cutover is decided on an eval result, not on completion. The golden set runs against both indexes; reads flip when the new index wins, or ties at acceptable cost. The old index is kept until the flip is proven, then dropped.
  4. During a long backfill, a stable base index plus a small continuously-updated delta index, queried together and fused, keeps fresh content searchable.

What exists today

  • Shipped: hybrid retrieval with two legs — FTS5/BM25 and the Arctic dense vector — fused with RRF. The shipped fusion constant is RRF k = 10 with equal leg weights (fts_weight = 1.0, vector_weight = 1.0), a default pool of 100 candidates per branch and a default k of 10 results, all pinned in crates/atlas-proto/query-parameters-v1.json. (The Python eval lineage fuses at k = 60; that is the eval harness’s configuration, not the service’s.)
  • Shipped: filters and the sensitivity ceiling are applied inside the branch queries, before any ranking — the pre-filter half of this chapter’s metadata design is already the shipped behaviour for the monolith backends. Partition routing by tier exists in the shard fan-out (a shard above the caller’s ceiling is never connected or scanned).
  • Shipped, off by default: query-side truncation (trunc, default 0 = full 768 dimensions) — the mechanics for the two-resolution design exist on the query side, but no 256-dimension first pass is run. Also shipped and off: the Jaccard shingle rescore (#5733), a third signal applied over the fused union. Its held-out gate failed — on the 54-query near-exact set, MRR@10 improved by +0.0361 against a pre-agreed bar of +0.10 (the general set passed its no-regression bar) — so jaccard_depth stays 0 and no production ranking change was made.
  • Not shipped: SPLADE. There is no SPLADE encoder, no postings table and no SPLADE run in the repository; it exists only as a named signal in the #5741 ablation matrix. No gate has run for SPLADE — the Jaccard verdict is about set-overlap geometry and neither validates nor undermines it.
  • Not shipped: ColBERT/late interaction, behavioural ranking signals, and any reranker — see Design: the reranking stage.
  • Serving physics today: the default vector backend is the exact scan (Scan). Two index strategies exist in code behind it — IndexFixed (one fixed-depth vector_top_k fetch) and IndexFill (escalating depth until the pool survives filtering) — but neither is the default; which becomes the default is to be decided at the #5356 cutover from A/B evidence. The sharded backend likewise serves its vector branch by exact per-shard scan. The ~4-second exact scan against the production store is the programme’s recorded figure, not a benchmark run for this book.
  • Second embedder today: an open evaluation (#9092), not a decision. A legacy BGE-small vector space (384 dimensions) coexists in the publish store as a dormant fallback; it is not a challenger in the #9092 sense and its vectors are not comparable with the Arctic space.

Design: the reranking stage

Design — not shipped behaviour. This chapter describes a proposed design. Nothing in it should be read as how Atlas works today; the final section, “What exists today”, states the shipped behaviour it would build on. Tracking: the Atlas programme epic #13241 and book issue #13251; the feedback seam is #6046 / #8062; the evaluation harness is #5741.

Source: written from pkgs/atlas-search/crates/atlas-core/src/search.rs, fusion.rs, eval.rs, feedback.rs and feedback_normalise.rs (paths under https://github.com/developing-today/code/blob/main/pkgs/atlas-search/), plus the programme’s search-technology research survey. The gain and latency figures quoted below are research figures from that survey — typical values reported for this class of system — not measurements of Atlas.

What a reranker is, and where it sits

A cross-encoder reranker scores a (query, document) pair jointly: the query and the candidate text go through one transformer together, with full attention between them, and the model emits a single relevance score. That is far more precise than comparing two independently computed embeddings — and far too slow to run over a corpus. So the pipeline shape is fixed:

retrieve (hybrid, wide pool) → fuse → cross-encoder rerank → top results

Atlas’s retrieval and fusion stages are described in Retrieval: hybrid full-text and vector search and layered further in Design: layered search characteristics on Snowflake. The reranker is the last stage: it takes the fused candidate pool — in this design, the fused top 50–200 — rescores every candidate against the query, and the final order is the reranker’s order (or a blend, § “Blend, don’t replace” below).

What it fixes — and what it cannot

A reranker can only reorder what retrieval already found. It therefore:

  • fixes precision — the order of the first handful of results, which is what nDCG@10 and MRR measure, and what a reader or an agent actually consumes;
  • never fixes recall — a relevant chunk that no retrieval leg surfaced is invisible to it, and no reranker quality compensates for a retrieval miss.

That asymmetry drives the evaluation discipline (§ “Gating”): retrieval changes are judged on Recall@k, reranker changes on nDCG/MRR over a fixed retrieved pool, so a failure localises to a stage instead of grading the pipeline as one black box — the per-stage pattern set out in Evaluation: golden sets and gates.

Expected value, stated as the research survey reports it for this class of system: a cross-encoder over the fused ranking typically gains +5–15 nDCG@10, at roughly 50–500 ms of CPU latency for a top-100 pool, depending on model size (about 50–150 ms for 20 candidates with a mid-size model in the cited local deployments). These are programme/research numbers quoted to size the opportunity. Atlas’s own numbers do not exist until the stage is built and gated; nothing in this chapter should be cited as an Atlas measurement.

The default candidate: BGE-Reranker-v2-m3

The design’s default open candidate is BGE-Reranker-v2-m3 (BAAI): 568M parameters, multilingual (100+ languages), 8,192-token query–document pairs, MIT-licensed, and the strongest quality-per-size balance among the open rerankers in the survey’s comparison (MTEB reranking ≈ 60.4 in the cited table — a leaderboard figure, quoted for candidate selection only). Multilingual matters here for the same reason it mattered for the embedder: the corpus is not English-only, and a reranker that degrades on the non-English slice would show up exactly where the golden set is thinnest.

Two practical properties shape integration:

  • Scores are unbounded logits, not probabilities or cosines. Before a reranker score is blended with any other signal it is normalised within the pool (§ below); raw logits are never compared across queries.
  • The architecture is plain — an XLMRobertaForSequenceClassification — which is what makes the candle route below possible.

Alternatives stay on the table as gated challengers, not defaults: Jina Reranker v2 base multilingual (278M, roughly half the size, slightly lower quality in the survey’s table — and it ships custom modelling code, which matters for the candle route; its licence history is inconsistent across sources and must be verified on the current model card before any redistribution), and the smaller English fast tier (mxbai-rerank, gte-reranker-modernbert-base) if the latency budget tightens.

Inference routes: fastembed-rs (ONNX) or candle

Both routes are Rust, in-process, and need no hosted service:

  • fastembed-rs TextRerank — the main route. ONNX Runtime via the ort crate, tokenizers via the Hugging Face tokenizers crate, a synchronous API. It supports bge-reranker-v2-m3 out of the box, alongside bge-reranker-base and the Jina rerankers, plus user-defined ONNX models.
  • candle — Hugging Face’s pure-Rust framework, and the route taken when ONNX Runtime is a liability. The liability is concrete: prebuilt ort binaries assume AVX-class CPUs and have SIGILL-crashed on older CPUs in a documented deployment, which moved that project to candle with runtime CPU-feature dispatch. BGE-Reranker-v2-m3 ports to candle because its architecture is standard; a reranker with custom modelling code (the Jina candidate) does not, which is a real selection constraint, not a footnote. fastembed itself uses candle as the backend for some of its model families, so the two routes can coexist in one dependency tree.

Serving shape follows the consumers. For the CLI and the local service, an in-process library keeps the deployment Atlas already has. If several consumers (the service, fleet, ID, the MCP server) end up reranking, a small shared inference service holding one warm model beats each consumer loading its own ~0.5–1 GB copy — that decision is deferred until a second consumer actually needs the stage.

One Atlas-specific caution: the existing embedder’s ONNX path is a parity contract (bit-identical output is a gate, not a preference — see Embeddings: Snowflake Arctic and the parity contract). The reranker carries no such contract: it is a new model with no Python reference to match, judged on ranking quality alone. The ONNX-versus-candle choice for the reranker is therefore free to be made on robustness and latency evidence, without touching the embedder’s route.

Hosted rerankers: quality ceilings, never a serving path

Hosted rerankers (Cohere Rerank, Voyage) are useful to this programme in exactly one role: as an offline quality ceiling. Running a hosted reranker over the golden set’s fixed pools answers “how much headroom is above the local candidate?” — if the local model is within noise of the ceiling, further reranker work is wasted; if it is far below, the gap is worth chasing.

They are never a serving path, for a reason that is not negotiable: secret-tier text is never sent to a hosted reranker — the same absolute rule that keeps secret text away from hosted embedders. A ceiling run is confined to queries and chunks the caller’s ceiling permits to leave the machine, which in practice means it is run deliberately, on non-secret material, by a person or a lane that states what it sent. No code path in the serving design contains a hosted-reranker call.

Gating: per-corpus, or it does not ship

Rerankers can hurt. In one local deployment measurement cited by the survey, two of four rerankers scored below plain hybrid retrieval on that corpus, and the largest was both the slowest and the worse. Leaderboard standing is therefore evidence for candidacy, never for adoption. The adoption rule is:

  1. Build a fixed candidate pool per golden query with the shipped retrieval pipeline.
  2. Score the reranked order with the #5741 harness (nDCG@10, MRR@10), overall and per query class.
  3. Adopt only on a win (or a tie at a cost worth paying) on Atlas’s own set — and re-gate on every model, pool-size or blending change, the same as every other ranking change in Design: the standing evaluation programme.

Pool size is the latency knob

Cross-encoder cost is linear in the number of candidates scored, so the pool size is the latency budget: in the survey’s local measurements, reranking a top-10 pool was roughly 3× faster than top-30 on that corpus, with no quality loss there; top-50–100 is the common production compromise. This design therefore exposes the rerank pool as a named parameter (alongside the existing retrieval pool, from which it draws), defaults it inside the 50–200 band, and sets the shipped default from the golden-set run — the pool size at which nDCG stops improving is the pool size Atlas pays for, and no larger.

Blend, don’t replace (an option the gate decides)

Pure reranker order is the simple design. The alternative is to min-max-normalise the reranker scores within the pool and blend them with the fused RRF score, which protects against reranker pathologies on out-of-distribution queries — a fused candidate the whole retrieval stack agreed on is not discarded because one model disliked it. Neither is asserted here: both orders are scored in the gating run, and the gate picks. What is not optional is the normalisation itself — unbounded logits are never blended raw.

The feedback loop is the prerequisite for learning-to-rank

Everything above is a fixed model applied to fixed pools. Any stronger claim — learning-to-rank (training or tuning a ranker on Atlas’s own usage), personalised ranking, behavioural boosts that adapt — needs labelled evidence of what good ranking looks like for this corpus and this user. That evidence is the feedback loop:

  • Capture exists. atlas-feedback/v1 records a vote (up/down, optional comment, opened flag) against the (query_id, chunk_id) identity of a served result, append-only, with a normalised derivative (atlas-feedback-normalised/v1) that classifies comments into categories such as ranking-too-low, missing-result and right-file-wrong-chunk, weighted by requester kind (Drew/user 1.0, agent 0.25, anonymous 0.1; self-feedback by an agent on its own session’s retrieval is weighted 0). Query traces (atlas-query-trace/v1) record per-result stage scores for every pool entrant, served or not.
  • The seam is the design work. The #6046/#8062 seam is where those records become ranking experiments: feedback joined back to traces gives, per query, the pool that was available, the order that was served, and a human/agent judgement on it — the minimum dataset from which a learned ranker, or even an honest per-class weight tuning, can be built and gated.
  • Until that seam is wired, no learning-to-rank claim is made. A reranker adopted on golden-set evidence is a measured component; calling any part of today’s ranking “learned” would be false. The feedback loop is sequenced before learning-to-rank work in the programme for exactly this reason.

What exists today

  • Shipped: the pipeline ends at fusion. Retrieval (FTS + vector) is fused with reciprocal rank fusion at the shipped constant k = 10, equal leg weights, default pool 100 per branch, and the fused order is the served order. There is no learned or cross-encoder reranker in the serving path.
  • Shipped, off by default, and gated off on evidence: the one post-fusion rescore that exists — the Jaccard shingle rescore (#5733) — failed its held-out gate (near-exact MRR@10 gain +0.0361 against a +0.10 bar) and stays off (jaccard_depth = 0). It is also the standing example of this chapter’s gating rule working as intended.
  • Shipped: the evaluation harness (#5741) that this design gates with — saved rankings from any signal scored offline against judged qrels (nDCG@10, Recall@100, Recall@1000, MRR@10), with a dev/test split discipline in which the test split is scored once, at decision time. It generates no signals and measures no latency; a reranker run would arrive as saved rankings like any other signal.
  • Shipped: feedback capture and normalisation (atlas-feedback/v1, atlas-feedback-normalised/v1) and query-trace capture, as described above. No consumer feeds feedback back into retrieval ranking — nothing in the search, fusion or rescore code reads feedback records. Today feedback influences only statistics, weekly-report nominations, trace-retention protection, and the normalised derivative store.
  • Not shipped: any cross-encoder model, any fastembed or candle dependency in the search path, any hosted-reranker call, and any learning-to-rank component.

Design: the single-user recommender

Design — not shipped behaviour. This chapter describes a proposed design. Nothing in it should be read as how Atlas works today; the final section, “What exists today”, states the shipped behaviour it would build on. Tracking: #9140 (recommendation objects, search history, retention classes), #9109 Part C (ID–Atlas storage economics, ID search and the recommendation surfaces), and #10158 (recommendation snapshot paging); programme epic #13241, book issue #13251.

Source: written from pkgs/atlas-search/crates/atlas-core/src/search.rs, trace.rs, feedback.rs and shards/ (paths under https://github.com/developing-today/code/blob/main/pkgs/atlas-search/), the #9109 Part C design record (doc/2026-11-13T03-40-00Z_design_id-atlas-summit/part-c/), and the programme’s search-technology research survey (§5). Judgements labelled as such below are design judgements, not sourced benchmark claims.

Why a personal recommender is a different problem

Classic recommender systems run on collaborative filtering — “users who liked X also liked Y” — computed across many users. Atlas has one user. There is no cross-user signal to copy, no crowd to average over, and no off-the-shelf collaborative design that survives contact with a population of one.

What a single-user corpus has instead is rich behavioural exhaust from that one user, plus the corpus’s own structure:

  • every search session, and which results were opened;
  • saves, re-finds (a document Drew keeps returning to is a hub, whatever its text says), and dwell;
  • provenance — which documents derive from, cite, or were produced alongside which others;
  • co-occurrence in sessions, projects and time windows.

The recommender in this design is therefore content-based + session-based + recency-aware, with the collaborative machinery repurposed: “items that go together” means items that appear together in Drew’s sessions and work, not across users. The signals are also the behavioural layer of Design: layered search characteristics on Snowflake — search and recommender are designed here as one loop, not two systems.

The signals

Four nominating signals, each cheap, each biased in a different direction — the biases are why the architecture (§ below) unions them rather than picking one.

1. The profile centroid (content similarity)

The user profile is a weighted centroid of embeddings: take the vectors — from the embedding index Atlas already maintains, see Embeddings: Snowflake Arctic and the parity contract — of the documents Drew opened, saved or searched for, weight each by the strength of the interaction, decay the weights with age, and average. Candidates are the embedding nearest neighbours of that centroid: “more like what I have been working on”, with zero new infrastructure beyond the index and the interaction log.

Decay is the load-bearing detail. An undecayed centroid is a portrait of everything Drew has ever cared about, dominated by the largest past project; a decaying one tracks the current work, with the half-life a named, tunable parameter. Per-source profiles (one centroid for code work, one for notes, and so on) are a refinement the same shape supports when a single centroid proves too blunt.

2. Session co-occurrence (item-to-item, single-user)

Documents opened or cited in the same session or task are related for this user, even when their texts are not similar — a specification and the incident log it eventually caused may share almost no vocabulary. Precomputing item→item neighbours offline from the session logs (pairs that co-occur, weighted by how often and how distinctively) is the strongest single-user analogue of Amazon-style item-to-item collaborative filtering, and the signal least replaceable by content similarity: it captures relationships that exist in Drew’s work rather than in the text.

The raw material is already recorded: every executed search mints a query trace (atlas-query-trace/v1) carrying the served results, and feedback records (atlas-feedback/v1) attach votes and opened flags to (query_id, chunk_id) pairs. Session co-occurrence is computed from that history, not from a new tracking system.

3. Recency and frequency

Trending-in-my-corpus: recent opens, repeated re-finds, and fresh ingest. A newly ingested document that matches an active interest should be able to surface before it is ever searched for — that is the difference between a recommender and a search box. Frequency matters independently of recency: the document returned to every week for a year is infrastructure, and its neighbours are standing recommendations.

4. Graph and provenance neighbours

Atlas’s corpus is provenance-first — content-addressed objects with occurrence records, and ID-graph edges where the publication format (#6062) lands: see The corpus: provenance and content addressing and Design: search integration for fleet and ID. Neighbours of a known-relevant document along those edges — the next version, the document that derived from it, documents sharing a rare chunk or entity — are candidates no text signal would nominate.

Production recommenders and production search have converged on one shape — candidate generation → ranking → re-ranking — which is also the shape of Atlas’s search pipeline (Retrieval: hybrid full-text and vector search). The recommender reuses the stack instead of duplicating it:

  1. Candidate generation (recall). Union the nominators: embedding kNN against the profile centroid; item-to-item neighbours of recent items; recency/frequency leaders within active sources; graph/provenance neighbours. Each nominator is biased; the union covers the biases. Sensitivity ceilings and tier enforcement apply here, inside retrieval, exactly as in search — a recommendation is a disclosure, and the ceiling discipline of Sensitivity tiers and client ceilings is inherited, not re-implemented.
  2. Ranking (precision). Score the union with the richest affordable model. The natural Atlas choice is the cross-encoder of Design: the reranking stage, with the “query” being a profile/session summary — or, before that stage exists, a transparent feature score (similarity, recency, co-occurrence count, source) whose weights are named constants. Either way the ranker is a component with an evaluation (§ below), not a formula beyond inspection.
  3. Re-ranking (the surface). Enforce what raw relevance ignores: diversity via MMR (maximal marginal relevance — each next pick is penalised for near-duplication of picks already made), a freshness quota so the feed is not all old hubs, deduplication against already-seen items, and exploration slots — a small ε of deliberately novel items, without which the system collapses into a filter bubble of Drew’s last topic and can never learn that his interests moved.

The two-tower question: overkill, deliberately

A trained two-tower model learns a user tower and an item tower into a shared embedding space so that retrieval is kNN of the user vector. It is the right tool at multi-user scale. For one user it is overkill as a trained model — there is exactly one user vector to learn — but its pattern is precisely signal 1 above: the “user tower” collapses to the hand-built, decaying weighted profile centroid. [Design judgement, not a sourced benchmark claim.]

So the profile vector is v1, and the upgrade path preserves the serving shape: learned per-source or per-signal weights, or a sequential model over session order (SASRec/BERT4Rec-style “what’s next in this session”, interesting only once session logs are long and dense), can replace the hand-built centroid in place — candidate generation still consumes one profile vector, and no consumer changes. Choosing the simple form first is not a compromise to apologise for; it is the form whose failures can be read directly off its weights.

Surfaces

  • More-like-this on any document or session: pure embedding kNN plus the tier filter, with co-occurrence and graph neighbours blended in when they exist. The day-one surface — it needs no profile at all.
  • Related results beside search: session co-occurrence neighbours of the top search hits, presented as their own rail rather than interleaved into the ranked results, so search quality measurements stay clean.
  • A resurface feed: documents matching active interests that were recently ingested, or recently became relevant (a new link, a new occurrence, a new neighbour), ranked by profile similarity + recency and passed through the MMR/freshness/exploration re-rank. This is the surface that justifies the whole system: it finds things before they are searched for.
  • Query suggestions and zero-result recovery: from the profile and the co-occurrence table — “you needed X last month alongside this” — offered when a search returns nothing or when a query matches a known past session’s shape.

Recommendations as stored objects, and the “next 10” fan-out (#9109 Part C)

The #9109 Part C design settles the serving shape for the ID-facing surfaces: one fan-out worker, a Durable Object accumulating a “next 10”, and recommendations as stored objects with per-class retention. Unpacked:

  • Recommendations are materialised objects, not computed per request: a generation pass produces a ranked, re-ranked list for a subject (a user profile state, a document, a search), stores it as an object with a retention class (#9140’s subject), and surfaces page through the stored object. That makes recommendation pages stable, cheap to serve, and auditable — what was recommended, when, from which signals, can be answered after the fact.
  • The fan-out worker is the single producer: it runs the candidate union across the nominators (and, in the ID shape, across the federated stores) and hands partial results to the accumulator rather than blocking a request on the slowest nominator.
  • The Durable Object accumulates the “next 10”: as fan-out results arrive, the DO merges, ranks and re-ranks them into the next page of the stored recommendation object, so a consumer paging forward is always reading an accumulated, deduplicated, diversity-checked page — never a raw nominator’s output, and never a page that changes shape because a slow nominator landed late.

Paging over a materialised object needs its own discipline, which is the one implementation slice already in flight (§ “What exists today”): an immutable materialised order (score descending, then immutable recommendation ID ascending) at a pinned cutoff, per-page signed envelopes, and a cursor bound to the snapshot it pages.

Evaluation

The recommender is measured like search, on held-out behaviour: split real sessions, and from each session’s first half predict its held-out opens — precision@k and nDCG on that prediction task — plus coverage and diversity measures, so the system cannot score well by merely echoing search results back. A recommender that only recommends what search would have found anyway has added a feed, not a capability. The standing programme that hosts these measurements is Design: the standing evaluation programme.

What exists today

  • Design only. The recommender is #9140 (recommendation objects, search history, retention classes — open) and #9109 Part C (the fan-out worker, Durable Object “next 10” accumulator, recommendations as stored objects with per-class retention — open). No candidate generation exists: no profile centroid is computed, no co-occurrence table is built, no recommendation endpoint is served, and no feedback-driven personalisation runs anywhere in the system.
  • One implementation slice in flight: snapshot paging, #10158 — the state machine for paging a materialised recommendation snapshot (immutable order: score descending, then recommendation ID ascending, at a pinned cutoff; per-page signed envelopes with their own envelope IDs; cursor bound to the parent snapshot ID). Its PR #12873 (worker/src/recommendation_state.ts plus tests) is open and unmerged, held in the programme’s shepherd queue — it is not shipped behaviour, and this chapter does not describe it as such. Note what it is: paging and envelope machinery for serving an already-materialised snapshot. It generates no recommendations.
  • The raw material exists. Query traces (atlas-query-trace/v1) are captured for every executed search, feedback capture (atlas-feedback/v1) and its normalised derivative are shipped, and the embedding index the profile centroid would query is the production index. What is missing is every consumer that would turn that material into recommendations — today those records feed statistics, weekly-report nominations and retention protection only.
  • A recorded dependency: #10158 carries a hard dependency on #9083 (tenant-scoped subject authorisation and policy epoch) in the ID-facing design line — the paging slice cannot be read as unblocked until that dependency’s status is checked.

Design: search integration for fleet and ID

Design — not shipped behaviour. This chapter describes work that is designed and tracked, not behaviour that works today. Nothing in this chapter should be read as a description of the current fleet search, service, or ID query path. Tracking: master prompt §2F in the Atlas programme investigation; fleet integration under #8983 and #9092; ID integration under #6062, projectors #11182–#11186, and #9109 Part C. The grounding section at the end — What exists today — is the only part of this chapter that describes shipped behaviour.

Source: pkgs/fleet/crates/fleet-search/src/cli.rs, pkgs/atlas-search/crates/atlas-core/src/search.rs, pkgs/atlas-search/crates/atlas-proto/query-parameters-v1.json, and the ID–Atlas summit design doc/2026-11-13T03-40-00Z_design_id-atlas-summit/ under https://github.com/developing-today/code/blob/main/pkgs/fleet/crates/fleet-search/src/cli.rs — provenance only; this chapter is complete without following it.

Atlas is one retrieval core with several consumers. Two consumers matter most for the next phase of work, and they need different things from the same core. The fleet — the system that dispatches and runs agent work in lanes (a lane is one running agent session working one queue item) — needs search that is fresh, cheap to call many times, and usable when the network path to the laptop is down. ID — Drew’s identity and object-graph system — needs Atlas to be its search and embeddings layer: the place ID content is vectorised, indexed, and queried. This chapter designs both integrations. They share the retrieval core and the sensitivity machinery described in Sensitivity tiers and client ceilings and Retrieval: hybrid full-text and vector search; neither integration gets a private copy of either.

Fleet: freshness is the fix

fleet search is live today. Its problem is not the query path — it is the corpus behind it. The canonical counts consumers see are frozen at the 2026-10-31 publish (18,325 sessions / 122,124 messages / 107,639 chunks) while the store has since grown, and ingestion is still manual and script-driven. An agent that searches before starting work and finds nothing may be looking at a stale corpus, not at an absence of prior work. That is the single largest consumer-facing gap recorded in the consumer survey, and no amount of ranking work fixes it.

So the fleet-facing fix is freshness first, in the sense of Design: automatic ingest of all sources: continuous ingest with an ingest watermark (a monotonically advancing marker of how far ingest has processed each source) that the search layer can read. Once the watermark exists, three fleet-specific pieces become possible.

Result caching keyed by index version

Today the Worker’s per-query cache is retained indefinitely with no TTL or eviction — see Design: MCP and programmatic access, next steps for the cache fix that belongs to the access workstream. The fleet service path needs its own, stricter rule: a cached result is valid only for the index version it was computed against.

The design keys every fleet result cache entry by index version — the corpus generation derived from the ingest watermark — alongside the fields the cache key already pins (normalised query, result depth k, sensitivity ceiling, disclosure context, embedding model revision, and vector table). When ingest advances the index version, old entries are simply never hit again: they are orphaned by the key change, not deleted by a sweeper racing in-flight queries. A caller that needs the newest corpus passes the existing no-cache bypass; a caller that can tolerate the previous generation gets the cache hit. The staleness window is therefore explicit and bounded by ingest cadence, rather than indefinite and invisible.

Batch search for lanes

A lane rarely asks one question. At startup it asks several — prior decisions on this issue, prior sessions touching this file, the runbook for this failure — and a fleet running many lanes at once asks them in bursts. Calling the single-query path once per question pays the embedding, fan-out, and round-trip cost every time, and makes lane startup latency the sum of its questions.

The design adds a batch search operation to the service: one request carrying several independent queries, each with its own filters and ceiling-checked identity, executed against one index version, returning one result envelope per query in request order. Batching shares what can be shared — the index-version read, the connection, and, where queries repeat across lanes, the result cache — without merging the queries themselves. Each query in a batch is still ceiling-enforced inside its own branch queries, never post-ranking, and each produces its own trace record so the evaluation programme (see Design: the standing evaluation programme) can attribute quality per query, not per batch. Batch is an efficiency surface, not a new retrieval semantic: a batch of one is the single-query path.

Offline fallback via libSQL embedded replicas

A lane on the sandbox or on a machine that has lost its path to the laptop service currently falls back to a standalone search or fails. The design gives the fleet an offline fallback built on libSQL embedded replicas: a local replica of the search database that libSQL keeps in sync with the remote primary when connectivity exists and serves reads locally when it does not.

The reason this route is available to Atlas — and the reason it is the designed route — is how Atlas stores vectors. Atlas vectors are native libSQL values in the monolith and shards, and native vectors behave identically in a local embedded replica and in the remote database: the same vector table, the same distance functions, the same query shapes. An embedded replica is therefore not a degraded export; it is the same index, read locally. The alternative route, sqlite-vec (a SQLite extension providing a separate vector store beside the relational data), cannot offer that identity: vectors would live in a second store with its own sync, its own consistency story, and its own divergence from the canonical index. The design takes the embedded-replica route precisely because it avoids a second vector store.

The fallback is read-only and freshness-labelled. A result served from a replica carries the index version of that replica, so the caller — and the trace — can see how stale the answer may be. When connectivity returns and the replica syncs forward, the version advances and cached results keyed to the old version stop being served, by the same keying rule as above. Secret-tier handling does not change offline: a replica holds only what its identity is permitted to hold, and ceiling enforcement still happens inside the branch queries against the replica’s own data.

Search-quality telemetry from real lane queries

Fleet lanes are Atlas’s largest source of real queries, and today almost none of that signal returns to the quality loop. Feedback capture exists (atlas-feedback/v1 — append-only thumbs votes keyed to query and chunk identity), and query traces are captured (atlas-query-trace/v1), but no ranking consumer reads the aggregated feedback, and the golden set was built offline rather than harvested from production runs.

The design closes that loop on the fleet side. Every lane search — single, batched, service, or replica — emits its trace with the index version, the surfaces and signals that produced each result, and any feedback the lane records. A periodic mining pass, owned by the evaluation programme, promotes recurring real lane queries and their judged outcomes into the golden set, with the harvesting discipline described in Design: the standing evaluation programme. Fleet search quality is then measured on the queries the fleet actually asks, not only on queries invented for an offline set. That is what makes the freshness, caching, and fallback work above verifiable: each change is gated on the same golden set the telemetry feeds.

ID: Atlas as the search and embeddings layer

The two programmes meet here. ID holds objects — identities, files, versions, attestations, ingest runs, and the relations between them — in its own graph. ID does not have a search engine of its own, and the design does not give it one. Atlas is ID’s search and embeddings layer: ID content is chunked, classified, embedded, and indexed by Atlas’s pipeline, and ID queries run over Atlas’s retrieval core. The coordination point is the ID programme’s own investigation; this chapter records the Atlas side of the contract.

The #6062 publication format

The first deliverable is the publication format tracked as #6062: the format in which Atlas objects and their provenance publish into the ID graph. In the design, what publishes is not raw chunk text but the object structure Atlas already maintains — files, versions, chunks and spans, and ingest runs, each with its identity and writer set — together with provenance and lineage relations mapped into ID’s relation vocabulary. The PROV-lite relations named in the #6062 record are wasRevisionOf, specializationOf, wasDerivedFrom, wasGeneratedBy, and wasAttributedTo.

One decision the format must state explicitly, per object kind, is which side is canonical: canonical-in-Atlas or canonical-in-graph. Search indexing needs a stable answer — Atlas indexes what Atlas holds, and the graph references it — while graph traversal needs the converse for objects ID owns. The publication format is where that line is drawn, once, rather than re-decided by each projector. The shared ground that already exists is narrow but real: the content-hash v1 test vectors are shared between pkgs/atlas-search/test-vectors/ and pkgs/id/test-vectors/, so both sides already agree on how content identity is computed.

The projectors #11182–#11186, built and running

Publication is performed by projectors — processes that read Atlas state and emit the corresponding ID-graph objects and relations. The projector set is filed as five issues, all open and unstarted at the time of writing:

  • #11182 — the projector for versions, files, and relations emission.
  • #11183 — the projector for attestations and ingest runs.
  • #11184 — projector operations: run logging, replay, and backfill.
  • #11185 — consumer view presets: the packaged views over the published graph that ID consumers actually query.
  • #11186 — the conformance audit: a check that what the projectors emitted conforms to the #6062 format.

The design target is the whole set built and running — not the format alone, and not one projector alone. A format with no running projectors publishes nothing; projectors with no conformance audit drift silently. Replay and backfill (#11184) are part of the target, not later polish, because the first publication is necessarily a backfill over the existing corpus, and every format revision after that is a replay.

#9109 Part C: storage economics, graph search, recommendations

#9109 Part C is the programme-level statement of the ID side, and it has three parts.

First, storage economics: the substrate ID search would run on. The work benchmarks latency and characteristics across D1, R2, laptop redb, and laptop Turso at various shard levels, and covers the D1 tenant hot cache (the #9134 chain — see Roadmap and issue map for its gated state) and tenant store placement. Search design that ignores where the bytes live produces latency numbers nobody can reproduce; Part C measures the substrate before the query surface is promised on top of it.

Second, ID search over the graph. Once ID content is vectorised (next section) and Atlas objects are published into the graph (#6062, above), a query can combine both directions: text and vector search over the content, and traversal over the graph relations the content participates in. A search for a file’s history, for example, is a graph walk seeded by a retrieval hit, not a keyword search over filenames. The retrieval core stays Atlas’s; the graph expansion happens in ID, over published relations, under the same sensitivity ceilings.

Third, recommendations. Part C names the recommendation surfaces for ID content — recommendations as stored objects with per-class retention, served by one fan-out worker with a Durable Object accumulating a “next 10”. That design is shared with Atlas’s own recommender and is covered in Design: the single-user recommender; the ID integration consumes it rather than building a second one.

Automatic vectorisation of ID content

None of the above works until ID content is in the index. The design vectorises ID content automatically, through the same staging, classification, and promotion pipeline every other source uses — classification before promotion, never after, and tier enforcement in the retrieval layer. New or changed ID objects are chunked, embedded, and indexed without a manual ingest run, under the continuous-ingest shape of Design: automatic ingest of all sources.

The embedder is Snowflake Arctic Embed m-v2.0 (768 dimensions; see Embeddings: Snowflake Arctic and the parity contract) plus the second embedder from the #9092 evaluation — BGE-M3, Voyage, and others are candidates there, explicitly not pre-picked. ID content must therefore carry per-corpus model identity from the start: vectors are tagged with the model that produced them, mixed embedders coexist in one corpus without a flag-day re-embed, and any model change follows the migration discipline of shadow index and cutover on evaluation result, not on completion. Secret-tier ID content follows the standing absolute rule: secret text is never sent to a hosted embedder.

What this creates

ID has no live query path today. There is no ID-side search surface, no running projector, and no vectorised ID corpus to query. This workstream creates that path end to end: vectorisation puts ID content in the index, the #6062 format and the #11182–#11186 projectors publish Atlas structure into the graph, and Part C’s graph search gives ID a query surface that is Atlas retrieval plus graph traversal. Until those pieces land, any statement about “ID search” is a statement about this design, not about a working system.

What exists today

  • fleet search is live: a flag-for-flag port of the atlas-search client with a byte-parity guard, routing via the laptop service for sandbox seats (identity sandbox-scripts, ceiling personal) and standalone for the laptop seat (identity drew-cli, ceiling secret-bearing). Its filters, modes, and flags are covered in fleet search and fleet serve search and summarised in Consumers: fleet, agents, memory and ID.
  • The corpus behind it is stale: canonical counts are frozen at the 2026-10-31 publish, ingestion is manual and script-driven, and the continuous-ingestion programme #9097 (Workstream E) is open and blocked. No index-version-keyed result cache, no batch search operation, and no embedded-replica offline fallback exist today.
  • Feedback capture (atlas-feedback/v1) and query traces (atlas-query-trace/v1) exist in atlas-core. No ranking consumer reads the aggregated feedback today.
  • On the ID side: #6062 is open and design-only; projectors #11182–#11186 are all open and unstarted; #9109 Part C is an open epic slice. The only shared code ground is the content-hash v1 test vectors held in both pkgs/atlas-search/test-vectors/ and pkgs/id/test-vectors/. ID has no live query path today.

Design: MCP and programmatic access, next steps

Design — not shipped behaviour. This chapter describes work that is designed and tracked, not behaviour that works today. The current MCP server exposes exactly one tool, and the current Worker cache has no TTL or eviction; both facts are stated plainly in What exists today at the end. Tracking: master prompt §2G in the Atlas programme investigation; #8625 (MCP surface and its cross-client acceptance remainder), #6805 (Worker cache eviction and invalidation), #9134 (D1 hot cache), and #12900 thread 2 (the multi-client question, which is Drew’s open decision — see the end of this chapter).

Source: pkgs/atlas-search/worker/src/index.ts, pkgs/atlas-search/worker/src/mcp.ts, pkgs/atlas-search/worker/src/search.ts, pkgs/atlas-search/worker/src/cache_do.ts, pkgs/atlas-search/worker/src/space.ts, pkgs/atlas-search/crates/atlas-proto/query-parameters-v1.json under https://github.com/developing-today/code/blob/main/pkgs/atlas-search/worker/src/mcp.ts — provenance only; this chapter is complete without following it.

Atlas has three access surfaces: MCP (the Model Context Protocol, by which agent clients call tools) for agents, REST for services, and the CLI for humans. The design principle for their evolution is stated once and applied everywhere: one retrieval core, three surfaces, and tier enforcement inside the core. Sensitivity ceilings and corpus scoping are enforced inside the retrieval core’s branch queries — the queries that gather full-text and vector candidates — never post-ranking and never by client goodwill. Every surface therefore inherits the same enforcement, and a new surface cannot accidentally widen access by forgetting a filter. The background is in Sensitivity tiers and client ceilings; the current surfaces are documented in The Atlas MCP server, The Worker HTTP API, and The service HTTP API.

The MCP growth path

The two-step shape: search, then read

The copyable access pattern for agents is a two-step shape: search returns references and snippets, and a second step reads the full content of a chosen reference. The first step is deliberately light — result identifiers, provenance (corpus and source_ref), a snippet sufficient to judge relevance, and the effective ceiling the search ran under. The second step fetches one identified chunk or object in full, re-checking the caller’s ceiling at read time, so a reference obtained under one ceiling cannot be redeemed under another.

What the MCP surface must never do is resource enumeration at corpus scale: listing or paging the corpus itself as MCP resources. The corpus is on the order of a hundred thousand chunks; an enumeration surface would be a bulk-export surface wearing a protocol’s clothes, it would bypass the ranking and ceiling logic that make search safe, and no agent workflow needs it — agents need the two-step shape above. Search is the enumeration boundary: what search cannot return under a caller’s ceiling, enumeration must not return either.

Growing the single search tool deliberately

The current server exposes a single search tool — see What exists today. The design grows it deliberately, one tool at a time, each with the same identity-stamping, ceiling, and audit treatment as search:

  • search — the existing tool: hybrid search over the unified index, returning references and snippets.
  • read — the second step of the two-step shape: fetch one referenced chunk or object in full, ceiling re-checked at read time.
  • related / recommend — related results beside a known item, and recommendations from the recommender workstream (see Design: the single-user recommender): more-like-this over the embedding index and the stored recommendation objects of #9109 Part C. One surface, two entry points: related-to-an-item and recommended-for-the-user.
  • corpus status — a read-only status tool reporting what the corpus holds and how current it is: the index version, the ingest watermark, and per-corpus counts. This tool exists because freshness is currently invisible to consumers (counts frozen at a publish date, with no live signal); an agent that can read corpus status can say how stale its own search results may be.

Deliberately not tools, now or in this design: cache purge (a write; it stays an operator surface) and cache inspect (an operator and audit surface). Both exist today as gated REST routes and stay there.

Each addition lands behind the evaluation and acceptance gates of its workstream. Growing the tool list is not a version bump; a tool ships when its acceptance — including the cross-client acceptance below — passes.

REST: signal provenance with explain

The REST surface serves services rather than agents, and its designed addition is signal provenance: an explain facility on search results that states, per result, which signals produced it and how they combined. Atlas retrieval is hybrid — a full-text (FTS/BM25) branch and a vector branch fused with reciprocal rank fusion (RRF) — with further stages designed in Design: layered search characteristics on Snowflake and Design: the reranking stage. A bare score tells a calling service nothing it can act on; a provenance record — which branches returned the chunk, at what ranks, with what per-signal weights, and what any reranking stage did to it — lets the service debug its own queries, lets the evaluation programme attribute failures to a stage, and makes the query-as-data record (atlas-query-trace/v1) complete.

The design returns explain on request, not by default: provenance is per-result bulk that interactive callers do not need. When requested, it is part of the versioned contract below, so MCP, REST, and CLI renderings of the same search agree on what the signals were.

One versioned contract: growing atlas-proto

All three surfaces currently honour, to different degrees, the seed contract in the atlas-proto crate: query-parameters-v1.json, the versioned query-parameter set (today: result depth, candidate pool, expansion, the RRF constant, and per-signal weights, with defaults every surface shares). The seed is described in atlas-proto: the wire contract.

The design grows that seed into the versioned API contract all three surfaces honour: query parameters, the result envelope, the explain provenance shape, error shapes, and the corpus-status shape, each versioned, each change additive within a version and a new version when it is not. A surface that cannot honour a contract field says so as a validation error — the existing precedent is the CLI’s planner and spell flags, which are present in the contract, accepted by the parser, and refused as not implemented rather than silently ignored. The contract is the mechanism that keeps “one retrieval core” true in practice: if the surfaces share the parameters and the envelope, they cannot drift into three different searches that happen to share a name.

Closing #8625’s remainder: cross-client acceptance

#8625 — the MCP query surface over the unified index, as an mcpx namespace — is partly landed: the hosted MCP endpoint is live on the Worker and wired into the laptop’s mcpx daemon as its remote atlas server. What remains open, and what keeps #8625 open, is cross-client acceptance.

The acceptance is per client, for the four consumers named in the issue: OpenClaw, OpenCode, OpenChamber, and Muse lanes. Each client must be shown querying the unified index through the namespace with:

  • identity stamped — the query carries the calling agent’s own identity, not a shared hosted identity;
  • ceiling and corpus scoping enforced in branch queries — the client’s sensitivity ceiling and its permitted corpora are applied inside the retrieval core’s branch queries, before ranking, so an out-of-scope chunk cannot surface, be counted, or leak its existence through a result total;
  • audit-logged — every query is written to the audit log with its identity, ceiling, corpus scope, and trace identifier.

Today all hosted MCP callers share the one identity hosted-per-user at the personal ceiling; per-agent identity and scoping are #8625’s later slices and are deliberately not improvised in the current Worker code. Closing the remainder means replacing that shared identity with per-client identities on the hosted path and passing the four-client acceptance above. Until then, #8625 stays open and this chapter describes the acceptance as a requirement, not a result.

The Worker cache fix (#6805)

The Worker’s per-query Durable Object cache currently retains every result indefinitely: no TTL, no eviction, no invalidation — the cache_do.ts header states this is v1 behaviour, and #6805 tracks the fix. Indefinite retention is not a caching strategy: the corpus changes, embedding spaces are pinned and revised, and a cache that never expires serves a frozen corpus forever while reporting itself as a hit.

The designed fix has three parts, consistent with the deferred triggers already recorded in the Worker README:

  • A TTL and eviction policy. Entries expire on a stated time-to-live and are evicted least-recently-used under a stated size bound, replacing retention-by-default with retention-by-policy.
  • Invalidation on corpus change. The ingest watermark is the corpus-change signal: when ingest advances the corpus past a stated threshold — the recorded trigger is the first same-space re-ingest changing more than 5% of chunks, or a stale-result complaint — the cache key gains the corpus generation, orphaning prior entries exactly as the fleet keying design in Design: search integration for fleet and ID does.
  • A sweeper at scale. At the recorded scale triggers (10,000 cached queries or 1 GB aggregate), an LRU sweeper reclaims orphaned and expired entries rather than letting Durable Object storage grow without bound.

The exact-key purge route that exists today remains as the operator tool; it is not a substitute for the policy above, because no operator purges one query at a time against a corpus-wide ingest. The D1 hot cache (the #9134 chain) is a separate store with its own freshness, admission, and invalidation slices; it is not the fix for #6805, and its master flag is off today.

Open decision: #12900 thread 2 — the multi-client future

#12900 thread 2 asks whether Atlas is headed for multi-client use — other clients and fork sessions querying it as a tool, with the service and result-store shape that implies — or whether it stays Drew’s personal system with the surfaces it has. Thread 1 of that issue (parallel FTS and vector branches) has landed; thread 3 (the Nix-packaged Rust binary) has substantially landed elsewhere. Thread 2 remains open, and it is Drew’s decision.

This chapter therefore presents thread 2 as an open decision and designs nothing on top of a multi-tenant answer. The work above — per-client identity, ceilings in the core, a versioned contract — is justified for Drew’s own fleet of agents on its own merits and does not presume the answer. If the decision goes toward multi-client use, tenant isolation, per-tenant store placement, and the D1 hot-cache chain become load-bearing and get their own design pass; if it does not, they remain what they are today: a personal system with several clients of one owner. Either answer leaves this chapter’s design intact, which is the point of not pre-building for an answer that has not been given.

What exists today

  • The Atlas MCP server lives in the Cloudflare Worker (worker/src/mcp.ts). It is a stateless Streamable HTTP endpoint at POST /mcp exposing exactly one tool, search, with input {query, k?} (k clamped to 1–50, default 10), over the same executeSearch path as REST POST /v1/search — an MCP search and a REST search for the same normalised query share one Durable Object cache entry. Cache purge and inspect are deliberately not MCP tools. There is no read, related/recommend, or corpus-status tool today.
  • The laptop’s mcpx connects to that endpoint as its remote atlas server. All hosted callers share the identity hosted-per-user and the pinned ceiling personal (compile-time constants in worker/src/space.ts, verified against the service’s reported effective ceiling before any result is cached). Per-agent identity stamping, per-agent ceilings and corpus scoping, and a query audit log do not exist on the hosted path today; they are #8625’s open later slices, and #8625 stays open on cross-client acceptance for OpenClaw, OpenCode, OpenChamber, and Muse lanes.
  • The Worker holds no database credentials; fan-out, embedding, and merge live in the fleet search service, reached over the atlas-search.security.cab tunnel with a Cloudflare Access service token. The Worker’s public routes are GET /health (open), POST /v1/search, GET /v1/cache/inspect, and POST /v1/cache/purge (all gated), and POST /mcp (gated).
  • The Worker cache retains entries indefinitely: no TTL, no eviction, no invalidation in v1; the only deletion is the exact-key operator purge. #6805 is open.
  • The D1 hot-cache binding is present in the Worker configuration with its master flag off (HOT_CACHE_ENABLED = "false"), and in the current code nothing in the request path calls the D1 store at all; the storage layer landed under #13100 (closed) and its follow-ons are gated or in review — see Roadmap and issue map.
  • atlas-proto’s query-parameters-v1.json exists as the seed contract (SearchParametersV1: k, pool, expand, RRF k, per-signal weights). No explain provenance field, no corpus-status surface, and no grown multi-surface contract exist today. #12900 thread 2 is open and undecided.

Design: the standing evaluation programme

Design — not shipped behaviour. This chapter describes the standing evaluation programme as designed and tracked, not a gate that runs today in the form described. The golden set, the offline harness, and the recorded gate results named in What exists today are real; the grown golden set, the adversarial slices, the CI regression gate on every change class, and the online failure-mining loop are the programme this chapter designs. Tracking: #8627 (cross-agent eval sets for the unified index — the standing oracle) and #5741 (the ablation harness), under the programme epic #8983. Master prompt §2H in the Atlas programme investigation.

Source: pkgs/atlas-search/eval/README.md, pkgs/atlas-search/eval/fixtures/golden-311.json, pkgs/atlas-search/crates/atlas-core/src/eval.rs, doc/2026-11-08T10-45-00Z_design_atlas_golden_set_eval_gate/ under https://github.com/developing-today/code/blob/main/pkgs/atlas-search/eval/README.md — provenance only; this chapter is complete without following it.

Every other design in this book is gated on measurement. Query planning, layered search characteristics, reranking, the recommender, and the fleet and ID integrations all claim to make search better; the evaluation programme is how any of those claims is checked. Its shape is a standing programme, not a one-off benchmark: a golden set (a fixed set of queries with judged relevant results — the qrels, relevance judgements per query) that grows from real use, a set of metrics assigned per pipeline stage, a regression gate in CI (continuous integration) that every change class must pass, and an online loop that mines real failures back into the set. The current harness is described in Evaluation: golden sets and gates; this chapter designs the programme around it.

Grow the golden set from real traces

The golden set’s authority comes from where its queries and judgements come from. The design grows it from real traces: gold contexts — the passages and chunks that actually answered a real query — harvested from real retrieval runs, principally the fleet and ID query traces (atlas-query-trace/v1) and the feedback records (atlas-feedback/v1) that real lanes and real sessions produce.

The failure mode this defends against has a name and two numbers. A system tuned and measured on an offline set alone can score 0.91 offline and 0.40 in production: the offline set drifts toward the queries its builders imagined, the ranking learns the set rather than the corpus, and production — different queries, different phrasing, different intent — exposes the gap all at once. Harvesting gold contexts from real retrieval runs is the direct countermeasure. A query enters the golden set because someone actually asked it and a run actually answered it; its judgements record what in the real corpus answered it. Offline-only additions are still possible — the adversarial slices below are built, not harvested — but they extend a real-trace core; they do not replace it.

Growth is continuous and versioned. New harvested queries land in a development split first, are judged, and are promoted into the gated set on a stated cadence; a held-out split is preserved so that tuning cannot quietly consume the test evidence. The existing held-out set (54 near-exact queries, held out from the 311-query v3 golden set) is the model for that discipline.

No-answer probes

A search system that always returns something is not necessarily helping. The golden set therefore includes no-answer probes: queries for which the correct behaviour is to return nothing, or to return results only with an explicit low-confidence signal — queries about material the corpus does not hold, about sources not yet ingested, and about tiers above the caller’s ceiling, where “no answer” is also the security-correct answer.

No-answer probes are judged differently from ordinary queries. Precision on them is the metric that matters (see below): every confident-looking hit on a no-answer probe is a fabrication risk in an agent’s hands, because a lane will cite what search returns. A change that improves ranking metrics while degrading no-answer behaviour fails the gate.

Adversarial slices

Beyond ordinary and no-answer queries, the set carries adversarial slices — query groups constructed to attack a specific weakness. Each slice is scored separately, so a weakness cannot hide inside an averaged headline number:

  • Distractors — queries whose corpus neighbourhood contains plausible, topically adjacent chunks that do not answer the query. They test whether ranking reads intent or merely topic.
  • Semantic twins — pairs of chunks with near-identical meaning and different provenance, wording, or date, where only one is the correct answer (the current version, the applicable decision). They test provenance and recency handling, which pure semantic similarity gets wrong by construction.
  • Alias-only — queries that name their target only by an alias, abbreviation, codename, or former name, with no shared vocabulary with the target chunk. They test expansion, rewriting, and entity handling — the planner workstream’s home ground (see Design: query planning).
  • Long-doc — queries whose answer is a small span inside a very long document or session. They test chunking and span handling: a system that retrieves the document but buries the span has not answered the query.

A new attack class becomes a new slice when a real failure exhibits it; the online mining loop below is the usual source.

Per-stage metrics

Atlas retrieval is a pipeline — retrieval (full-text and vector branches gathering candidates), fusion, any reranking stage, and final presentation — and a single end-to-end number cannot say which stage regressed. The programme assigns each stage the metric that gates it:

  • Recall@k gates retrieval. Recall at depth k — of the chunks judged relevant, what fraction appears in the candidate pool at depth k — is the retrieval stage’s gate. Nothing downstream can recover a chunk retrieval missed, so retrieval changes (a new signal, a new embedder, an ANN index replacing the exact scan) are judged first on whether recall holds. The harness reports Recall@100 and Recall@1000.
  • nDCG and MRR judge ranking. Normalised discounted cumulative gain at 10 (nDCG@10) — graded relevance, discounted by rank, normalised against the ideal ordering — and mean reciprocal rank at 10 (MRR@10) — how high the first relevant result sits — judge the ranking stages: fusion, the planner’s routing, and the reranker. A reranker that improves nDCG without touching recall is doing exactly its job (see Design: the reranking stage); a fusion change that trades recall for nDCG has moved the loss somewhere the headline number hides, and the per-stage split exposes it.
  • Precision@k controls noise. Precision at depth k — of the results returned, what fraction is relevant — controls how much noise a caller must filter. It is the primary metric for the no-answer probes and a guard metric everywhere else: a change may not buy recall or nDCG with a precision collapse that floods lanes with plausible junk.

Metrics are reported per query class as well as in aggregate — the harness already reports per class — so that a strategy that helps one class (say, alias-only queries) and hurts another cannot pass on the average.

The CI regression gate

The programme’s enforcement point is a CI regression gate on every change class that can move retrieval quality:

  • an embedding model change, including a second embedder’s introduction and any model-revision bump;
  • a chunker change — chunk size, boundary policy, or span handling;
  • a fusion change — weights, the RRF constant, or a new fused signal;
  • a reranker change — model, pool size, or adoption for a corpus;
  • a planner change — routing, rewriting, expansion, or any transform’s gating.

The gate runs the golden set through the ablation harness (#5741) — saved rankings from each signal combination scored offline against the judged qrels — and compares per-stage metrics and per-slice scores against the recorded baseline. A regression beyond the stated tolerance in any gated metric or adversarial slice blocks the change, whatever its other merits; an improvement is recorded as the new baseline only when the change merges. This is the same discipline that already governed two landed changes: the Rust binary’s swap for the Python CLI was gated on the golden 311 tying the Python reference, and the shard programme’s oracle is p50/p95 latency at fixed Recall@10 against the standing eval sets — a configuration wins only at equal-or-better recall. The design generalises those one-off gates into the standing rule. Model cutovers in particular follow it absolutely: a new model or embedder cuts over on its eval result, not on its completion.

Online failure mining

The offline gate cannot see queries nobody has written yet. The online half of the programme mines real failures from real use and folds them back into the set:

  1. Collect. Fleet lane queries and ID queries (as the ID query path lands — see Design: search integration for fleet and ID) produce traces and feedback continuously.
  2. Mine. A periodic pass selects failures by signal: queries with down-votes, queries whose results were all ignored or immediately re-queried in different words, queries with no clicks on a full result page, and queries a lane escalated to a human or another source.
  3. Judge and fold back. Mined queries are judged — what in the corpus should have answered this? — and enter the golden set’s development split, or become a new adversarial slice when they exhibit a new attack class. The 0.91/0.40 trap is, operationally, what happens when this loop does not run: the set stays frozen while production moves. Failure mining is what keeps the gated set the same distribution as the real one.

Feedback capture is the seam this loop consumes. atlas-feedback/v1 records thumbs votes keyed to (query_id, chunk_id) result identity — never rank position, so a vote survives re-ranking — with a derived supersede view and requester-kind weighting in the aggregation. Today nothing consumes the aggregated feedback for ranking; the mining loop is its first standing consumer, and any later learning-to-rank claim is built on the same seam, not on a new one.

What exists today

  • The golden set is pkgs/atlas-search/eval/fixtures/golden-311.json: the 311-query v3 golden set, copied byte-for-byte from the laptop’s golden queries file, whose header records the source corpus size and fingerprint the corpus-specific runner checks before scoring. Beside it: fixtures/heldout-nearexact-54.json (54 held-out near-exact queries) and fixtures/eval-smoke.json (synthetic; explicitly not held-out evaluation evidence).
  • The harness (#5741) exists: atlas-eval in atlas-core (eval.rs, format atlas-eval/v1) scores saved rankings from any signal combination offline against judged qrels, reporting nDCG@10, Recall@100, Recall@1000, and MRR@10 per query class. The designed ablation matrix — dense / BM25 / SPLADE / their fusions, each with and without Jaccard rescore — is measured, not argued. Recorded gate results exist for the Jaccard third-signal gate (#5733) and the overlap and boundary-drift studies (#6039, #6038).
  • The standing programme issue #8627 is open. #9092 names its oracle as p50/p95 latency at fixed Recall@10 against the standing eval sets.
  • Feedback capture exists with no ranking consumer: atlas-core implements atlas-feedback/v1 (append-only thumbs votes keyed to query and chunk identity) and query traces (atlas-query-trace/v1); no code path in the tree consumes aggregated feedback for ranking or recommendation today, and the evaluator scores supplied rankings — it does not itself run retrieval (#8062 records that seam).
  • What does not exist today: a golden set grown by harvesting real traces, the no-answer and adversarial slices as standing gated slices, a CI regression gate spanning all five change classes, and the online failure-mining loop. Those are this chapter’s design.

Roadmap and issue map

Design — not shipped behaviour, and a dated snapshot. This chapter is the Atlas programme on one page: the workstream order, the standing blockers, and the shape of the issue census as counted on 2026-11-23. It is not the living map. The living map is the tracking issue #13241, kept current as issues open, close, and change state; this chapter is the snapshot of that map at the count date, written for the book. Where this chapter and #13241 disagree, #13241 is right and this chapter is stale. The book itself is tracked as #13251; the programme epic is #8983.

Source: GitHub Search API counts and issue states verified 2026-11-23 for label:epic/atlas-program in developing-today/code, the programme records on #8983, #9097, #9134, and #12900 under https://github.com/developing-today/code/issues/8983 — provenance only; this chapter is complete without following it.

The workstream order

The programme runs in one order, for one reason: each workstream’s output is the next workstream’s input, and the evaluation programme gates all of them. The order is the master prompt’s §2 sequence, restated as a dependency chain.

  1. Ingest and freshness first. Automatic ingest of all sources (Design: automatic ingest of all sources) — continuous ingestion, the ingest watermark, and a verified corpus recount. Everything downstream is measured against, cached against, and served from the corpus; while the corpus is frozen at the 2026-10-31 publish, every later workstream is building on stale ground. Freshness is also the fleet-facing fix (see Design: search integration for fleet and ID).
  2. Query planning and layered search characteristics. The planner the API already pretends to have — routing, filter extraction, conversational rewriting first; expansion, multi-query, HyDE, and decomposition second (Design: query planning) — together with the layered signals on the Snowflake base: learned sparse (SPLADE), late interaction (ColBERT) as a mid-stage, metadata pre-filtering, and the ANN serving path that replaces the ~4-second exact scan (Design: layered search characteristics on Snowflake). The second-embedder evaluation (#9092) is decided in this workstream, on eval results.
  3. Reranking. A cross-encoder stage over the fused candidate pool (Design: the reranking stage), adopted per corpus and golden-set-gated. It comes after the layered work because it ranks what the layers retrieve: reranking a weak candidate pool polishes a recall failure.
  4. The recommender. The single-user recommender (Design: the single-user recommender) — profile-centroid and session co-occurrence candidates, ranked and diversity-re-ranked — built on the retrieval stack the previous workstreams finished, and on its snapshot-paging foundation (#10158, whose PR is flag-held; see Blockers).
  5. Fleet and ID integration. Result caching keyed by index version, batch search, embedded-replica offline fallback, and search-quality telemetry for the fleet; the #6062 publication format, the #11182–#11186 projectors, and #9109 Part C for ID (Design: search integration for fleet and ID). Integration follows the retrieval work so that what is integrated is the finished core, not an interim one.
  6. Access growth. The MCP tool growth, REST explain, the grown atlas-proto contract, and #8625’s cross-client acceptance (Design: MCP and programmatic access, next steps). Access is last because each new surface freezes a shape; the shapes are frozen after the core settles.

Gated on the evaluation programme, throughout. Design: the standing evaluation programme is not a seventh workstream at the end of the list. It is the gate across all six: every model, chunker, fusion, reranker, and planner change passes its CI regression gate, and its golden set grows from the real traces the other workstreams produce. A workstream that cannot show its eval result has not finished, whatever its code state.

Standing blockers

Blockers are marked here as they stood at the 2026-11-23 count. A blocker is a named issue or decision that stops named work; flag-held means the work may not start without Drew’s item-specific word, and shepherd-held means a finished PR waits in the parent programme’s shepherd queue and is not merged by the programme’s own lanes.

  • The D1 chain (#9134). The D1 tenant hot-cache chain: #13100 (schema and store) is closed and landed, with the master flag off. #13101 (freshness evaluator) and #13103 (admission policy) are open and in review. #13105 (read-path integration) is gated on #13101 — it may not proceed until the freshness evaluator lands. #13106 (invalidation) is flag-held — it awaits Drew’s item-specific go-ahead and is not ordinary queue work. #13107 (measurement report) sits behind #13105. Net effect: production search does not touch D1 today, and the chain advances only through #13101.
  • #8479 — purge versus reclassify is Drew’s decision. The 638 secret-bearing chunks also live in the production monolith and a local replica, so the tier boundary does not currently hold outside the shard set. The options are a purge from the wrong-tier stores or a reclassification of the material; the destructive leg is additionally gated on production-ingestion verification. No programme work decides this, and no claim that the tier boundary holds may be made until it is decided and done.
  • #12900 thread 2 — Drew’s decision. Whether Atlas is headed for multi-client use or stays Drew’s personal system. Thread 1 (parallel branches) landed via PR #13039; thread 3 (the Nix-packaged binary) substantially landed elsewhere; thread 2 stays open as a product question. It is presented as an open decision in Design: MCP and programmatic access, next steps and is not designed around.
  • The thinking-traces question — open. Inside #9097 item 4 (all OpenCode sessions): whether to ingest thinking traces, with a recommendation covering volume, value, and classification implications. Undecided; the investigation is filed, the answer is Drew’s.
  • #9097 Workstream E — blocked. Continuous ingestion of the queue/PM, GitHub, Muse, OpenCode, and ID corpora plus the sources-inventory pass. It is the programme’s first workstream and it is blocked: the staging tier and promote gate exist in code, but the aggregator/embedder, the session-close hook, and the recurring sweep runner (#7969, open) are not built, and its external-GitHub half waits on the licensing and zone-policy gates (#6024, #6052, both open).
  • Flag-held shepherds: PR #12873 and PR #13097. PR #12873 (recommendation snapshot paging, #10158) and PR #13097 (atlas-core clippy cleanup, #13056) are both open and unmerged, held in the shepherd queue. They are not merged without Drew’s word, and work depending on them — the recommender’s paging foundation, in #12873’s case — plans around the hold rather than through it.
  • Also standing: the atlas-core clippy issue #13056 itself (open, in review, 22 pre-existing warnings recorded); the Worker cache issue #6805 (open; the fix is designed in the access chapter); and the secret-tier follow-ons #12403, #12404, and #12406 on the #8479 line.

The census shape (2026-11-23)

Counts are GitHub Search API totals verified on 2026-11-23. They will drift; that is expected, and it is why the living map lives on #13241 rather than here.

  • 57 open issues carry the epic/atlas-program label; 123 carry it in all states (so 66 are closed). The programme epic is #8983, created 2026-11-12 because the label cluster — then 68 open issues — had no epic issue of its own. The older epic/atlas label is a redundant carrier whose open issues are a strict subset.
  • 207 open issues mention Atlas by text search — the wider penumbra beyond the labelled programme, including the atlas-adjacent families this map also tracks: #3125 (provenance and CAS; phases 1–2 landed 2026-11-22/23, phases 3–4 open), #9097, and #9134.
  • The open 57 group, in working order, as: the memory-programme slices (#8622, #8623, #8625, #8626, #8627); the search v1 build-out (#9091, #9092, #5773, #5774, #6805); the ingest programme (#6018, #6025, #7969, #9097, #5670); the cold tier (#8227–#8231); storage and placement research (#9098, #9133, #9135, #8528); the ID-facing set (#6062, #11182–#11186, #9109); and the programme roots (#5350, #3125, #6024).

The prioritised, blocker-annotated ordering of every one of those issues — the map itself, as opposed to its shape — is maintained on #13241 and in the programme’s working records, and is worked, not just listed: a blocker that can be cleared by programme work gets a lane, and a blocker that is Drew’s decision gets surfaced with its options, once, and is not re-asked.

The design archive, mapped

The repository’s doc/ tree holds 38 Atlas records (dated design, decision, research and report folders); doc/README.md indexes only 6 of them. Every record is treated somewhere in this book — the archive itself stays in doc/, and this table is the map from each record to the chapter that carries its substance.

Record in doc/What it designs or decidesTreated in
2026-11-04T08-07-13Z_design_atlas_binary_service/The design of record: Atlas as a Rust binary and multi-client search serviceArchitecture, The service and the Worker
2026-11-04T21-27-34Z_design_atlas_scaler_revision/Turso data architecture, Scaler-era revision; source of the staging-tier designIngest today: staging, classification, promotion, Data stores and schemas
2026-11-05T13-03-49Z_design_atlas_manifest_filter_surface/Schema-driven filter surface from the classification manifestSensitivity tiers and client ceilings
2026-11-05T15-50-41Z_decision_atlas_pitr_vs_retention/Decision: Turso PITR is not Atlas corpus retention (#6043)Backup, restore and the census
2026-11-08T09-15-51Z_design_atlas_license_capture_ingest/License capture at ingest, in provenance (#6053)The corpus: provenance and content addressing, Design: automatic ingest of all sources
2026-11-08T10-26-00Z_design_atlas_content_versioning_retention/Content versioning and retention (#6026)The corpus: provenance and content addressing
2026-11-08T10-26-00Z_design_atlas_offset_matching/Offset matching for delta-only ingestion (#6036)Design: automatic ingest of all sources
2026-11-08T10-44-00Z_decision_atlas_cross_tier_vector_comparability/Decision: one embedding model for every tier (#6060)Embeddings: Snowflake Arctic and the parity contract
2026-11-08T10-45-00Z_design_atlas_golden_set_eval_gate/Golden-set builder and eval gate (#6046)Evaluation: golden sets and gates, Design: the standing evaluation programme
2026-11-08T11-18-02Z_design_atlas_storage_growth_model/Storage growth model (#6061)Data stores and schemas
2026-11-08T13-45-00Z_design_atlas_staging_shard_ingest_gate/Staging-shard ingest gate: write, classify, dedup, provenance-check, publish (#6057)Ingest today: staging, classification, promotion
2026-11-08T20-45-40Z_design_atlas_presidio_ner.mdPresidio NER pass: recognizer set, tier scoping, review queue (#6048); design onlySensitivity tiers and client ceilings
2026-11-09T00-42-59Z_design_atlas_deletion_propagation.mdDeletion propagation: source deleted → corpus purge (#6054)Design: automatic ingest of all sources
2026-11-09T01-07-20Z_design_atlas_embedding_cost_ledger/Embedding cost ledger (#6058)Design: automatic ingest of all sources
2026-11-09T01-31-29Z_design_atlas_chunk_boundary_policy_v2/Chunk-boundary policy v2 (#6037)Ingest today: staging, classification, promotion
2026-11-09T05-10-38Z_design_atlas_revalidation_cadence.mdClassification revalidation cadence (#6051); design onlySensitivity tiers and client ceilings
2026-11-09T05-12-00Z_design_atlas_ingestion_operations/Semi-automated ingestion operations and guardrails (#6019)Design: automatic ingest of all sources
2026-11-09T05-12-32Z_design_atlas_ingest_attestation/Ingest attestation record (#6045)The corpus: provenance and content addressing
2026-11-09T07-20-00Z_design_atlas_id_publication/Atlas → ID-graph publication format (#6062)Design: search integration for fleet and ID
2026-11-10T20-06-24Z_design_atlas_cold_tier_shard_format/Cold-tier shard format and restore path (#6042)Data stores and schemas, Backup, restore and the census
2026-11-10T20-41-01Z_design_atlas_retrieval_stats_feedback.mdRetrieval statistics, result feedback, query trace (#6027)Evaluation: golden sets and gates, atlas-search: serve, init, fetch-model, traces and feedback
2026-11-10T20-55-00Z_design_atlas_secret_tier_embedder/Secret-tier local embedder, no-egress invariant (#6059)Sensitivity tiers and client ceilings
2026-11-10T22-56-00Z_design_atlas_delta_detection_join/Per-source delta detection and join semantics (#6028)Design: automatic ingest of all sources
2026-11-11T03-45-00Z_design_atlas_v2_v4/Atlas beyond v1: evidence, adaptation, stewardship (#6020)This chapter
2026-11-12T23-59-00Z_design_atlas_v1_proto/Atlas v1 proto designatlas-proto: the wire contract
2026-11-13T00-41-00Z_design_id-atlas-primitives-federation-namespaces/ID/Atlas primitives, federation, namespaces (#9106)Design: search integration for fleet and ID
2026-11-13T03-40-00Z_design_id-atlas-summit/ID/Atlas summit decisions and defaultsDesign: search integration for fleet and ID
2026-11-13T10-55-11Z_design_atlas_span_table_schema/Span-table schema for offset embeds (#6035)Data stores and schemas
2026-11-14T12-20-00Z_research_atlas_cdc_feasibility_6040/Research: CDC feasibility — content-defined chunking rejected at the embed layer (#6040)Design: automatic ingest of all sources
2026-11-15T00-50-00Z_report_atlas_layer1_revalidation.mdLayer 1 classification revalidation scan report (#6021)Sensitivity tiers and client ceilings
2026-11-17_design_atlas_retention_rule_engine.mdRetention rule engine (#6041)Backup, restore and the census
2026-11-21T17-56-24Z_design_atlas_metadata_schema_v1/Metadata schema v1 and evolution doctrine (#9095)Data stores and schemas
2026-11-21T21-32-00Z_design_atlas_classification_model_v1.mdPer-embed classification and disclosure model (#9096)Sensitivity tiers and client ceilings
2026-11-22T01-48-21Z_design_c8_atlas_ingestion_investigation/C8 error-driven investigation ingest (#9576)Consumers: fleet, agents, memory and ID
2026-11-23T04-10-00Z_decision_atlas_embedded_replica_integration/Decision: embedded-replica integration shape (#11213)Design: search integration for fleet and ID
2026-11-23T08-06-00Z_design_atlas_d1_tenant_hot_cache/D1 tenant hot cache design (#9134); design onlyThe service and the Worker
2026-11-23T12-06-51Z_design_atlas_program_investigation/The programme full-investigation prompt and snapshot (#13241)This chapter
atlas-scratch-sweep-2026-11-14/Scratch sweep bundle: Jaccard rescore note, SPLADE note, ingestion brief inventoryDesign: layered search characteristics on Snowflake

One further record lives outside the filename pattern: the external-GitHub-content lawyer review (2026-11-08T20-11-41Z_legal_external-github-content-lawyer-review/, no “atlas” in its name) — the licensing gate behind Workstream E, treated in Design: automatic ingest of all sources.

What exists today

  • The programme exists as a labelled issue set and an epic: 57 open epic/atlas-program issues at the 2026-11-23 count, epic #8983 open, and the full-investigation tracking issue #13241 as the living map. This book is tracked separately as #13251.
  • Shipped today, beneath the roadmap: the hybrid search core (FTS + vector, RRF fusion only — no reranker in the serving path), the Snowflake Arctic Embed m-v2.0 embedder at 768 dimensions with bit-identical Rust/Python parity, fleet search and the atlas-search CLI, the laptop search service, the Cloudflare Worker with its single-tool MCP server, the golden-311 evaluation harness, staging with a promote gate, and the #3125 provenance phases 1–2 (12,092 content-addressed objects interned, verified 2026-11-23).
  • Not shipped today, and therefore roadmap rather than record: continuous ingest, the query planner (its contract flags are accepted and refused as unimplemented), any learned-sparse, late-interaction, ANN, or reranking stage in the serving path, the recommender beyond its design and one held paging PR, any ID query path, per-agent MCP identity, and any D1 read path (the D1 master flag is off and the store is unwired in the request path).
  • The blockers listed above stood as described at the 2026-11-23 count: #13105 gated on #13101, #13106 flag-held, #8479 and #12900 thread 2 awaiting Drew’s decisions, the thinking-traces question open, #9097 blocked, and PRs #12873 and #13097 flag-held in the shepherd queue.

Repository layout

Source: pkgs/atlas-search/ in https://github.com/developing-today/code/blob/main/pkgs/atlas-search/Cargo.toml, https://github.com/developing-today/code/blob/main/pkgs/atlas-search/flake.nix and https://github.com/developing-today/code/blob/main/pkgs/atlas-search/default.nix, and the design of record at doc/2026-11-04T08-07-13Z_design_atlas_binary_service/ — provenance only; this chapter is complete without following it.

Everything Atlas lives in one directory: pkgs/atlas-search/ in the developing-today/code repository. It is a self-contained workspace on the pkgs/id pattern — its own Cargo workspace, its own Nix sub-flake, its own pinned Rust toolchain — so the package can be built, tested and versioned without the rest of the repository’s build machinery. Other packages consume it as it stands: pkgs/fleet path-depends on its crates, its workspace manifest and its schema/ directory, and reuses its vendored ONNX Runtime package, so moving a file inside this tree can break a build outside it.

The tree

pkgs/atlas-search/
  atlas_search.py        the Python reference implementation
  Cargo.toml  Cargo.lock the workspace manifest and lockfile
  rust-toolchain.toml    the pinned Rust toolchain (the sub-flake reads it)
  flake.nix  flake.lock  the package sub-flake
  default.nix            the package derivation (called by the sub-flake
                         and by home configuration)
  book.toml  book/       this book (config at the package root, sources in book/)
  crates/                the four Rust crates
  worker/                the Cloudflare Worker (TypeScript)
  eval/                  the evaluation harness scripts and golden sets
  schema/                versioned SQL DDL for the staging tier
  tools/                 auxiliary tools that live with the package
  fixtures/              parity fixtures and their generators
  test-vectors/          pinned known-answer test vectors
  onnxruntime/           the vendored ONNX Runtime Nix package
  docs/                  the three package-local design/operations notes
  tests/                 package-level tests (currently one Python test)

crates/ — the four crates

The workspace members, declared in the root Cargo.toml (edition 2024, rust-version 1.96, licence MIT OR Apache-2.0):

CrateWhat it holds
crates/atlas-coreSearch semantics as a library: filters and sensitivity ceilings, the FTS and vector branches, RRF fusion, the result envelope, the Turso and local backends, plus staging, classification, the ingest gate, evaluation and trace machinery. It also carries four of the six binaries, auto-discovered from src/bin/: atlas-classify, atlas-eval, atlas-github-comments and atlas-sweep. See atlas-core: the engine as a library.
crates/atlas-embedThe Snowflake Arctic embedder: dynamically loaded ONNX Runtime plus the model’s own Unigram tokenizer. A single src/lib.rs, plus the Gate A parity test. See atlas-embed: embeddings as a library.
crates/atlas-protoThe wire contract shared by the service and its clients: the job-protocol types and query-parameters-v1.json, the versioned file the query defaults are derived from. See atlas-proto: the wire contract.
crates/atlas-searchThe atlas-search binary: the CLI, the via-service client and serve, in src/main.rs, src/server.rs (with src/server/ submodules), src/service.rs and src/fetch_model.rs, plus the Python-shaped JSON writer (src/pyjson.rs) and envelope renderer (src/render.rs). One extra binary lives here: atlas-stage, from src/bin/atlas-stage.rs.

The full crate inventory is The crates.

worker/ — the Cloudflare Worker

The hosted surface, in TypeScript: src/index.ts (routing and the gate), src/mcp.ts (the MCP endpoint), src/search.ts (the one search execution path), src/service.ts (the client for the laptop service), src/cache_do.ts (the per-query Durable Object cache), src/hot_cache.ts (the D1 hot-cache storage layer), src/key.ts, src/space.ts and src/body.ts. Beside the sources: test/ (the vitest suite), migrations/ (the D1 migration 0001_hot_cache.sql), package.json, wrangler.toml (local development and tests) and cloudflare.config.ts (the deploy source of truth — the two configuration files must be kept in step). Its own README.md is the Worker’s operator notes. See The service and the Worker.

eval/ — evaluation

The offline evaluation programme: eval3.py (the Python reference runner), gate5733.py and its recorded results, the boundary-drift and overlap experiments, an eval/README.md, and fixtures/ holding the golden query sets (golden-311.json, heldout-nearexact-54.json). See Evaluation: golden sets and gates.

schema/ — versioned DDL

Exactly three versioned SQL artifacts: atlas_stage_v1.sql (the staging database schema), stage_registry_v1.sql (the staging registry) and gate_records_v1.sql (the ingest-gate record). The versioning rule is stated in the files and in the code that embeds them: bump only by adding a new vN artifact; never edit an applied version in place. atlas-core embeds these files with include_str!, which is why the Nix dependency layer in Building and testing must include schema/ in its source tier. See Data stores and schemas.

tools/ — auxiliary tools

One tool: note_promotion_sweep.py, the pointer-stub sweep for note promotions, with its tests in tools/tests/. Note what it is not: it is a notes-placement tool that lives in this package, not a corpus-ingest tool.

fixtures/ — parity fixtures

The recorded evidence the parity gates run against: embed-probes.json (Gate A embedder probes), core-expectations.json (Gate B envelopes and SQL strings recorded from the Python reference), the miniature fixture corpus (fixture_corpus.sql + fixture_spec.json), eval-smoke.json, the generators that recorded them (gen_fixtures.py, gen_core_fixtures.py, make_fixture_db.py), and smoke_check.py — the script the Nix package runs as its install check.

test-vectors/ — known-answer vectors

One file today: content-hash-v1.json, pinning the classification manifest’s content hash with known-answer vectors — and recording, just as explicitly, that the chunk content_hash producer is not pinned there and that interop claims for it are forbidden until it is.

onnxruntime/ — the vendored runtime

A small Nix package (default.nix, plus a musl patch) vendoring the pinned ONNX Runtime release in-tree (code#6765, Drew’s ruling 2026-11-08) rather than taking the ambient nixpkgs version: the corpus and the Gate A fixtures were embedded and certified under that release, so the library the binary loads must be the same one. The main package compiles in ATLAS_SEARCH_ORT_LIB_DEFAULT pointing at this package’s libonnxruntime.so. See Embeddings: Snowflake Arctic and the parity contract.

docs/ — package-local notes

Exactly three files: external-set-enumeration.md (the external-corpus candidate list, #6023), memory-integration-design-8567.md (the memory integration decision, #8567) and owner-inventory-matcher.md (the Layer 3 owner-inventory matcher note). The large design archive — including the design of record — does not live here; it lives in the repository-root doc/ directory.

atlas_search.py — the Python reference

The Python implementation the Rust crates port, kept permanently as the eval instrument and parity reference. The in-repo copy is 1,629 lines. (The design of record describes a 1,177-line Python file; that number is true of the older hatch-personal copy, not of this one — where a chapter cites “the Python reference”, it means this file.) Its own header points at a README.md in this directory; no such file existed before this book — the README it describes is the turso-atlas README in the laptop working tree. See atlas_search.py: the Python reference implementation.

The sub-flake

flake.nix + flake.lock + rust-toolchain.toml make the package independently buildable:

  • Inputs: nixpkgs (nixos-unstable, the same track as pkgs/id), the systems and flake-utils helpers, rust-overlay, and crane — the build library that splits dependency compilation out of the package build (#8392), pinned to the revision the repository’s root lock already carries.
  • The toolchain is read from rust-toolchain.toml via rust-overlay (pkgs.rust-bin.fromRustupToolchainFile), so the Nix build, the dev shell and a rustup user all resolve the same pinned compiler.
  • Outputs: packages.atlas-search (also default), checks.default, and devShells.default carrying the pinned toolchain.

default.nix is the derivation both routes call: the sub-flake passes it a crane library and gets the split build; home configuration calls it without one and gets the monolithic buildRustPackage build — same sources, same checks, no split. See Building and testing.

How the built package differs from the design of record

The design of record (doc/2026-11-04T08-07-13Z_design_atlas_binary_service/, §4) proposed this package as exactly the four crates plus fixtures/ and a package-local doc/ directory, packaged with rustPlatform.buildRustPackage. The four crates exist exactly as designed. Everything around them grew beyond the tree in the design — state it as fact, not as drift to be apologised for:

  • worker/, eval/, schema/, tools/, tests/ and test-vectors/ were not in the 4-crate design at all. Neither was onnxruntime/ (the design assumed nixpkgs’ runtime; the vendored package is the later #6765 ruling), nor atlas_search.py at the package root (the design treated the Python as an external source of truth to port from; the migration, #5670, brought it in as the permanently kept reference).
  • The package-local documentation directory is docs/ (plural, three files), not the doc/ (singular) the design’s tree shows; there is no package-local doc/.
  • A book — book.toml + book/ — is the newest addition, added by the work this chapter is part of (#13251).

A chapter, a script or a review that reprints the design’s tree as the current layout is wrong. This chapter is the layout of record; when the tree changes, this chapter changes in the same change — see Keeping this book current.

Building and testing

Source: pkgs/atlas-search/flake.nix, pkgs/atlas-search/default.nix and pkgs/atlas-search/rust-toolchain.toml in https://github.com/developing-today/code/blob/main/pkgs/atlas-search/flake.nix, and the workflows .github/workflows/atlas-search-pr.yml, .github/workflows/atlas-search-worker-tests.yml and .github/workflows/fleet-search-parity-guard.yml — provenance only; this chapter is complete without following it.

There are two build routes and they must agree: the Nix package build (what ships) and cargo in the dev shell (what you iterate with). The package layout these routes operate on is Repository layout.

The Nix build

From the repository root:

nix build path:./pkgs/atlas-search

That builds the package through its own sub-flake (pkgs/atlas-search/flake.nix), which reads the pinned toolchain from rust-toolchain.toml via rust-overlay and calls default.nix. The same default.nix is called by home configuration (pkgs.callPackage ../../pkgs/atlas-search { … }) when the laptop’s service package is built — with one difference in build shape, covered under the crane split below.

What the package build does beyond compiling:

  • ONNX Runtime is never downloaded, at build time or run time. The ort crate is built with dynamic loading against the vendored in-tree onnxruntime/ package, and ATLAS_SEARCH_ORT_LIB_DEFAULT is compiled into the binary pointing at that package’s libonnxruntime.so — which also puts libstdc++.so.6 and libz.so.1 in the runtime closure.
  • The test suite runs in the check phase (doCheck = true), with HOME redirected to the build’s temp dir (the server tests write traces under the state directory and fail against the sandbox’s unwritable home) and git provided (the atlas-core detection tests spawn it).
  • An install check proves the loader lesson: fixtures/smoke_check.py runs one FTS-only and one embedded query against the installed binary with no ATLAS_ORT_LIB set, so a closure that cannot load the runtime fails the build instead of failing on the laptop.

The crane dependency split (#8392)

When a crane library is supplied — the sub-flake supplies one — dependency compilation is split out of the package build. Crane’s buildDepsOnly compiles every registry dependency as its own derivation, keyed only on what can change dependency compilation. Two source tiers make that keying honest:

TierContentsFeeds
Dependency tierCargo.toml, Cargo.lock, crates/, schema/buildDepsOnly only
Package tierthe dependency tier plus fixtures/the package build and its check phase

schema/ is in the dependency tier because atlas-core embeds the staging DDL from it with include_str! — a schema edit really can change a crate build. fixtures/ is deliberately not: the test suite reads fixtures by relative path, so the check phase needs them, but a fixture edit must not rebuild the whole dependency tree. eval/, worker/ and any in-tree target/ are in neither tier.

The consequence a contributor feels: a change to workspace sources rebuilds just the workspace crates; a change to Cargo.lock rebuilds the dependency layer, once. Callers that do not pass a crane library (home configuration) keep the monolithic buildRustPackage build — same sources, same checks, no split.

Cargo in the dev shell

Enter the sub-flake’s dev shell, which carries exactly the pinned toolchain:

cd pkgs/atlas-search
nix develop
cargo test --all-targets
cargo test -p atlas-core
cargo test -p atlas-search

Per-crate runs mirror what CI does (below). The toolchain pin lives in exactly one place: rust-toolchain.toml reads channel = "1.99.1" (with rustfmt and clippy components, profile default), mirroring the pkgs/id pin. Every other source states the same figure: CI installs 1.99.1 (rustup toolchain install 1.99.1 --profile minimal), the flake.nix comment describes the pin as “the pinned toolchain (rust-toolchain.toml, channel 1.99.1) — the same rustup toolchain the step 1–4 gates ran under on the laptop”, and the laptop’s home configuration builds its Atlas toolchain from the same file. (Until 2026-11-23 the CI workflow and the comments still said 1.99.0, so CI tested a different compiler than the Nix build shipped; #13286 records the alignment.) The file also carries the warning that changing the channel may cause rustc itself to build, so a channel bump is committed only once nixpkgs has the new compiler cached. Separately, the workspace manifest’s rust-version = 1.96 is a minimum (the oldest compiler the code claims to support), not the pin.

One release-profile rule with no exceptions: the release profile carries no fast-math-style flags. The embedder’s numerics are a parity contract (Gate A, in Embeddings: Snowflake Arctic and the parity contract), and the comment in Cargo.toml exists so a future profile edit has to argue with it.

What CI actually runs

House policy is CI on main only: workflows are not merge gates, and Atlas’s run on the nightly-plus-dispatch pattern Drew set on 2026-11-16. State the triggers as they are in the files, not as the filenames or headers claim — all three Atlas workflows disagree with their own presentation somewhere, and the on: block is the truth in each case.

atlas-search-pr.yml — the Rust checks

  • Triggers: nightly schedule (17 7 * * *) and workflow_dispatch only. Despite the -pr filename, no pull-request or push trigger exists in the file; the header cites the 2026-11-16 nightly-main-CI policy, and the name is the stale part.

  • One job (“basic: atlas-search Rust checks”), ubuntu-latest, 30-minute timeout, contents: read: checkout, install the 1.99.1 toolchain, then four test steps — one per crate, each of the shape:

    cargo +1.99.1 test --manifest-path pkgs/atlas-search/Cargo.toml --all-targets -p atlas-core
    

    for -p atlas-search, -p atlas-core, -p atlas-proto, -p atlas-embed.

  • There is no cargo fmt --check: formatting is not a merge gate in this repository; it is auto-fixed on main.

  • atlas-embed’s Gate A model test stays #[ignore]d in this venue: it requires ATLAS_ORT_LIB and the pinned model snapshot, and its verdict is version-matched to ONNX Runtime 1.31.1 — it runs on the laptop, not in CI.

atlas-search-worker-tests.yml — the Worker vitest suite (#7683)

  • Triggers as written in the file: workflow_dispatch and the nightly schedule (17 7 * * *). The header prose says the suite runs “on pushes to main that touch pkgs/atlas-search/worker/ and on dispatch” — header and trigger disagree within the one file; the trigger block is what runs.
  • Why it exists: before it, the Worker’s vitest suite was run by no workflow, flake check or recipe — only by hand via npm test.
  • One job, ubuntu-latest, 15 minutes: checkout, Node 24, then a guard step that fails the run if any of test/key.test.ts, test/space.test.ts, test/worker.test.ts, package.json or package-lock.json is missing — a green run can never be a silently skipped suite — then npm ci and npm test in pkgs/atlas-search/worker (vitest with @cloudflare/vitest-pool-workers). The suite also covers the MCP endpoint, the body cap and the hot cache (mcp.test.ts, body.test.ts, hot_cache.test.ts).
  • Run it locally the same way: cd pkgs/atlas-search/worker && npm ci && npm test; npm run typecheck runs tsc --noEmit.

fleet-search-parity-guard.yml — the byte-parity guard

  • Trigger: workflow_dispatch only. Nothing runs it automatically on a change to either guarded file; the guard exists, the gating does not.
  • Pure bash on ubuntu-latest, 5 minutes, no Nix and no toolchain: first the guard’s own contract test suite (bash .github/scripts/check-fleet-search-parity.test.sh), then the comparison itself (bash .github/scripts/check-fleet-search-parity.sh).
  • What it compares: the fleet-search copies of the Python-JSON writer and the envelope renderer — pkgs/fleet/crates/fleet-search/src/{pyjson,render}.rs against pkgs/atlas-search/crates/atlas-search/src/{pyjson,render}.rs — byte-for-byte outside the pinned parity header in each copy (#5920, contract origin #5433). Touch either file and this guard is part of your change’s verification, dispatch it yourself; see Add a command or a tool.

The named-oracle rule for tests

Every automated test names its oracle: the independent source of truth its expected values come from, stated in the test or its module doc. A test whose expectation was produced by running the code under test is not a test of anything but stability. The Atlas suites already work this way; new tests follow the same shape:

  • The shard fan-out tests run the identical statement over a union store — “the monolith exact-scan oracle” — and compare the sharded result against it (crates/atlas-core/tests/shards.rs).
  • The join assembler’s oracle is the version text itself: assembled bytes must equal the version’s own bytes for the paragraph, byte for byte (invariant J1).
  • The embed-cache tests use a counting raw embedder as “the provider-call oracle”: repeat queries must keep its call count at 1.
  • The staging tests carry an independent hash oracle over the archive’s own rows and a lossless-partition oracle: chunks in index order rejoin to the staged text exactly.
  • Parity expectations are recorded from the other implementation: fixtures/core-expectations.json was recorded from the production Python by gen_core_fixtures.py, and atlas-core’s parity tests must reproduce every envelope and SQL string in it. Regenerate a fixture with its generator when behaviour changes deliberately; never hand-edit an expectation to match new output.

The golden CLI output tests

crates/atlas-search/tests/golden/ holds three small text files — text_search_flat.txt, text_search_grouped.txt and text_get_chunk.txt — the expected --text renderings of a search (flat and grouped by session) and of a get-chunk, recorded from the miniature fixture corpus and asserted byte-for-byte by the atlas-search CLI tests (tests/cli_parity.rs). The fixture corpus is built so the goldens also pin the ceiling behaviour: its secret-bearing chunk carries the query’s exact vector and FTS terms and must be absent from the default-ceiling rendering — not down-ranked — and present, at the top, at a secret-bearing ceiling.

Do not confuse these with the golden query sets. The output goldens pin how results are rendered; golden-311 (311 judged queries, in eval/fixtures/) pins how well the system retrieves, and is scored by the evaluation harness in Evaluation: golden sets and gates. Changing rendering touches the first; changing ranking, the model or chunking touches the second — and a model change is cut over on the second, per Change the embedding model.

Add a command or a tool

Source: pkgs/atlas-search/crates/atlas-search/src/main.rs, pkgs/atlas-search/crates/atlas-proto/query-parameters-v1.json, pkgs/atlas-search/crates/atlas-proto/src/lib.rs, pkgs/atlas-search/crates/atlas-search/src/server.rs, pkgs/fleet/crates/fleet-search/src/cli.rs and pkgs/atlas-search/worker/src/mcp.ts in https://github.com/developing-today/code/blob/main/pkgs/atlas-search/crates/atlas-search/src/main.rs — provenance only; this chapter is complete without following it.

“Verb” here means any new invocable surface: a subcommand on an Atlas binary, or a tool on the Atlas MCP server. Both routes are end-to-end checklists. A verb is not done when its handler works; it is done when the parser, the defaults, every surface that mirrors it, the help text, the tests and this book all describe the same verb — in the same change, per Keeping this book current.

Part 1 — a new atlas-search verb

0. Pick the host binary first

The six binaries have two parser cultures, and a new verb inherits its host’s:

  • clap 4 derive: atlas-search (crates/atlas-search/src/main.rs) and atlas-stage (crates/atlas-search/src/bin/atlas-stage.rs). Most new verbs belong on atlas-search.
  • Hand-rolled strict parsers: atlas-classify, atlas-eval, atlas-sweep and atlas-github-comments, all in crates/atlas-core/src/bin/. These declare their whole command line in the source header and reject anything unaccounted for. Add a verb here only when the verb belongs to that binary’s operating procedure.

Exit-code conventions differ by host and are part of its contract: atlas-search uses 2 for usage/validation errors and 1 for runtime failures; atlas-classify and atlas-sweep route every failure to 2; atlas-github-comments routes every failure to 1; atlas-stage prints errors as atlas-stage: &lt;msg&gt; and exits 1. Match the host. Never invent a new code for a shape the host already has.

1. The parser

Declare the verb in the host’s parser: the subcommand, its positionals, its flags with their help text, and any flattened argument groups it shares. On atlas-search, backend flags (--backend, --db, --vecdb, --via-service, --service-url) live in the flattened BackendArgs group and vector flags in VectorArgs — reuse the group instead of re-declaring its flags, so the new verb’s backend behaviour cannot drift from search’s.

Validation runs before any backend or service work, and violations are usage errors. The existing shape: numeric ranges are checked in the command handler together with SearchParametersV1::validate (for example --pool must be 1..=400, --expand 0..=100), and the error is printed as atlas-search: &lt;msg&gt; with exit 2. A flag that names a stage that does not exist yet is a validation error, not a silent no-op — the precedent is --planner_enabled, which the parser accepts and validation refuses with “planner/spell stages are not implemented yet”.

2. Defaults and RunConfig: the contract file is the source

If the verb takes a parameter that is part of the query contract — a depth, a weight, a fusion constant, a mode — its default does not live in the parser. It lives in crates/atlas-proto/query-parameters-v1.json, the versioned contract file the CLI defaults are derived from (k = 10, pool = 100, rrf_k = 10, fts_weight = 1.0, vector_weight = 1.0, jaccard_depth = 0, and the rest), with its typed form and validate in atlas-proto’s SearchParametersV1. That one file is what keeps the CLI, the service and the fleet client agreeing on what an unstated parameter means. A default hardcoded only in a parser is a second source of truth and will diverge.

The same rule applies inside the library: a verb’s run configuration is a struct next to its implementation (the classification runner’s RunConfig in atlas-core’s classify module is the shape), with its defaults in one Default impl — not literals scattered through the handler.

3. Service exposure — decide it explicitly

Ask, and record the answer in the change: does this verb work --via-service?

  • If yes: the work is in three more places. The request/response types go in atlas-proto (the crate both sides share); the route and handler go in the service (crates/atlas-search/src/server.rs and its src/server/ submodules); the client path goes in the CLI/service layer. The service-side rules are not optional: the caller’s ceiling is clamped to the authenticated client’s cap (effective = min(requested, cap)), the clamp is recorded and reported in the envelope, and a request the service cannot serve in the requested shape falls back to standalone loudly — a stderr warning plus a note in the envelope’s notes, never a silent reroute. The precedents are the search job protocol and its fallbacks, in The service HTTP API.
  • If no: say why, in the verb’s help or the book chapter. The precedent is get-chunk: chunk reads are scoped to an existing job in the protocol, so there is no via-service path for it — requesting one produces the loud fallback note and the chunk is served standalone. init and fetch-model are the other standing examples: service administration stays on the standalone binary by design.

4. The fleet-search parity question

fleet search is a second surface over the same semantics, and every new verb forces the question: does the fleet surface get this too?

  • The fleet surface deliberately carries only the subset of atlas-search’s arguments that translates to the wire request or to routing. Standalone-only engine knobs (--backend, --db, --vec-table, the contract-tuning flags) are absent from it by design, and a flag the fleet parser rejects can never reach the standalone artifact through fleet search — it is a usage error first. “Fleet does not get it” is a legitimate answer; record it where the verb is documented.
  • If fleet does get it: the touches are the parser and usage text in pkgs/fleet/crates/fleet-search/src/cli.rs, the client-side protocol types in its proto.rs, and — if the verb is a service role — the serve half in serve.rs/server.rs, which is a maintained copy of the atlas-search server.
  • If the change touches either output writer — pyjson.rs (the Python-shaped JSON writer) or render.rs (the envelope renderer) — in either package, the byte-parity contract applies: the fleet copies must stay byte-identical to the atlas-search originals outside their pinned parity headers, and the parity guard (.github/workflows/fleet-search-parity-guard.yml, dispatch-only) is part of the change’s verification. See Building and testing.

5. Help text

Help text is a contract surface, not decoration. The verb’s --help must state every flag, its default as a literal value, and any behaviour a caller would otherwise have to read source to learn. Where help text and source end up disagreeing anyway, this book documents the source and calls out the discrepancy until the help is fixed — see the worked examples in Building and testing.

6. Tests

  • Parser and validation tests for every new flag: the accepted range, the boundary values, and the exact failure shape outside it.
  • A named oracle for every behavioural expectation — the rule and the existing examples are in Building and testing. If the verb changes an envelope or a SQL string, the expectation comes from the recorded parity fixtures (fixtures/core-expectations.json, recorded from the Python reference), regenerated with gen_core_fixtures.py when the change is deliberate.
  • If the verb renders --text output, a golden file under crates/atlas-search/tests/golden/ joins the CLI golden tests.
  • If the verb reads or writes a store, a test against the miniature fixture corpus — including the ceiling case: content above the default ceiling is absent, not down-ranked.

7. The book, in the same change

Update the verb’s reference chapter (the atlas-search chapters are atlas-search: search and get-chunk and atlas-search: serve, init, fetch-model, traces and feedback; each auxiliary binary has its own), this chapter if the change alters the pattern it teaches, and any chapter that states a default the verb changes. The full contract is Keeping this book current.

Part 2 — a new MCP tool

The MCP surface is the Cloudflare Worker’s POST /mcp endpoint (pkgs/atlas-search/worker/src/mcp.ts): a stateless Streamable HTTP server with exactly one tool today, search. Its reference is The Atlas MCP server. Adding a tool touches four places, and the fourth is the one that usually decides whether the tool may exist at all.

1. The tool definition and handler (src/mcp.ts)

  • Add the tool’s definition beside SEARCH_TOOL and return it from tools/list: a name, a description that states the surface’s pinned context and ceiling in plain words (the search description does — copy its honesty), an inputSchema (JSON Schema; query-style required fields named in required), and annotations (readOnlyHint, destructiveHint, idempotentHint, openWorldHint) that tell the truth about the tool.
  • Add the dispatch in tools/call: validate the tool name (unknown → JSON-RPC error -32602, unknown tool: &lt;name&gt;), then validate the arguments with the same error code and message shape the search tool uses (arguments.query must be a string, arguments.query must not be empty — emptiness judged after normalization).
  • A successful call returns the payload twice, identically: content[0].text as the JSON string and structuredContent as the object, with isError: false. A failed execution returns isError: true with the error payload as the text content, no structuredContent, and the HTTP status stays 200.

2. The execution path

A search-like tool calls the same executeSearch in src/search.ts as POST /v1/search — that is what makes an MCP search and a REST search for the same normalized query and k share one Durable Object cache entry, with the same ceiling pinning and cache keying. Do not write a second path to the service. A tool that needs a new upstream call adds it to src/service.ts (the postJson shape: service bearer plus the Cloudflare Access pair, names only, never values in code or docs) and validates the response in src/space.ts’s style before anything is cached.

3. Worker tests

Extend worker/test/mcp.test.ts (and worker.test.ts if the tool shares the REST path): the tools/list result, the call’s success shape (text content JSON-equals structuredContent), and every validation failure. Note that the current suite asserts tools/list returns exactly one tool — a second tool fails that assertion deliberately, and updating it is part of the change, not a workaround.

4. The gate and identity consequences — read before building

This surface has no per-client identity, and a new tool inherits that fact:

  • The gate is checked once, in src/index.ts, before dispatch: one shared gate token (secret name GATE_TOKEN) for every gated route, /mcp included. A valid check yields a boolean — no caller name, no per-agent credential. mcp.ts receives only a SearchEnv ({ QUERY_CACHE }); it never sees the token.
  • Every MCP caller therefore shares the one hosted identity: disclosure context hosted-per-user, sensitivity ceiling personal, both compile-time constants in src/space.ts that no request field, header or environment variable can change, pinned into the cache key and verified against the service’s reported effective_ceiling before a result may be cached.
  • So: a tool that needs a different ceiling, a different context, per-agent scoping or an audit identity cannot be improvised on this endpoint. Per-agent identity stamping, per-agent ceilings and corpus scoping are later slices of #8625, explicitly not built yet. A tool that is a write, or an operator/audit surface, does not belong here at all — the standing precedent is that cache purge (a write) and cache inspect (an operator surface) are deliberately not MCP tools and live on the gated REST surface in The Worker HTTP API.

If the tool passes that test — read-only, safe at the personal ceiling, safe for every gate holder to call — build it by the steps above, and update The Atlas MCP server in the same change.

Add an ingest source

Source: pkgs/atlas-search/crates/atlas-core/src/stage.rs, pkgs/atlas-search/crates/atlas-core/src/gate.rs, pkgs/atlas-search/crates/atlas-core/src/boundary.rs, pkgs/atlas-search/crates/atlas-core/src/aggregate.rs and pkgs/atlas-search/schema/atlas_stage_v1.sql in https://github.com/developing-today/code/blob/main/pkgs/atlas-search/crates/atlas-core/src/stage.rs, and the designs doc/2026-11-08T13-45-00Z_design_atlas_staging_shard_ingest_gate/, doc/2026-11-09T05-12-32Z_design_atlas_ingest_attestation/ and doc/2026-11-08T09-15-51Z_design_atlas_license_capture_ingest/ — provenance only; this chapter is complete without following it.

A new source — a new client export, a new corpus, a new feed — never writes to the corpus directly. It takes one route: stage, classify, pass the gate, promote. That route is the subject of Ingest today: staging, classification, promotion; this chapter is the contributor’s version: the steps a new source’s code takes, in order, and the gates it cannot skip. Classification happens before promotion, never after — content that reaches the corpus unclassified is a defect, not a backlog item.

Step 1 — register the source

Give the source an identity in atlas-core, following the two landed examples (the GitHub-comments feed and the query-trace corpus): a module carrying a source class string and a source id as constants (the shape of GITHUB_COMMENTS_SOURCE_CLASS / GITHUB_COMMENTS_SOURCE_ID and TRACE_SOURCE_CLASS / TRACE_SOURCE_ID), a registration record naming the source, and the record/document shapes its staged units will carry, each with a versioned schema string (the shape of atlas-github-comment/v1). If the source will be swept periodically, its class also joins the sweep’s source-class vocabulary in the sweep module — the classes the sweep runner accepts today are boot-records, session-logs, chat-logs, statistics, reports and code-repo.

Step 2 — the staging unit

Provision one staging database per unit of work (a queue task, a session, a batch) through the registry:

atlas-stage provision --db <path> --unit <id> --owner <owner> \
    [--sensitivity internal] --registry <path>

The staging schema is schema/atlas_stage_v1.sql: an items table (one row per staged unit of content), chunks_raw (raw, un-embedded chunks) and working tables. Two properties define the tier:

  • Writes are free and unmediated. Producers write directly, through stage_artifact in code or atlas-stage ingest from the shell. Sensitivity at this tier is recorded, not enforced.
  • A staging database never stores vectors, so it is cheap to write and cheap to branch. Embedding happens exactly once, at promotion (step 5).

Provisioning today targets a local libSQL/SQLite file. Hosted staging is a later deployment surface, not part of this foundation — do not build a new source against a hosted staging tier that does not exist yet.

Step 3 — the parser and chunker

The source’s own code parses its native format into items and chunks. The chunking rules are not the source’s to improvise:

  • Chunks are cut at declared source boundaries only — a message or turn, an authored block or paragraph, a code symbol, a log record, a source-native unit. The splitter and the classifier share source offsets: boundary::split_by_boundaries composes the producer’s declared classification segments into boundary-safe chunks that partition the source text exactly — no overlap across a boundary, no gap.
  • Uncertainty fails closed. Undeclared, contradictory or uncertain text becomes one secret-bearing chunk marked uncertain. It is never split on a guess and never given a lower sensitivity to make it fit.
  • Size discipline comes from the staging module: an artifact at or below 32 KiB stages as one whole-file unit; no chunks_raw chunk exceeds 64 KiB, split further at line boundaries, never mid-line; the promotion-time splitter subdivides oversize chunks at line boundaries into pieces that partition the chunk text exactly and never cross the classification boundary the chunk was cut on.

Step 4 — classification, before anything moves

When the producer can declare classification, stage classified: stage_classified_artifact (CLI: atlas-stage ingest --segments <segments.json>) takes the producer’s source-native segments — a JSON array of {start, end, sensitivity, certain?} over byte offsets — and persists one classification record per resulting chunk, with its exact source offsets and effective sensitivity, in the item’s metadata.

  • Segment files are parsed strictly: a missing or mistyped field, or an unknown sensitivity name, is a usage error — never a silent default.
  • Segment declaration stays with the producer (the classifier or boundary detector that knows the source); staging composes and persists. Do not move declaration into the staging layer.
  • Read-back fails closed per record: a malformed or unrecognised sensitivity in a stored record resolves to secret-bearing.

Sensitivity defaults. A staged item’s sensitivity defaults to the tier word internal (the staging tier vocabulary is public / internal / secret); per-chunk classification uses the four-rung ladder (shareable, personal, local-only, secret-bearing). Defaults exist so an undeclared unit can be staged — they confer no right to be promoted or served. Where several classification records cover one chunk, the effective classification is composed, not negotiated: the sensitivity is the maximum over the records, and an excluded_personal_life disposition is sticky — once excluded, always excluded. That composition rule is the narrow-never-widen rule in its concrete form, and the classification manifest enforces the same direction at load time: the manifest schema has no sensitivity keys at all, its column shapes bind only to code-known label columns, and any unknown shape, semantics, column or key fails validation and falls back to the built-in manifest, loudly. No manifest, segment file or source declaration can widen access beyond what the code and the records already grant.

Step 5 — the gate, then the M6 promotion gate

Two distinct gates stand between a staged unit and the corpus. Do not conflate them.

The batch ingest gate (#6057 design, #7709 record) judges one batch — a staging unit, or one increment of a long-lived unit — through five ordered stages: write → classify → dedup → provenance-check → publish. Its record (gate.rs, DDL in schema/gate_records_v1.sql) is the durable audit trail: counts, enumerated reason codes, row ids, content hashes and the publish manifest id — never content, so a secret-tier batch’s record is readable without reproducing what quarantined it. The rules that matter to a new source:

  • Fail-closed: a stage with no recorded verdict has not passed, and verdicts are recorded strictly in order — no stage can be judged before its predecessor passed.
  • The state machine is open → closing → gated → published | quarantined, with quarantined → gated on retry, and no other transitions. A retry resumes at the failing stage; changed bytes never inherit a verdict obtained for different content.
  • Bounded quarantine: the same reason code three times (STRIKE_LIMIT = 3) marks the batch needs_review and refuses further automatic retries. Quarantine is a state, not a deletion — the gate never touches the batch’s staging database.

Attestation binds the batch to its sources: the per-batch attestation record (#6045, in-toto-shaped, on the #3125 provenance substrate) is the statement that these chunks came from these sources. In the target pipeline the gate’s publish step produces it; a source whose provenance cannot be stated in that shape fails the provenance-check stage, not the paperwork afterwards.

The M6 model gate is the promotion transition itself (Registry::promote, #7648, from the #6060 one-model decision). A unit promotes only when its database’s recorded atlas_manifest.embedding_model equals the mandated model, EMBEDDING_MODEL_ID (snowflake-arctic-embed-m-v2.0). Every refusal is fatal and leaves the unit unpromoted:

  • a different model named — “vectors from different embedding models are not comparable”;
  • no model recorded — provenance unknown;
  • an empty unit.

The promoting verb is the aggregator’s embed-at-promotion step:

atlas-stage promote --registry <path> --unit <id> --shard-dir <dir> \
    [--topic codeconfig]

It embeds the unit’s staged chunks with the mandated model (document-side, prompt-free), writes a new core scan shard, stamps the unit database’s embedding-model provenance, then promotes through the M6 gate. On success the registry writes the merge manifest — rows in, rows promoted, content hash, embedding model, timestamp — branches the staging database as the unit’s archive, and takes the unit out of every active state (merged). The manifest and the archive are the durable record. Changing the mandated model is not a source change; it is Change the embedding model.

Step 6 — licensing and zone gates for external sources

Everything above is the route for the estate’s own sources. External content — anything not from Drew’s own orgs and accounts — has two further gates, both policy gates, and both currently closed:

  • Licensing (#6024, #6052, #6055). External extraction is gated on licensing research (#6024). The candidate set exists — docs/external-set-enumeration.md enumerates 31 candidate external repositories — and the file states explicitly that zero external comment text has been extracted or ingested. Five legal questions sit in a lawyer review packet under #6055, unresolved; the packet is not legal advice and not a ratification of the #6052 zone policy. When a source is cleared, licence capture happens at ingest (#6053): the per-repo licence and its flag are recorded in the content’s provenance, not looked up later. Deletion propagation (#6054) is part of the same bargain: a source deleted or made private purges its content on the next sync.
  • Zones (#6052). Under the memory-integration decision’s composition with the zone policy: before ratification, scope is fleet/own corpora only — no bulk external content, full stop. After ratification, external corpora join through this same connector and stage/registry path, carrying their zone from their first staged chunk. The gate is a data/policy gate, not an architecture gate: nothing about a new external source justifies a new pipeline, a side door, or a staging tier of its own.

The checklist, on one page

  1. Source registered: class, id, versioned record schema.
  2. Staging unit provisioned; producer writes items and raw chunks; no vectors in staging.
  3. Parser/chunker cuts only at declared boundaries; uncertain text is one secret-bearing chunk.
  4. Classification staged with the content — strictly parsed, composed by maximum, exclusion sticky; defaults recorded, never relied on.
  5. Batch gate passed in order; attestation stated; M6 gate passed; merge manifest and archive written.
  6. External sources only: licensing cleared, licence captured at ingest, zone carried from the first chunk.
  7. The book updated in the same change: this chapter if the route changed, atlas-stage if a verb did, and the source’s own reference chapter if it gained one.

Change the embedding model

Source: pkgs/atlas-search/crates/atlas-core/src/types.rs, pkgs/atlas-search/crates/atlas-core/src/shards/mod.rs, pkgs/atlas-search/crates/atlas-core/src/stage.rs, pkgs/atlas-search/crates/atlas-embed/src/lib.rs, pkgs/atlas-search/worker/src/space.ts and pkgs/atlas-search/eval/fixtures/golden-311.json in https://github.com/developing-today/code/blob/main/pkgs/atlas-search/crates/atlas-core/src/types.rs — provenance only; this chapter is complete without following it.

An embedding model turns text into a vector — a list of numbers — such that similar texts land near each other; the vector branch of search is distance in that space. The load-bearing consequence: vectors from different models are not comparable. They do not live in the same space, distances between them are meaningless, and no normalisation fixes that. Almost every rule in this chapter is that sentence applied. The current model, its space and the parity contract are covered in Embeddings: Snowflake Arctic and the parity contract; this chapter is the migration discipline for replacing it.

The identity of a model: three spellings, one model

One model is named in three places, in two spellings, and no code converts between them. A model change must update all three, in step:

WhereConstantCurrent value
atlas-core’s types (and atlas-proto’s default, and the CLI’s --model default)DEFAULT_MODELSnowflake/snowflake-arctic-embed-m-v2.0 — the HuggingFace org/name spelling
atlas-core’s shard module — the value actually stamped into shard manifests and staging-database manifests, and compared at discovery, fan-out and promotionEMBEDDING_MODEL_IDsnowflake-arctic-embed-m-v2.0 — no org, lowercase
The Worker’s pinned space (worker/src/space.ts)EMBED_MODELSnowflake/snowflake-arctic-embed-m-v2.0 — the HuggingFace spelling again

Around them sit the rest of the pinned identity, all of which moves with a model change: the pinned revision (95c2741480856aa9666782eb4afe11959938017f today — recorded in fetch-model’s file list, the fixture provenance and the Worker’s MODEL_REV), the output width (EMBED_DIM = 768 in atlas-embed; EMBED_DIMS in the Worker), and the vector table name (below). A shard stamped by the aggregator can never string-equal DEFAULT_MODEL — the two spellings are compared only within their own subsystems — so “I updated the model constant” is a claim that must name which constants, all of them.

Vectors are tagged, and spaces are separate tables

Every stored vector set belongs to exactly one model, and the tag is structural, not a comment:

  • Vectors live in a per-model table, named for its space: vec_snowflake_m_v2_768_f32 for the current model (768 dimensions, f32), vec_bge_small_384_f32 for the dormant one (below). A new model gets a new table — a new vector space is never written into an existing model’s table, and a table is never re-interpreted under a new model.
  • Shards and staging databases carry the identity in their manifests (atlas_manifest.embedding_model), merge manifests record the model that produced them, and query traces record the producing shard’s model per result — two or more distinct models among one search’s candidates set embedding_model_breach = true on the trace.
  • The enforcement points refuse mixtures, fatally: shard discovery refuses a shard whose manifest names a different model (and, in strict mode, one that names none); fanout_scan re-checks the scanned set itself and fails a mixed merge; the M6 promotion gate refuses a unit whose recorded model is not the mandated one. See Add an ingest source.

The migration procedure

Migration is additive-first, in this order. No step is skippable, and the order is the safety property.

  1. Pin the new model exactly. Repository, revision, and the sha256 of every file atlas-search fetch-model will install (tokenizer.json, onnx/model.onnx), recorded in the repo. The model is data, provisioned into the state directory (~/.local/state/atlas-search/model/<rev>/) by fetch-model with hash verification and an atomic rename into place — never a nix store artifact, never a download at search time. A missing or mismatched model fails loudly, and FTS-only search and get-chunk keep working with no model present.
  2. Port the embedder, and pass Gate A. atlas-embed must reproduce the new model’s reference pipeline bit-identically on a fixed probe set — token ids equal, output vectors delta 0.0, single and batched — with the probes recorded by a generator the way fixtures/embed-probes.json was. Gate A verdicts are version-matched: the gate reads the ONNX Runtime version from the library and refuses to judge against a different one (a different runtime produces ~1e-7 deltas and the gate reports NOT APPLICABLE, not a pass).
  3. Build the new space beside the old one — the shadow index. Embed the corpus into the new table and the new shards, from the same chunk text, while production keeps serving the old space untouched. The index is derived and disposable; the corpus is neither. The shadow space is evaluated as its own shard set — never merged with the old set for a “combined” look, because a mixed fan-out is exactly what the machinery refuses.
  4. Evaluate on the golden set. Score the shadow space against the golden set (golden-311: 311 judged queries over the frozen corpus) through the evaluation harness, against the production space’s recorded row for the same set — the current production hybrid’s best measured row is 189 hits@10 / MRR 0.3894 at RRF k=10, pool 100 per branch. Parameter selection happens on the dev split only; the harness’s select_best_signal refuses a test-split report, and the test split is scored once, as the final pass. Gate B is the tie requirement against the reference implementation’s production path; the programme is Evaluation: golden sets and gates.
  5. Cut over on the evaluation result — not on completion. Finishing the embedding pass is not the decision. The decision is the gate result, and Gate C states it as a rule: the A/B winner is the implemented default. If the new space wins, cutover is a defaults change, not a data migration: the three identity spellings, the revision, the dimension, DEFAULT_VEC_TABLE, the service configuration’s vec_table, and the Worker’s space pins move together, and the service restarts onto the new space (see Release and rollout). If it does not win, the shadow space is deleted or kept as a recorded experiment — and production never moved.
  6. Mind the caches; they mostly mind themselves. A query-embedding cache key is a pure function of (normalized query text, model id, model revision), so a model change changes every key — no TTL, no invalidation pass. The Worker cache key likewise carries the model revision and vector table, so new-space entries are new entries and old ones are orphaned, never served across spaces. A re-shard changes the shard set’s snapshot id, which invalidates every cached service result at once. Verify these three properties hold for the new model before cutover; do not add a manual purge step in their place.

What happens to the old space

The old space is kept, dormant, at first — the migration phases are additive-first and nothing is removed before its replacement is proven. But dormancy needs a retirement decision with a date, or it becomes permanent. The cautionary example is already in the corpus:

The BGE-small dormancy. The previous space, vec_bge_small_384_f32 (model BAAI/bge-small-en-v1.5, 384 dimensions), remains in the publish database as a dormant fallback to this day. Its afterlife, in full: the string naming its table appears only in the Python reference — no Rust code names it, so no Rust surface can be pointed at it deliberately; the Worker explicitly refuses its vectors (a 384-dimension BGE-small vector “is not comparable with the corpus” under the pinned-space check); its side-store files still sit in the laptop working tree; and the local backend can still be configured to read whichever vector table it is told to, so the dormant space is one configuration value away from being served by accident. Nothing about it is broken, and nothing about it is decided — it occupies the publish, invites confusion about which space is real, and has no owner for its removal.

So the last step of a model migration, scheduled at cutover time, is the old space’s disposition, recorded in the change: retained as a named fallback with the surfaces that may use it stated, or removed — table, side stores, configuration references and book mentions together. “Left in place, undecided” is the one outcome this chapter exists to prevent.

Release and rollout

Source: home/common/default.nix and pkgs/atlas-search/worker/README.md, pkgs/atlas-search/worker/package.json and pkgs/atlas-search/worker/cloudflare.config.ts in https://github.com/developing-today/code/blob/main/pkgs/atlas-search/worker/README.md — provenance only; this chapter is complete without following it.

Atlas ships as three artefacts on three different paths: the Rust package (built by Nix, run on the laptop), the service (that package, run as a systemd user service — through the fleet binary, as explained below), and the Cloudflare Worker (deployed through the cf versions flow). A change is shipped when every artefact it touches has moved and been verified in place — not when its pull request merges. The build itself is Building and testing; running the result day to day is Running the service and the Worker.

The merge rule

  • CI runs on main only. The Atlas workflows are nightly plus dispatch (their actual triggers are stated in Building and testing); they are the main-tier safety net, not a merge gate, and no pull request waits on them.
  • Merge when verified. A change merges when its verification — local tests, the laptop build, the smoke checks its surface demands — has actually run and passed. Finished pull requests do not sit open: not merged is not done. A red main after a merge is fixed forward or reverted, in the same working session that discovers it.

The laptop package and the service restart

  1. Build the package from current main:

    nix build path:./pkgs/atlas-search
    

    The crane split means a source-only change rebuilds the workspace crates, not the dependency tree; the build’s check phase runs the test suite and its install check runs the smoke script, so a green build is already a tested artefact.

  2. Deploy through home configuration. The service package is pkgs.callPackage ../../pkgs/atlas-search { … } in home/common/default.nix, with the toolchain read from pkgs/atlas-search/rust-toolchain.toml. A home-manager switch is what puts the new package in place; nothing is copied into position by hand.

  3. Restart the service. The unit is the systemd user service atlas-search.service: Restart = on-failure, RestartSec = 3, wanted by default.target, configuration from ~/.local/state/atlas-search/service.json (mode 0600, written by atlas-search init). The restart shape is therefore:

    systemctl --user restart atlas-search.service
    
  4. Know which binary you just restarted. The unit’s ExecStart is selected by the home-manager flag atlasSearchServeViaFleet, which is true today: the live service runs fleet serve search — the serve half rehomed into the fleet-search crate (#5604) — not atlas-search serve. Setting the flag false re-points the unit at the standalone binary; the unit name, the configuration, the port (loopback 127.0.0.1:18760) and the wire are unchanged, so rollback of the serving binary is a single re-point and a restart. init and fetch-model stay on the standalone atlas-search in both shapes. Debugging “the service” against the standalone binary’s serve path is debugging the rollback, not the live service.

  5. Verify in place, by surface. GET /health on the loopback port answers without auth — {status: "ok", embedder_state, queue_depth, …} — and the embedder state must reach ready; then one real search through the surface the change touched (the CLI, the service, or fleet search), checked against what the change was supposed to do. A version string alone is not verification.

Exposure does not change at rollout time: the service binds loopback only, and its tailnet exposure is a tailscale serve mapping created imperatively in front of it. A rollout that needs a new listener, a new port or a public route is not a rollout — it is a design change, and it goes through a design record first.

The Worker deploy

First, a correction this book states once and applies everywhere: the Worker does not deploy via wrangler. wrangler.toml drives local development and the test suite; the deploy source of truth is cloudflare.config.ts, and the deploy command (the Worker’s package.json deploy script) is the sanctioned cf binary’s versions flow:

  1. Create a version with cf workers versions create, uploading a throwaway secrets file assembled at deploy time from fleet secrets, by name — the gate token, the service token and the Access client pair (atlas.search-worker-gate-token, atlas.search-cf-worker-token, cloudflare.access-atlas-search-client-id, cloudflare.access-atlas-search-client-secret). No version deploys without its secrets, and no secret value ever lands in a config file or the Nix store.
  2. Verify the bindings on the created version: the QUERY_CACHE Durable Object, SERVICE_BASE, the HOT_CACHE D1 binding and its flag (below), and the four secret names present.
  3. Create the deployment at 100%. There is no percentage rollout machinery in this Worker; the versions flow’s deployment step is the rollout.
  4. Verify: GET /health on the workers.dev hostname answers {status: "ok", service: "atlas-search-worker"} unauthenticated; then a gated search and, if the change touched it, an MCP tools/call — remembering that the Worker degrades to 502 with nothing cached while the laptop service is unreachable, so a Worker verification is also a service verification.
  5. Rollback is a new deployment at the previous version id. No upload is needed and no code changes hands; the previous version is still there.

One deploy-time substitution to check every time: the D1 database_id committed in both config files is a local placeholder (00000000-0000-0000-0000-000000000001), replaced with the real id when the database is created at deploy time. A deploy that ships the placeholder has not connected the hot cache to anything.

The flag posture

New paths land flag-off, and stay off until their own change turns them on. The standing examples:

  • The D1 hot cache’s master flag, HOT_CACHE_ENABLED, is committed as "false" in both Worker config files. Only the literal string "true" enables it, and the store also requires the HOT_CACHE binding to be present. State the current truth precisely when you touch it: in the code as it stands, nothing in the request path calls the hot-cache store at all, so the flag today changes no behaviour either way — its read-path integration is follow-on work (#13105), and landing that integration flag-off is the pattern to copy.
  • The service itself landed inert: in its step 5 the systemd unit was declared with no Install section, so it could not auto-start; the Install section arrived at the step-6 cutover. A new service role follows the same shape — declared, inert, enabled by a separate deliberate change.
  • Experimental search paths are off by default and hidden: the shard fan-out behind the hidden --shards flag is the CLI-side example. Hidden and off is the correct posture for a path whose evidence is still being gathered.

The rule for a new flag: name it, state its default as a literal value in Configuration and environment, default it to off, and make the enabling change a separate, verifiable step from the landing change.

Rollout checklist

  1. Merged to main when verified; main-tier CI watched after the merge.
  2. Package built from main; service restarted; /health ok and the embedder ready; one real search per touched surface.
  3. Worker, if touched: version created with its secrets file, bindings verified (placeholder D1 id checked), deployment at 100%, /health and one gated call verified.
  4. Flags: every new path landed off; every enabling is its own step.
  5. This book updated in the same change — including this chapter, if the rollout shape itself moved.

Keeping this book current

Source: pkgs/atlas-search/book.toml and pkgs/atlas-search/README.md in https://github.com/developing-today/code/blob/main/pkgs/atlas-search/book.toml, and the contract this chapter mirrors, pkgs/fleet/README.md §“Operator and contributor contract (DOC-01, #10728)” with pkgs/fleet/book/development/keeping-this-book-current.md — provenance only; this chapter is complete without following it.

A book that drifts from the system is worse than no book: agents and operators script against what it says. Atlas, unlike fleet, had no documentation contract before this book existed — verified for this book’s research: pkgs/atlas-search/ had no package README and no AGENTS.md, so a contributor’s contracts lived scattered across the repository-root doc/ design archive, the three package notes in docs/, module-doc headers in the Rust sources, the schema DDL headers, and the Worker and eval READMEs. This book replaces that scatter with one reference, and this chapter states the contract that keeps it true. The contract is modelled on fleet’s DOC-01 mechanism; where Atlas’s version is weaker than fleet’s, this chapter says so.

The contract

Any change to a command, a flag, a default, a config key, an MCP tool, a REST route, a schema, a model, or an operational procedure updates the matching chapter of this book in the same change.

Concretely, in the same change as the code:

  1. A new or changed verb or flag → its reference chapter, plus Add a command or a tool if the change alters the pattern that chapter teaches.
  2. A new or changed MCP tool → The Atlas MCP server; a new or changed REST route → The service HTTP API or The Worker HTTP API, whichever serves it.
  3. A changed default → every chapter that states the old default. Search the book for the value; defaults are stated in more places than you remember.
  4. A new or changed config key or environment variable → Configuration and environment.
  5. A schema change → Data stores and schemas, and Add an ingest source if the staging or gate route moved. A new schema version is a new vN artifact, never an edit to an applied one — the book’s schema chapter follows the same rule and describes the new version beside the old.
  6. A model change → Embeddings: Snowflake Arctic and the parity contract, Data stores and schemas for the new vector table, and Change the embedding model if the migration discipline itself changed.
  7. A changed operational procedure (ports, service shape, deploy or rollback order) → the matching operations chapter: Running the service and the Worker or Release and rollout.
  8. A changed deployment of the book itself → Deploying this book.

“Same change” means the same pull request (or the same run, for non-PR work). A follow-up issue promising to update the book later does not satisfy the rule — that is exactly how the pre-book documentation drifted into the disagreements this book’s research catalogued: a design tree reprinted as a layout, a workflow named for pull requests that never runs on one, a Python header pointing at a README that was not there.

Two disciplines ride with the rule:

  • Designed versus shipped. Chapters in this book’s design section are marked as designs, name their tracking issues, and never present a designed behaviour as if it works today. A spelling that is designed but not shipped is documented as contract, not surface.
  • Source over help. Where help text and source disagree, the book documents the source behaviour and calls out the discrepancy until the stale side is fixed. Building and testing carries three live examples (the CI triggers, the worker-tests header, the toolchain channel); do not “fix” a discrepancy by silently copying the wrong side into the book.

The two build gates

The contract is enforced by two gates, and they are the whole of its teeth today:

  1. create-missing = false. The book’s configuration, pkgs/atlas-search/book.toml (title atlas, sources in pkgs/atlas-search/book/), sets create-missing = false: a chapter listed in SUMMARY.md that does not exist is a build failure, never a generated stub. A new chapter is therefore a real file, written by its author, or the build is red.
  2. The .#atlas-docs Nix build. From the repository root, nix build .#atlas-docs builds the rendered site exactly as it will be deployed. The atlas-docs.yml workflow runs that build, and the book ships through the combined GitHub Pages deploy alongside the repository’s other books, at https://developing-today.github.io/code/atlas/.

An honest limitation, recorded so nobody over-trusts the gates: fleet’s contract has a third part Atlas does not have yet — a machine check (a test) tying the written contract to a registered inventory of the surface. Atlas has no single registry its help renders from, and no equivalent test; its nearest machinery is atlas-proto’s versioned query-parameters file and the fleet-search byte-parity guard, which is dispatch-only. Until an inventory check exists, the same-change rule above is enforced by the build gates and by review — which is why this chapter exists in the book itself, where a contributor changing a surface will meet it.

Where the rule is recorded

The rule lives in two places, which must agree:

  1. pkgs/atlas-search/README.md — the package README, added with this book (the package had none before it). Its contract section is the source of truth a contributor meets at the package root, before they open the book.
  2. This chapter — the book stating its own maintenance rule, so a reader who arrived here first can find the whole contract.

(Fleet’s version of the rule lives in three places — its README, its package’s agent documentation, and its book chapter. Atlas has no package-local agent documentation today; if one is added, it becomes the third recording, in the same change that adds it.)

If the two recordings disagree, the README wins for package-scope questions and this chapter wins for book-scope questions — and the disagreement itself gets fixed in the same pass it is noticed.

The book’s own form rules are part of the contract: every file starts with its exact chapter title (the SUMMARY.md text) as its single # heading, and internal links are relative .md links whose text is the target chapter’s title. Both keep SUMMARY.md, the file and the rendered page in agreement, and keep the book readable in the repository as well as on the rendered site.

Build and preview the book locally

  1. From pkgs/atlas-search/, with mdBook available, build in place:

    mdbook build
    

    The rendered site lands in the build directory named by book.toml. Open its index.html to preview.

  2. Or build the packaged form, exactly as the deploy does, from the repository root:

    nix build .#atlas-docs
    

    The result is the rendered site; serve or open result/index.html to check links, search and chapter order before merging.

Either route is a valid pre-merge check. The Nix route is the stronger one: it is the same derivation the deploy uses, with the same mdBook version.

Running the service and the Worker

Source: home/common/default.nix, pkgs/atlas-search/crates/atlas-search/src/server.rs, pkgs/fleet/crates/fleet-search/src/serve.rs and pkgs/fleet/crates/fleet-search/src/server.rs, and pkgs/atlas-search/worker/ (cloudflare.config.ts, wrangler.toml, src/index.ts, src/search.ts, src/service.ts, src/cache_do.ts) under https://github.com/developing-today/code/blob/main/home/common/default.nix — provenance only; this chapter is complete without following it.

Atlas serving has two halves on two machines. The service is a long-lived process on the laptop that owns the corpus connection, the resident embedding model, and the search itself. The Worker is a Cloudflare Worker in front of it: the hosted front door that authenticates callers, caches whole query results, and forwards anything new to the laptop. The concepts are drawn in The service and the Worker; this chapter is the operator version — units, ports, checks, and restarts. The HTTP surfaces themselves are in The service HTTP API and The Worker HTTP API.

The laptop service: one unit, two binaries

The unit is the systemd user service atlas-search.service, declared in home/common/default.nix (not under nixos/):

PropertyValue
DescriptionAtlas search service (hybrid corpus search, serve mode)
OrderingAfter / Wants = network-online.target
RestartRestart = on-failure, RestartSec = 3
EnablementInstall.WantedBy = [default.target] — added at the step-6 cutover; in step 5 the unit landed with no Install section so it could not auto-start

Which binary is live. The unit’s ExecStart is selected by a home-manager flag, atlasSearchServeViaFleet:

  • Flag true (the production setting): ExecStart is fleet serve search — the serve half rehomed into the fleet binary (#5604). This is the live service.
  • Flag false: ExecStart is atlas-search serve — the standalone binary. This is the rollback shape, not the live one.

The unit name, the configuration, the port, and the wire protocol are identical in both shapes; rollback is that single flag pointed back, followed by a home-manager switch and a unit restart. Two verbs never moved: atlas-search init (writes the service config) and atlas-search fetch-model (provisions the model) stay on the standalone atlas-search on PATH in both shapes. Any runbook step that says “restart atlas-search” is talking about the unit; debugging the standalone binary’s serve path is debugging the rollback.

What the serve process holds, and why it exists as a process at all: one lazily loaded ONNX embedder session for the Snowflake model (about a second to load, a few hundred megabytes resident, against roughly 35 seconds of cold start for the Python path), a connection pool to the corpus stores, the job registry and in-memory temp store (below), and a worker pool for branch execution. It resolves the same read-only Turso token the Python resolves — by name from Bitwarden, or the turso CLI mint cache — and holds no write credential for any Turso database.

Port and exposure

The service binds 127.0.0.1:18760 — loopback only. The single source of truth is atlasSearchPort = 18760 in home/common/default.nix, and the code defaults agree everywhere: the server listen default, the init template, and every client’s default service URL (http://127.0.0.1:18760) are all 18760.

Exposure beyond loopback is layered in front of that bind, never by widening it:

  • Tailnet callers reach it through a tailscale serve mapping on the laptop’s MagicDNS name. That mapping is created imperatively at activation; it is deliberately not declared in the home config, because tailscale serve state is imperative tailscaled state in this fleet, and a mapping in front of a not-yet-started service would itself be a live exposure change.
  • Hosted callers never reach the port directly at all: they reach the Worker, and the Worker reaches the service through the tunnel hostname atlas-search.security.cab plus a Cloudflare Access service token (below).

The service is never a public listener in its own right.

Configuration and client identities

Service configuration lives in ~/.local/state/atlas-search/service.json, mode 0600, written by atlas-search init. It holds the listen address and the per-client token table: each named client has its own bearer token (named here, never valued) and a ceiling cap — the highest sensitivity ceiling that client may ever search under. The state directory also holds the model snapshot (model/), traces, and feedback records; nothing else writes there.

The clamp is the security property: the server computes effective = min(requested, token ceiling cap), records the effective ceiling on the job, and reports it in the result envelope. Raising a cap is a local edit by Drew in that file — never something a request can do. The v1 client set and caps, as designed and configured:

ClientCeiling cap
Drew’s CLI on the laptop (drew-cli)secret-bearing
OpenChamber sessionspersonal
Fork / OpenCode agentspersonal
Sandbox scripts and Muse lanes via the tailnet (sandbox-scripts)personal
The Worker (cf-worker)personal

Aster is explicitly not a v1 client. The sensitivity ladder and the context intersection that further narrows a request are in Sensitivity tiers and client ceilings; the full variable and file inventory is in Configuration and environment.

Client side, a seat presents its token from the environment variable named ATLAS_SEARCH_TOKEN, or from ~/.config/atlas-search/client.json (mode 0600, one token string field). A seat with no client config cannot use the service route at all — its searches fall back to standalone, loudly; see Troubleshooting.

Health checks

Laptop service, GET /health — no auth, no corpus data:

{ "status": "ok", "embedder_state": "...", "queue_depth": 0, "active_branch_executions": 0, "active_jobs": 0 }

embedder_state is the shared embedder’s load state (the design vocabulary is cold / warming / ready). This is the liveness, embedder-state, and queue-depth surface in one call. Operator checks, in order:

$ systemctl --user status atlas-search.service
$ curl -s http://127.0.0.1:18760/health
$ journalctl --user -u atlas-search.service -n 100

A service that answers /health with embedder_state not yet ready will still serve FTS-only work; vector and hybrid searches wait on the embedder. A service that does not answer at all is down for via-service clients (which fall back to standalone) and fatal for the Worker (which has no fallback — it returns 502).

The Worker in production

The Worker is the package in pkgs/atlas-search/worker/: name atlas-search, deployed to the fleet Cloudflare account’s workers.dev subdomain, reached at https://atlas-search.developing-today.workers.dev. Its deploy source of truth is cloudflare.config.ts; wrangler.toml drives local development and tests only, and the two files must be kept in step (bindings were verified field-for-field, including the shared D1 placeholder id below).

Routes and the gate

Five public routes: GET /health (open, liveness only, returns { "status": "ok", "service": "atlas-search-worker" }), POST /v1/search, GET /v1/cache/inspect, POST /v1/cache/purge, and POST /mcp — the one-tool MCP surface in The Atlas MCP server. Everything else is a 404.

Every route except /health is gated by one shared secret, named GATE_TOKEN, presented as Authorization: Bearer &lt;token&gt;. The same gate covers /mcp; there are no per-route, per-caller, or per-agent tokens, and a valid check yields a boolean and nothing else — every gated caller is the same identity to the Worker. The comparison is constant-time by construction (both tokens are SHA-256 digested and the digests XOR-folded). Missing or invalid gate: 401 with code unauthorized.

Bindings, variables, and secrets (names only)

Binding / variableKindTarget / value
QUERY_CACHEDurable ObjectClass QueryCache in this Worker, SQLite-backed (new_sqlite_classes, migration tag v1) — the per-query cache; see The service and the Worker
HOT_CACHED1 databaseDatabase atlas-hot-cache. The committed database_id in both config files is a local placeholder (00000000-0000-0000-0000-000000000001), replaced with the real id when the database is created at deploy time
SERVICE_BASEPlain variablehttps://atlas-search.security.cab — the tunnel hostname of the laptop service. Every service call is fetch against this base
HOT_CACHE_ENABLEDPlain variable"false" as committed. Only the literal string "true" enables the D1 store — and today that still changes nothing, because the store is not wired into the request path (#13105); see Troubleshooting

Secrets are set with wrangler secret put or uploaded with the new version at deploy time; values are never in either config file:

Secret namePurpose
GATE_TOKENThe inbound bearer gate above
SERVICE_TOKENThe service’s cf-worker client token (service-side cap personal), presented as a bearer on every service call
ACCESS_CLIENT_ID / ACCESS_CLIENT_SECRETThe Cloudflare Access service token for atlas-search.security.cab, presented as the CF-Access-Client-Id / CF-Access-Client-Secret headers on every service call

At deploy time these are assembled from fleet secrets under the names atlas.search-worker-gate-token, atlas.search-cf-worker-token, cloudflare.access-atlas-search-client-id, and cloudflare.access-atlas-search-client-secret, plus cloudflare.api-token-account-wide for the cf CLI itself. The Worker holds no Turso credentials and no shard list: fan-out, shard discovery, manifest reads, and merging all live in the laptop service.

Outbound, the Worker pins its identity at compile time: ceiling personal, disclosure context hosted-per-user, model Snowflake/snowflake-arctic-embed-m-v2.0 at 768 dimensions. No request field, header, or environment variable can change any of them, and the Worker verifies the service’s reported effective_ceiling is personal before anything is cached. There are no application-level timeouts in the Worker — outbound calls run unbounded, subject only to Cloudflare platform limits.

Deploying and rolling back the Worker

Deploys go through the sanctioned cf binary’s versions flow, not a bare wrangler deploy:

  1. Assemble a throwaway secrets file from the fleet secrets, by name.
  2. Create the new version with that secrets file (cf workers versions create --secrets-file …; the package’s deploy script is cf workers versions create), so no version ever deploys without its gate and service tokens.
  3. Verify the bindings on the new version.
  4. Create a deployment at 100%.

Rollback is a new deployment at the previous version id — no upload needed. Local development is wrangler dev; the test suite is vitest run (the package’s test script), and tsc --noEmit is its typecheck script.

Restarts: what is lost, what survives

Restart the laptop service with:

$ systemctl --user restart atlas-search.service

A restart of the serve process loses exactly the state that was designed to be perishable:

  • The temp store, entire. Every job’s fused ranking lives only in the serve process’s memory, with a TTL of 10 minutes from completion and a 60-minute hard cap from submit. A restart takes in-flight jobs, queued jobs, and finished-but-unpaged rankings with it. Clients see their job handles fail and simply submit again — that resubmission is the recovery procedure, by design. Nothing in the temp store survives a restart, by requirement: job results hold ceiling-gated snippets, and their lifetime is meant to match the job, not the disk.
  • The warm embedder. The ONNX session is resident state; the restarted process reloads it lazily (about a second) on the first vector or hybrid search.
  • Connections and queues. The Turso connection pool, the branch-execution slots, and any queued work behind the backpressure limits (saturation is answered 429 with a retry hint; a job queued beyond its useful life fails as expired) are all rebuilt empty.

A restart does not lose: the service config or client table (service.json on disk), the provisioned model snapshot, traces or feedback records (files under the same state directory), any corpus store (the monolith, the shards, the canonical atlas.db — the service is a reader of all of them), or the backup (a separate unit; see Backup, restore and the census).

A Worker redeploy is the mirror image: it loses nothing durable. The Durable Object cache lives in the objects’ own SQLite storage, not in the Worker code version, so cached answers survive a deploy — which is precisely why stale answers are a purge operation, not a redeploy operation; see Troubleshooting. The D1 hot cache, being unwired, is unaffected either way.

Backup, restore and the census

Source: nixos/home/laptop-backups.nix and nixos/home/atlas-backup.sh, the schedule registry row in doc/fleet-schedule-registry.md, and the census statement in the Atlas program investigation record doc/2026-11-23T12-06-51Z_design_atlas_program_investigation/ under https://github.com/developing-today/code/blob/main/nixos/home/laptop-backups.nix — provenance only; this chapter is complete without following it.

Two different questions get confused under the word “backup”: is the corpus recoverable if the laptop store is lost, and how big is the corpus right now? The first has a landed, scheduled answer. The second has a frozen answer from 2026-10-31 and an honest caveat. This chapter keeps them separate.

The backup: atlas-backup

The wiring lives in nixos/home/laptop-backups.nix, with the script vendored beside it as nixos/home/atlas-backup.sh and packaged as atlas-backup (pkgs.writeShellScriptBin). It was migrated from a sandbox cron on 2026-10-30 under the laptop-only execution rule (#1515).

UnitShape
atlas-backup.servicesystemd user service, Type = oneshot, ExecStart = the packaged atlas-backup, TimeoutStartSec = 90m, description Daily atlas.db backup - local + R2 + Drive (code#1515). Gated on cfg.atlas.enable
atlas-backup.timersystemd user timer, OnCalendar from the option services.laptop-backups.atlas.onCalendar, default 04:47, Persistent = true, RandomizedDelaySec = 15m, WantedBy = [timers.target]

The fleet schedule registry corroborates the live shape: atlas-backup.timer at OnCalendar=*-*-* 04:47:00 driving atlas-backup.service on the laptop (user systemd), dated 2026-11-04. Because the timer is persistent, a night the laptop is asleep is caught up on wake rather than skipped. Note what this timer is not: it is the only laptop schedule in the Atlas story — ingest has no timer; see the census section below.

What is covered

The backup target is the canonical local store, ~/atlas/turso-atlas/data/atlas.db — the durable asset of the collect → normalize → index pipeline, from which the published copies are derived. One run:

  1. Snapshots atlas.db with sqlite3 .backup (a consistent copy of a live database, not a file copy).
  2. Gzips the snapshot deterministically.
  3. Files it to three places: the local backup directory on the laptop, R2 (bucket supabase-backups, prefix atlas/&lt;date&gt;/), and Google Drive (Cloud/cold-store/db-backups/local-atlas/).
  4. Verifies every copy by sha256, and dedupes by content hash against the backup log — an unchanged database does not produce duplicate archives.
  5. Applies retention of 7 / 7 / 4 (laptop dates / R2 dates / Drive archives).

Credentials are fetched from Bitwarden by name at runtime, never written into the Nix store — the module’s shared pattern. The Python atlas-backup.py in the laptop script tree is the script-side ancestor of this unit, not the live shape; the Nix unit above is.

Also covered, through the same store: the content-addressed extracts of the provenance programme (#3125). Phase 1 landed 2026-11-22 and phase 2 landed 2026-11-23, interning 12,092 content-addressed objects (about 2.6 GB, 0 dedupe collisions) for the chatgpt-export and sandbox-agents sources, with the verification marker ATLAS-EXTRACTS VERIFY OK recorded — and the programme record states plainly that atlas-backup covers that store. Phases 3 (occurrence backfill) and 4 (catalog database and multi-shard resolution as MCP tools) remain open.

What the backup is not: it is not a backup of the Turso-hosted publish (Turso is distribution — it never holds the only copy of anything, so it is the copy, not the source), not a backup of the service temp store or the Worker cache (both are caches with their own lifetimes; see Running the service and the Worker), and not a fleet search verb — a backup verb or maintenance role inside the fleet binary was proposed in the scaler design and has not landed as such. The Nix unit is the live shape.

Restore shape

There is no restore verb. A restore is the backup read backwards, by hand, and its shape follows from what a backup is — a sha256-verified, gzipped sqlite3 .backup snapshot:

  1. Stop the reader: systemctl --user stop atlas-search.service, so nothing serves a half-replaced store.
  2. Pick the copy: the local backup directory first, then the R2 copy under atlas/&lt;date&gt;/, then the Drive archive under Cloud/cold-store/db-backups/local-atlas/.
  3. Verify before trusting: check the copy’s sha256 against the backup log. A copy that does not verify is not a restore source.
  4. Decompress and place the result at the canonical path, ~/atlas/turso-atlas/data/atlas.db. Keep the file it replaces until the restored store has been checked — the replaced file is the only thing a failed restore can fall back to.
  5. Restart the service and check it: GET /health on port 18760 answers, and a known query returns sane results. The hosted publish, if it also needs rebuilding, is republished from this restored canonical store — never the other way round.

Two boundaries to keep straight. First, restoring atlas.db restores the canonical store; the shard set and the hosted publish are derived or distributed state with their own provenance (their manifests are described in Data stores and schemas). Second, the cold-tier shard restore path (#6042) is a design record, not this procedure — do not present the manual restore above as the cold-tier mechanism.

The census: where the numbers live

The frozen snapshot: 2026-10-31

Issue #3125 is the provenance and occurrence-registry issue. Its census does not live in a standalone census file in doc/ — it is quoted inside later design records, and the canonical statement is section 1 of the program investigation record (2026-11-23):

Last verified census (2026-10-31, on #3125): 18,325 sessions / 122,124 messages / 107,639 chunks.

The store that census describes is the canonical store on the laptop — the atlas.db above plus 29 topic shards. Its sensitivity split, from the same record, cross-checks the total exactly:

TierShardsChunks
Internal28107,001
Secret1638
Public00
Total29107,639

Zero public-tier shards is a stated fact of the v1 record, not a gap in the table. Any chapter, dashboard, or answer that quotes 18,325 / 122,124 / 107,639 must date it 2026-10-31 — see FAQ.

The unrecounted monolith

Later records describe a ~7.3 GB monolith without a verified recount. Both halves of that sentence matter. The store has grown since October — ingest, however manual, did not stop — and no fresh verified census has been taken. The 7.3 GB is a size observation, not a count: it cannot be turned into sessions, messages, or chunks by arithmetic, and this book does not try.

How a fresh census would be taken

A fresh census is an early deliverable of the Atlas programme (#13241), and its shape is fixed by what made the October one trustworthy:

  1. Count the canonical store directly: sessions, messages, and chunks in ~/atlas/turso-atlas/data/atlas.db.
  2. Count every shard: each shard carries an atlas_manifest with an expected_chunks value, checked against an actual COUNT(*) of its chunks — a manifest that disagrees with its own store is a finding, not a number.
  3. Split the result by tier (public / internal / secret) so the split cross-checks the total, as the October split does.
  4. Date it, name the store it was taken from, and publish it in the same place the October census is quoted from — a design or programme record — so the next reader finds one canonical statement, not a scatter of counts.

Until that runs, there is no newer number to quote, from any source.

Why consumers still see the October counts

Because nothing downstream recounts. Consumers — the service, the Worker, the CLIs — search the published store, and the publish consumers see is the October publish: ingestion today is manual and script-driven (the recurring sweep runner, #7969, is unbuilt; the ingest scripts still live outside the repo, with migration #5670 open), and no recount-and-republish pass has landed since. The counts are therefore not stale by accident or by caching — they are the counts of the corpus as published, frozen at the last verified census, while the underlying store has grown past them uncounted. The Worker cache’s indefinite retention (#6805) is a separate staleness story, covered in Troubleshooting; even a perfectly fresh cache would still be answering over the October-published corpus.

Troubleshooting

Source: pkgs/atlas-search/crates/atlas-core/src/turso.rs, pkgs/atlas-search/crates/atlas-core/src/stage.rs and gate.rs, pkgs/atlas-search/crates/atlas-search/src/service.rs, pkgs/fleet/crates/fleet-search/src/cli.rs, and pkgs/atlas-search/worker/src/ (index.ts, search.ts, service.ts, cache_do.ts, hot_cache.ts, space.ts) under https://github.com/developing-today/code/blob/main/pkgs/atlas-search/ — provenance only; this chapter is complete without following it.

Every entry here is a recorded failure shape, not a hypothetical: what you see, why it happens, what to check, and what actually fixes it. Two distinctions resolve most confusion before you start — the service temp store (in memory, 10 minutes) is not the Worker cache (Durable Objects, indefinite), and standalone is not the service route. The service and the Worker draws both; Running the service and the Worker is the operator companion to this chapter.

A search takes about four seconds

What you see. Hybrid and vector searches take roughly 4 seconds; FTS-only searches are fast by comparison.

Why. That is the serving physics of the current store, not a fault. The production vectors are stored as plain BLOBs — vec_snowflake_m_v2_768_f32 holding a F32_BLOB(768) per chunk — and vector_top_k does not work on them. Semantic search is therefore an exact cosine scan (--vector-backend scan, the default): every allowed chunk’s distance is computed, which the programme record measures at about 4 seconds for a plain scan, and a filtered scan is 6–15 seconds of server-side work — which is why the service bounds concurrent branch executions and answers saturation with 429 rather than queueing without limit. Earlier measurements agree in scale: a pool-100 scan branch at 6.18 seconds wall on the Python path, and the Rust scan arm at 18.5–21.9 seconds end-to-end for golden queries under the rewrite-idle conditions of 2026-11-04.

Check. GET /health on the service: a high queue_depth or active_branch_executions means you are waiting behind other scans, not stuck. --mode fts on the same query confirms the split — fast FTS, slow vector is the signature of this entry.

Fix. There is no operator fix today; replacing the exact scan with an approximate-nearest-neighbour path is programme work, stated in the investigation record as “fix the serving physics”. The index-fixed and index-fill vector backends exist in the CLI, but they call vector_top_k against the libsql vector index — the mechanism that does not work on the plain-BLOB vectors above — so switching to them is not a workaround for this store. Do not file the 4 seconds as an outage.

A via-service search falls back to standalone — loudly

What you see. The search succeeds, but stderr carries a warning of the shape fleet search: warning: --via-service: &lt;detail&gt;; falling back to standalone (the atlas-search client prints its own equivalent), and the result envelope’s notes carry the fallback note. Exit code is 0.

Why. The fallback is contractual, not silent, by design: any service failure under --via-service degrades to a standalone search with the reason recorded in both places. The recorded causes, in the order to check them:

  • The service is down or unreachable — the unit is stopped, failed, or the port is taken by something else. Check GET /health on 127.0.0.1:18760 first.
  • The seat has no usable token. A via-service client presents a token from the environment variable named ATLAS_SEARCH_TOKEN, or from ~/.config/atlas-search/client.json (mode 0600). A seat with no client config cannot use the service route and falls back. A token the service does not know, or whose identity was removed from ~/.local/state/atlas-search/service.json, fails the same way.
  • The request disqualifies the service route. --backend local and a non-default --vec-table each force the loud standalone fallback with an explanatory note; any --shards specification skips the service attempt entirely, with no note. None of these three appears in any help text — this is source behaviour.
  • get-chunk always does this. Chunk reads are job-scoped in the protocol, so get-chunk always runs standalone, with the loud note when via-service was in effect. That is its normal shape, not a failure.

Fix. Restore the missing leg — start the unit, provision the seat’s client config, or accept the standalone route the request actually asked for. If the standalone artifact itself is missing from PATH, there is nothing to fall back to: fleet search exits 3 naming the missing artifact.

An MCP caller sees only personal-tier results

What you see. Through the MCP endpoint (or the Worker REST search), results stop at the personal tier no matter what the caller asks for. local-only and secret-bearing content never appears, and no parameter changes it.

Why. That surface has exactly one identity, pinned at compile time. The Worker sends ceiling personal and disclosure context hosted-per-user on every service search, presenting the service’s cf-worker client token, whose service-side cap is personal. Neither the REST body nor the MCP tool schema has a field for a ceiling or a context, so a caller cannot request a different one. After the service responds, the Worker verifies effective_ceiling is personal before caching — a result computed above personal is refused with a 502 and can never enter the cache. All MCP callers share this one hosted identity; per-agent identity and ceilings are a later slice (#8625), deliberately not improvised in the Worker.

Fix. None on that surface — by design. A caller entitled to a higher ceiling uses the laptop service directly, with its own named client identity and cap (Drew’s CLI is capped at secret-bearing), under the rules in Sensitivity tiers and client ceilings. The Worker will never be that route: it holds no credential that could search above personal, and that absence is the security property. The full surface is in The Atlas MCP server.

Cache answers look stale

What you see. A hosted (Worker) search returns the same answer after the corpus underneath it has changed. Repeating the query, waiting, and redeploying the Worker all change nothing.

Why. The Worker’s Durable Object cache retains entries indefinitely — no TTL, no eviction in v1, by Drew’s order (#6805). Each (normalized query, clamped k, pinned ceiling, pinned context, pinned model revision, pinned vector table) gets one Durable Object holding one row; a complete entry is served verbatim forever, with only its hit counter moving. The deferred triggers for revisiting this exist on the record — add a corpus generation to the key at the first same-space re-ingest changing more than 5% of chunks or on a stale-result complaint, add an LRU sweeper at 10,000 cached queries or 1 GB aggregate — but they are triggers, not code. Do not confuse this store with the service temp store (10 minutes, in memory): the stale answer is the Worker’s, and restarting the laptop service cannot touch it.

Check. GET /v1/cache/inspect?query=&lt;query&gt;&amp;k=&lt;k&gt; on the Worker (gated) returns metadata only — whether the entry exists, whether it has an embedding and a result, its hit count and timings — which proves the answer came from cache without exposing the cached body.

Fix. Purge the exact key: POST /v1/cache/purge (gated) with body { "query": "&lt;query&gt;", "k": &lt;k&gt; } deletes that one entry’s row and returns { "key": …, "query": …, "purged": true }; the next search is a miss and re-runs against the service. Purge is exact-key only — there is no prefix or enumeration purge, intentionally: the key is a SHA-256 digest, and enumeration would need a separate index. Note that k is part of the key: purging at the wrong k purges a different entry and leaves yours intact.

The D1 flag is on, but nothing changes

What you see. HOT_CACHE_ENABLED is set to "true", the HOT_CACHE D1 binding exists — and no read or write behaviour changes at all.

Why. The D1 tenant hot cache is storage layer only, not wired into the request path (#13105). Its module provides tested get / put / touch / evict primitives over the hot_cache table, but nothing in the Worker’s routing, search, MCP, service, or cache code ever calls the store — its only callers are its own tests. The flag’s own semantics are narrow (only the literal string "true" enables the store constructor, and only when the binding also exists), but even a correctly enabled store is never consulted. Freshness evaluation (#13101) and the admission/eviction sweep (#13103) are likewise follow-ons.

Fix. None available, and none needed: leave the flag at its committed "false". When you are asked where a hosted answer was cached, the answer today is always the Durable Object, never D1. Turning the flag on in the hope of changing staleness, latency, or cost will do none of those things — see the stale-cache entry above for the purge that does work.

A promotion refuses

What you see. atlas-stage promote (or the registry’s promote transition) fails fatally and the staging unit stays unpromoted — it is not left half-merged.

Why — the model gate. Promotion is gated on the embedding-model contract (M6 of the one-model decision, #7648 / #6060): a unit promotes only when its database’s recorded atlas_manifest.embedding_model equals the mandated model, snowflake-arctic-embed-m-v2.0. The three refusals are all fatal and all leave the unit unpromoted:

  • A different model is named — vectors from different embedding models are not comparable.
  • No model is recorded — provenance unknown.
  • The unit is empty.

Why — classification. The batch gate behind promotion runs five ordered stages — write → classify → dedup → provenance-check → publish — and fails closed: a stage with no recorded verdict has not passed, and verdicts are recorded strictly in order. A classification that cannot be resolved (classify_unresolved), a malformed or unrecognised per-chunk classification record (which resolves to secret-bearing on read-back, never to something more permissive), or a producer’s segment declaration with a missing, mistyped, or unknown-sensitivity field (a usage error, never a silent default) will each stop the batch. The same reason code three times (STRIKE_LIMIT = 3) marks the batch needs_review and refuses further automatic retries; resume is at the failing stage, and changed bytes never inherit a verdict obtained for different content.

Fix. Read the refusal literally: stamp or re-embed the unit with the mandated model through the promote verb’s embed-at-promotion step (it needs the model and ONNX runtime, resolved like the atlas-search binary), or fix the classification input at the producer — segment declaration stays with the producer; staging composes and persists it. Do not edit the recorded model name to match: the gate exists precisely because the name is a claim about vectors that must be true. The full workflow is in Ingest today: staging, classification, promotion.

Results differ between Python and Rust

What you see. The same query through atlas_search.py (kept on the laptop as atlas-search-py) and through the Rust atlas-search returns different results or a different order.

Why. The Rust engine is a semantics port of the Python, with named parity breaks — check these before suspecting the corpus:

  • Context default. Python search defaults --context to local-owner for both verbs and does not validate the value (an unknown context fails closed inside the disclosure logic). Rust search defaults to fleet-internal, Rust get-chunk to local-owner, and an unknown Rust context is a hard exit-2 error. Different contexts mean different context ceilings, which means different result sets — legitimately. Align --context explicitly before comparing anything else.
  • RRF constant. The shipped production fusion — Rust, and the Python production path’s own header — uses reciprocal rank fusion at k = 10, pool 100 per branch (query-parameters-v1.json). The Python eval lineage is a different configuration: eval3.py fuses top-30 branches at k = 60 with truncation to 384 dimensions. Numbers or orderings produced through the eval harness are k = 60, trunc-384 numbers; they are not the production ordering and never were.
  • Smaller named breaks. The Rust FTS match expression keeps short digit-bearing tokens (r2, s3) that the Python hybrid rule drops, and the Python baseline additionally removes a 23-word stop list. The Rust topics/projects matching deliberately diverges from the Python’s LIKE behaviour (#5375): the Rust escapes the pattern so a value matches only a JSON element exactly equal to it, where the Python has the wildcard bug. Gate A’s bit-identity is also version-matched: fixtures were recorded with ONNX Runtime 1.31.1, and a different runtime produces small deltas rather than a parity verdict.

Fix. Compare like with like: same context, same ceiling, same mode, the production path on both sides. Where a break above explains the difference, the Rust production behaviour is the shipped behaviour and the book documents the source, per the parity discipline — the standing gates themselves are in Evaluation: golden sets and gates.

The Worker returns 502

What you see. Hosted searches fail with 502 and the envelope { "error": { "code": "query_failed", "message": "…" } }; MCP callers see the same failure as an isError: true result over HTTP 200.

Why. The Worker has no fallback: when the laptop service is unreachable, returns a non-JSON or error response, reports an effective_ceiling other than personal, or returns an embedding outside the pinned space (wrong model, wrong dimensions, a non-finite component), the Worker maps the failure to 502. Any upstream HTTP status is re-mapped to 502; the upstream status survives only inside the message text. Nothing is cached from a failed search beyond a possibly stored embedding — if the embed call itself failed, not even that.

Fix. Work the laptop leg: service health on port 18760, the tunnel hostname atlas-search.security.cab, and the Access service token’s validity (names in Running the service and the Worker). The Worker side needs no clearing afterwards — a failed fill leaves the entry at most in the embedded state, and the next request retries the search without re-embedding.

Exit-code quick table

Success is always 0. Error lines go to stderr prefixed with the binary’s name; no partial JSON is printed on failure paths (the loud via-service fallback is the exception — it succeeds, at 0).

Surface012Other
atlas-searchSuccess, including a loud standalone fallbackBackend / transport / embed failures; get-chunk not-foundUsage and validation: clap errors, count / parameter / context validation, init / fetch-model failures—
fleet searchSuccess, including --help and bare --versionService-job or backend failure with no fallback availableUsage and validation; rejected init / fetch-model verbs3 = no service route and the standalone artifact is not on PATH. 69 = domain stub in a build that cannot serve it
fleet serve searchHelp only — a running service never exits 0Runtime failure: backend token, bind (an occupied 18760 exits 1)Usage and config errors—
atlas-stageSuccessAll runtime errors: unknown sensitivity or state, missing unit, embedder or model absence, registry and database errorsClap usage errors only—
atlas-classify, atlas-sweepSuccess (for atlas-sweep, including a run-once overlap-skip)— (no exit-1 path)Everything: usage and runtime failures alike—
atlas-evalSuccess, report printedUnreadable input, invalid eval data, evaluation failureWrong arity, unknown split—
atlas-github-commentsSuccess, including runs that skipped HTTP-451 reposEverything, including argument errors— (no exit-2 path)—
atlas_search.pySuccessget-chunk not-found; unhandled backend failures (as tracebacks)Argparse errors; die() validation, token-resolution, and backend errors—
Worker HTTP200——400 bad request, 401 gate failure, 404 no route, 405 non-POST to /mcp, 413 body over 64 KiB, 502 upstream / space / ceiling failure (see above)

The inconsistency in the middle rows is real, not a table error: no two hand-rolled binaries in the family share one exit-code philosophy, and only the clap binaries mirror the Python. Check the row for the binary you actually ran before scripting against a code.

Deploying this book

Source: pkgs/atlas-search/book/, pkgs/atlas-search/book.toml, pkgs/atlas-search/docs.nix, lib/default.nix, .github/workflows/atlas-docs.yml, and .github/workflows/mcpx-docs.yml under https://github.com/developing-today/code/blob/main/pkgs/atlas-search/book.toml — provenance only; this chapter is complete without following it.

This book is one of three books on one GitHub Pages site. That single fact decides everything about how it deploys: the Atlas book is never deployed on its own. Its build is checked on its own; its deployment happens only as one staging step inside the combined deploy that publishes the whole site at once. The live book is at https://developing-today.github.io/code/atlas/.

The pieces

PieceWhat it is
pkgs/atlas-search/book/The book sources — the Markdown chapters, in the layout the summary file names
pkgs/atlas-search/book.tomlThe mdBook configuration: title atlas, src = "book", create-missing = false — a chapter named in the summary but missing on disk is a build failure, never a silently generated stub
pkgs/atlas-search/docs.nixThe build: an mdBook build of the sources above, offline, with the book’s checks
lib/default.nixExposes that build to the flake as .#atlas-docs
.github/workflows/atlas-docs.ymlThe build-only workflow for this book (below)
.github/workflows/mcpx-docs.ymlThe combined deploy workflow for the whole Pages site (below)

Build the book locally exactly as CI does:

$ nix build .#atlas-docs

The two workflows

atlas-docs.yml — build only

This workflow builds .#atlas-docs and nothing more. It is the gate: a broken chapter, a missing chapter (create-missing = false), or a failed book check fails the build here, before anything can deploy. It publishes nothing — there is no Pages deploy step in it, and adding one would be the standalone-deploy mistake described below.

mcpx-docs.yml — the combined deploy

This is the repository’s one Pages deployment. It builds each book and stages them into one site tree, then deploys that tree as the site’s single artifact:

Staged pathBookSite URL
Site root (site/)The mcpx bookhttps://developing-today.github.io/code/
site/fleet/The fleet bookhttps://developing-today.github.io/code/fleet/
site/atlas/This bookhttps://developing-today.github.io/code/atlas/

The Atlas staging step builds .#atlas-docs and copies the result into site/atlas, with the book’s site URL configured as /code/atlas/ — the path prefix the rendered links and assets must assume, because the book does not live at the site root. The deploy step then publishes the assembled site/ tree once.

The one-site rule

GitHub Pages serves one site per repository, and a Pages deployment replaces that site with the artifact it is given. The rule follows directly:

Never deploy the Atlas book on its own. A workflow that uploaded only the Atlas build output as the Pages artifact would publish a site containing only Atlas — and wipe the mcpx book at the root and the fleet book at /code/fleet/ until the next combined deploy restored them.

Every Atlas deploy therefore goes through mcpx-docs.yml’s combined staging, even when only Atlas chapters changed. The same rule protects Atlas in the other direction: no other book’s change can deploy without staging Atlas alongside it. If you find a draft workflow, a manual gh Pages call, or a helpful script that deploys .#atlas-docs output directly, that is the bug — do not run it.

The writability fix when staging

Built book output arrives from the Nix store read-only, and a site tree assembled by copying store output inherits that. A later staging step that copies the next book into — or over — a read-only part of the tree then fails with permission errors, typically on the second or third book staged, which makes it look like that book’s build is at fault. It is not: it is the tree.

The fix, applied in the workflow whenever a built book is copied into the copied site tree, is to make the staged tree writable before the next staging step touches it:

$ cp -r &lt;built-book-output&gt; site/atlas
$ chmod -R u+w site

Keep the chmod with the copy it belongs to. Removing it because one run happened to pass reintroduces an order-dependent failure that will return the first time the staging order or the store paths change.

Verification after a deploy

A green combined deploy is not the verification. Check all three books, every time, because the failure this deploy shape risks is another book disappearing:

  1. Atlas is live. https://developing-today.github.io/code/atlas/ returns the book’s front page, and a chapter page under it (this chapter, for instance) renders with working links — which also proves the /code/atlas/ site URL was staged correctly.
  2. The mcpx root still serves. https://developing-today.github.io/code/ returns the mcpx book, not a 404 and not the Atlas book.
  3. The fleet book still serves. https://developing-today.github.io/code/fleet/ returns the fleet book.

If check 1 passes and either of checks 2 or 3 fails, the deploy was not combined — treat it as the one-site rule having been broken, and re-run the combined mcpx-docs.yml deploy to restore the full tree. If check 1 fails while 2 and 3 pass, the Atlas staging step is the suspect: rebuild .#atlas-docs locally, confirm the output exists, and check the staging copy and the writability fix above before re-deploying.

Custom domain: not wired

There is no custom domain for this book, or for the site it lives on. The canonical address is the github.io URL above; no CNAME is set, and no DNS record points a fleet domain at the Pages site.

A later DNS step — choosing a hostname, adding its DNS records, and configuring the domain on the Pages site — is documented as future work and is not wired. Until that step is deliberately done, do not add a CNAME file to any book’s output, do not set a custom domain in the repository’s Pages settings as part of a book change, and do not publish links under any domain other than developing-today.github.io. A half-wired domain would move all three books at once, which is exactly the blast radius the one-site rule exists to keep visible. The standing rule for keeping the chapters themselves current as the system changes is in Keeping this book current.

FAQ

Source: pkgs/atlas-search/crates/atlas-search/src/main.rs, pkgs/atlas-search/atlas_search.py, pkgs/atlas-search/worker/src/ (index.ts, search.ts, hot_cache.ts, space.ts), pkgs/fleet/crates/fleet-search/src/cli.rs, and nixos/home/laptop-backups.nix under https://github.com/developing-today/code/blob/main/pkgs/atlas-search/ — provenance only; this chapter is complete without following it.

Short answers, each pointing at the chapter that carries the full story. Operational symptoms — slowness, fallbacks, refusals — are diagnosed step by step in Troubleshooting.

They are two front doors to one engine, not two engines. atlas-search is the standalone binary: the complete surface, including the service verbs serve, init, and fetch-model, and every engine flag. fleet search is the fleet binary’s search domain — the client subset of that surface that translates to the wire request or to routing — and fleet serve search is the same serve role rehomed into fleet, which is what production actually runs. On the standalone route, fleet search delegates to the deployed atlas-search artifact and inherits its output byte-for-byte; the writers that render service envelopes are parity-guarded copies, so both routes print what atlas-search prints. Rule of thumb: script against whichever binary your seat already has; reach for atlas-search when you need a verb or flag the fleet subset deliberately omits. See atlas-search: search and get-chunk and fleet search and fleet serve search.

Why is search slow?

Because the vector branch is an exact scan. The production vectors are stored as plain BLOBs, vector_top_k does not work on them, and so every allowed chunk’s cosine distance is computed — about 4 seconds for a plain scan, more under filters. FTS-only search (--mode fts) skips that cost entirely. There is no operator fix today; an approximate-nearest-neighbour path is programme work. The measurements and the reasons the index backends are not a workaround are in Troubleshooting.

Why can’t the Worker — or an MCP caller — see the secret tier?

Because that surface has exactly one identity and it is pinned at personal. The Worker presents the service’s cf-worker client, whose cap is personal, sends ceiling personal and context hosted-per-user on every search, and verifies the reported effective ceiling before caching anything. No request field can ask for more, and the Worker holds no credential that could search higher — that absence is the design, not a missing permission. Higher ceilings exist only on the laptop service, under named client identities with their own caps; see Sensitivity tiers and client ceilings.

Where do vectors live?

In the corpus stores, next to the chunks they describe — never in staging databases, and never only in one place. The production set is the table vec_snowflake_m_v2_768_f32: one 768-dimension float32 vector per chunk, in the Turso publish (typed F32_BLOB(768), with a libsql_vector_idx index) and in each scan shard beside its chunks table. The local backend can also read vector side stores — separate files joined to the corpus by content_hash, never by chunk id, because the id spaces differ between stores and an id join would silently attach the wrong vectors to thousands of chunks. A dormant bge-small set (vec_bge_small_384_f32, 384 dimensions) remains in the publish as a fallback; it is a different, incomparable space, and the Worker refuses it outright. Staging databases store no vectors at all by design — vectors are written only at promotion, by the embed-at-promotion step. The store inventory is in Data stores and schemas.

Why did setting HOT_CACHE_ENABLED not change D1 behaviour?

Because the D1 hot cache is not wired into the request path. The flag (only the literal "true" counts) plus the HOT_CACHE binding would construct the store — and then nothing would call it: the store’s get / put / touch / evict primitives are exercised only by their own tests. Read-path integration is follow-on work (#13105), alongside freshness evaluation (#13101) and the eviction sweep (#13103). Hosted answers today are cached in the Durable Object cache, always. See The service and the Worker.

Is the corpus current?

The corpus you can search is current as of its last publish — and the last verified census is frozen at 2026-10-31: 18,325 sessions / 122,124 messages / 107,639 chunks (#3125). The underlying store has since grown to a ~7.3 GB monolith with no verified recount, and ingestion is still manual and script-driven, so no newer count exists to quote and no consumer recounts on your behalf. A fresh census is an early programme deliverable; how one would be taken, and why the October numbers are the ones consumers still see, is in Backup, restore and the census. Treat any undated Atlas size claim — including one in an older chapter or design — as that October snapshot until a dated replacement exists.

Can ID search Atlas today?

No. There is no shipped path by which the ID system queries Atlas: no ID-side Atlas client, no publication feed from the corpus into the ID graph, and no MCP tool pair joining them is live today. What exists is design — an Atlas-to-ID publication format (corpus objects plus provenance and lineage relations as ID-graph objects, #6062) and the wider federation work — and it is written up as design, with its grounding in what exists today, in Design: search integration for fleet and ID. Anyone who needs Atlas results in ID work today copies them there by hand; the book will not pretend otherwise.

What does the Python file do?

pkgs/atlas-search/atlas_search.py is the original implementation and the permanent parity oracle. The Rust engine is its semantics port: wording, defaults, error texts, and exit codes are mirrored from it, the parity fixtures were recorded from it, and it remains the evaluation instrument of record — every parity gate runs against Python behaviour. It is also still the only surface with the bge/fastembed embedder path and with non-default embedding models for vector search; the Rust binary refuses both, loudly. It is kept alongside the Rust binary on the laptop as atlas-search-py, renamed but retained — never removed first. Its own chapter is atlas_search.py: the Python reference implementation; the places its behaviour deliberately differs from the Rust port are listed in Troubleshooting.

Why did my search fall back to standalone?

Because the service route failed or was disqualified, and the fallback is loud by contract: a warning on stderr, a note in the result envelope, standalone results, exit 0. The usual causes are the service being down, the seat having no client token configured, a --backend local or non-default --vec-table request (which the service cannot serve), or the verb being get-chunk, which is always standalone. It is a degradation, not an error — but it is never silent, so if you see the warning and did not expect it, Troubleshooting walks the causes in order.

A cached answer is wrong now. How do I clear it?

Purge the one key. The Worker cache has no TTL (#6805), so waiting does nothing; POST /v1/cache/purge on the Worker (gated) with { "query": …, "k": … } deletes exactly that entry, and the next search re-runs. Remember that k is part of the key — purge at the depth the answer was cached at. There is no bulk or prefix purge, by design. The inspect route (GET /v1/cache/inspect) proves an entry exists before you purge it; both routes are in The Worker HTTP API.

Why are there two caches with opposite lifetimes?

Because they protect different things. The service temp store holds one job’s fused ranking — ceiling-gated snippets fetched for one client — so it is in memory, lives 10 minutes, and dies with the process: perishability is its security property. The Worker Durable Object cache holds whole hosted query answers so repeated agent queries never re-pay the multi-second laptop fan-out, so it persists indefinitely: retention is its cost property. They share the nickname “the Atlas cache” in older documents and nothing else — different machines, different stores, opposite reasons. The service and the Worker keeps them apart throughout.

What happens to running searches when the service restarts?

They are gone, and that is the designed behaviour. Jobs, their rankings, and the queue live in the serve process’s memory; a restart returns the service empty — config, model, traces, and every corpus store survive on disk — and clients simply submit again. If a client reports a job handle failing after a restart, that is the expected shape, not data loss. See Running the service and the Worker.

Can I change the embedding model to a better one?

Not as a configuration change. Atlas runs one embedding model for every tier — Snowflake snowflake-arctic-embed-m-v2.0 at 768 dimensions — because vectors from different models are not comparable, and the whole corpus, every shard manifest, the promotion gate, and the Worker all pin that one identity. A shard or staging unit stamped with a different model is refused at discovery and at promotion rather than silently mixed in. Changing models means re-embedding the corpus into a second vector set beside the first and cutting over on evaluation evidence — a programme, with its own gates — not a flag. The contract is in Embeddings: Snowflake Arctic and the parity contract.

Which numbers can I trust for evaluation?

The ones whose configuration is named. Golden-311’s production row — 189 hits@10, MRR 0.3894 — is the one-stage hybrid at RRF k = 10, pool 100 per branch. The eval harness’s hybrid is a different configuration (RRF k = 60, top-30 branches, trunc-384) and produces different numbers for the same set; both are labelled “production hybrid” somewhere in the older records, which is exactly why this book names the configuration with the number. The harness, the splits, and the held-out discipline are in Evaluation: golden sets and gates.

Glossary

Source: pkgs/atlas-search/schema/, pkgs/atlas-search/crates/atlas-core/src/ (stage.rs, gate.rs, search.rs, fusion.rs, shards/, eval.rs), pkgs/atlas-search/crates/atlas-proto/query-parameters-v1.json, pkgs/atlas-search/worker/src/ (search.ts, cache_do.ts, hot_cache.ts), and .github/workflows/fleet-search-parity-guard.yml under https://github.com/developing-today/code/blob/main/pkgs/atlas-search/ — provenance only; this chapter is complete without following it.

Atlas terms, defined once. Where a term names two things that must not be confused — there are two caches, two sensitivity vocabularies, and two RRF constants in the older records — the definition says so and names both.

atlas_stage

The staging system: the versioned schema (atlas_stage_v1.sql) that every staging database carries, and the discipline around it. A staging database has exactly five tables — _schema_version, items, chunks_raw, notes, kv — holds raw, un-embedded chunks, and never stores vectors, which is what makes staging databases cheap to write and cheap to branch. The schema is versioned by adding a new vN artifact, never by editing an applied version in place: a staging database is promoted by being read, never by being migrated. See also stage unit, promote.

attestation

The per-batch ingest record (#6045): an in-toto-shaped statement binding a batch’s chunks to the sources they came from, built on the #3125 provenance substrate. Attestation is the step after promotion in the target pipeline — staging → classification → ingest-gate promotion → per-batch attestation — so that any chunk in the corpus can be traced to the batch statement that admitted it. A design-and-substrate term today: the record shape is designed and its substrate has landed in phases; it is not yet emitted for every batch.

ceiling

Short for sensitivity ceiling: the highest sensitivity a caller may be shown, enforced before ranking, never after. The ladder is shareable &lt; personal &lt; local-only &lt; secret-bearing. A search’s effective ceiling is a minimum of independent caps — the caller’s grant, the client token’s cap on the service, and the disclosure context’s ceiling — and neither side can widen the other. Content above the ceiling is absent from results, not down-ranked. The full model is in Sensitivity tiers and client ceilings.

chunk

The unit of search: one slice of one message (the corpus is sessions → messages → chunks; chunks run to roughly 3,500 characters in the canonical pipeline), deduplicated by content_hash and embedded as one vector. A chunk carries its provenance — session, client, sensitivity — and is what search returns, what get-chunk fetches by id, and what every count in the census ultimately counts. See Backup, restore and the census for the frozen count: 107,639 chunks at 2026-10-31.

content_hash

The chunk identity every store shares: a hash of the chunk’s content, UNIQUE NOT NULL in the publish and shard schemas, and the join key wherever id spaces differ — vector side stores are mapped onto the corpus by content_hash, never by chunk id, because an id join would silently attach wrong vectors. The golden-set corpus fingerprint is likewise built from sampled content_hashes. One honest caveat, recorded in test-vectors/content-hash-v1.json: the hash’s producer is not yet pinned there with an algorithm and known-answer vectors, and interop claims are forbidden until it is — the code treats as canonical an identity whose derivation no single artifact yet specifies.

corpus tier

The physical sensitivity vocabulary: public / internal / secret — the tiers shards, staging registries, and gate records are labelled with. It is a different vocabulary from the ceiling ladder (shareable / personal / local-only / secret-bearing), and the two are two namings of one ladder by prose, not by any schema-encoded mapping. The working correspondence: shareable → public; personal and local-only → internal; secret-bearing → secret. At the frozen census the corpus held 28 internal shards, 1 secret shard, and zero public shards.

delta DB

A vector side store holding chunks beyond the main corpus file: in the local backend’s known pairs, ~/atlas/atlas-delta-chunks2.db, where unusually the vector file and the corpus file whose chunks map its ids are the same file. Like every side store, it joins to the corpus by content_hash. See also topup DB.

Durable Object cache

The Worker’s live cache: one Cloudflare Durable Object (the QueryCache class) per distinct cache key, each holding exactly one SQLite row — the normalized query, its embedding, the verbatim result, and bookkeeping (timestamps, embed/search milliseconds, hit count). The whole check-and-fill runs inside the object, so concurrent misses for one key serialize and the laptop fan-out executes once. Entries move absent → embedded → complete, with the embedding persisted before the search runs. The cache retains entries indefinitely — no TTL, no eviction in v1 (#6805); the only deletion is an explicit per-key purge. This is not the service temp store, which is in memory and lives 10 minutes.

executeSearch

The Worker’s one search execution path: the function in worker/src/search.ts that both POST /v1/search and the MCP search tool call, after their own gate and validation. It derives the cache key, opens that key’s Durable Object, and returns the object’s hit or fill result as the search envelope. Because there is exactly one such function, ceiling pinning and cache keying cannot drift between the REST and MCP surfaces — an MCP search and a REST search for the same normalized query at the same k share one cache entry.

Gate A

Embedder parity: the Rust embedder must reproduce the production Python corpus pipeline bit-identically — token ids equal, output vectors at delta 0.0, single and batched — on the fixed probe set in fixtures/embed-probes.json. The gate is version-matched: it reads the ONNX Runtime version from the runtime itself and fails as NOT APPLICABLE, rather than reporting a verdict, against a different version than the fixtures were recorded with (1.31.1).

Gate B

Search parity: the Rust search must tie the Python production path on the golden-311 set, against the production corpus, within the tolerances the design states. Its expectations are recorded in fixtures/core-expectations.json, generated from the production Python — envelopes and SQL strings the Rust parity tests must reproduce.

Gate C

The adoption rule that closes the parity programme: whichever vector backend strategy wins the A/B comparison — exact scan, fixed-depth index, or escalating fill — is the one implemented as the default. Gates A and B prove the port is faithful; Gate C decides what the faithful port should default to, on evidence rather than preference.

golden set

A judged query set: queries with known relevant chunks (qrels), against which rankings are scored offline. Atlas’s set of record is golden-311 — 311 queries, frozen 2026-10-26 against the merged corpus of 101,471 chunks, identified by a content_hash fingerprint — plus the held-out near-exact set of 54 queries used by the Jaccard gate. Discipline: the dev split is for iteration and parameter selection; the test split is held out and scored once, at decision time. Not to be confused with the CLI text-render goldens in the test tree, which are expected-output files, not query sets. See Evaluation: golden sets and gates.

hot cache

The D1 tenant hot cache: a Cloudflare D1 database (atlas-hot-cache) designed as a cheaper cache tier in front of the Durable Objects — one shared database, rows keyed by (tenant, cache key), each holding an opaque payload, a class (A / B / C), a source watermark, fill and last-hit timestamps, and a hit count, with an index for least-recently-hit eviction order. Its storage primitives (get / put / touch / evict) are complete and tested, and it has no TTL as implemented. It is not wired into the request path (#13105): today it caches nothing, and the Durable Object cache is the only live Worker cache.

job protocol

The service’s asynchronous search protocol over HTTP and JSON, defined by the shared atlas-proto crate: submit with POST /v1/search/jobs and receive 202 with a job id and a per-job capability token; poll GET /v1/search/jobs/&lt;id&gt;; page the finished, immutable ranking with GET …/results (cursor, limit — default 100); fetch a chunk in the job’s context, or DELETE the job early. Fusion runs once, inside the job, over complete branch pools — which is why depth escalation lives in the vector branch and never in client paging. A one-shot POST /v1/search is the same machinery with the waiting done for the caller. The Worker does not use this protocol; its service calls are two synchronous posts (embed, then search).

MRL

Matryoshka Representation Learning, as Atlas uses it: the property that a vector’s first N dimensions are themselves a usable embedding. The stored Snowflake vectors are always the full 768 dimensions; a query may truncate both sides to N (for example --trunc 384) and renormalize, trading accuracy for speed without re-embedding the corpus. trunc = 0 means full width, and is the production default. Evaluation numbers recorded at trunc-384 are 384-dimension numbers — one of the parity breaks catalogued in Troubleshooting.

parity guard

The byte-parity drift guard for the fleet copies of the Atlas writers (#5920, contract origin #5433): a pair of scripts — the guard’s own contract tests, then the comparison itself — checking that pkgs/fleet/crates/fleet-search/src/pyjson.rs and render.rs stay byte-identical to the atlas-search originals outside their pinned parity headers, so a fleet-rendered service envelope cannot silently drift from an atlas-search-rendered one. It runs as the fleet-search-parity-guard workflow — on manual dispatch only, a fact the book records because a guard nothing runs automatically is a guard that can be skipped.

profile centroid

A design term, from the recommender programme: the weighted average (centroid) of the embedding vectors of documents a user has opened, saved, or searched for, with weights decaying with age — the user’s profile in the same 768-dimension space as the corpus, so “more like what I have been working on” is a nearest-neighbour query over the existing index with no new infrastructure. It names a designed mechanism in Design: the single-user recommender, not a shipped store: no centroid is computed or kept by Atlas today.

promote

The merge-on-close transition that admits a staging unit into the corpus (Registry::promote, driven by atlas-stage promote): the unit’s staged chunks are embedded with the mandated model, written as a new core scan shard, the unit’s provenance is stamped, a merge manifest is written (rows in, rows promoted, content hash, embedding model, timestamp), the staging database is branched as the unit’s archive, and the unit leaves every active state as merged. Promotion is gated — the M6 model gate refuses a unit whose recorded embedding model is not the mandated one, whose provenance is missing, or which is empty — and the batch gate’s five stages (write → classify → dedup → provenance-check → publish) must each have passed, in order, before it. See Ingest today: staging, classification, promotion.

RRF

Reciprocal rank fusion: the fusion that merges the FTS and vector branch pools into one ranking. Each branch contributes weight / (k + rank) per chunk, rank 1-based, and the fused list sorts by descending score, then best rank, then chunk id. Production k = 10, pool 100 per branch, both weights 1.0 — the contract in query-parameters-v1.json, giving a chunk ranked first in both branches a score of 1/11 + 1/11 = 0.181818. The Python eval lineage uses k = 60 at different depths; that is a different configuration, not a second production value.

shard

One database of the core tier’s fan-out set, named atlas-core-&lt;tier&gt;-&lt;topic&gt;-&lt;nn&gt;. A scan shard holds chunks, its vector table, and an atlas_manifest self-description (tier, topic, part, expected chunk count, metric cosine, embedding model). Shards join the fan-out by existing — discovery reads each candidate’s manifest and cross-checks it — never by code change; a shard above the caller’s tier ceiling, or of a tier with no credential, is never even connected. Fan-out runs an exact cosine scan per shard in parallel and merges by distance, which stays exact because the global top-k is contained in the union of per-shard top-ks. A failing shard fails the query: a partial answer that silently omits a shard is worse than an error.

stage unit

One unit of work’s staging database, registered in the staging registry: a queue task, a session, an epic, a notes batch — “many small DBs, free writes”. The registry row carries the unit id, its database URI, owner, sensitivity, schema version, and a state of open (producers are writing), closing (an aggregator may pick it up), or merged (promoted; terminal). Producers write items and raw chunks into the unit’s own atlas_stage database without mediation — sensitivity is recorded at write time, and enforced at classification and promotion, not at the write.

sweep

Two related uses, kept apart by context. The source sweep is the periodic ingest pass over candidate sources — candidate filtering, guardrails, headroom checks, locking, and run reporting — whose machinery is the atlas-sweep binary; the standing recurring runner for it (#7969) is unbuilt, which is why ingest today is still manual. The note promotion sweep (tools/note_promotion_sweep.py) is a different, smaller tool: it moves agent notes to their new homes on next touch, leaving pointer stubs behind. When an Atlas chapter says “the sweep” about ingest, it means the first.

tombstone

The marker left where content was deleted or retired, so the absence itself is representable. In the span/join machinery, a retired version renders a Tombstone — built from the span’s stored snippet — instead of its text, and a span whose every referencing version is retired behaves as retired. In the target ingest pipeline, deletion propagates as tombstones: one operation that purges across the content-addressed store, the FTS index, the vector tables, and the recommender tables together, with the tombstone as the trace-safe record that something was there and was removed. Quarantine in the ingest gate is not a tombstone — a quarantined batch still exists, unpromoted.

topup DB

A vector side store of additional chunks staged on top of the main corpus file: in the local backend’s known pairs, ~/atlas/v3/topup-chunks.db, with its vectors in ~/atlas/v3/vec-bge-small-topup.db. Like the delta DB, it joins to the corpus by content_hash, because its chunk ids live in their own id space.

vec table

The per-model table holding one vector per chunk, shaped (chunk_id INTEGER PRIMARY KEY, vec BLOB NOT NULL) in SQLite-shaped stores, the blob being little-endian float32 in dimension order. Atlas has exactly two named vec tables: the production vec_snowflake_m_v2_768_f32 (Snowflake Arctic m-v2.0, 768 dimensions; in the Turso publish it is typed F32_BLOB(768) with the vector index named vec_snowflake_m_v2_768_f32_idx) and the dormant fallback vec_bge_small_384_f32 (bge-small, 384 dimensions). The table name is the embedding space’s address: a query vector from one table’s space is meaningless against the other, which is why the Worker pins the table name into its cache key and refuses any embedding that does not name the production space.