diff --git a/doc/2026-11-23T23-45-44Z_research_atlas-investigation/2026-11-23T23-45-44Z_research_atlas-investigation.md b/doc/2026-11-23T23-45-44Z_research_atlas-investigation/2026-11-23T23-45-44Z_research_atlas-investigation.md new file mode 100644 index 000000000..6677519d0 --- /dev/null +++ b/doc/2026-11-23T23-45-44Z_research_atlas-investigation/2026-11-23T23-45-44Z_research_atlas-investigation.md @@ -0,0 +1,14 @@ +# Atlas investigation — research corpus + +The research corpus behind the Atlas programme investigation (#13241), gathered 2026-11-23: the state of the Atlas system, its sources and consumers, and search-technology research. + +## Provenance + +Migrated 2026-11-23 from hatch-personal (`workspace/`) under the DOCS-MIGRATION programme (#5983): code-project research and design material lives in this repo's `doc/` area; the hatch repos keep only hatch-operational material. This is a dated research record — it states what was known when the research was done and is not rewritten later. + +## Contents + +- `atlas-program-investigation-prompt.md` +- `research-atlas-state.md` +- `research-search-tech.md` +- `research-sources-consumers.md` diff --git a/doc/2026-11-23T23-45-44Z_research_atlas-investigation/atlas-program-investigation-prompt.md b/doc/2026-11-23T23-45-44Z_research_atlas-investigation/atlas-program-investigation-prompt.md new file mode 100644 index 000000000..d90ce575b --- /dev/null +++ b/doc/2026-11-23T23-45-44Z_research_atlas-investigation/atlas-program-investigation-prompt.md @@ -0,0 +1,225 @@ +# Atlas Program — Full Investigation, Next-Steps Design & Build-Out Prompt + +**You are the coordinator of a program-scale investigation and build-out of Atlas** — Drew's +personal corpus search system in `developing-today/code` (`pkgs/atlas-search/`, `pkgs/atlas-core` +surfaces, the Cloudflare Worker, and the laptop corpus at `~/atlas/`). Dig into the **full +system**: what it holds, how it ingests, how it plans and ranks queries, who consumes it, and +what it should become. This prompt is a **starting point, not a conclusive or final stopping +point**. Work the design end to end, begin implementation wherever you are unblocked, and when a +pass finishes, review what remains, expand the plan, and repeat — until nothing more can be done +with the access and authority you have. Use subtasks and orchestration heavily: launch many +parallel agents (analyze, research, design, document, implement) and keep them pointed at the +frontier. A phase finishing is a signal to start the next one, not to stop and ask. + +--- + +## 1. What Atlas is (ground truth — verify, don't re-derive) + +Atlas is a unified search index over every corpus Drew produces, with provenance-first storage, +tiered sensitivity, and hybrid (FTS + vector) retrieval. Program epic: +[#8983](https://github.com/developing-today/code/issues/8983). + +- **Canonical store**: laptop Turso/libSQL DB at `~/atlas/turso-atlas/data/atlas.db` plus 29 + topic shards. Last verified census (2026-10-31, on + [#3125](https://github.com/developing-today/code/issues/3125)): **18,325 sessions / 122,124 + messages / 107,639 chunks**. Later records describe a ~7.3 GB monolith **without a verified + recount** — the counts consumers see are frozen at the October publish while the store has + grown. A fresh verified census is an early deliverable. +- **Provenance/CAS**: #3125 phase 1 landed 2026-11-22, phase 2 landed 2026-11-23 — backfill + interned **12,092 content-addressed objects (~2.6 GB, 0 dedupe collisions)**: chatgpt-export + + sandbox-agents; `ATLAS-EXTRACTS VERIFY OK`; atlas-backup covers the store. **Phases 3 + (occurrence backfill) and 4 (catalog DB + multi-shard resolution as MCP tools) remain open.** + Staged tiers exist beside the canonical store: per-unit `atlas_stage` v1 staging DBs (promote + gate built; the aggregator/session-close hook is not), and legacy topup/delta vector DBs + resolved at query time by content_hash, never merged into canonical identity. +- **Code surfaces**: `pkgs/atlas-search/` (atlas-core engine, atlas-embed, atlas-proto, + atlas-search binary; a Python reference implementation kept for parity); the **Cloudflare + Worker** (`worker/src/index.ts` — holds no DB credentials, per-query Durable Object cache, one + `executeSearch` path serving REST + MCP, D1 binding present but flag-off); the **Atlas MCP + server lives in that same Worker** (`worker/src/mcp.ts`, #8625) — one `search` tool, live, + wired into the laptop's mcpx as its remote `atlas` server; **`fleet search`** + (`pkgs/fleet/crates/fleet-search/`) is a flag-for-flag port of the atlas-search client with a + byte-parity guard, documented in the fleet book. atlas-core clippy cleanup #13056 is open with + PR #13097 unmerged (flag-held shepherd — not yours to merge without Drew's word). +- **Embeddings**: production model verified in code: **`Snowflake/snowflake-arctic-embed-m-v2.0`** + (the `Snowflake/` prefix is the stored model id), **768 dims**, table + `vec_snowflake_m_v2_768_f32`, native Rust ONNX, CLS pooling, `"query: "` query prompt, + bit-identical to the Python reference. Vectors live in the monolith/shards as plain BLOBs — + **`vector_top_k` does not work on them; semantic search is an exact cosine scan (~4 s)**. A + legacy BGE-small vector space coexists (mixed-embedder by accretion). A second embedder + (BGE-M3 / Voyage / etc.) is an open evaluation in #9092. The D1 chain (#9134: #13100 closed, + #13101/#13103 in review, #13105 gated, #13106 flag-held, #13107 behind) is a **result/content + cache**, not a vector store; production does not touch D1 (master flag off). +- **Retrieval today**: hybrid FTS + vector with **RRF fusion only — no learned or cross-encoder + reranker in the serving path** (Jaccard #5733 and SPLADE sit at eval-gate stage). Query-planner + flags (spell, query-class, rewritten) are **accepted by the API but unimplemented** + (#9092 / #5773 / #5774). #12900 thread 1 (parallel FTS+vector branches) landed via PR #13039; + thread 2 is the still-open multi-client product question (Drew's); thread 3 substantially + landed elsewhere. +- **Evaluation**: golden-311 v3 + a held-out 54, an ablation harness (#5741), and a standing + eval programme #8627 (open). Feedback capture (`atlas-feedback/v1`) exists with **no ranking + consumer**. +- **Recommender**: design only (#9140, #9109 Part C) plus one in-flight slice — snapshot paging + #10158 / PR #12873 (flag-held shepherd). **No candidate generation exists.** +- **Sensitivity model** (two namings of one ladder): corpus tiers **public / internal / secret** + (28 internal shards / 107,001 chunks; 1 secret shard / 638 chunks; secret material allowed only + in the 2 secret DBs) vs client ceilings **public < internal < private < sensitive** + (default internal), enforced server-side per client identity (sandbox-scripts → internal; + drew-cli → sensitive; cf-worker → internal). Machinery: classification manifest #5410 + (can narrow, never widen), gitleaks + classifier + vector-neighbourhood revalidation #6021, + Drew's own Layer-1 review #10412 (closed), Presidio NER #6048. **Absolute rules: candidate + secret content is never reproduced in issues, chat, or logs; secret text is never sent to a + hosted embedder** (held out of sweeps until the local embedder #6059 lands). +- **Open wound — #8479**: the 638 sensitive chunks also live in the production monolith + + a local replica, so the tier boundary does not currently hold outside the shard set; + purge-vs-reclassify is undecided (Drew's call — surface it with options, don't decide it). +- **Census**: **57 open `epic/atlas-program`** issues (123 all-state), verified 2026-11-23. + +## 2. Drew's directions (the next-steps agenda — design all of it, build what's unblocked) + +### A. Integrate all data sources with automatic ingest +Ingestion today is **manual/script-driven** — the only laptop schedule is the daily backup +timer; ingest scripts still live in hatch-personal (#5670 migration open); the recurring sweep +runner #7969 is unbuilt. The target list already exists as **#9097 Workstream E** (open, +blocked): (1) Turso queue/PM data; (2) **all** GitHub issues/PRs/commits/files for all orgs +(comments are in — #6023 closed, writer #10688 landed; objects + continuous delta are missing; +external repos gated on licensing #6024 + zone policy #6052, both open); (3) all Muse +conversations/memory/artifacts (no connector issue exists yet — design the mechanism); (4) all +OpenCode sessions, plus the explicitly undecided thinking-traces investigation; (5) all ID +objects (reverse direction: #6062 + projectors #11182–#11186, all open/unstarted); (6) a +sources-inventory pass naming zettel/notes, Fleet Reports, the ask-ledger, quota/burn records, +laptop state stores (connectors #8622 memory-lancedb, #8626 memory files/notes/repo docs already +filed). **Pipeline shape to design and build**: source-of-record CDC/hooks + periodic +reconciliation crawl; detection ladder metadata → SHA-256 → full process; per-document +parser/chunking/model version stamps; chunk-level hashing so a small edit re-embeds one chunk; +staging → classification → ingest-gate promotion (#6057) → per-batch attestation (#6045); +deletion as tombstones with purge propagating across CAS + FTS + vector + recommender tables as +one operation. **Every source enters under the tier machinery (§1) — classification before +promotion, never after.** Gmail: no ingest is filed and Drew has paused all Gmail background +checks (2026-11-22) — record it as a named future source; do not build Gmail ingest without his +word. + +### B. Query planning +Design and build the planner the API already pretends to have: fast classifier (<10 ms) → +conditional transforms → routed retrieval → fuse → rerank. Components: conversational query +rewriting; expansion; multi-query / RAG-Fusion; HyDE (gated to underspecified queries); +decomposition into sub-queries; step-back; **routing by source / intent / sensitivity tier**; +structured filter extraction (kind/topic/project/client/date — the filters `fleet search` +already exposes). Disciplines: adaptive per-query strategy selection instead of stacking every +transform; evaluation sliced by query class so each strategy proves itself. Minimum viable +planner: routing + filter extraction + conversational rewriting; HyDE/decomposition second wave. + +### C. More search characteristics on top of Snowflake +The base is Arctic Embed m-v2.0 (768d; MRL truncation to 256d retains ~98% quality — a free +two-resolution index before any new model). Layer, each golden-set-measurable: lexical (BM25 — +exists), **learned sparse (SPLADE)**, **late interaction (ColBERT) as a top-100 mid-stage**, +metadata pre-filtering (pre-filter/routing, never post-filter — the sensitivity tier is a +security boundary and belongs in the retrieval layer), behavioural signals, and the reranker +(§D). Fix the serving physics: replace the ~4 s exact scan with an ANN path (libSQL native +`F32_BLOB` + DiskANN `vector_top_k` where the store supports it, an embedded-replica strategy, +or a dedicated index) — measure recall loss against the exact scan on the golden set. Run the +second-embedder evaluation (#9092) to a decision: BGE-M3's one-pass dense+sparse+ColBERT is the +interesting challenger; any model change follows the migration discipline — model_id-tagged +vectors, shadow index, **cutover on eval result, not on completion**. + +### D. Reranking +Add a cross-encoder stage over the fused top-50–200: fixes precision, not recall; typical ++5–15 nDCG@10 at 50–500 ms CPU. Default open candidate: **BGE-Reranker-v2-m3** (568M, +multilingual) via fastembed-rs `TextRerank` (ONNX) or candle (avoids the ONNX Runtime AVX/SIGILL +liability; v2-m3 ports as plain XLM-R). Hosted rerankers (Cohere/Voyage) are offline quality +ceilings for comparison only — and never see secret-tier text. Adoption is per-corpus and +**golden-set-gated**: a reranker that hurts on Atlas's own queries does not ship; pool size is +the latency knob. Wire the feedback loop (#6046/#8062 seam, `atlas-feedback/v1`) into ranking +experiments — it is the prerequisite for any learning-to-rank claims. + +### E. Recommender +Single-user system: no cross-user collaborative filtering exists to copy. The signals are +**content similarity** (decaying weighted profile centroid over the existing embedding index), +**session co-occurrence** (item-to-item CF over Drew's own sessions — the strongest single-user +collaborative analogue), recency/frequency, and graph/provenance neighbours. Same three-stage +shape as search (candidate union → rank → MMR diversity/freshness/exploration re-rank), reusing +Atlas's stack — a trained two-tower model is overkill; the pattern collapses to the hand-built +profile vector, upgradeable in place. Surfaces: more-like-this, related results beside search, +a resurface feed, query suggestions. Build on the #9140 design and land the snapshot-paging +foundation (#10158) when its shepherd hold clears; design the DO-accumulated "next 10" fan-out +from #9109 Part C. + +### F. Search integration for fleet and for ID +- **Fleet**: `fleet search` is live but searches a stale corpus (§1) — freshness (§A) is the + fleet-facing fix. Then: result caching keyed by index version, batch search for lanes, + offline fallback via libSQL embedded replicas (native vectors work identically local/remote — + the route sqlite-vec can't take), and search-quality telemetry from real lane queries feeding + the golden set (§H). +- **ID**: Atlas is ID's search/embeddings layer (the two programs meet here — coordinate with + the ID program prompt). Deliverables: the #6062 publication format, the projectors + #11182–#11186 built and running, #9109 Part C (storage economics, ID search over the graph, + recommendations), automatic vectorization of ID content via Snowflake + the #9092 second + embedder. ID has **no live query path today** — this workstream creates it. + +### G. MCP and programmatic access +One retrieval core, three surfaces, tier enforcement **inside the core** so every surface +inherits it: **MCP** for agents (the copyable shape is `search → read` two-step tools returning +references + snippets, never resource enumeration at corpus scale; the current server exposes a +single `search` tool — grow it deliberately: search, read, related/recommend, corpus status), +**REST** for services (with signal-provenance `explain` on results), **CLI** for humans +(`fleet search` + atlas-search). Grow `atlas-proto`'s `query-parameters-v1.json` seed into a +versioned API contract all three surfaces honour. Close #8625's remainder: cross-client +acceptance for OpenClaw / OpenCode / OpenChamber / Muse lanes (identity-stamped, ceiling + +corpus scoping enforced in branch queries, audit-logged). #12900 thread 2 (is Atlas headed for +multi-client use?) is Drew's decision — prepare the options paper; don't pre-build for a +multi-tenant answer he hasn't given. Also fix the Worker cache: indefinite with no TTL/eviction +(#6805) is not a caching strategy. + +### H. Evaluation & quality programme +Everything above is gated on measurement. Grow the golden set from real traces (gold contexts +harvested from real retrieval runs — beware the 0.91-offline / 0.40-production trap), with +no-answer probes and adversarial slices (distractors, semantic twins, alias-only, long-doc). +Metrics per stage: Recall@k gates retrieval, nDCG/MRR judge ranking, Precision@k controls noise. +CI regression gate on **every** model / chunker / fusion / reranker / planner change (#8627). +Online: lightweight failure mining from real fleet/ID queries folded back into the set. + +### I. Book, issue map, and the living record +1. **An Atlas book in bookwright form** (survey before structure; coordinator-fixed skeleton; + mechanical coverage proof; zero-warning build), joining the existing code-repo Pages deploy + under **https://developing-today.github.io/code/atlas/** (one Pages site per repo — never a + standalone deploy). The fleet book is the form reference. Include a DOC-01-style docs-sync + contract in the atlas README surfaces: any engine/API/model change updates its chapter in + the same change. +2. **An issue-by-issue map of ALL Atlas issues** — every open `epic/atlas-program` issue (and + the atlas-adjacent #3125/#9097/#9134 families), prioritized in best working order, **with all + blockers marked both on the issues themselves and in the priority list** (book chapter + + tracking issue kept current). Blockers are worked, not just listed. +3. **Designs + PRs** — every workstream above produces landed designs (repo `doc/` archive) and, + wherever unblocked, merged implementation PRs. CI runs on main only; merge when verified. + +## 3. How to work (fleet rules — binding) + +- GitHub via the **gh CLI / REST only** (the GitHub connector is banned). File a GitHub issue in + the owning repo the same pass for any problem found. +- Execution on the **laptop** (primaries stay on main + clean; worktrees on branches, landed by + PR). Never `git stash` in shared clones. Never force-push main. +- Before implementing any issue: premise check + singular-ownership check (a claim comment from + another agent is a hard stop). Re-read an issue's newest comments immediately before merging. +- Builds/tests dispatch-first (`fleet queue dispatch`), laptop fallback; a container environment + failure is not a test result — record which route verified. Tests name their oracle. +- Evidence standard: every factual claim carries its checked source or is labelled unverified; + counts computed from a named source, never estimated in prose. +- **Privacy absolutes** (§1): secret candidate content is never reproduced in issues/chat/logs; + secret text never goes to a hosted embedder or hosted reranker; tier enforcement lives in the + retrieval layer, not in client goodwill. +- Respect standing holds: flag-held items (the #13106 slice, PRs #12873/#13097 shepherds) are + not yours to start without Drew's item-specific word. Decisions that are Drew's (#8479 + purge-vs-reclassify, #12900 thread 2, the thinking-traces question in #9097) get surfaced with + substance — options, ramifications, recommendation — never silently decided and never re-asked + once recorded. +- Secrets by name only, never values. Never touch the `vertexinc` org. External communications + need per-item pre-approval. Quota doctrine: plan quotas only, never funds; a 402 is a wall. + +## 4. The iteration rule + +This prompt is the **starting point**. When every workstream has reported, do not conclude: +re-survey (corpus, issues, consumers, eval results), reconcile what the passes learned, expand +the design set and the issue map, and run the next pass. The program ends only when a full pass +finds nothing more that can be designed, documented, or implemented with the authority +available — and even then, the book, the issue map, and the docs-sync contract remain as the +living record the next pass starts from. diff --git a/doc/2026-11-23T23-45-44Z_research_atlas-investigation/research-atlas-state.md b/doc/2026-11-23T23-45-44Z_research_atlas-investigation/research-atlas-state.md new file mode 100644 index 000000000..94728713f --- /dev/null +++ b/doc/2026-11-23T23-45-44Z_research_atlas-investigation/research-atlas-state.md @@ -0,0 +1,302 @@ +# Atlas — Current-State Research + +- **Repo:** developing-today/code — https://github.com/developing-today/code (plus execution home dezren39/hatch-personal for the corpus/ingest side, noted where it applies) +- **Researched:** 2026-11-23 (~05:53–06:15 CST), read-only, via `gh api` REST (git tree of `main`, contents API, issue/search API), the local `fleet search --help` surface, and saved program records. No repo or issue was modified. +- **Method / caveats:** every claim cites an issue number + URL or a repo file path verified in the `main` git tree (11,805 paths) or via the contents API. Counts are GitHub Search API totals at research time and will drift. The canonical Atlas DB itself lives on Drew's laptop and was **not** read in this pass; all corpus numbers below are as recorded on issues. Anything not directly verified is marked **UNVERIFIED**. + +--- + +## 1. What Atlas is today + +Atlas is Drew's personal corpus / search infrastructure: every conversation and corpus he cares about ingested into one canonical store (`sessions → messages → chunks`), classified (scheme-1.0: kind / topics / projects / sensitivity), embedded, and searched hybrid (FTS + vector). Its program home is the epic [#8983](https://github.com/developing-today/code/issues/8983) — "epic: Atlas program — unified search and memory index over every corpus" — whose goal text states: "every corpus (conversations, memory files, notes, repo docs, research) ingested through corpus connectors into one staging index, with embedding unification and per-corpus model identity, a query surface (including the mcpx MCP namespace), and standing cross-agent eval sets as the quality oracle." + +### 1.1 Canonical DB + +- **Location (laptop only):** `~/atlas/turso-atlas/data/atlas.db` — confirmed as the path in the in-repo backup script `nixos/home/atlas-backup.sh` ("The canonical atlas.db lives on this laptop (~/atlas/turso-atlas/data/atlas.db, since 2026-10-28)"). +- **Verified counts (2026-10-31, recorded on [#3125](https://github.com/developing-today/code/issues/3125)):** canonical **18,325 sessions / 122,124 messages / 107,639 chunks**; the Turso publish at that date was **1.0 GB / 100,698 chunks**; **6,941 chunks** of personal-client TEXT were at that point held back from Turso by policy (private tier, not missing embeddings). +- **Privacy-model change (same day, comment on [#3125](https://github.com/developing-today/code/issues/3125), 2026-10-31):** the private-tier publish gate was **lifted** — everything in canonical publishes to Turso, including the six personal clients (the 6,941 chunks); privacy moved to **query-time classification filters** (scheme-1.0 labels complete for all 18,325 sessions: personal 16,009 / local-only 2,226 / secret-bearing 90, shipped in the publish with a denormalised `sensitivity` column; `secret-bearing` is deny-by-default for callers not granted that tier). +- **Later recorded state (2026-11-12, on [#9092](https://github.com/developing-today/code/issues/9092) and [#9097](https://github.com/developing-today/code/issues/9097)):** the Turso monolith is described as **7.3 GB** over the same 107,639 chunks **+ 29 topic shards**; [#9097](https://github.com/developing-today/code/issues/9097) explicitly warns canonical counts are "frozen at the 2026-10-31 publish … while the Turso monolith has since grown to 7.3 GB **without a verified recount**." Treat 18,325 / 107,639 as the last verified census, not a live count. +- **Laptop `~/atlas` overall:** 12 GB at 2026-10-31, hash-verified to contain **no** consequential byte-identical duplicates — it is distinct versions / working sets, so no cleanup windfall exists ([#3125](https://github.com/developing-today/code/issues/3125)). +- **Backup:** `nixos/home/atlas-backup.sh` — a daily laptop systemd user service+timer (declared in `nixos/home/laptop-backups.nix`) that snapshots the DB consistently (`sqlite3 .backup`), gzips it, and files it to three legs: laptop `~/backups/atlas//`, **R2 bucket `supabase-backups`** under `atlas//`, and Google Drive `Cloud/cold-store/db-backups/local-atlas/` (rclone). Unchanged snapshots are skipped by sha256. It formerly ran from the sandbox pulling ~500 MB over SSH; it now runs on the laptop. Since 2026-11-23 it also covers the extracts store (see §1.2). + +### 1.2 Extracts / CAS store (the [#3125](https://github.com/developing-today/code/issues/3125) provenance programme) + +[#3125](https://github.com/developing-today/code/issues/3125) — "atlas: provenance registry (chunk occurrences), content-addressed extracts, multi-DB vector resolution" (OPEN, `priority/high`, `epic/atlas-program`) — is the provenance-first direction, under Drew's 2026-10-31 rules: keep ALL data (only byte-identical dupes cleaned, backups kept); backups AND plain extracts for every corpus; every chunk records **every** place it was found (`chunk_occurrences`: chunk → source locators with spans + `observed_at` — dedup originally dropped ~127K occurrences, and 6,344 canonical sessions own zero chunks for exactly this reason); every import interned content-addressed or pinned as `repo@commit:path`. + +Phase state, all verified from comments on [#3125](https://github.com/developing-today/code/issues/3125) dated 2026-11-22/23 (execution is homed in **dezren39/hatch-personal**, tracker hatch-personal#24 — no code change for phases 1–2 lands in developing-today/code): + +| Phase | State | +|---|---| +| 1. `chunk_occurrences` + `cas_registry` in canonical DB; ingest writes occurrences from now on | **LANDED 2026-11-22** (hatch-personal PR #58, cherry-picked after the original hatch-personal#29 PR proved unmergeable). A further in-repo slice landed 2026-11-23 via code PR #13216: each promoted chunk gets a `chunk_occurrences` row (canonical text hash, source locator, byte span, staged `observed_at`) — explicitly **not** the full criterion: historical occurrence recovery/backfill, canonical dedup identity, and CAS/source-root registry remain. | +| 2. Laptop extracts dir + CAS; atlas-backup covers it; backfill extracts for sources still on disk | **LANDED 2026-11-23 in three slices:** tooling (hatch-personal PR #60: `scripts/atlas-extracts.py`, layout `~/atlas/extracts/cas///` + `manifests/-.json`, manifest entries carry source / extraction time / hash / byte count / destination, optional `cas_registry` registration, and a `verify` subcommand that re-hashes every manifest-referenced object); backup coverage (hatch-personal PR #63: deterministic tar.gz of `cas/`+`manifests/` filed laptop + R2, recoverability proven each run by `verify` against a restored copy); **backfill interning (hatch-personal PR #67, `--files-from` support)** — see numbers below. | +| 3. Occurrence backfill from CAS extracts; document the private-tier publish predicate | **OPEN / not started as a completed slice.** (Note: the publish predicate itself changed on 2026-10-31 — §1.1.) | +| 4. Catalog DB + shard layout (collection × month) at next publish growth; resolution as MCP tools (search → ids → resolve → fetch span) | **OPEN / not started.** | + +**Backfill run, 2026-11-23 (Lane SE done-record on [#3125](https://github.com/developing-today/code/issues/3125)):** starting state that morning was CAS objects = 0, manifests = 0, and **no `cas_registry` table yet** in canonical (created additively by the tool's `--db` path). The run interned, with `--db` registration into canonical `cas_registry`: + +| Corpus (under `~/atlas/extracts/`) | Files interned | Bytes | Manifest | +|---|---|---|---| +| chatgpt-export (`imports/` — the ChatGPT export zip, 1 file) | 1 | 103,945,101 | `manifests/chatgpt-export-2026-11-23.json` | +| sandbox-agents | 12,091 | 2,492,957,497 | `manifests/sandbox-agents-2026-11-23.json` | + +Total: **CAS objects 0 → 12,092 (~2.6 GB), zero dedupe collisions** (every file unique content), full-store `ATLAS-EXTRACTS VERIFY OK`. [#3125](https://github.com/developing-today/code/issues/3125) **stays open**: phases 3–4 remain, plus the phase-2 remainders recorded on hatch-personal#24 at slice time have since been consumed by the slices above except as noted there. **UNVERIFIED in this pass:** the current contents of hatch-personal#24 itself (private repo, not read). + +### 1.3 Staged / delta DBs not yet interned + +Three distinct "not yet in canonical" tiers exist; do not conflate them: + +1. **Per-unit staging DBs (in code, `atlas_stage` v1).** `pkgs/atlas-search/crates/atlas-core/src/stage.rs` (#5669, design `doc/2026-11-04T21-27-34Z_design_atlas_scaler_revision` §4.1): one small DB per unit of work (queue task, session, epic, notes batch), same versioned schema (`items`, `chunks_raw`, `notes`, `kv`, `_schema_version`), a registry mapping unit → staging DB / owner / sensitivity / state (open / closing / merged), and a **promote** (merge-on-close) transition gated on the embedding-model contract — a unit promotes only when its DB's `atlas_manifest.embedding_model` equals the mandated model (#7648 / #6060 decision). Deliberately out of scope in that module, i.e. **not built**: the aggregator/embedder, the session-close extraction hook, the physical core sensitivity stores, the end-to-end demo. Provisioning targets a local libSQL/SQLite file today. Schema artifacts: `pkgs/atlas-search/schema/{atlas_stage_v1,stage_registry_v1,gate_records_v1}.sql`. +2. **Legacy delta / topup vector DBs (laptop, read at query time, not merged into canonical identity).** The Python reference (`pkgs/atlas-search/atlas_search.py`, copied byte-for-byte from the laptop's `~/atlas/turso-atlas/scripts/atlas_search.py`) carries a multi-DB resolution layer: vector sources such as `~/atlas/v3/vec-bge-small-topup.db` (mapped through `~/atlas/v3/topup-chunks.db`, ~14k chunks) and `~/atlas/atlas-delta-chunks2.db` are resolved **by `content_hash`, never by raw `chunk_id`** — "the id spaces differ per corpus file … while content_hash is the identity." These are the concrete, working-today form of multi-DB vector resolution; the general catalog/shard form is [#3125](https://github.com/developing-today/code/issues/3125) phase 4 (open). +3. **The 29 topic shards** beside the Turso monolith ([#9092](https://github.com/developing-today/code/issues/9092)): shard fan-out exists only behind a hidden experimental flag (`--shards`, #5755); the production default is the monolith scan. + +--- + +## 2. Code surfaces in developing-today/code + +All paths below verified present in the `main` git tree. + +### 2.1 `pkgs/atlas-search/` — the main package + +A Rust workspace (plus the Python reference implementation kept beside it): + +- `pkgs/atlas-search/atlas_search.py` — the production Python reference, copied byte-for-byte from the laptop (SHA recorded in `pkgs/atlas-search/eval/README.md`); kept as the eval/reference implementation. Its header states the model: "conversation into one canonical store (sessions -> messages -> chunks), classifies every session (scheme-1.0…), embeds every chunk." +- `pkgs/atlas-search/crates/atlas-core/` — the engine library. Notable modules: `search.rs` (orchestration + envelope rendering, parity-tested against recorded Python envelopes), `fusion.rs` (RRF — §7), `embed.rs` + `embed_cache.rs` (query embedding — §3), `turso.rs` / `local.rs` / `backend.rs` (backends), `stage.rs` (staging tier — §1.3), `shards/` (content/local/scan shard handling), `manifest.rs`, `gate.rs`, `classification.rs` / `classify.rs` / `boundary.rs` / `disclosure.rs` (scheme-1.0 classification, source-boundary splitting, disclosure-context ceilings), `feedback.rs` / `feedback_normalise.rs` (retrieval feedback — §7), `trace.rs` / `trace_ingest.rs` / `trace_stats.rs` (query traces, `atlas-query-trace/v1`, #9973), `eval.rs` (offline eval scorer), `join.rs`, `aggregate.rs`, `sweep.rs`, `github_comments.rs`. Binaries: `atlas-classify`, `atlas-eval`, `atlas-github-comments`, `atlas-sweep`. Examples: `live_smoke.rs`, `retrieval_proof.rs`, `shard_bench.rs`. +- `pkgs/atlas-search/crates/atlas-embed/` — the native Snowflake embedder (§3). +- `pkgs/atlas-search/crates/atlas-proto/` — the wire protocol crate, incl. `query-parameters-v1.json` (versioned query-time parameters shared with the wire). +- `pkgs/atlas-search/crates/atlas-search/` — the CLI/service binary (`main.rs`, `server.rs` + `server_http.rs` / `server_feedback.rs`, `service.rs`, `render.rs`, `fetch_model.rs`, `bin/atlas-stage.rs`); golden text fixtures under `tests/golden/`; parity tests (`tests/cli_parity.rs`, atlas-core `tests/parity.rs`). +- `pkgs/atlas-search/worker/` — the Cloudflare Worker (§2.2). +- `pkgs/atlas-search/eval/` — the evaluation harness (§4.4); `fixtures/` (fixture corpora, embed probes, eval smoke); `schema/`; `test-vectors/content-hash-v1.json` (shared with ID: `pkgs/id/test-vectors/atlas-content-hash-v1.json`, `pkgs/id/crates/id-core/tests/atlas_content_profile_vectors.rs`). +- `pkgs/atlas-search/docs/` — `external-set-enumeration.md`, `memory-integration-design-8567.md`, `owner-inventory-matcher.md`. +- `pkgs/atlas-search/default.nix` + `flake.nix` — the Nix packaging (the [#12900](https://github.com/developing-today/code/issues/12900) thread-3 binary, §4.2); a pinned ONNX Runtime mirror lives at `pkgs/atlas-search/onnxruntime/` (with musl patches). +- Design archive: ~40 Atlas design/decision docs under repo-root `doc/` (2026-11-04 → 2026-11-23), incl. the atlas v2–v4 design (`doc/2026-11-11T03-45-00Z_design_atlas_v2_v4/`), the ID–Atlas summit (`doc/2026-11-13T03-40-00Z_design_id-atlas-summit/`), golden-set eval gate, staging-shard ingest gate, embedding cost ledger, chunk-boundary policy v2, secret-tier embedder, delta-detection join, CDC feasibility (#6040), and the two newest: `doc/2026-11-23T04-10-00Z_decision_atlas_embedded_replica_integration/` and `doc/2026-11-23T08-06-00Z_design_atlas_d1_tenant_hot_cache/`. +- CI: `.github/workflows/atlas-search-pr.yml`, `.github/workflows/atlas-search-worker-tests.yml`. + +### 2.2 The Cloudflare Worker (`pkgs/atlas-search/worker/`) + +Per `worker/README.md` and `worker/src/index.ts` (issue [#6788](https://github.com/developing-today/code/issues/6788)): "a Worker that pulls all databases for search" — the cross-database search surface. Shape: + +- The Worker **holds no database credentials**: fan-out, embedding, and merge live in the fleet search service (`worker/src/service.ts` calls `fleet serve search` — `POST /v1/embed`, `POST /v1/search` — via the `atlas-search.security.cab` tunnel hostname + a Cloudflare Access service token; `SERVICE_BASE = "https://atlas-search.security.cab"` in `worker/wrangler.toml`). New `atlas-core-*` databases join the fan-out through the service's manifest discovery, not a Worker-side shard list. +- Per query it stores a **Durable Object** (`worker/src/cache_do.ts`, class `QueryCache`, one DO per query key; state machine absent → embedded → complete): the query is automatically inserted **as an embedding** (the pinned Snowflake space, `worker/src/space.ts`), and the result is **cached indefinitely** (no TTL/eviction in v1 — §7). DO key = sha256 over the normalised query + a pinned config fingerprint (ceiling, model revision, vector table, k) (`worker/src/key.ts`) — a cached entry is never served across ceilings or embedding spaces. +- Routes (`worker/src/index.ts`): `GET /health` (open), `POST /v1/search {query, k?}` (gated, k clamped 1–50, default 10 — `worker/src/search.ts`), `GET /v1/cache/inspect`, `POST /v1/cache/purge` (both gated), `POST /mcp` (gated — §2.3). **One search execution path** (`executeSearch` in `worker/src/search.ts`): REST and MCP both call it, keyed under the pinned disclosure context (#12622), "so the ceiling/context pinning and the cache keying can never drift between surfaces." +- The service enforces this client's **`personal` tier ceiling**; the Worker is a `cf-worker` client identity of the search service. +- Tests: `worker/test/{worker,mcp,hot_cache,key,space,body}.test.ts` (vitest + @cloudflare/vitest-pool-workers). Deploys go through the sanctioned `cf` binary's versions flow (never a silent overwrite); `cloudflare.config.ts` is the deploy source of truth, `wrangler.toml` drives local dev/tests. +- D1 hot-cache binding present but **flag off** (`HOT_CACHE_ENABLED = "false"` in `wrangler.toml`; §4.3). + +### 2.3 The Atlas MCP server + +- **Repo home:** the same Worker — `pkgs/atlas-search/worker/src/mcp.ts` (issue [#8625](https://github.com/developing-today/code/issues/8625), "atlas memory slice 3: MCP query surface over the unified Atlas index (mcpx namespace)", OPEN as a slice of [#8983](https://github.com/developing-today/code/issues/8983); its hosted-endpoint slice is live). Docs: the "Endpoints" section of `pkgs/atlas-search/worker/README.md`; tests `worker/test/mcp.test.ts`. +- **Shape:** a stateless MCP Streamable HTTP endpoint at `POST /mcp`, behind the same gate token as `/v1/*`, exposing **exactly one tool — `search`** — over the exact same execution path as `POST /v1/search` (same pinned context/ceiling, same DO cache: an MCP search and a REST search for the same query share one cache entry). `SERVER_INFO = { name: "atlas-search", version: "0.1.0" }`; tool input is `{query, k?}`. Cache purge and inspect are deliberately **not** MCP tools (purge is a write; inspect is an operator/audit surface). +- **mcpx wiring (live):** per the Worker README, "The laptop's mcpx connects to this endpoint as its `atlas` server (remote transport, bearer token expanded from the daemon's environment)." Callers currently share the one hosted identity (`hosted-per-user`); **per-agent identity and scoping are [#8625](https://github.com/developing-today/code/issues/8625)'s later slices** (open). +- There is no separate MCP-server crate/repo for Atlas; the other MCP-shaped surface is ID's own MCP bridge (in `pkgs/id`, `id-caps` — outside this survey's scope except as a consumer pattern). + +### 2.4 `fleet search` (the fleet binary's Atlas client + service) + +- **Code:** `pkgs/fleet/crates/fleet-search/` (`cli.rs`, `client.rs`, `proto.rs`, `pyjson.rs`, `render.rs`, `serve.rs`, `server.rs` + `server/server_http.rs`, `server/server_feedback.rs`) — a verbatim copy of the atlas-search engine, "held byte-for-byte by a parity check script and the code repo's `fleet-search-parity-guard` workflow" (`.github/scripts/check-fleet-search-parity.sh`, `.github/workflows/fleet-search-parity-guard.yml`; contract test `pkgs/fleet/crates/fleet-search/tests/serve_contract.rs`, `pkgs/fleet/tests/search_serve.rs`). +- **Two roles:** (a) **client** — `fleet search ` (also `fleet search search …`, `fleet search get-chunk `), "the atlas-search client surface (step 5, #5433)"; hybrid FTS+vector with classification filters (`--kind/--topic/--project/--client/--since/--until/--max-sensitivity`), `--k` (default 10), `--pool` (1–400, default 100), `--mode hybrid|fts|vector`, `--group-by-session`, `--expand`, `--with-message`, `--no-cache`, `--hydrate`, `--raw-rows`, `--model/--embedder/--trunc/--vector-backend scan|index-fill|index-fixed`. Routing defaults ("Atlas Q3"): the sandbox seat prefers the service (loud standalone fallback); the laptop seat (the serving host) defaults to standalone; service at `http://127.0.0.1:18760` by default (`ATLAS_SEARCH_URL`). Per-seat bearer provisioning: `ATLAS_SEARCH_TOKEN` or `~/.config/atlas-search/client.json` (0600); the server clamps `--max-sensitivity` to the identity's ceiling (**drew-cli: secret-bearing; sandbox-scripts: personal**). (b) **service** — `fleet serve search` (also `fleet search serve`, and via the `atlas-search serve` argv0 route) is "the atlas-search service rehomed into fleet (#5604) — same config, same wire": a loopback HTTP job protocol (bounded async queue, per-client recovery listing, dedupe keyed by the effective request, never across sensitivity ceilings) over **one shared embedder per process** (single lazily loaded ONNX session, mutex-held, loaded on first vector query only — FTS-only jobs and a cold service work without it) and a **mechanically read-only Turso backend** (token only from the service config chain — env, the Bitwarden item named `atlas-ro`, or the turso CLI's `--read-only` mint; the query layer issues nothing but SELECTs; "there is no write path to opt into"). Rollback = point the unit's ExecStart back at `atlas-search serve`. +- **Docs:** book chapters `pkgs/fleet/book/reference/search.md` and `pkgs/fleet/book/concepts/search.md` (live in the fleet book at https://developing-today.github.io/code/fleet/), plus `pkgs/fleet/docs/verbs.md` §`search`. +- **[#12782](https://github.com/developing-today/code/issues/12782) — CLOSED** (2026-11-23): "Atlas search discoverability: sandbox routing stale since #5343, --help shadowed, docs/skill silent" — the fix that made the sandbox seat route to the service correctly and documented the surface; this is the issue that closed the "agents can't find Atlas search" gap. Related rollout still open: [#9101](https://github.com/developing-today/code/issues/9101) — "worker search instructions rollout — runbooks + lane bodies gain a search section." + +### 2.5 `atlas-core` clippy / quality state + +- [#13056](https://github.com/developing-today/code/issues/13056) — OPEN (`status:in-review`): "atlas-core: pre-existing clippy warnings outside c8_profile (verdict run for #12919)" — 22 pre-existing warnings recorded. +- PR [#13097](https://github.com/developing-today/code/pull/13097) — **OPEN, unmerged** at research time (head `af7f7ef419bc`): "chore(atlas-core): clear the pre-existing clippy warnings recorded in #13056" (37→0 per its author record; held in the shepherd queue in the parent programme — do not treat as landed). + +--- + +## 3. Embeddings + +### 3.1 The production model — Snowflake Arctic Embed m v2.0 + +Verified in code, in three places that agree: + +- `pkgs/atlas-search/crates/atlas-core/src/types.rs`: `pub const DEFAULT_MODEL: &str = "Snowflake/snowflake-arctic-embed-m-v2.0";` and `pub const DEFAULT_VEC_TABLE: &str = "vec_snowflake_m_v2_768_f32";` — i.e. the Hugging Face id carries the **`Snowflake/` prefix**, the stored vector table is named for **768 dimensions, f32**. (This is the `Snowflake/`-prefixed model id the fleet book survey saw printed by the search surface; the fleet CLI help shortens it to "Snowflake arctic-embed-m-v2.0".) +- `pkgs/atlas-search/crates/atlas-embed/src/lib.rs`: "atlas-embed — the Snowflake `snowflake-arctic-embed-m-v2.0` embedder": a native Rust ONNX implementation — the model's own `tokenizer.json` (SentencePiece Unigram), **CLS pooling**, `pub const EMBED_DIM: usize = 768`, model context 8192 (the shipped sentence-transformers config truncates at 512 by default; atlas-embed does not inherit that cap), Matryoshka truncation supported at query time. Load cost is the expensive part: one resident session is ~1.6 GB RSS (`embed.rs` comment) — hence one shared embedder per process, mutex-serialised. +- `pkgs/atlas-search/crates/atlas-core/src/embed.rs`: the query-side contract ported from the Python `embed_query` — sentence-transformers applies the model's query prompt (`prompt_name="query"`; for this model the shipped query prompt is the string prefix **`"query: "`**), then Matryoshka truncation slices, then L2 renormalisation (NumPy pairwise f32 summation replicated exactly). **Documents are embedded prompt-free**; only queries pass through the prompt step. The Rust binary reproduces the Python vectors **bit-identically** (the parity claim gated by the golden set — §4.4, and the premise of [#12900](https://github.com/developing-today/code/issues/12900) thread 3). +- The Python reference agrees: `MODEL = "Snowflake/snowflake-arctic-embed-m-v2.0"` in `pkgs/atlas-search/atlas_search.py`, with `--model / --vec-table / --embedder / --trunc` (or `ATLAS_SEARCH_MODEL` / `ATLAS_VEC_TABLE`) overrides. +- The Worker pins the same space: `worker/src/space.ts` pins (ceiling, model revision, vector table) into every cache key, and the fleet service loads "the Snowflake `snowflake-arctic-embed-m-v2.0` model at a pinned snapshot revision" (model dir from `ATLAS_MODEL_DIR` or the Nix closure; `atlas-search fetch-model` / `fleet`-side `fetch_model.rs` fetches the pinned snapshot). + +### 3.2 Legacy / secondary embedding spaces still in the corpus + +- **BGE-small:** the Python header documents a fallback `--model BAAI/bge-small-en-v1.5 --vec-table …`; the v2 publish originally carried bge-small vectors, and the previously held-back 6,941 chunks were embedded with bge-small for publish v2 ([#3125](https://github.com/developing-today/code/issues/3125) comment). The topup DB (`vec-bge-small-topup.db`, §1.3) is a bge-small space resolved alongside the Snowflake space by content_hash. So the live corpus is **mixed-embedder today, by accretion** — per-candidate `embedding_model` provenance is tracked in the Rust engine (`atlas-core/src/types.rs`: "Per-candidate embedding-model provenance (#7647, M5 of the #6060 decision): chunk id → the `embedding_model` recorded…"), and promotion between tiers is gated on model identity (§1.3). +- **Second embedder (planned, not picked):** [#9092](https://github.com/developing-today/code/issues/9092) workstream A item 5 requires evaluating a second embedding approach alongside Snowflake (candidates named there, explicitly not pre-picked: BGE-M3, Voyage, OpenAI text-embedding-3, Workers AI models — judged on eval-set quality, cost, self-hostability), and v1 must support **mixed embedders in one corpus without a flag-day re-embed** (per-corpus model identity already exists as a concept, [#8623](https://github.com/developing-today/code/issues/8623) — "embedding unification + per-corpus model identity and re-embed job", OPEN). [#9109](https://github.com/developing-today/code/issues/9109) Part C likewise names "automatic vectorization of ID content (Snowflake + **the second embedder from Atlas #9092**)". +- **Secret-tier embedder:** a separate design exists (`doc/2026-11-08T20-55-00Z_design_atlas_secret_tier_embedder/`) and classification-boundary enforcement at embed time is open ([#12403](https://github.com/developing-today/code/issues/12403), §7). + +### 3.3 Where vectors live + +- **Canonical/Turso:** chunk vectors in the Turso monolith's vec table (`vec_snowflake_m_v2_768_f32`) plus the 29 topic shards. Known limitation recorded on [#3125](https://github.com/developing-today/code/issues/3125) (2026-10-31): "`vector_top_k` does not work on the current plain-BLOB vec table (no libsql vector index) — the CLI uses `ORDER BY vector_distance_cos(vec, vector32(?))` (~4 s unfiltered full scan)"; a v3 publish with a libsql vector index (DiskANN) is the recorded fix direction. The Rust CLI exposes `--vector-backend scan | index-fill | index-fixed` (default `scan`). +- **Local laptop:** the v3 local corpus/vector DBs under `~/atlas/v3/` and the delta DBs (§1.3), read by the local backend. +- **Query vectors:** computed at query time by the one shared embedder (service / standalone binary / Worker-via-service), cached in the query-embedding cache (`atlas-core/src/embed_cache.rs`, keyed on the raw full-dimension vector before truncation/renormalisation) and, on the Worker path, persisted inside the per-query Durable Object before the search runs. +- **D1 is NOT a vector store in the current design:** the D1 hot cache (§4.3) caches *results and content payloads* (classes A/B/C), not an ANN index. **UNVERIFIED / no evidence found** of any sqlite-vec / LanceDB / Qdrant-style external vector DB in the Atlas serving path; the recorded options stay inside libSQL/Turso + in-process scan/index backends. + +### 3.4 The `aa` benchmark table + +No Atlas connection found: nothing in the `pkgs/atlas-search/` files inspected reads an `aa` table, and Atlas's own benchmarks are the golden/eval sets in §4.4. (Standing context outside Atlas: the `aa` table lives in the Supabase `ainventory` project only, holding Artificial-Analysis-style benchmark figures — a different programme's data. A code search for `ainventory` in developing-today/code returns hits, but none in the Atlas search path inspected here.) **Mark: not part of Atlas today; UNVERIFIED whether any future Atlas design intends to ingest it** — [#9097](https://github.com/developing-today/code/issues/9097)'s sources-inventory pass (§6) is where such a source would be picked up. + +--- + +## 4. Issue census + +### 4.1 Totals (GitHub Search API, 2026-11-23, this pass) + +- `label:epic/atlas-program state:open` = **57** (matches the last recorded count); `label:epic/atlas-program` all states = **123** (so 66 closed). +- `atlas state:open` (text search, all Atlas-mentioning issues) = **207**. +- The programme epic is [#8983](https://github.com/developing-today/code/issues/8983) (OPEN; created 2026-11-12 because the label cluster — then 68 open issues — had no epic issue at all). The older `epic/atlas` label is a redundant carrier whose open issues are a strict subset. + +### 4.2 [#12900](https://github.com/developing-today/code/issues/12900) — the three threads + +[#12900](https://github.com/developing-today/code/issues/12900) — "Atlas search improvements: parallel branches, service/result-store shape, nix-packaged binary CLI" (OPEN, `status:in-review`; moved from dezren39/hatch-personal#21 on 2026-11-22; exploration opened by Drew 2026-11-04 "after the Snowflake swap landed"): + +1. **Thread 1 — parallel branch execution: LANDED.** Hybrid FTS + vector branches run concurrently in `atlas_search.py` (`run_branches`, thread pool; per-thread sqlite connections locally; one pipeline per branch on Turso) — PR [#13039](https://github.com/developing-today/code/pull/13039) merged 2026-11-23 (`03e5d20ba88d`), with `tests/test_branch_concurrency.py` proving concurrent == serial == committed recording. Expected saving per the issue: the ~6 s vector branch overlaps FTS instead of adding; cold start (~35 s, mostly ST model load) untouched. +2. **Thread 2 — service / temp result store shape: OPEN, and it is a product decision before it is engineering.** Drew's sketch: fan queries to simultaneous workers writing a temp result store (temp D1 / scratch Turso / in-memory), CLI pulls until its pools are satisfied. The issue states the decision input explicitly: "**is Atlas headed for multi-client use** (e.g. OpenChamber/fork sessions querying it as a tool), **or does it stay Drew's personal CLI? Build the service only if the former.**" Note the ground has partly shifted since filing: a service shape now exists anyway (the fleet search service + Worker, §2.2/§2.4, built under other issues), but the thread-2 question as posed — multi-client as a *product* commitment — remains unanswered on the issue. +3. **Thread 3 — nix-packaged Rust binary replacing the Python CLI: substantially landed under other issues.** The binary exists (`pkgs/atlas-search`, §2.1, rehomed into fleet as `fleet serve search`, §2.4), gated on golden-set parity with the Python reference, which remains as the eval/reference implementation. #12900 stays open on threads 2–3's formal remainder. + +### 4.3 The D1 hot-cache chain ([#9134](https://github.com/developing-today/code/issues/9134) design; design doc merged via PR #13098) + +Design: `doc/2026-11-23T08-06-00Z_design_atlas_d1_tenant_hot_cache/` — a per-tenant D1 cache in front of Turso for the ID/Atlas multi-tenant serving shape (Part C storage economics, [#9109](https://github.com/developing-today/code/issues/9109)). Six implementation follow-ons: + +| Issue | Slice | State | +|---|---|---| +| [#13100](https://github.com/developing-today/code/issues/13100) | Schema, wrangler D1 binding, store module (get/put/evict over `hot_cache`, classes A/B/C), flag default off | **CLOSED** (`status:done`). Landed code is visible in the tree: `worker/migrations/0001_hot_cache.sql`, `worker/src/hot_cache.ts`, `HOT_CACHE_ENABLED="false"`. The committed `database_id` is a local placeholder — the real `atlas-hot-cache` D1 database is created at deploy time. | +| [#13101](https://github.com/developing-today/code/issues/13101) | Freshness evaluator — per-class watermark/TTL rules (A: content hash is the version; B: source-watermark equality or TTL_B 60 s; C: TTL_C 15 min + no later invalidation event) + fail-safe degradation | OPEN, `status:in-review` — a PR is open in the parent programme's shepherd queue (xaltha's PR #13133 per programme records; **not re-verified in this pass**). | +| [#13103](https://github.com/developing-today/code/issues/13103) | Admission policy — heat (eligible after 2 requests / 10 min), heavy-query immediate admission (source latency > 250 ms or rows-read > 10,000), per-tenant quotas (tier weights 1:4:16, 5% floor), 256 KB entry cap, 30 s negative TTL, LRU eviction (B/C before A) | OPEN, `status:in-review` — PR open in the shepherd queue (programme records say xaltha's PR #13132; **not re-verified in this pass**). | +| [#13105](https://github.com/developing-today/code/issues/13105) | Read-path integration — Turso-hop skip (Class B result-set skip, Class A hydration skip, independently decided, only inside the freshness bound) with skip logging | OPEN; depends on #13101 (follow-ons 1+2) — gated behind it. | +| [#13106](https://github.com/developing-today/code/issues/13106) | Invalidation — per-tenant invalidation events on ingest completion, Worker consumption (drop Class C, forced revalidation), audited operator purge | OPEN; **flag-held in the parent programme** (awaits Drew's item-specific go-ahead) — do not treat as ordinary queue work. | +| [#13107](https://github.com/developing-today/code/issues/13107) | Measurement report for the storage-economics prototype (hits/skips/revalidations per class+tenant, stale-serves with expected value zero, estimated Turso cost avoided) + first tuning round after ~2 weeks of counters | OPEN; behind #13105. | + +Net: the D1 tier is **schema + store landed, everything else in flight or gated, and the master flag is off** — production search does not touch D1 today. + +### 4.4 Golden set / evaluation state + +- **Golden set:** `pkgs/atlas-search/eval/fixtures/golden-311.json` — the **311-query v3 golden set**, copied byte-for-byte from the laptop's `~/atlas/v3/golden-queries-v3.json` (SHA recorded in `eval/README.md`); its header records the source corpus size + fingerprint used to build it, and the corpus-specific runner (`eval/eval3.py`, the production Python reference runner) checks its frozen fingerprint before scoring. Plus `fixtures/heldout-nearexact-54.json` (54 held-out near-exact queries) and `fixtures/eval-smoke.json` (synthetic; explicitly "not held-out evaluation evidence"). +- **Harness:** `pkgs/atlas-search/eval/README.md` (#5741): saved rankings from any signal combination are scored offline against judged qrels (`atlas-eval`, `crates/atlas-core/src/eval.rs`; format `atlas-eval/v1`; metrics nDCG@10, Recall@100, Recall@1000, MRR@10, reported per query class). The designed ablation matrix — {dense} / {BM25} / {SPLADE} / {dense+BM25} (today's design) / {dense+SPLADE} / {dense+BM25+SPLADE} / each ± Jaccard rescore — "is measured, not argued." +- **Gate results on record:** `eval/gate-5733-results.md` + `eval/gate5733.py` (the Jaccard third-signal gate, #5733), `eval/overlap-report-6039.md` / `overlap-results.json` (#6039), `eval/boundary-drift-6038.md` (#6038). Design: `doc/2026-11-08T10-45-00Z_design_atlas_golden_set_eval_gate/`. +- **Standing eval programme:** [#8627](https://github.com/developing-today/code/issues/8627) — "atlas memory slice 5: cross-agent eval sets for the unified index (standing oracle)" — OPEN (child of [#8983](https://github.com/developing-today/code/issues/8983)). [#9092](https://github.com/developing-today/code/issues/9092)'s shard benchmark programme names its oracle as "p50/p95 end-to-end query latency at fixed recall@10 against the standing eval sets (#8627) — a shard configuration wins only at equal-or-better recall." Thread-3's binary swap was likewise gated on "the golden 311 tying the Python reference" ([#12900](https://github.com/developing-today/code/issues/12900)). +- **Parity fixtures in the engine:** atlas-core `tests/parity.rs`, atlas-search `tests/cli_parity.rs`, and `tests/golden/*.txt` text fixtures pin the Rust output to recorded Python envelopes. + +### 4.5 Recommendation engine state + +Design exists; production serving does not (see also §7): + +- [#9140](https://github.com/developing-today/code/issues/9140) — OPEN: "design(atlas): recommendation objects, search history, retention classes." +- [#9109](https://github.com/developing-today/code/issues/9109) Part C names the intended surfaces: "one fan-out worker, a Durable Object accumulating 'next 10', recommendations as stored objects with per-class retention" (settled design in the ID–Atlas summit Part C, §S6.4–S6.7/S6.15 of `doc/2026-11-13T03-40-00Z_design_id-atlas-summit/part-c/versioned-design.md`, with a recommendation-page fixture + oracle in the same folder). +- The one implementation slice in flight: [#10158](https://github.com/developing-today/code/issues/10158) — "Recommendation snapshot paging state machine" (OPEN, `status:in-review`/`status/in-progress`): immutable materialised order (score DESC, then immutable recommendation ID ASC) at a pinned cutoff, per-page signed envelopes with their own EnvelopeId, cursor bound to the parent SnapshotId. Its PR [#12873](https://github.com/developing-today/code/pull/12873) — "feat(atlas-search): recommendation snapshot paging state machine (#10158)", adding `worker/src/recommendation_state.ts` + tests — is **OPEN, unmerged** at research time (head `7e55bb1fa94e`; held in the parent programme's shepherd queue). Hard dependency recorded on #10158: #9083 (tenant-scoped subject authorisation and policy epoch). +- No recommendation *generation* (candidate scoring) implementation was found in the tree — what exists is the paging/envelope state machine for serving an already-materialised recommendation snapshot. **UNVERIFIED** beyond tree inspection: no `recommendation*.rs` exists under `pkgs/atlas-search/crates/`; the only recommendation code path in the tree is the Worker-side state machine in PR #12873. + +### 4.6 [#6021](https://github.com/developing-today/code/issues/6021) and the classification / secret-tier line + +- [#6021](https://github.com/developing-today/code/issues/6021) — **CLOSED**: "classification revalidation scan — verify nothing sensitive sits at the wrong tier" (the Layer-1 scan over scan candidates). Its follow-on [#10412](https://github.com/developing-today/code/issues/10412) — "secret-tier review of 47 candidate chunks (67 findings) + 45 candidate messages from the 2026-11-15 revalidation scan (#6021)" — is also **CLOSED** (reviewed by Muse under Drew's 2026-11-22 Atlas order; it is a review record, not a design statement). Its relevance to planning: Atlas has working **tiered-sensitivity machinery** (classification, revalidation scans, secret-tier review) that any ingest/search expansion must keep intact. +- Still open on that line: [#8479](https://github.com/developing-today/code/issues/8479) — "secret-bearing rows still live in the production monolith and a local replica (#6021 wave 1)" (boundary remediation; its destructive purge leg is gated on production-ingestion verification in the parent programme); [#12406](https://github.com/developing-today/code/issues/12406) (remediate secret-bearing monolith chunks), [#12404](https://github.com/developing-today/code/issues/12404) (disclosure-context filters at output boundaries), [#12403](https://github.com/developing-today/code/issues/12403) (source-boundary-safe embed classification). + +### 4.7 The rest of the open census (57, grouped) + +Full open list was pulled this pass; beyond the issues above, the load-bearing groups are: + +- **Memory programme slices ([#8983](https://github.com/developing-today/code/issues/8983) children, from #8567):** [#8622](https://github.com/developing-today/code/issues/8622) corpus registry + memory-lancedb connector into staging; [#8623](https://github.com/developing-today/code/issues/8623) embedding unification + per-corpus model identity; [#8625](https://github.com/developing-today/code/issues/8625) MCP surface (§2.3); [#8626](https://github.com/developing-today/code/issues/8626) remaining corpus connectors (memory files, notes, repo docs, research); [#8627](https://github.com/developing-today/code/issues/8627) eval sets (§4.4). +- **Search v1 build-out:** [#9091](https://github.com/developing-today/code/issues/9091) (Atlas v1 design-mill starter), [#9092](https://github.com/developing-today/code/issues/9092) (§7), [#5773](https://github.com/developing-today/code/issues/5773) / [#5774](https://github.com/developing-today/code/issues/5774) (query understanding / parameter surface, §7), [#6228](https://github.com/developing-today/code/issues/6228) + [#6993](https://github.com/developing-today/code/issues/6993) (schema-driven filter surface + manifest schema/loader), [#9099](https://github.com/developing-today/code/issues/9099) (query-as-data: query embeds, full tool/parameter provenance, permanent result archive), [#6805](https://github.com/developing-today/code/issues/6805) (Worker cache eviction/invalidation), [#6666](https://github.com/developing-today/code/issues/6666) (shard consumer serve-mode + snapshot-id integration). +- **Ingest programme:** [#6018](https://github.com/developing-today/code/issues/6018), [#6025](https://github.com/developing-today/code/issues/6025), [#6029](https://github.com/developing-today/code/issues/6029), [#6052](https://github.com/developing-today/code/issues/6052), [#7969](https://github.com/developing-today/code/issues/7969), [#9097](https://github.com/developing-today/code/issues/9097), [#5670](https://github.com/developing-today/code/issues/5670) (§6). +- **Cold tier ([#6042](https://github.com/developing-today/code/issues/6042) follow-ons):** [#8227](https://github.com/developing-today/code/issues/8227)–[#8231](https://github.com/developing-today/code/issues/8231) (shard writer, restore importer, cold catalog + fan-out addressing, roundtrip-verify tool, shard compaction). +- **Storage / placement research:** [#9098](https://github.com/developing-today/code/issues/9098) (embed-storage economics), [#9133](https://github.com/developing-today/code/issues/9133) (benchmark harness D1 vs R2 vs laptop redb vs laptop Turso), [#9135](https://github.com/developing-today/code/issues/9135) (tenant store placement), [#9094](https://github.com/developing-today/code/issues/9094) (OpenCode DB backup economics), [#9093](https://github.com/developing-today/code/issues/9093) (backup mesh), [#8528](https://github.com/developing-today/code/issues/8528) (cost-aware placement simulator), [#9100](https://github.com/developing-today/code/issues/9100) (virtual filesystem over the CAS + aggregated file index, Basin/Parquet evaluation), [#9095](https://github.com/developing-today/code/issues/9095) (Metadata schema v1 + evolution doctrine). +- **ID-facing:** [#6062](https://github.com/developing-today/code/issues/6062) + projectors [#11182](https://github.com/developing-today/code/issues/11182)–[#11186](https://github.com/developing-today/code/issues/11186), [#9109](https://github.com/developing-today/code/issues/9109), parent [#9106](https://github.com/developing-today/code/issues/9106) (§5). +- **Programme roots:** [#5350](https://github.com/developing-today/code/issues/5350) — "Epic: Atlas as a Rust binary + multi-client search service (b+c)" (OPEN, the older epic framing the [#12900](https://github.com/developing-today/code/issues/12900) thread-2/3 work), [#3125](https://github.com/developing-today/code/issues/3125) (§1.2), [#6024](https://github.com/developing-today/code/issues/6024) (licensing gate for external GitHub corpus ingestion). + +--- + +## 5. Consumers — who searches Atlas today, and by what path + +| Consumer | Access path | Ceiling / identity | State | +|---|---|---|---| +| **Drew (CLI)** | `fleet search` client (§2.4) or the standalone `atlas-search` binary, standalone route against the local/Turso backend | Identity `drew-cli`, ceiling **secret-bearing** (the only identity granted that tier) | Live | +| **Agents on the sandbox seat (Archer/Muse lanes, OpenCode sessions on the sandbox)** | `fleet search` via-service route → laptop loopback service (`fleet serve search`, http://127.0.0.1:18760) | Identity `sandbox-scripts`, ceiling **personal** (server-clamped) | Live; discoverability fixed by [#12782](https://github.com/developing-today/code/issues/12782); instruction rollout to runbooks/lane bodies still open ([#9101](https://github.com/developing-today/code/issues/9101)) | +| **The laptop seat itself** | `fleet search` standalone default (it is the serving host) | Local | Live | +| **Hosted / remote agents via the Worker** | Cloudflare Worker `POST /v1/search` (REST) → per-query Durable Object cache → fleet search service over `atlas-search.security.cab` + Access service token | Client identity `cf-worker`, ceiling **personal**; Worker holds no Turso credentials | Live | +| **MCP clients via the laptop's mcpx** | mcpx `atlas` remote server → Worker `POST /mcp` → the same `executeSearch` path (§2.3) | Shared hosted identity `hosted-per-user`, personal ceiling; per-agent identity is [#8625](https://github.com/developing-today/code/issues/8625)'s open later slice | Live (one tool: `search`) | +| **OpenChamber / fork sessions** | Only through the two paths above (fleet search on a seat, or mcpx's `atlas` server where mcpx is wired) — **no direct OpenChamber→Atlas integration was found**; this is exactly the open [#12900](https://github.com/developing-today/code/issues/12900) thread-2 question | — | **Not a first-class consumer today** | +| **ID** | **No live query path.** The stated relationship is design + unstarted implementation: [#6062](https://github.com/developing-today/code/issues/6062) (OPEN, design-only: Atlas objects + provenance/lineage relations as ID-graph objects — files, versions, chunks/spans, ingest runs with identity/writer-set, PROV-lite relations `wasRevisionOf` / `specializationOf` / `wasDerivedFrom` / `wasGeneratedBy` / `wasAttributedTo` mapped into the ID relation vocabulary; canonical-in-Atlas vs canonical-in-graph decided explicitly in the design) and its five projector follow-ons, all OPEN and unstarted: [#11182](https://github.com/developing-today/code/issues/11182) (projector — versions, files, relations emission), [#11183](https://github.com/developing-today/code/issues/11183) (projector — attestations and ingest runs), [#11184](https://github.com/developing-today/code/issues/11184) (projector operations — run logging, replay, backfill), [#11185](https://github.com/developing-today/code/issues/11185) (consumer view presets), [#11186](https://github.com/developing-today/code/issues/11186) (conformance audit). Plus [#9109](https://github.com/developing-today/code/issues/9109) Part C (OPEN epic slice): storage economics + benchmarks, **automatic vectorisation of ID content (Snowflake + the #9092 second embedder) feeding built-in ID search**, and the recommendation surfaces. Shared ground that *does* exist in code: the content-hash v1 test vectors shared between `pkgs/atlas-search/test-vectors/` and `pkgs/id/test-vectors/` (§2.1). | — | Design only | +| **Evaluation / offline tooling** | `atlas-eval`, `eval3.py`, fixture generators (`pkgs/atlas-search/eval/`, `fixtures/`) run against the corpus/golden sets directly | Local | Live (offline) | + +"Drew's 'Atlas baked into ID' framing is a direction for new planning, not a recorded decision" — the recorded decisions are #6062 (publication format) + #9109 Part C (storage economics / ID search / recommendations), per the sibling ID-state survey. + +--- + +## 6. Ingest today — how data gets in + +### 6.1 Current state: manual / script-driven (verified 2026-11-12, [#9097](https://github.com/developing-today/code/issues/9097)) + +> "Ingestion is **manual/script-driven**: the only Atlas schedule on the laptop is the daily backup timer. Canonical counts are frozen at the 2026-10-31 publish … The staging tier exists in code with a promote gate; the aggregator/embedder and session-close hook slices are not built." + +- **The ingest script:** `atlas-ingest.py` in dezren39/hatch-personal (workspace/turso-atlas) — the phase-1 landing ([#3125](https://github.com/developing-today/code/issues/3125), hatch-personal PR #58) added `source_roots` / `chunk_occurrences` / `cas_registry` + occurrence-aware ingest to it, so **new imports write occurrences from now on**; historical occurrence recovery is phase 3 (open). +- **What has been ingested (corpora on record):** AI conversation sessions across clients (the 18,325 canonical sessions, classified scheme-1.0 in `classification-full-v1.json`); the **ChatGPT export** (present on disk as the single 100 MB zip in `~/atlas/extracts/imports/`, interned into the CAS 2026-11-23 — §1.2); the **sandbox-agents corpus** (12,091 files / ~2.5 GB under `~/atlas/extracts/sandbox-agents/`, likewise interned 2026-11-23); GitHub comments (a dedicated extractor exists in code: `atlas-core/src/github_comments.rs` + `bin/atlas-github-comments.rs`; external-corpus ingestion is policy-gated — [#6024](https://github.com/developing-today/code/issues/6024) licensing research and [#6052](https://github.com/developing-today/code/issues/6052) external-content three-zones policy, both OPEN); first-pass corpus ingestion of code repos/docs is [#6025](https://github.com/developing-today/code/issues/6025) (OPEN). +- **Staging path (for new units of work):** producers write per-unit staging DBs (`atlas_stage` v1, §1.3) via `atlas-stage` / the atlas-core stage writers (including the classified-artifact writer that composes source-boundary splitting + per-chunk classification records, #12628); promotion to core is gated on the embedding-model contract. The **aggregator/embedder and session-close extraction hook are not built** ([#9097](https://github.com/developing-today/code/issues/9097)), so staging→core flow is not an automatic pipeline today. +- **Migration debt:** [#5670](https://github.com/developing-today/code/issues/5670) — OPEN: "migrate all Atlas/search/embedder scripts into developing-today/code + fleet binary; retire outside copies." The Python reference has been copied in (§2.1), but the ingest-side scripts still live in hatch-personal — execution for [#3125](https://github.com/developing-today/code/issues/3125) phases 1–2 was homed there for exactly this reason (recorded repeatedly on #3125 by standing-down lanes). + +### 6.2 What is automatic vs manual + +| Automatic today | Manual / script-driven today | +|---|---| +| Daily **backup** timer on the laptop (`atlas-backup.sh`, §1.1) — DB snapshot + (since 2026-11-23) extracts-store archive with `verify` proof | All corpus ingestion: session imports, ChatGPT export, sandbox-agents, repo/doc corpora — run by hand / by an agent lane invoking the scripts | +| Query-time embedding + per-query DO caching on the Worker path; query-embedding cache in the engine | Occurrence backfill (phase 3), catalog/shard publish steps (phase 4) | +| Staging-DB provisioning + promote **gate checks** when a producer runs them | The recurring ingestion sweep itself — [#7969](https://github.com/developing-today/code/issues/7969) "recurring ingestion sweep runner + guardrail monitor + plan-headroom reporting (#6019)" is OPEN, not built | + +### 6.3 The continuous-ingestion programme (designed, acceptance unmet) + +[#9097](https://github.com/developing-today/code/issues/9097) — "impl(atlas): continuous ingestion — queue/PM/GitHub/Muse/OpenCode/ID corpora + sources inventory" (OPEN, workstream E of the v1 build-out under [#8983](https://github.com/developing-today/code/issues/8983); standing related work [#6018](https://github.com/developing-today/code/issues/6018) the long-term ingestion programme, [#6028](https://github.com/developing-today/code/issues/6028) delta-only ingestion + offset embeds, [#8622](https://github.com/developing-today/code/issues/8622)/[#8626](https://github.com/developing-today/code/issues/8626) connectors). Drew's source list (2026-11-12, internal-use only): + +1. Turso queue data (fleet-queue) + PM stack data (aggregator state, boards, reconcile). +2. **All GitHub issues / PRs / commits / files for all orgs and repos in scope** (developing-today, developing-today-forks, Clustered-Computing, personal) — extending #6023 beyond its first pass. +3. **All Muse conversations and data** (main + side chats, memory tree, artifacts). +4. **All OpenCode sessions and data** — including an explicit investigation of ingesting **thinking traces**, with a recommendation (volume, value, classification implications). +5. **All ID objects** across the various stores (redb, Turso id DBs, hosted stores as they arrive). +6. **Sources-inventory pass:** hunt for missed sources (notes/zettel, Fleet Reports Space records, ask-ledger logs, quota/burn records, laptop state stores) — the inventory is a deliverable; anything missed gets its own connector issue. + +Rules recorded there: every item lands with versioned metadata + as many classifications as can be found/applied; ingestion is **continuous** (event hooks where the source supports them, scheduled sweeps otherwise — [#7969](https://github.com/developing-today/code/issues/7969)); the **ingest watermark is the corpus-change signal** the search cache policy consumes; delta-only where supported; re-embeds follow mixed-embedder support (no flag-day re-embeds). Acceptance (sources-inventory doc merged, per-source connector issues filed, continuous-update design merged, canonical recount procedure defined "so counts never freeze silently again") is **unmet** — this is the single biggest ingest gap. + +### 6.4 Backup relations (atlas-backup / supabase-backup) + +- `atlas-backup` (§1.1) is a standalone laptop timer in developing-today/code's Nix home config (`nixos/home/atlas-backup.sh` + `atlas-backup.test.sh`); it **files into the R2 bucket named `supabase-backups`** (key prefix `atlas//`) and reuses the pm-dashboard-backup patterns (dated dirs, sha256 manifest, rotation, BWS-fetched R2 credentials by name only). The bucket name is historical/shared infrastructure — the Atlas backup is a tenant of it, not a Supabase database backup. **UNVERIFIED:** any current coupling between Atlas ingest and the separate supabase-backup jobs beyond that shared bucket; none was found in the files inspected. +- The backup-mesh ambition is [#9093](https://github.com/developing-today/code/issues/9093) — OPEN: "backup mesh — all-Turso 14d restic-zstd to R2, R2/laptop/Drive mesh, D1+laptop DBs into Turso." + +### 6.5 Awaiting interning / promotion (summary) + +- Staged per-unit DBs whose aggregator/promotion pipeline is unbuilt (§1.3.1, §6.1). +- Delta/topup vector DBs resolved at query time by content_hash but never merged into canonical identity (§1.3.2). +- Historical chunk occurrences (~127K dropped at first ingest; 6,344 zero-chunk sessions) — phase-3 backfill from the now-interned CAS extracts is the recorded route ([#3125](https://github.com/developing-today/code/issues/3125)). +- Any corpus newer than the 2026-10-31 publish that has not been through a manual ingest run since (§6.1) — **UNVERIFIED** per-corpus freshness; no live ingest ledger was read in this pass. + +--- + +## 7. Known gaps / limitations (as recorded on issues and in code) + +**Query planning / query understanding.** +- [#9092](https://github.com/developing-today/code/issues/9092) (verified 2026-11-12): "Contract flags for the query planner, spell correction, query-class hint, and `rewritten|both` variants are **accepted but unimplemented**." Search v1 scope item 1: implement the dead contract surface or formally retire each flag — planner per [#5773](https://github.com/developing-today/code/issues/5773) ("query-understanding front-end — spell correction + LLM query planner/rewriter as toggleable stages, dual submission with provenance", OPEN), parameter surface per [#5774](https://github.com/developing-today/code/issues/5774) ("every retrieval knob as a CLI flag / raw-query field, no hardcoded constants", OPEN). The versioned parameter set that *does* exist is `atlas-proto`'s `SearchParametersV1` (k, pool, expand, RRF k, per-signal weights). +- Branch execution was serial in the Python until [#12900](https://github.com/developing-today/code/issues/12900) thread 1 landed 2026-11-23; the Rust serve path supplies a concurrent branch executor (`atlas-core/src/search.rs`: "serve mode supplies an executor that runs the FTS and vector branches concurrently while preserving this module's exact validation, fusion, and rendering semantics"). +- Vector retrieval is an exact scan by default (~4 s unfiltered over Turso; session-filtered vector queries cost ~15 s server-side per the Python header's join-chain note, 20–60 s for naive joins per [#3125](https://github.com/developing-today/code/issues/3125)); index backends (`index-fill` / `index-fixed`) exist as CLI options but the publish lacks a libsql vector index (§3.3). Shard fan-out is a hidden experimental flag, not the default ([#9092](https://github.com/developing-today/code/issues/9092)). + +**Fusion today; reranking — what exists and what doesn't.** +- What exists: **reciprocal rank fusion only.** `atlas-core/src/fusion.rs` fuses the FTS (FTS5/BM25) and vector pools: `score += weight / (rrf_k + rank)` per branch (defaults from `SearchParametersV1`), ordered by (−score, best rank, chunk_id). The FTS match expression is a heuristic builder (content words >3 chars OR-joined as quoted phrases, plus short digit-bearing tokens). Sensitivity/classification filtering is **filter-before-rank** inside the backend's branch construction. +- **No learned / cross-encoder reranker exists in the serving path.** A code search for `rerank` across developing-today/code returns 10 hits, none of them an Atlas serving reranker (eval tooling `eval/gate5733.py` and a Worker `service.ts` mention are the closest). **UNVERIFIED** as a negative beyond that search + tree inspection — but no rerank stage, model, or issue-scoped implementation was found. +- Third-signal candidates are at the *evaluation* stage, not adopted: **Jaccard rescore** (gate #5733 — results in `eval/gate-5733-results.md`; [#9092](https://github.com/developing-today/code/issues/9092) scope: "Jaccard third signal per #5733 where it earns its place") and **SPLADE** (in the #5741 ablation matrix design, §4.4; a SPLADE issue draft exists in the design archive `doc/atlas-scratch-sweep-2026-11-14/atlas-splade-issue.md`). Shingle machinery for near-duplicate/Jaccard work exists in the engine (`atlas-core/src/shingles.rs`). +- Feedback exists as *capture*, not as a ranking input: `atlas-core/src/feedback.rs` implements `atlas-feedback/v1` (#9976, design `doc/2026-11-10T20-41-01Z_design_atlas_retrieval_stats_feedback.md` §6) — append-only thumbs votes keyed to `(query_id, chunk_id)` result identity (never rank position), with a derived supersede view and requester-kind weighting known to the aggregation; query traces (`atlas-query-trace/v1`, #9973) are captured alongside. Whether any ranking/recommendation path *consumes* aggregated feedback today: **no consumer found in the tree — UNVERIFIED negative**, and the retrieval-stats/feedback loop is a design-stage follow-on family of #6027. + +**Recommender.** Design-stage only — §4.5: recommendation objects/retention ([#9140](https://github.com/developing-today/code/issues/9140), OPEN), the fan-out-worker + DO-accumulator "next 10" shape ([#9109](https://github.com/developing-today/code/issues/9109) Part C), and exactly one implementation slice in flight (snapshot paging, [#10158](https://github.com/developing-today/code/issues/10158) / PR [#12873](https://github.com/developing-today/code/pull/12873), both OPEN). No candidate generation, no serving endpoint, no feedback-driven personalisation exists today. + +**Freshness / incremental indexing.** +- Worker result cache: **indefinite, no TTL, no eviction, no invalidation** in v1 (Worker README); [#6805](https://github.com/developing-today/code/issues/6805) (eviction & invalidation policy) is OPEN, with deferred triggers recorded in the README (add corpus generation to the cache key at the first same-space re-ingest changing >5% of chunks or on a stale-result complaint; add an LRU sweeper at 10,000 cached queries or 1 GB aggregate). A gated per-query purge route exists (§2.2). The standalone CLI has **no result caching** (#5668, via [#9092](https://github.com/developing-today/code/issues/9092)). +- [#9092](https://github.com/developing-today/code/issues/9092) scope item 4 defines the target semantics — results cached until the corpus changes; on change, a short specified staleness window unless the caller passes a real-time requirement or a cache-disable flag (both to become first-class flags at CLI/service/Worker); the corpus-change signal is the ingest watermark from [#9097](https://github.com/developing-today/code/issues/9097). The service client already exposes `--no-cache` (bypasses cache reads; the fresh result still lands in cache). +- Incremental indexing: delta-only ingestion + offset embeds are designed ([#6028](https://github.com/developing-today/code/issues/6028), via [#9097](https://github.com/developing-today/code/issues/9097)) and a CDC-feasibility research exists (`doc/2026-11-14T12-20-00Z_research_atlas_cdc_feasibility_6040/`), but with ingestion itself manual (§6.1) there is no incremental index pipeline in production; the D1 hot-cache invalidation slice that would consume ingest events ([#13106](https://github.com/developing-today/code/issues/13106)) is flag-held. + +**Multi-DB vector resolution.** Working in the small (content_hash resolution across the monolith + topup/delta DBs, §1.3.2; Worker fan-out across service-discovered `atlas-core-*` DBs, §2.2) and unbuilt in the general form ([#3125](https://github.com/developing-today/code/issues/3125) phase 4: catalog DB + collection×month shards + resolve/fetch-span as MCP tools). Cross-tier vector comparability is a recorded decision (`doc/2026-11-08T10-44-00Z_decision_atlas_cross_tier_vector_comparability/`); mixed-embedder corpora are a v1 requirement, not a landed feature ([#9092](https://github.com/developing-today/code/issues/9092) / [#8623](https://github.com/developing-today/code/issues/8623)). + +**Other recorded limitations.** +- Cold start: ~35 s for the Python CLI (ST model load dominates); the Rust service amortises this with one resident embedder (~1.6 GB RSS) but serialises vector queries on its mutex. +- Corpus counts freeze silently between manual publishes — a recount procedure is an explicit [#9097](https://github.com/developing-today/code/issues/9097) acceptance item. +- Sensitive rows still live in the production monolith + a local replica ([#8479](https://github.com/developing-today/code/issues/8479), OPEN) — query-time ceilings are the current mitigation; embed-time classification enforcement is open ([#12403](https://github.com/developing-today/code/issues/12403)/[#12404](https://github.com/developing-today/code/issues/12404)/[#12406](https://github.com/developing-today/code/issues/12406)). +- Per-agent identity/scoping for MCP consumers is unbuilt ([#8625](https://github.com/developing-today/code/issues/8625)); all hosted MCP callers share `hosted-per-user`. +- atlas-core carries 22 pre-existing clippy warnings ([#13056](https://github.com/developing-today/code/issues/13056)) with the cleanup PR [#13097](https://github.com/developing-today/code/pull/13097) still open. + +--- + +## Appendix — verification ledger + +- **Verified first-hand in this pass (gh api / local binary, 2026-11-23):** full `main` git tree (11,805 paths); bodies/labels/state for #3125, #12900, #8983, #9092, #9097, #9109, #6062, #6021, #10412, #12782, #13056, #13100, #13101, #13103, #13105, #13106, #13107, #10158, #10237 (checked as a non-Atlas control — it is an ID append-list issue, not Atlas); PR states/heads for #12873, #13097; #12900 comments (thread 1 landed via PR #13039); #3125 comments through 2026-11-23T11:59Z (phase 1, phase-2 slices 1/backup/backfill, PR #13216 note); search totals (57 open `epic/atlas-program`, 123 all-state, 207 open atlas-mentioning); contents of `pkgs/atlas-search/crates/atlas-core/src/{embed,fusion,search,feedback,stage,types}.rs` (heads/excerpts), `crates/atlas-embed/src/lib.rs` (excerpts), `worker/{README.md,wrangler.toml,src/index.ts,src/search.ts,src/mcp.ts,src/hot_cache.ts}` (heads/excerpts), `eval/README.md`, `atlas_search.py` (header + grep), `nixos/home/atlas-backup.sh` (grep), `fleet search --help` / `fleet serve search --help` from the installed fleet binary, fleet book search-chapter text (via the book source excerpts returned with the file reads). +- **Taken from parent-programme records (not re-read this pass):** the #13101/#13103 PR numbers (#13133/#13132, attributed to xaltha) and their shepherd-queue status; PR #13097's "37→0" author claim; the #13106 flag hold. +- **Explicitly UNVERIFIED:** the laptop DB itself and any live counts after 2026-10-31; hatch-personal#24's current remainder list; per-corpus ingest freshness; the reranker/feedback-consumer negatives (search + tree inspection only); any Atlas use of the Supabase `aa` table (none found); a direct OpenChamber→Atlas integration (none found). diff --git a/doc/2026-11-23T23-45-44Z_research_atlas-investigation/research-search-tech.md b/doc/2026-11-23T23-45-44Z_research_atlas-investigation/research-search-tech.md new file mode 100644 index 000000000..39104cbbf --- /dev/null +++ b/doc/2026-11-23T23-45-44Z_research_atlas-investigation/research-search-tech.md @@ -0,0 +1,343 @@ +# Atlas — Modern Search & Retrieval Technology Survey + +**Purpose:** Research backing for a program-planning prompt to fully investigate Atlas — Drew's personal corpus search system (Snowflake embeddings, Turso/libSQL storage, FTS + vector search, golden-set evaluation, a recommendation component, CAS-backed corpus from the #3125 provenance program) — and to plan: automatic ingest of all data sources, query-planning improvements, search integration for fleet and ID, MCP + programmatic access, and richer search characteristics layered on top of the Snowflake embedding base (hybrid signals, reranking, recommender, etc.). + +**Method:** Public web sources via search + fetch, November 2026. Claims that could not be confirmed against a primary source are tagged **[unverified]**. Benchmark numbers are quoted from the cited source; MTEB/BEIR numbers are not comparable across papers unless the dataset split and metric match — treat cross-source deltas as directional. + +**Atlas context assumed throughout** (from the parent survey): ~18,325 sessions / 107,639 chunks at last verified state; storage in Turso/libSQL; embeddings keyed by content hash + `model_id` as a derived, rebuildable index; tiered-sensitivity machinery from the #10412 review; Atlas MCP server already live and wired into mcpx; `fleet search` documented as a consumer; ID-graph publication format design is #6062 (open, design-only) with projector set #11182–#11186 unstarted. + +--- + +## 1. Snowflake Arctic Embed — the embedding base + +### What it is + +Snowflake's Arctic Embed is a family of open-weight (Apache 2.0) encoder embedding models optimised for retrieval, released in successive generations: + +- **v1 / v1.5 (English-first):** a size ladder (xs / s / m / l) trading latency for quality; the medium and large v1 models were widely deployed defaults in 2024. +- **Arctic Embed 2.0 (Dec 2024):** the multilingual generation. Two published sizes: + - **arctic-embed-m-v2.0** — 305M total params, 113M non-embedding, **768 dimensions**, built on GTE-multilingual-base, 8,192-token context via RoPE. + - **arctic-embed-l-v2.0** — 568M total params, 303M non-embedding, **1,024 dimensions**, built on a long-context XLM-R-Large variant, 8,192-token context. +- Both 2.0 models are trained with **Matryoshka Representation Learning (MRL)** at a 256-dimension truncation point plus quantization-aware training: truncating m-v2.0 to 256 dims retains ~98% of its MTEB Retrieval score, and 4-bit quantization reaches ~128 bytes/vector with small further loss — i.e. the same stored embedding can serve a cheap first pass at 256 dims and a full-quality pass at 768/1024 dims. + +Sources: [arctic-embed-m-v2.0 model card](https://huggingface.co/Snowflake/snowflake-arctic-embed-m-v2.0), [Arctic-Embed 2.0 paper (arXiv:2412.04506)](https://arxiv.org/pdf/2412.04506), [Snowflake engineering blog](https://www.snowflake.com/en/blog/engineering/snowflake-arctic-embed-2-multilingual/). + +### MTEB standing (from the 2.0 paper, nDCG@10 averages) + +| Model | Params | Dim | MTEB-R (BEIR 15) | MIRACL (4) | CLEF | +|---|---|---|---|---|---| +| arctic-embed-m-v2.0 | 305M (113M non-emb) | 768 | **55.4** | 55.2 | **51.7 / 53.9** | +| arctic-embed-l-v2.0 | 568M (303M non-emb) | 1024 | **55.6** | 55.8 | **52.9 / 54.3** | +| bge-m3 | 568M | 1024 | 48.8 | **56.8** | 40.8 / 41.3 | +| multilingual-e5-base | 560M | 1024 | 51.4 | 54.0 | 43.0 / 34.6 | +| gte-multilingual-base | 305M | 768 | 51.1 | 52.3 | 47.7 / 53.1 | + +Reading: Arctic 2.0 leads its size class on English retrieval and CLEF while staying competitive on MIRACL — its design goal was explicitly "multilingual without sacrificing English," which is where earlier multilingual models (including BGE-M3 on English) give ground. BGE-M3 still edges it on MIRACL average. + +### How it compares for a local deployment + +| | Arctic Embed 2.0 (m / l) | BGE-M3 (BAAI) | Multilingual E5 (large) | Nomic Embed (v1.5 / v2-MoE) | +|---|---|---|---|---| +| License | Apache 2.0 | MIT | MIT | Apache 2.0 | +| Dim | 768 / 1024, MRL→256 | 1024 | 1024 | 768, MRL→256 | +| Context | 8,192 | 8,192 | **512** (chunking burden) | 8,192 (v1.5) / 512 (v2-MoE) **[unverified for v2 context in all secondary tables]** | +| Languages | ~74 [from model-card metadata, secondary] | 100+ | 94–100+ | English-first (v1.5); ~100 (v2-MoE) | +| Distinct capability | Best English retrieval per parameter; MRL + quantisation-aware compression | **One pass emits dense + learned-sparse + ColBERT multi-vector** — hybrid search without a second model | Broadest tooling/prefix ecosystem; the safe baseline | Fully open training data/code; smallest footprint (137M for v1.5) | +| Local inference | ONNX exports exist (incl. `onnx-community` INT8 ports for the reranker sibling); runs via fastembed-rs / `ort` / candle BERT-family paths | Via fastembed-rs `Bgem3Embedding` (dense+sparse+ColBERT in one type) | Everywhere (sentence-transformers, fastembed, TEI, Ollama) | Everywhere; Ollama default | + +Sources: [embedding comparison survey](https://github.com/thorwhalen/equate/blob/HEAD/docs/research/13-llm-and-modern-embedding-matching.md), [2026 embedding model comparison](https://resources.rework.com/tools/ai-data-infra/best-embedding-models-2026), [fastembed-rs docs](https://docs.rs/fastembed/latest/fastembed/). + +**Practical read for Atlas:** staying on Arctic is defensible — it is not the weak link. The two credible reasons to evaluate alternatives on Atlas's own golden set are (a) BGE-M3, if Atlas wants learned-sparse + late-interaction signals *from the embedding model itself* instead of from separate components, and (b) a long-context or instruction-tuned model (Qwen3-Embedding family, via fastembed's candle backend) if chunking artefacts dominate the failure taxonomy. Any swap is a full re-embed (vectors from different models are not comparable) — see §7 for the versioning pattern that makes that safe. + +### What "more search characteristics on top of Snowflake" means in practice + +The phrase, as the field uses it, means: the dense embedding is the *base signal*, and quality comes from layering additional, complementary signals over it rather than from a bigger embedding model: + +1. **Lexical signal** — BM25/FTS over the same chunks (§2), fused by rank. +2. **Learned sparse / late interaction** — SPLADE or ColBERT-style scoring (§2). +3. **Metadata & structural signals** — source, type, time, sensitivity tier, graph neighbourhood (Atlas-specific: provenance, occurrence counts, ID-graph links). +4. **Behavioural signals** — clicks/opens, session co-occurrence, recency (the recommender's raw material, §5). +5. **A precision stage** — cross-encoder reranking over the fused top-N (§3). +6. **Query-side intelligence** — planning, expansion, routing (§4). + +Each layer is independently measurable on the golden set (§6); that measurability, not any single layer, is the actual best practice. + +**Relevance to Atlas:** Arctic 2.0's MRL truncation gives Atlas a free two-resolution index (256-dim first pass, full-dim rescore) inside its existing model choice — the cheapest "more characteristics" step is using capabilities of the base model Atlas already stores, before adding new models. + +--- + +## 2. Hybrid search — BM25 + dense, and the signals beyond both + +### What it is + +Hybrid search runs two or more retrievers in parallel over the same corpus and merges their ranked lists. The canonical pairing is **BM25** (sparse lexical: term frequency × inverse document frequency over an inverted index; in Atlas's stack, SQLite FTS5) and **dense ANN** (bi-encoder embeddings; in libSQL, `vector_top_k` over a DiskANN index, or exact scan — §7/§8 notes). The two fail in opposite directions: + +- BM25 nails identifiers, error codes, names, version strings, rare jargon — and cannot connect "drop connections" to "connection reset." +- Dense retrieval handles paraphrase and (with a multilingual model) cross-lingual queries — and squashes rare tokens into low-information vectors, so it misses exactly the strings BM25 is best at. + +Sources: [Hybrid search and reranking: a field guide](https://www.aiagentichandbook.com/blog/hybrid-search-and-reranking-field-guide/), [Hybrid search (Masst docs)](https://docs.masst.dev/ai/retrieval/hybrid-search). + +### Fusion: RRF is the default; weighted fusion is the calibrated alternative + +- **Reciprocal Rank Fusion (RRF)** — `score(d) = Σ 1/(k + rank_r(d))`, `k = 60` from Cormack et al. (SIGIR 2009). It fuses *ranks*, not scores, which sidesteps the core problem: BM25 scores are unbounded and cosine similarities live in [−1, 1], with per-query distributions that make score normalisation fragile. Appearing in both lists roughly doubles a document's fused score — consensus is rewarded automatically. Lower `k` (10–40) sharpens top-rank differences when one retriever is known-stronger. RRF is shipped natively by Elasticsearch, OpenSearch, Qdrant, Weaviate, Vespa and Azure AI Search; in a SQL stack it is ~15 lines over two `LIMIT k` result sets. +- **Weighted / alpha fusion** — `α·dense + (1−α)·sparse` over normalised scores (Pinecone's model; Weaviate's relative-score fusion is a variant). More expressive, but needs per-corpus calibration and silently breaks when either retriever changes. Best practice: start with RRF; move to weighted only when a golden set can tune α per query class, and pin the fusion type explicitly across upgrades (Weaviate changed its default fusion in v1.24 — the cautionary tale). +- Rule-of-thumb gains quoted across the field guides: hybrid over best single leg ≈ **+5–15% nDCG / +8–15 points Recall@10** on mixed-intent corpora, at ~10–20 ms added latency. **[Directional, per-source; measure on Atlas's golden set.]** + +### The two in-between signals + +- **SPLADE** (Formal et al., 2021) — *learned sparse* retrieval. A BERT-style MLM head emits a weight for every vocabulary term (~30k), including terms not present in the text, so a document about "connection reset" also lights up *drop* and *socket*. The output is still a sparse vector served from an ordinary inverted index: most of dense's paraphrase handling with BM25's infrastructure and exact-match behaviour. Costs: an encoder pass at indexing time, larger posting lists. fastembed-rs exposes it as `SparseTextEmbedding`; BGE-M3 emits an equivalent learned-sparse vector natively. +- **ColBERT / late interaction** (Khattab & Zaharia, 2020; ColBERTv2, 2022) — every token gets its own embedding; relevance is MaxSim over query-token × document-token pairs. Quality sits between bi-encoders and cross-encoders (BEIR nDCG@10 ≈ 0.50 vs BM25 ≈ 0.43, SPLADEv2 ≈ 0.47 in the cited decomposition), at 10–100× bi-encoder compute. Production placement is as a **mid-stage reranker over the top ~100**, not a first-stage retriever; ColBERTv2's centroid+residual compression brings storage to ~20–36 bytes/token-vector. Jina's `jina-colbert-v2` (137M, Apache 2.0) is the small open option. + +### Metadata filtering — the unglamorous multiplier + +Filtering (source, document type, time range, sensitivity tier, tenant) should be a *first-class part of the query plan*, not a post-filter over an already-truncated top-k (post-filtering starves recall: the ANN returns k results, the filter discards most, and relevant items ranked k+1 never surface). Patterns: + +- **Pre-filter** where the engine supports filtered ANN (libSQL's exact-scan path supports arbitrary `WHERE` naturally; the DiskANN `vector_top_k` path needs over-fetch + join, with the over-fetch factor tuned per filter selectivity). +- **Partitioned indexes** — separate indexes/collections per source or tier, with the query planner routing (§4) — filtering becomes routing. +- In Atlas's case the sensitivity tier is also a *security* boundary (the #10412 tier machinery): a filter that is merely post-hoc is a leak risk if any consumer path forgets it; tier enforcement belongs in the retrieval layer itself. + +**Relevance to Atlas:** Atlas already has the two base legs (FTS5 + libSQL vectors). The ordered upgrades are: (1) verify fusion is RRF with a tuned `k` and per-leg depth, measured; (2) add metadata pre-filtering tied to source/tier; (3) evaluate a learned-sparse leg (SPLADE via fastembed, or BGE-M3's sparse head if the embedding evaluation in §1 favours it) — only if the golden-set failure taxonomy shows paraphrase-miss failures that BM25+dense both miss. + +--- + +## 3. Reranking — the precision stage + +### What it is + +A **cross-encoder reranker** scores each (query, document) pair jointly through a transformer — no pre-computed vectors, full attention between query and text. It is far more precise than bi-encoder cosine and far too slow to run over a corpus, so the universal pipeline shape is: + +``` +retrieve (hybrid, top 50–200) → fuse → cross-encoder rerank → top 5–20 +``` + +The reranker can only reorder what retrieval found; it fixes *precision* (positions 1–5), never *recall*. Typical quoted gain over the fused bi-encoder ranking: **+5–15 nDCG@10**. Latency: roughly 50–500 ms for a top-100 pool on CPU depending on model size; ~50–150 ms for 20 candidates with a mid-size model on CPU in the cited local deployments. + +Sources: [Reranking & cross-encoders guide (2026)](https://localaimaster.com/blog/reranking-cross-encoders-guide), [hybrid field guide](https://www.aiagentichandbook.com/blog/hybrid-search-and-reranking-field-guide/), [local RAG reranker measurements](https://www.bigiron.cc/guides/adding-a-reranker-to-local-rag-when-a-cross-encoder-pays-for-itself). + +### Leading models + +| Model | Params | License | Notes | +|---|---|---|---| +| **BGE-Reranker-v2-m3** (BAAI) | 568M | MIT | The default open pick: multilingual (100+), 8,192-token pairs, strongest quality/size balance (MTEB-rerank ≈ 60.4 in cited table). ONNX INT8 ports ~570 MB. Scores are unbounded logits — normalise within the pool before blending with other signals. | +| **Jina Reranker v2 base multilingual** | 278M | Apache 2.0 per cited table; **note:** some deployments report CC-BY-NC terms for earlier Jina reranker releases — verify the current model card before redistributing **[unverified — licence history is inconsistent across sources]** | Latency-critical pick; half the size of v2-m3, slightly lower quality (≈56.8). Ships custom modelling code (`trust_remote_code`) — matters for the candle route below. | +| BGE-Reranker-v2-Gemma / -MiniCPM | 9B / 2.7B | Apache 2.0 | Top-of-leaderboard quality when GPU latency budget exists (≈64.5 / 62.3). | +| mxbai-rerank (large/base/xsmall) | 435M / 184M / 33M | Apache 2.0 | English fast tier; xsmall is the edge option. | +| gte-reranker-modernbert-base (Alibaba) | 149M | — | Best accuracy/size ratio in one cited production stack; 8,192 context, INT8 ≈150 MB via fastembed. | +| **Cohere Rerank 3 / 3.5** (hosted) | closed | API | The commercial reference point: 4K+ context, 100+ languages, ≈62.0 in the cited comparison table; Voyage rerank-2.5 is the other hosted reference. Useful as an *offline quality ceiling* to measure a local reranker against on the golden set, even if production stays local. | + +### Local inference routes (Rust-first) + +- **fastembed-rs (`TextRerank`)** — the main Rust route: ONNX Runtime via `ort`, tokenizers via HF `tokenizers`, synchronous API (no Tokio dependency). Supports bge-reranker-base (default), **bge-reranker-v2-m3**, jina-reranker-v1-turbo-en and v2-base-multilingual out of the box, plus user-defined ONNX models. Models cache to `./.fastembed_cache` (`FASTEMBED_CACHE_DIR`). +- **candle** (HF's pure-Rust framework) — the alternative when ONNX Runtime is a liability: prebuilt `ort` binaries assume AVX-class CPUs and have SIGILL-crashed on older NAS CPUs in a documented deployment, which moved that project to candle with runtime CPU-feature dispatch. Caveats: candle needs a *standard* architecture implementation — bge-reranker-v2-m3 is a plain `XLMRobertaForSequenceClassification` and ports; jina-reranker-v2's custom code does not. fastembed itself uses candle as the backend for its Qwen3 embedding/reranker features, so the two routes coexist in one crate. +- **Serving shape:** in-process library for a CLI/local tool; a small HTTP inference service (embed + rerank endpoints) when several consumers (fleet, ID, MCP server) should share one warm model instead of each loading ~0.5–1 GB. + +Sources: [fastembed-rs README](https://github.com/anush008/fastembed-rs/blob/HEAD/README.md), [fastembed docs.rs](https://docs.rs/fastembed/latest/fastembed/), [candle-vs-ONNX ADR](https://github.com/huulanka/hippocampus/blob/HEAD/docs/adr/0008-candle-not-onnxruntime.md). + +### Trade-offs & placement rules + +- **Pool size is the latency knob:** reranking top-10 was ~3× faster than top-30 in local measurements with no quality loss in that corpus; top-50–100 is the common production compromise. Tune pool size on the golden set, not by feel. +- **Rerankers can hurt:** in the cited homelab measurement, two of four rerankers scored *below* plain hybrid retrieval on that corpus, and the largest was both slowest and worse. The lesson is procedural: a reranker is adopted per-corpus on golden-set evidence, never on leaderboard standing alone. +- **Blend, don't replace (optional):** some stacks min-max-normalise reranker scores within the pool and blend with the fused score rather than taking the reranker's order wholesale — protects against reranker pathologies on out-of-distribution queries. + +**Relevance to Atlas:** Atlas's pipeline (per the parent survey) fuses FTS + vector; a cross-encoder stage over the fused top-N is the single highest-expected-value quality addition, and fastembed-rs's v2-m3 support makes it a same-language, in-process change. The golden set decides pool size and whether blending beats pure rerank order. + +--- + +## 4. Query planning & understanding + +### What it is + +Query planning is everything that happens between the raw user/agent query and retrieval: deciding *what* to search, *where*, and *in what form*. Production systems structure it as a small planner with a fast classification step and conditional transforms — not as "always run every trick," because each transform costs an LLM call and latency. + +### The component techniques + +- **Conversational rewriting** — resolve pronouns/ellipsis against session history into a standalone query. Near-universal in chat-shaped interfaces; for Atlas, this is what makes multi-turn fleet/ID agent sessions searchable ("that file from before" → a real query). +- **Query expansion** — add synonyms/related terms (LLM-generated, or pseudo-relevance feedback from a first retrieval pass). Helps lexical legs most; dense legs already model some synonymy. +- **Multi-query / RAG-Fusion** — generate 3–5 query variants, retrieve for each, merge with RRF. Directly reuses Atlas's existing fusion machinery on the query side. +- **HyDE (Hypothetical Document Embeddings)** — Gao et al. 2022 (arXiv:2212.10496): an LLM writes a hypothetical *answer document*; embed that instead of the query, retrieve real documents near it, discard the fake. Fixes query–document asymmetry for short/vague queries. Cost: one generation + the risk that a hallucinated hypothesis drags retrieval off-topic; gate it to underspecified queries. +- **Decomposition** — split a multi-part/multi-hop query into sub-queries, retrieve per sub-query, merge. The only way conjunctive questions ("X and how it interacts with Y") retrieve both halves. +- **Step-back prompting** — add a higher-level conceptual query alongside the specific one; pairs with decomposition for analytical questions. +- **Routing** — classify the query and send it to the right index/collection/filter set: by source (code vs notes vs sessions), by intent (exact-identifier lookup → BM25-heavy; conceptual → dense-heavy), by sensitivity tier. In multi-collection systems this is the highest impact-per-cost component: a fast classifier (<10 ms, small model or rules) gates everything downstream. +- **Structured filter extraction** — parse dates, sources, authors, types out of natural language into metadata filters (§2) instead of leaving them as embedding fodder: "the deploy doc from October" → `source=… AND created_at∈October` + a much shorter semantic query. +- **Classification / intent detection** — the planner's switchboard: factoid → direct retrieval; ambiguous/short → HyDE or expansion; multi-part → decomposition; conversational → rewrite first; non-retrieval intents → skip search entirely. + +### How production systems structure the planner + +The reference shape from the surveyed production patterns: + +``` +query → classify (fast, <10 ms) → route + select transforms conditionally + → retrieve per (sub-)query from routed collections + → fuse (RRF) → rerank → answer/return +``` + +With two disciplines on top: **adaptive selection** (DMQR-RAG's contribution: choose the rewriting strategy per query rather than stacking all of them — stacking multiplies latency and can compound errors), and **per-strategy evaluation** (each transform is an experiment gated on the golden set, sliced by the query class it targets — HyDE should win on short queries and is allowed to lose, unused, elsewhere). + +Sources: [Pre-retrieval optimization survey](https://github.com/mehmetaliyilmaz0/ragfactory/blob/HEAD/research/pre-retrieval-optimization-techniques.md), [Agentic RAG pattern catalog](https://www.neurals.ca/agents/agentic-rag/pattern-catalog/), [Query rewriting chapter](https://www.kunwar.page/chapter/063-query-rewriting-hyde-multi-query-query-decomposition). + +**Relevance to Atlas:** Atlas's consumers are increasingly *agents* (fleet, ID, MCP clients) whose queries are conversational, multi-part, and source-specific — exactly the traffic a planner exists for. The minimal viable planner for Atlas is routing + filter extraction + conversational rewriting (all cheap, no generation); HyDE and decomposition are second-wave, golden-set-gated additions for the query classes that measurably fail today. + +--- + +## 5. Recommender systems for a personal corpus + +### What changes in a single-user system + +Classic collaborative filtering ("users who liked X also liked Y") needs many users. A personal corpus has **one user but rich behavioural exhaust**: search sessions, opens/clicks, dwell, saves, re-finds, and the documents' own structure (provenance, co-occurrence in sessions, graph links). The realistic recommender is therefore **content-based + session-based + recency-aware**, with collaborative machinery repurposed: "items that co-occur" means items that appear together in *this user's sessions, projects, and time windows*, not across users. + +### The signal inventory (all available to Atlas) + +- **Content similarity** — the embedding index itself: user profile = weighted centroid of embeddings of documents the user opened/saved/searched-for, weights decaying with age. This is "more like what I've been working on" with zero new infrastructure. +- **Session co-occurrence** — item-to-item collaborative filtering over sessions: documents opened or cited in the same session/task are related *for this user*, even when their text isn't similar (a spec and the incident log it caused). Precompute item→item neighbours offline from session logs; this is the strongest single-user analogue of Amazon's item-to-item CF. +- **Recency & frequency** — trending-in-my-corpus: recent opens, repeated re-finds (a document the user keeps returning to is a hub), and fresh ingest (new documents matching active interests should surface before they are ever searched for). +- **Graph signals** — provenance/occurrence links (Atlas's CAS + occurrence model; ID-graph edges where #6062 lands): neighbours of known-relevant documents, documents sharing rare chunks/entities. + +### Architecture: the same three stages as search + +Production recommenders and production search have converged on one shape — **candidate generation → ranking → re-ranking** — which means Atlas's recommender can reuse its search stack: + +1. **Candidate generation (recall):** union of cheap nominators — embedding kNN against the user-profile vector, item-to-item neighbours of recent items, recency/popularity within active sources, graph neighbours. Each nominator is biased; the union covers the biases. +2. **Ranking (precision):** score candidates with the richest affordable model — for Atlas, the same cross-encoder reranker (§3) with the "query" being a profile/session summary, or a learned model over features (similarity, recency, co-occurrence count, source). +3. **Re-ranking (the surface):** enforce what raw relevance ignores — **diversity** (MMR: penalise near-duplicates of already-picked items), **freshness quotas**, deduplication against already-seen, and exploration slots (a small ε of deliberately novel items, without which the system collapses into a filter bubble of the user's last topic). + +### Two-tower models — where they fit and where they don't + +A two-tower model trains a user tower and an item tower into a shared embedding space so retrieval is kNN of the user vector. It is the right tool at multi-user scale. For a single user it is usually **overkill as a trained model** — there is one user vector to learn — but the *pattern* is exactly Atlas's content-based profile above: the "user tower" is a hand-built, decaying weighted average of item embeddings, and it can be upgraded later (learned weights per source/signal) without changing the serving shape. Sequential models (SASRec/BERT4Rec-style, "what's next in this session") become interesting only with long, dense session logs. **[Judgement call, not a sourced benchmark claim.]** + +### What it can realistically do for Atlas + +- **"More like this"** on any document/session (pure embedding kNN + tier filter) — day one. +- **Related results** alongside search: session-co-occurrence neighbours of the top hits. +- **A "resurface" feed:** documents matching active interests that were recently ingested or recently became relevant (new link, new occurrence), ranked with recency + profile similarity + MMR diversity. +- **Search assistance:** query suggestions and zero-result recovery from profile + co-occurrence ("people — i.e. you, last month — also needed…"). +- Evaluation mirrors search: precision@k / NDCG on held-out sessions (predict the held-out opens of a session from its first half), plus coverage/diversity measures so the recommender doesn't just echo search. + +Sources: [Recommendation engine architecture](https://gortex.ai/blog/recommendation-engine-architecture), [Recommender systems lesson](https://chaduvuko.com/learn/ai-ml/classical-ml/recommender-systems). + +**Relevance to Atlas:** Atlas already logs the raw material (searches over 18k sessions) and already owns every stage of the serving stack; the recommender is primarily a *logging + offline neighbour computation + one blended surface* project, not a new ML platform. Its outputs also feed back into search as behavioural ranking signals (§1, layer 4) — the two systems should be designed as one loop. + +--- + +## 6. Evaluation — golden sets, metrics, and regression gating + +### What it is + +Search quality is invisible without measurement: every change in §§1–5 (model swap, fusion change, reranker, planner transform) silently shifts results. The discipline that makes iteration safe is a **frozen golden set + per-stage metrics + a CI gate that blocks regressions**. + +### The golden set + +- A set of real queries, each labelled with its relevant documents/chunks and **graded relevance** (e.g. 0–3: irrelevant / somewhat / relevant / exact). 50–200 query–document pairs is the commonly cited starting size; quality of labels beats quantity. +- Build it from **real production traces** (Atlas: real fleet/ID/user searches), and harvest gold contexts from real retrieval runs — the documented failure mode is a golden set built from hand-picked chunks the live retriever never surfaces, which read 0.91 recall offline against 0.40 in production. +- Include **no-answer probes** (queries with an empty relevant set) to measure noise/threshold behaviour, plus adversarial slices: keyword distractors (same words, different meaning), semantic twins (same meaning, different words), alias-only matches, and long-document probes (relevant fact buried at the end). +- Grow it by **error analysis**: open-code real failures, group into a failure taxonomy, stop at saturation; prefer binary pass/fail judgements where graded labels create annotator drift. Every production failure that gets fixed becomes a golden-set entry — the set is a regression suite, not a benchmark poster. + +### Metrics — pick per stage, per failure mode + +| Metric | What it rewards | Use for | +|---|---|---| +| **Recall@k** | gold doc anywhere in top-k | First-stage retrieval ceiling — a miss here is unrecoverable downstream. The must-pass gate for retriever changes. | +| **Hit rate@k** | at least one relevant in top-k (binary per query) | Single-answer corpora; simplest starting metric. | +| **MRR** | rank of the *first* relevant result (mean of 1/rank) | Single-right-answer tasks; reranker top-of-list quality. | +| **nDCG@k** | graded relevance, position-discounted, normalised to ideal ordering | The workhorse for multi-relevant ranking and reranker comparison. | +| **Precision@k** | share of top-k that is relevant | Context-noise / token-budget control. | + +The senior pattern: evaluate **retrieval and ranking separately** (recall@k for stage 1, nDCG/MRR for the reranked order), so a failure localises to a stage instead of grading the pipeline as one black box. + +### Offline vs online, and the CI gate + +- **Offline** (the gate): frozen golden set, run in CI on *every* embedding-model, chunker, parser, fusion, reranker, or planner change; fail the build if any gated metric regresses past a set margin against the frozen baseline. Embedding swaps are the highest-risk change class and should never ship on "the new model is better on MTEB" alone. +- **Online** (the check): shadow/canary evaluation on real traffic, watching long-tail behaviour — offline sets over-sample easy queries and can flatter a change that collapses the tail. For a personal system, "online" is lightweight: log real queries + clicks, periodically mine them for failures, fold them into the golden set. +- Tooling shapes worth copying: a small eval runner that boots the *same* retrieval stack the server uses (no transport, no reimplementation), prints a per-configuration metrics table, and is invoked identically locally and in CI — the Kioku MCP-server eval harness is a worked example at personal-corpus scale. + +Sources: [RAG evaluation — metrics & golden sets](https://www.dataaihub.co/learn/retrieval-evaluation), [RAG engineer evaluation notes](https://github.com/landedjobs/rag-engineer-interview-questions/blob/HEAD/content/05-rag-evaluation.md), [Kioku retrieval evaluation](https://kioku.sandovaldavid.com/retrieval-eval.html). + +**Relevance to Atlas:** Atlas already has a golden set — the program risk is not its absence but its *coverage and gating*: whether it slices by source and query class (so planner/reranker changes can be judged per class), whether it gates CI for the fleet/ID consumers, and whether real fleet/ID query failures flow back into it. Every other section of this survey should be read as "adopt only where this section's machinery shows a win." + +--- + +## 7. Incremental ingest & indexing + +### What it is + +Keeping the index in agreement with a corpus that never stops changing, without re-processing what didn't change. Four sub-problems: change detection, dedupe, embedding versioning, and deletion. + +### Change detection: CDC over crawl, and the cost ladder + +- **Change-data-capture first:** subscribe to the source of record's change feed (database logical replication / WAL, filesystem events, API webhooks, git commits) rather than re-crawling; keep a periodic full reconciliation crawl as the safety net for what CDC missed. This converts ingest from batch-shaped to stream-shaped and is what makes minute-level freshness affordable. +- **The detection ladder** (stop at the first proof of no-change): (1) metadata compare — size/mtime/etag from a listing, no file read; (2) content hash — one streaming SHA-256 pass; identical hash after a touch/resave → update metadata, skip; (3) full process — parse → chunk → embed → upsert. Store per document: `external_id, size, mtime/etag, content_hash, parser_version, chunking_config_version, embedding_model_version, last_processed_at`. +- **Chunk-level hashing** is the big win for large documents: hash each chunk's text and re-embed only changed chunks — a one-paragraph edit to a 200-page manual re-embeds one chunk. +- **Config-driven reprocessing:** if any stored version (parser / chunking / embedding model) ≠ current, the document needs reprocessing *even if its hash matches* — as a separate, explicit, rate-limited job, never as a surprise inside the incremental path. + +### Content-addressed dedupe + +Atlas's CAS design is the textbook shape: the content hash *is* the identity. Exact dedupe falls out (identical normalised text → identical hash → one stored object, many occurrences — the #3125 chunk_occurrences model). For **near-duplicates** (drafts, template variants, format twins like a PDF and its HTML export), exact hashing is blind; the standard ladder is MinHash/LSH over shingles to nominate candidate pairs, confirmed by real similarity (or embedding cosine) before merging — and dedupe *within a scope*: two near-identical documents from different sources/regions may both be legitimately needed, distinguished by metadata. + +### Embedding versioning — the model-upgrade pattern + +Model upgrades are the one event that genuinely requires re-embedding everything (vectors across models are incomparable; mixing them degrades results silently). The production pattern: + +1. Tag **every stored vector with its `model_id`** (+ dimension + chunking version) — Atlas already keys its derived index by content hash + model_id, which is this pattern. +2. Run the new model into a **shadow index** (new table/collection), backfilled incrementally with the dedupe cache suppressing unchanged chunks. +3. **Cut over on an eval result, not on completion:** run the golden set (§6) against both indexes; flip reads when the new index wins or ties with acceptable cost; keep the old index until the flip is proven, then drop it. +4. A **two-tier variant** for freshness during long backfills: a stable base index + a small continuously-updated delta index, queried together and fused, with the delta merged into base on a schedule. + +### Sharding, tenancy, and deletion + +- **Sharding by source/tenant** maps naturally onto Atlas: per-source (or per-tier) tables/collections in libSQL, routed by the query planner (§4). Benefits: independent re-indexing, tier isolation as a security property, per-source freshness SLAs. Cost: cross-shard queries need federation + fusion (RRF again). +- **Deletion is the hard part:** vector indexes tombstone rather than truly delete; recall degrades and memory doesn't return until compaction. Track the tombstone ratio and compact on it, not on a calendar. In a CAS design, deletion is reference-counted: removing an occurrence must not remove an object other occurrences still reference — and the sensitivity-tier machinery adds a second deletion class (purge-for-policy) that must reach the derived indexes, the FTS index, and any recommender neighbour tables, not just the source store. + +Sources: [Change detection ladder](https://www.mnsai.io/learn/06-rag/apply/1-ingestion-parsing/change_detection), [Freshness & incremental re-embedding](https://vfaraji89.github.io/applied-ai-simplified/problems/incremental-re-embedding/), [Embedding pipelines at scale](https://scalablebook.icsgen-ai.org/part-8-case-studies/module-40-case-distributed-llm-agentic/section-40.3.html), [Incremental ingestion guide](https://medium.com/@priyanshigupta1701/stop-re-embedding-everything-a-step-by-step-guide-to-incremental-ingestion-359a447f3ae5). + +**Relevance to Atlas:** Atlas's CAS + hash-keyed derived index already implements the strongest parts of this pattern; the planning gaps are (a) CDC-style automatic ingest per source (vs batch runs), with the ladder + reconciliation crawl per connector, (b) a written shadow-index cutover procedure so the next embedding-model evaluation (§1) is routine rather than a project, and (c) tombstone/compaction + purge propagation across FTS, vector, and recommender tables as one designed operation. + +--- + +## 8. Programmatic access — MCP, APIs, and fleet/ID/agent consumers + +### MCP for search — the protocol surface + +The Model Context Protocol (Anthropic, Nov 2024; now under the Linux Foundation's Agentic AI Foundation as of Dec 2025 **[per secondary sources]**) is JSON-RPC 2.0 with three server primitives: + +- **Tools** — model-callable functions with JSON-Schema inputs (`search_docs`, `read_section`, …), annotated (read-only / destructive hints) and, since 2025-06-18, able to return structured output. +- **Resources** — URI-addressed read-only data (`file:///…`, `db://…`) the host app reads/subscribes to; resource templates parameterise them. +- **Prompts** — user-invoked templates surfaced as commands. + +Transports: **stdio** (local subprocess — the personal/local-first default) and **Streamable HTTP** (remote; replaced the deprecated HTTP+SSE transport in the 2025-03-26 revision). The **2025-06-18** revision made servers OAuth 2.1 resource servers (RFC 9728 metadata, RFC 8707 resource indicators binding tokens to one server), added elicitation and structured tool output, and dropped JSON-RPC batching. A **2025-11-25** revision and a **2026-07-28** stateless revision (no `initialize` handshake, `server/discover`) are reported by secondary sources — **[verify against modelcontextprotocol.io before designing against them]**; the safe design target today is 2025-06-18 compatibility with no reliance on protocol sessions. + +Sources: [MCP (Masst docs)](https://docs.masst.dev/ai/edges/mcp), [MCP term guide](https://www.aiagentichandbook.com/terms/mcp/), [MCP security guide](https://apexlytech.com/blog/model-context-protocol-crm-erp-security). + +### Existing search-MCP shapes worth copying + +- **The docs-search pattern** (small, production-shaped): four tools — `list_documents`, `search_docs` (query + limit → ranked sections with scores and snippets), `read_section` (by stable id), and optionally `answer_question` (RAG over top-k with citations, using MCP sampling when the client offers it, else returning citation-ready context). Tools return *references + snippets*, not full content; full text is a separate read. This two-step (search → read) keeps agent context windows clean and maps exactly onto Atlas's chunk/occurrence model. +- **Tool-based resource discovery at scale:** enterprise MCP guidance is explicit that hosts should discover via search tools rather than enumerating resources — a corpus of 100k+ chunks must never be a `resources/list`. +- **Security posture from the spec ecosystem:** tool descriptions are untrusted input to the model; tokens are audience-bound and never passed through; a human can deny tool calls. For Atlas, the load-bearing point is §2's: **sensitivity-tier enforcement lives in the retrieval layer behind the tool**, so no MCP client behaviour can widen access. + +### REST/gRPC APIs and CLI consumers + +MCP is the agent-facing surface, not the only surface. The conventional trio: + +- **MCP (stdio + Streamable HTTP)** for LLM hosts/agents (Claude, Cursor, mcpx-wired consumers — Atlas's MCP is already live per the parent survey). +- **REST/JSON** for scripts, services, and the ID/fleet backends: `POST /search` (query, filters, limit, explain flag), `GET /documents/{id}`, `POST /similar`, `POST /recommend`. Versioned, with the response carrying per-result signal provenance (which legs matched, reranker score) behind an `explain` flag — debugging search quality without it is guesswork. +- **CLI** (`fleet search` is the existing consumer shape) as the human + scripting surface over the same API — never a separate implementation. + +### How consumers typically integrate + +- **Caching:** query-result caching keyed by (normalised query, filters, index version) with short TTLs at the consumer or a shared cache; embedding caching by content hash at the producer (already Atlas's model). Cache invalidation rides the index version from §7's versioning — a cutover bumps the version and stale entries die naturally. +- **Batching:** batch embed at ingest (the embedding service boundary: continuous batching behind one service, not library calls scattered through ingest code); batch search endpoints for eval/recommender jobs. +- **Offline fallback:** for local-first consumers (fleet CLI on the laptop, ID nodes), an embedded replica of the libSQL database is the structural answer — libSQL's embedded-replica mode syncs a local file from a remote sqld/Turso primary, so the same SQL (FTS5 + `F32_BLOB`/`vector_top_k`) runs offline and online with no code change. This is also why the libSQL-native vector path beats the `sqlite-vec` extension path for Atlas's consumers: loadable extensions cannot be used over remote sqld connections, while native vectors behave identically local, self-hosted, and hosted. +- **Capability discipline (Atlas/ID-specific):** MCP's own auth is young and tool hints are advisory. In the ID design language, an Atlas MCP server should sit *behind* the capability layer — calls arrive holding a capability, tier checks happen server-side in retrieval, and the API/MCP surfaces are views over one retrieval core, not parallel implementations. + +Sources: [libSQL vector search walkthrough](https://layerbase.com/blog/libsql-relational-and-vector-database), [Turso native vector search](https://turso.tech/blog/turso-brings-native-vector-search-to-sqlite), [libSQL migration issue (docs-mcp-server #435)](https://github.com/arabold/docs-mcp-server/issues/435), [docs-search MCP example](http://glama.ai/mcp/servers/erickmacielsoto/mcp-server-example). + +**Relevance to Atlas:** Atlas already has the hardest piece (a live MCP server wired into mcpx). The planning work is convergence: one retrieval core serving MCP + REST + CLI with identical ranking, index-version-aware caching for fleet/ID consumers, embedded-replica offline search for laptop/ID nodes, and capability/tier enforcement in the core so every surface inherits it. + +--- + +## Cross-cutting takeaways for the planning prompt + +1. **The base is fine; the layers are the program.** Arctic Embed 2.0 is competitive per parameter; Atlas's quality roadmap is hybrid completeness (RRF tuning, metadata pre-filtering, a possible learned-sparse leg), a reranker stage, and a query planner — in that order, each golden-set-gated. +2. **One stack, three surfaces.** Search, recommender, and "more like this" are the same candidate→rank→re-rank pipeline with different candidate nominators; MCP, REST, and CLI are the same retrieval core with different transports. Design them as one system or maintain them as three. +3. **Evaluation is the licence to change anything.** Golden-set coverage by source/query class + CI gating is what turns §§1–5 from opinions into a sequence of safe, reversible steps — including the embedding-model question, which should be settled by a shadow-index bake-off on Atlas's own set, not by MTEB. +4. **Ingest is a streaming system with a batch safety net.** Per-source CDC + the metadata→hash→process ladder + chunk-level hashing; model upgrades via shadow index + eval-gated cutover; deletion/purge as one designed operation across CAS, FTS, vector, and recommender tables. +5. **Local-first Rust routes exist for every layer** — fastembed-rs (embeddings incl. BGE-M3 triple output and SPLADE, reranking incl. v2-m3), candle where ONNX Runtime is a liability, libSQL native vectors + FTS5 in the store Atlas already runs. No layer requires a hosted service; hosted rerankers (Cohere/Voyage) are useful only as offline quality ceilings. +6. **Security is a retrieval-layer property.** Sensitivity tiers and (for ID) capabilities must be enforced inside the retrieval core, pre-filtered rather than post-filtered, so that MCP/API/CLI consumers — present and future — inherit them by construction. diff --git a/doc/2026-11-23T23-45-44Z_research_atlas-investigation/research-sources-consumers.md b/doc/2026-11-23T23-45-44Z_research_atlas-investigation/research-sources-consumers.md new file mode 100644 index 000000000..f80cd464d --- /dev/null +++ b/doc/2026-11-23T23-45-44Z_research_atlas-investigation/research-sources-consumers.md @@ -0,0 +1,518 @@ +# Atlas — Data Sources & Consumers Inventory + +Research for the Atlas program-planning prompt. Compiled 2026-11-23 from +first-hand `gh api` reads of developing-today/code issues and repo docs, the +hatch-personal `workspace/turso-atlas/` operational docs, and the two prior +research files — cross-referenced, not duplicated: + +- ID/Atlas current state: `~/workspace/id-investigation/research-id-state.md` §5 + (Atlas definition, [#3125](https://github.com/developing-today/code/issues/3125) + provenance direction, [#10412](https://github.com/developing-today/code/issues/10412) + secret-tier review, [#6062](https://github.com/developing-today/code/issues/6062) + ID-publication format, [#9109](https://github.com/developing-today/code/issues/9109) Part C). +- Embedding/vector technology options: + `~/workspace/id-investigation/research-tech.md` §5. + +Program homes: [#8983](https://github.com/developing-today/code/issues/8983) +(epic: Atlas program — unified search and memory index over every corpus, +OPEN; ~57–68 open `epic/atlas-program` issues) and +[#6018](https://github.com/developing-today/code/issues/6018) (Atlas ingestion +program, OPEN). Drew's standing decision, recorded on +[#1300](https://github.com/developing-today/code/issues/1300) and implemented by +[#8567](https://github.com/developing-today/code/issues/8567) (closed): +fleet/agent memory integrates **into Atlas** — one queryable surface across all +agents/corpora, no new standalone vector store, no per-agent silos. + +**Headline state (verified on [#9097](https://github.com/developing-today/code/issues/9097), +2026-11-12): ingestion today is manual/script-driven.** The only Atlas schedule +on the laptop is the daily backup timer. Canonical counts are frozen at the +2026-10-31 publish — 18,325 sessions / 122,124 messages / 107,639 chunks — +while the Turso monolith has since grown to ~7.3 GB without a verified recount. +The staging tier and promote gate exist in code; the aggregator/embedder and +session-close hook slices are not built. Everything in §2 below is therefore +mostly *designed or filed*, not running. + +--- + +## 1. Sources already in Atlas + +### 1.1 The ingest pipeline as it exists + +Per the operational README (`dezren39/hatch-personal:workspace/turso-atlas/README.md`): + +1. **Collect** — `scripts/atlas-ingest.py` (hatch-personal + `workspace/turso-atlas/scripts/`) runs on any machine (sandbox VM, Framework + laptop, work Mac). Each AI client keeps conversations in a default on-disk + location; the script has **per-client adapters + a per-machine + `locations.json`** and reads those stores. Nothing is uploaded by this step. +2. **Normalize** — every conversation becomes one shape in a local SQLite file + `data/atlas.db`: sessions → messages → chunks (~3,500 chars, deduplicated + by content hash), plus `source_roots`, `chunk_occurrences` (every observed + location of a chunk, with span and how the occurrence was established), and + a `cas_registry` for content-addressed source locators. Re-ingest is + idempotent for already-recorded occurrences. **This file is the durable + asset**; everything else rebuilds from it + the sources. +3. **Index** — built locally from the chunks: FTS5 keyword index (in atlas.db) + + per-model vector sets (~768-dim embeddings). Vectors are explicitly + *derived and disposable*; a better model means building a second vector set + beside the first from the same chunk text, never re-collecting. +4. **Publish** — a *copy* of the hot index (keyword + current-best vectors over + the most valuable chunks) is pushed to Turso, plus coordination/session + DBs. Turso is distribution only; the full store stays on the laptop and + Turso never holds the only copy of anything. +5. **Access** — the `atlas-search` CLI (§3.4). + +Storage shape (per [#6018](https://github.com/developing-today/code/issues/6018), +verified 2026-11-04): 31 TursoDB shards — internal tier = 28 shards / +107,001 chunks; secret tier = exactly 1 shard / 638 chunks, with secret +material supposed to exist **only** in the 2 secret DBs (but see §4.3 — that +boundary is currently breached in the monolith). Production monolith stays +libSQL; TursoDB for all new databases; cold tiers → rustfs. Spend anchor: +Turso scaler $24.92/mo yearly is the plan ceiling. + +### 1.2 Source classes actually feeding the corpus + +| Source | Evidence | Volume signal | Ingest path today | Freshness | +|---|---|---|---|---| +| **AI chat/session corpora** — the founding corpus. Client adapters read on-disk conversation stores; the session-logs class in the ingestion-operations design names **OpenCode session store** and **Muse session transcripts** explicitly (`doc/2026-11-09T05-12-00Z_design_atlas_ingestion_operations`, §2 table) | turso-atlas README step 1; #6019 design doc §2 | The whole canonical count: 18,325 sessions / 107,639 chunks (2026-10-31) | Manual/script-driven runs of `atlas-ingest.py` per machine; designed trigger is event-driven (session end / file close stages finalized sessions only) — the session-close hook is **not built** ([#9097](https://github.com/developing-today/code/issues/9097)) | Frozen at 2026-10-31 publish; no verified recount since | +| **ChatGPT export** | [#3125](https://github.com/developing-today/code/issues/3125) phase-2 backfill records (2026-11-23): the ChatGPT export's CAS hash matches the October design record; the backfill interned 12,092 files (~2.6 GB) into the Atlas CAS with `ATLAS-EXTRACTS VERIFY OK` | Part of the 12,092-file backfill | One-shot export file, interned content-addressed under #3125 phase 2 (hatch-personal PR #67 added `--files-from` interning) | Point-in-time export; no automatic refresh path | +| **GitHub issue/PR comments — all own repos** | [#6023](https://github.com/developing-today/code/issues/6023) **CLOSED**: "extract the GitHub corpus — all issue/PR comments from all our repos; external set gated on licensing"; writer landed: [#10688](https://github.com/developing-today/code/issues/10688) **CLOSED** "GitHub comments ingestion writer + extraction feed"; atlas-core ships an `atlas-github-comments` binary (`pkgs/atlas-search/crates/atlas-core/src/bin/atlas-github-comments.rs`) | All comments across Drew's repos (org census: 102 admin orgs — count from fleet program records) | Extraction feed + ingestion writer exist; *continuous* re-extraction is part of open [#9097](https://github.com/developing-today/code/issues/9097) item 2, not a running schedule | First pass done; continuous updates not running | +| **Code / config artifacts** | [#10788](https://github.com/developing-today/code/issues/10788) **CLOSED**: "stage code/config artifacts as embedding entries — item writer + atlas-stage ingest"; [#6025](https://github.com/developing-today/code/issues/6025) **OPEN**: first-pass corpus — all code repos, all findable docs, dezren39/cairn | All code repos (first pass still open) | Staged via `atlas-stage`; the full first-pass corpus task (#6025) remains open | Partial | +| **Query traces / statistics & reports class** | [#8246](https://github.com/developing-today/code/issues/8246) / [#10364](https://github.com/developing-today/code/issues/10364) **CLOSED**: trace ingestion + retention as statistics-and-reports corpus; [#10418](https://github.com/developing-today/code/issues/10418) **CLOSED**: statistics aggregation + weekly report from traces; atlas-core has `trace_ingest.rs` / `trace_stats.rs` | Atlas's own query traces | Built into atlas-core | Landed | +| **Boot / reboot records, statistics snapshots, generated reports** | Designed source classes with triggers and inclusion tests in the #6019 operations design (`doc/2026-11-09T05-12-00Z_design_atlas_ingestion_operations` §2): boot records from `~/logs/init.jsonl` + init-status records per fleet host (event-driven on boot-completion); statistics = quota/statistical reports, provider usage snapshots, fleet health rollups (sweep on the report's own cadence, final version only); reports = generated briefs/sweep reports/design records outside the repo (event-driven on file close) | Per-host, per-period | **Design only** — the recurring sweep runner is [#7969](https://github.com/developing-today/code/issues/7969) OPEN (runner core landed via [#11210](https://github.com/developing-today/code/issues/11210), closed) | Not running as a schedule | + +### 1.3 The semi-automated ingest design that governs all of the above + +[#6019](https://github.com/developing-today/code/issues/6019)'s operations +design (closed; record on main, cited in §1.2) defines how any source joins: +**semi-automated** means discovery, filtering, staging, and accounting run +unattended; adding a source class, loosening an inclusion test, bulk backfills, +and plan changes are always human decisions. Every class must answer a stated +question ("what question would this ever answer?"); rejects are logged with the +same manifest shape as accepts (`no-question`, `duplicate-content`, `oversize` +>256 MiB, `secret-tier-held`, `superseded-version`). Pipeline: delta-only +discovery ([#6028](https://github.com/developing-today/code/issues/6028), +span-anchored offset matching) → usefulness + classification-manifest filter → +content-addressed landing in the **staging shard** ([#3125](https://github.com/developing-today/code/issues/3125)) +→ promotion through the ingest gate ([#6057](https://github.com/developing-today/code/issues/6057): +write → classify → dedup → provenance-check → publish; merge-on-close per +[#5669](https://github.com/developing-today/code/issues/5669)) → per-batch +in-toto-shaped attestation ([#6045](https://github.com/developing-today/code/issues/6045)). +Disk/IO guardrails and the Turso plan ceiling are part of the same design. +**Status: designed and partially built (gate + staging + runner core landed); +the continuous runner ([#7969](https://github.com/developing-today/code/issues/7969)) +and continuous-ingestion program ([#9097](https://github.com/developing-today/code/issues/9097), +`status/blocked`) are still open.** + +--- + +## 2. Sources that are natural next ingest targets + +Drew's own target list is already written down — [#9097](https://github.com/developing-today/code/issues/9097) +(Workstream E of the [#8983](https://github.com/developing-today/code/issues/8983) +program, 2026-11-12): "constantly updating, every source, internal only." +Its six items, plus the surrounding connector issues: + +### 2.1 Fleet queue / broker data + PM stack data — #9097 item 1 + +- **Holder:** the queue broker's Turso backend on the laptop + (`placement_sessions` table added 2026-11-23 by + [#13146](https://github.com/developing-today/code/issues/13146) slice 1; + tasks, sessions, claims, parks, dispositions) and the PM stack (aggregator + state, boards, reconcile records). +- **Automatic ingest shape:** event hooks where the source supports them, + scheduled sweeps otherwise (#9097's rule); delta-only via broker watermarks; + the ingest watermark doubles as the corpus-change signal for cache policy. +- **Status:** named in #9097 (open, blocked); no connector built. Queue/PM + content is operational data — internal tier by default; session transcripts + attached to tasks inherit the session classification rules. + +### 2.2 GitHub — everything, all orgs — #9097 item 2, extending #6023 + +- **Holder:** GitHub, via `gh` CLI / REST (the GitHub connector is banned by + standing rule; all access is `gh api`). Scope per #9097: **all issues / PRs / + commits / files for all orgs and repos in scope** (developing-today, + developing-today-forks, Clustered-Computing, personal) — 102 admin orgs per + fleet records. +- **What exists:** comments extraction is done (#6023 closed, #10688 writer + landed). **What's missing:** issues/PRs as first-class objects (not just + comments), commits, and repo files beyond the #6025 first pass; continuous + delta updates (webhook or ETag/`since`-cursor sweeps) instead of one-shot + extraction. +- **Constraint:** the **external** half (repos Drew interacts with but doesn't + own) is gated on the licensing research — + [#6024](https://github.com/developing-today/code/issues/6024) OPEN ("may we + ingest external GitHub comments/discussions into Atlas?") and the + three-zone external-content policy + [#6052](https://github.com/developing-today/code/issues/6052) OPEN (deferred + by Drew behind the [#6066](https://github.com/developing-today/code/issues/6066) + networking epic per [#8567](https://github.com/developing-today/code/issues/8567)). + Design may proceed; external ingestion may not be built until the gate + answers. Per-repo license capture at ingest is already built + ([#7608](https://github.com/developing-today/code/issues/7608), closed). + +### 2.3 All Muse conversations and data — #9097 item 3 + +- **Holder:** the Muse platform itself — main chat + side chats, the memory + tree (`~/MEMORY.md`, `~/memory/**`), artifacts/documents produced for Drew. +- **Automatic ingest shape:** **[unverified mechanism]** — no export/API path + is recorded on any issue found; today Muse session material reaches Atlas + only insofar as transcripts land in stores the client adapters already read. + #9097 names it as a target with no connector issue yet; its sources-inventory + acceptance item is where the mechanism gets decided. + +### 2.4 All OpenCode sessions and data — #9097 item 4 + +- **Holder:** the OpenCode session store on the laptop (server at + 127.0.0.1:13420) + OpenChamber session data. +- **Automatic ingest shape:** session-end event hook (the unbuilt session-close + hook from §1.2) or sweep over the session store; the design's session-logs + class already covers OpenCode. +- **Open question filed in #9097 itself:** an explicit investigation of + ingesting **thinking traces**, with a recommendation covering volume, value, + and classification implications — undecided. + +### 2.5 All ID objects — #9097 item 5 + the #6062 publication line + +- **Holder:** ID's own stores — laptop redb, Turso ID DBs, hosted stores as + they arrive. +- **Automatic ingest shape:** the reverse direction is the designed one today: + Atlas objects publish *into* the ID graph — + [#6062](https://github.com/developing-today/code/issues/6062) (publication + format design, OPEN) + projector set + [#11182](https://github.com/developing-today/code/issues/11182)–[#11186](https://github.com/developing-today/code/issues/11186) + (all OPEN, unstarted). #9097 item 5 asks for ID objects *into* Atlas search + as well; [#9109](https://github.com/developing-today/code/issues/9109) Part C + states the end state: "automatic vectorization of ID content (Snowflake + + the second embedder from Atlas + [#9092](https://github.com/developing-today/code/issues/9092)) feeding + built-in ID search." Neither direction is built; see + `research-id-state.md` §5.2 for the full record. + +### 2.6 The sources-inventory pass — #9097 item 6 + +#9097 makes the inventory itself a deliverable ("anything missed gets its own +connector issue"). It names: **notes/zettel** (dezren39/zettel + +developing-today/zettel, Emanote), **Fleet Reports Space records**, +**ask-ledger logs**, **quota/burn records**, **laptop state stores**. Related +connector work already filed under +[#8567](https://github.com/developing-today/code/issues/8567): + +- [#8622](https://github.com/developing-today/code/issues/8622) OPEN — memory + slice 1: corpus registry + **memory-lancedb connector** into Atlas staging + (OpenClaw's local memory store is the first external corpus connector). +- [#8626](https://github.com/developing-today/code/issues/8626) OPEN — memory + slice 4: remaining corpus connectors — **memory files, notes, repo docs, + research reports**. +- [#9576](https://github.com/developing-today/code/issues/9576) OPEN — C8: + Atlas ingestion of reports & pages + error-driven investigation boosts. +- Agent-notes placement (zettel vs repo vs directly into the ID graph) is + [#6018](https://github.com/developing-today/code/issues/6018) topic 3, tied + to [#5545](https://github.com/developing-today/code/issues/5545) / + [#5686](https://github.com/developing-today/code/issues/5686). + +### 2.7 Drew-world sources with no Atlas record found + +Recorded factually, as candidates the inventory pass (#9097 item 6) has not +yet dispositioned — **no ingest issue exists for any of these** (searched +2026-11-23): + +- **Gmail** — no Atlas ingest exists or is filed. Standing constraint: the + Gmail connector is currently **NOT connected**, and all Gmail/Plaid + background checks are **paused on Drew's order (2026-11-22)** regardless of + connection state (`~/MEMORY.md` standing record). Any future mail ingest + needs both reconnection and Drew lifting the pause; mail would also be a + internal/private-tier source by default. +- **Google Drive / Docs** — not named in #9097's list; "all findable docs" in + [#6025](https://github.com/developing-today/code/issues/6025) refers to repo + docs. Drive holds Drew's documents/notebooks; an ingest would ride the + Drive export/download surface. **[unverified — no design record found]** +- **Slack (Developing Today workspace)** — the #6019 design's chat-logs class + covers "fleet chat exports (Slack/Discord-class sources as they are + connected)": scheduled hourly sweep over the export delta, **channel + allowlist, human-approved per channel**, bot/heartbeat posts excluded. + Whether a live Slack export feed is connected today is **[unverified]**; + no connector issue found. +- **CI run history** (GitHub Actions runs across the orgs) — not named as a + source class; nearest neighbours are the statistics class (fleet health + rollups) and trace ingestion. Would ingest via the Actions API on a sweep. + **[no record found]** +- **The Turso databases themselves** (beyond Atlas's own shards) — the queue + broker DB is §2.1; other fleet Turso DBs (fleet-config D1, ID DBs) fold + into #9097 items 1/5 rather than a separate class. +- **The memory/topics corpus in hatch-personal** — Drew's curated long-term + memory (`~/memory/topics/**`, `~/MEMORY.md`) is explicitly in scope via + #9097 item 3 ("memory tree") and #8626 ("memory files"). + +### 2.8 Standing constraints on any new ingest + +- **Tier assignment at ingest, per source class** — the classification + manifest ([#5410](https://github.com/developing-today/code/issues/5410)) is + the home for per-source tier rules (§4). +- **Secret-tier content is held out of automated sweeps entirely** until the + local embedder lands ([#6059](https://github.com/developing-today/code/issues/6059), + open/in-review) — never sent to a hosted embedder (§4.2). +- **External content** waits on #6024/#6052 (§2.2). +- **Keep-all rule** ([#3125](https://github.com/developing-today/code/issues/3125)): + keep ALL data; only byte-identical duplicates are cleaned; backups AND + plain extracts for every corpus; every chunk records *every* place it was + found (`chunk_occurrences`) — dedup must never silently drop provenance + (it had dropped ~127K occurrences before #3125). +- **Plan ceiling:** Turso scaler $24.92/mo is a hard envelope; sweeps carry + disk/IO guardrails and per-batch embedding-cost accounting + ([#6058](https://github.com/developing-today/code/issues/6058) ledger design). + +--- + +## 3. Consumers and their search needs + +### 3.1 `fleet search` — the agent-facing CLI (live) + +`pkgs/fleet/crates/fleet-search/src/cli.rs` (developing-today/code, main): +`fleet search` **is** the atlas-search client surface, ported flag-for-flag +with a parity guard (`.github/scripts/check-fleet-search-parity.sh`); the +fleet workspace deliberately carries no second embedder/backend. + +- **Who:** every fleet agent/seat (Muse lanes, OpenCode sessions, other + seats) looking up prior work — past decisions, session evidence, "have we + seen this before" — across the corpora in §1. Drew's Atlas order + (2026-11-22): `fleet search` documented for all agents/sessions, which + closed [#12782](https://github.com/developing-today/code/issues/12782). +- **Query shape:** hybrid FTS+vector (default), `--mode fts|vector`; filters + `--kind/--topic/--project/--client`, `--since/--until` (session dates), + `--max-sensitivity` ceiling, `--group-by-session`, `--expand N` neighbours, + `--with-message`, `--hydrate N`, `--pool N` per-branch candidates, + `--k N` final results; `get-chunk ` returns one chunk with provenance. + Default embedding model: Snowflake `snowflake-arctic-embed-m-v2.0`; + `--embedder auto|fastembed|st`; vector backends `scan|index-fill|index-fixed`. +- **Routing/latency:** sandbox seat → via-service by default (job protocol + against the laptop's loopback service, `http://127.0.0.1:18760`, through the + laptop-ssh forward) with a loud standalone fallback; laptop seat → + standalone by default. Service enforces ceilings server-side by client + identity: `sandbox-scripts` is capped at `personal`, `drew-cli` at + `secret-bearing`. +- **Freshness need vs reality:** agents assume the corpus is current; it is + frozen at the 2026-10-31 publish (§1) until #9097/#7969 land. **This is the + single largest consumer-facing gap.** + +### 3.2 The Atlas MCP server — mcpx namespace (built, acceptance open) + +[#8625](https://github.com/developing-today/code/issues/8625) OPEN — memory +slice 3: an MCP server (an mcpx namespace) in front of atlas-core's +`run_search`. The design's decided access pattern ([#8567](https://github.com/developing-today/code/issues/8567) +design record `pkgs/atlas-search/docs/memory-integration-design-8567.md`): +MCP for cross-agent access; native library access stays Atlas-internal only. + +- **Landed:** [#12785](https://github.com/developing-today/code/issues/12785) + CLOSED — MCP endpoint on the search Worker; + [#12809](https://github.com/developing-today/code/issues/12809) CLOSED — + Atlas MCP server wired into the laptop's mcpx daemon as a remote server + (Drew's 2026-11-22 Atlas order, all three parts complete). +- **Contract (from #8625):** the MCP layer stamps the calling agent's + identity, enforces its sensitivity ceiling and corpus scoping **inside the + branch queries, never post-ranking**, and audit-logs every query. Every hit + carries corpus + `source_ref` provenance. +- **Consumers named in the acceptance criteria:** OpenClaw, an OpenCode + session, OpenChamber, and a Muse lane — each querying the unified index + through the namespace with its own identity and ceiling. #8625 stays open + on that cross-client acceptance verification. +- **Query shape:** same hybrid search as §3.1, identity-scoped; freshness + need is the same corpus-currency gap. + +### 3.3 ID search & recommendations — #9109 Part C (designed, unbuilt) + +[#9109](https://github.com/developing-today/code/issues/9109) (Part C of the +[#9106](https://github.com/developing-today/code/issues/9106) epic) is the +program-level statement that ID search and recommendations are Atlas-facing: + +- **Query shape:** search *over the ID object graph* — automatic vectorization + of ID content (Snowflake + the second embedder from + [#9092](https://github.com/developing-today/code/issues/9092)) feeding + built-in ID search; plus **recommendation surfaces**: one fan-out worker, a + Durable Object accumulating a "next 10", recommendations as stored objects + with per-class retention. +- **Also in Part C:** the storage-economics substrate ID search would run on + — latency/characteristic benchmarks across D1 vs R2 vs laptop redb vs + laptop Turso at various shard levels, the D1 tenant hot cache (the + [#13100](https://github.com/developing-today/code/issues/13100)–#13107 + chain; #13106 flag-held), tenant store placement. +- **Missing today:** everything above the substrate — the #6062 publication + format is undesigned-to-unbuilt, the projectors (#11182–#11186) are + unstarted, and there is no ID-side query surface. Latency/freshness needs + are not yet specified on any issue found **[unverified]**. + +### 3.4 The `atlas-search` CLI / service — programmatic access today + +From the turso-atlas README (§1.1 step 5) and the atlas-search Worker +(`pkgs/atlas-search/`): two JSON-first subcommands — `search` (hybrid FTS5 + +vector, reciprocal-rank fusion k=60, per-branch ranks and full provenance on +every result) and `get-chunk`. Backends: `--backend turso` (published DB over +HTTPS, read-only token resolved at runtime — env, Bitwarden by name, or +turso-CLI-minted; never stored in the repo) or `--backend local --db PATH`. +The Rust service (`atlas-core`: embed, classify, detect, eval, disclosure, +boundary, fusion, shards modules) is the same engine behind §3.1/§3.2, with a +query front-end ([#5773](https://github.com/developing-today/code/issues/5773)), +shard fan-out ([#5755](https://github.com/developing-today/code/issues/5755)), +and a full parameter surface with per-run vector logging +([#5774](https://github.com/developing-today/code/issues/5774)). +[#9092](https://github.com/developing-today/code/issues/9092) OPEN is the +search-v1 build-out: Workers fan-out, shard benchmarks, cache policy, second +embedder. **Missing for programmatic users:** any documented, versioned API +contract beyond the CLI/Worker surface and the MCP namespace — the +`atlas-proto` crate (`pkgs/atlas-search/crates/atlas-proto/`, +`query-parameters-v1.json`) is the seed of one. + +### 3.5 OpenClaw / agent memory — the memory-integration consumer + +[#8567](https://github.com/developing-today/code/issues/8567)'s corpora — +OpenClaw's memory-lancedb content, zettelkasten/Emanote notes, repo docs, +prior research reports — are consumed by agents (OpenClaw, OpenCode sessions, +OpenChamber, Muse lanes) as *memory*: recall-shaped queries ("what do we +know about X", prior decisions) rather than document search. Slices: +[#8622](https://github.com/developing-today/code/issues/8622) (registry + +connector), [#8625](https://github.com/developing-today/code/issues/8625) +(MCP surface, §3.2), [#8626](https://github.com/developing-today/code/issues/8626) +(remaining connectors), [#8623](https://github.com/developing-today/code/issues/8623) +/ [#8627](https://github.com/developing-today/code/issues/8627) (open children +of [#8983](https://github.com/developing-today/code/issues/8983)). +**Missing today:** the connectors themselves (#8622/#8626 open), so memory +recall still runs against per-agent silos (e.g. OpenClaw's local +memory-lancedb) instead of the unified index. + +### 3.6 Evaluation as a consumer + +Atlas's own quality loop consumes the corpus: golden-set eval +([#6046](https://github.com/developing-today/code/issues/6046) design; +[#8062](https://github.com/developing-today/code/issues/8062) records the +open seam — the evaluator scores supplied rankings, it does not run +retrieval), retrieval statistics + feedback +([#6027](https://github.com/developing-today/code/issues/6027) / +[#8245](https://github.com/developing-today/code/issues/8245)–[#8249](https://github.com/developing-today/code/issues/8249): +per-stage trace, thumbs up/down, result↔query trace with exact embed state). +Any query-planning/reranking work in the planning prompt inherits this as +its measurement prerequisite — see `research-id-state.md` appendix and the +v2–v4 baseline inventory (`doc/2026-11-11T03-45-00Z_design_atlas_v2_v4/research/01-baseline-inventory.md`). + +--- + +## 4. Sensitivity / privacy model + +### 4.1 The tier model — two namings, one ladder + +- **Corpus tiers** (storage/classification, per + [#6018](https://github.com/developing-today/code/issues/6018) / + [#6021](https://github.com/developing-today/code/issues/6021)): **public / + internal / secret** in the design records; physically, internal = 28 shards + / 107,001 chunks, secret = exactly 1 shard / 638 chunks, and secret material + may exist **only** in the 2 secret DBs. +- **Client-surface ceilings** (per `fleet search --help` and the turso-atlas + README): `public < internal < private < sensitive`, default + ceiling **internal** — private and sensitive material is excluded + unless the ceiling is explicitly raised. Ceilings are enforced + **server-side** and clamped per client identity (`sandbox-scripts` → + personal; `drew-cli` → secret-bearing). The classification manifest + ([#5410](https://github.com/developing-today/code/issues/5410); design + `doc/2026-11-05T13-03-49Z_design_atlas_manifest_filter_surface`) declares + the non-sensitivity filter dimensions and per-source tier rules, but code + retains the sensitivity ladder — **a manifest cannot widen access**, and an + invalid manifest falls back loudly without widening (v2–v4 baseline + inventory V1-D08). +- Classification is enforced **before ranking** and again on each + expansion/hydration step (V1-D01/D12) — a search can never surface, count, + or leak the existence of chunks above the caller's ceiling. + +### 4.2 The scanning + review machinery + +- **Deterministic scanning (gitleaks-class patterns) + classifier pass + + vector-neighbourhood check**: [#6021](https://github.com/developing-today/code/issues/6021) + (CLOSED) revalidated the whole corpus — sweep the internal tier for + secret-class content (credential-shaped strings, keys/tokens, + personal/financial/medical details), including internal chunks that embed + *close to* secret chunks; verify the converse (secret tier holds only + secret-class content) and that secret material exists nowhere else, + including the production monolith and local replicas/caches. +- **The Layer 1 secret-tier review**: [#10412](https://github.com/developing-today/code/issues/10412) + (CLOSED) — 47 candidate chunks (67 findings) + 45 candidate messages from + the #6021 scan, each ruled confirmed/dismissed by Drew personally. +- **Presidio NER pass**: [#6048](https://github.com/developing-today/code/issues/6048) + (CLOSED) — full internal-tier + sampled secret-tier PII detection at + corpus scale. +- **Handling rule (absolute):** findings are handled at the secret tier's + sensitivity — reports name counts, classes, and locations (DB + chunk IDs) + and **never reproduce candidate content** in issues, chat, or logs. + Confirmed mis-tiered chunks get a remediation path (move + re-embed at the + correct tier, purge from the wrong tier including replicas) filed before + the scan task closes. +- **Embedder rule:** secret-tier text is **never sent to a hosted embedder**. + Until the local secret-tier embedder + ([#6059](https://github.com/developing-today/code/issues/6059)) lands, + secret-tier source classes are held out of automated sweeps entirely + (`secret-tier-held` is a queue, not a rejection — held items re-offer + automatically once the route exists). A dedicated secret-tier embedder + design exists (`doc/2026-11-10T20-55-00Z_design_atlas_secret_tier_embedder`). +- **Cross-tier comparability:** one Snowflake model **and pipeline** across + tiers (decision `doc/2026-11-08T10-44-00Z_decision_atlas_cross_tier_vector_comparability`); + no arbitrary cross-model score merging — this is what makes the + vector-neighbourhood mis-tier check in #6021 meaningful. + +### 4.3 The known boundary breach — #8479 + +[#8479](https://github.com/developing-today/code/issues/8479) **OPEN** — +"Atlas boundary remediation: secret-bearing rows still live in the +production monolith and a local replica (#6021 wave 1)". The shard set's +boundaries are clean, but the same 638 sensitive chunks also live in +the production libSQL monolith and its local replica, plus pre-tiering +unclassified snapshots — so the standing claim "secret material exists only +in the 2 secret DBs" is currently **false outside the shard set**. Purge vs +secret-tier reclassification is undecided; per fleet records the issue waits +on production ingestion verification (a destructive purge gate). **Any new +ingest or consumer work must treat #8479 as a precondition for claiming the +tier boundary holds.** + +### 4.4 What must never be ingested, or must be gated + +- **Never:** secret-tier content into any non-secret store, replica, cache, + or hosted embedder (§4.2); candidate secret content reproduced into + issues/chat/logs at any point in the pipeline (§4.2 handling rule); + external content above its zone policy (§2.2) — and per the deletion + design (`doc/2026-11-09T00-42-59Z_design_atlas_deletion_propagation`), + source deletions / repo privation must propagate into Atlas, including + backup/restore handling, as a policy-governed purge distinct from ordinary + retention retirement. +- **Gated on human approval (per #6019 design):** adding any new source + class; loosening a class's inclusion test; adding a chat channel to the + allowlist; bulk backfills beyond the runbook bound; any plan change; + reclassifying a session to the secret tier before promotion. +- **Gated on decisions:** external GitHub corpus (#6024 licensing research + + #6052 zone policy, both OPEN); OpenCode thinking traces (#9097's explicit + investigation, undecided); Gmail anything (§2.7 — connector disconnected + + Drew's pause order). +- **Not a gate but a rule:** sweeps never delete. Retention/retirement is a + *report* a sweep surfaces; erasure happens only through the + deletion-propagation process or a human decision. Feedback/usefulness + signals can propose movement or retirement, never authorize erasure + (v2–v4 baseline inventory V1-D06/D13). + +--- + +## Appendix — verification notes + +- Verified first-hand in this pass (gh api, 2026-11-23): #6018, #6021, + #8567, #8625, #8983, #9097, #9109 bodies; titles/states for #3125, #5410, + #6023, #6024, #6025, #6029, #6048, #6052, #6057, #6059, #7969, #8479, + #8622, #8626, #9092, #9576, #10412 (via prior pass), #10688, #10788, + #11182–#11186; `pkgs/atlas-search/` + `pkgs/fleet/crates/fleet-search/` + trees; `fleet-search/src/cli.rs` (the `fleet search` surface); + `doc/2026-11-09T05-12-00Z_design_atlas_ingestion_operations` (source-class + table); `doc/2026-11-11T03-45-00Z_design_atlas_v2_v4/research/01-baseline-inventory.md`; + hatch-personal `workspace/turso-atlas/README.md` + atlas path census. +- Taken from the two prior research files (same-day, first-hand there): + #3125's phase structure and counts, #10412's review counts, #6062's scope, + the 57-open-`epic/atlas-program` census, the D1 hot-cache chain. +- Explicitly **[unverified]**: the mechanism for ingesting Muse platform + data (#9097 item 3); whether a live Slack export feed is connected; + Google Drive/Docs as a source (no record found); CI run history as a + source (no record found); ID search latency/freshness requirements (not + specified on any issue found); which specific client adapters exist in + `atlas-ingest.py` beyond the OpenCode/Muse stores named in the + #6019 design (the README describes adapters generically). diff --git a/doc/README.md b/doc/README.md index d1aa1794a..eee0dc931 100644 --- a/doc/README.md +++ b/doc/README.md @@ -167,6 +167,7 @@ Folders are named `__`. The kinds in use are `feature` - [Capability classes for the post-#5999 registrations](2026-11-23T07-06-00Z_design_id_capability_class_assignments/2026-11-23T07-06-00Z_design_id_capability_class_assignments.md) (PROPOSED design pass for #13004: class assignments for the sixteen names #12982 left as CLASS_UNKNOWN — eight new classes, world.records extended to the kv/blob reads, cap.none for device.info — with the implementation slice gated on ratification) Two names break the pattern. They stay as they are because other documents link to them: `2026-03-23T00:00:00Z_feature_file_list_ui/` has colons in its name, and `2026-10-14T10-18-19Z_design_p7_2_cloudflare_workers.md` is a file, not a folder. +- [Atlas investigation research corpus](2026-11-23T23-45-44Z_research_atlas-investigation/2026-11-23T23-45-44Z_research_atlas-investigation.md) — the 2026-11-23 research behind the Atlas programme investigation (#13241): system state, sources and consumers, search technology. ## Legacy places