Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions pkgs/atlas-search/book/concepts/corpus-and-provenance.md
Original file line number Diff line number Diff line change
Expand Up @@ -218,13 +218,10 @@ of personal-client text were at that point held back from Turso by policy.
That same day the hold-back was lifted: everything in canonical publishes,
and privacy moved to query-time classification filters instead.

Since then the store has grown without a recount. Later records (2026-11-12)
describe the Turso monolith as about **7.3 GB** over the same 107,639 chunks
plus the 29 topic shards, and state in terms that the canonical counts are
frozen at the 2026-10-31 publish while the monolith grew *without a verified
recount*. Read every number in the table above as "true on 2026-10-31", not
as today's count; a fresh verified census is an open deliverable of the
Atlas programme. For scale, the laptop's `~/atlas/` directory overall was
The November 23 canonical count was 18,325 sessions, 122,115 messages and 107,439 chunks.
The dated publish-source file still held the October table counts above.
See [Backup, restore and the census](../operations/backup-and-census.md) for the
store roles, read times and repeatable count procedure. For scale, the laptop's `~/atlas/` directory overall was
12 GB at the census date, hash-verified to contain no consequential
byte-identical duplicates — it is distinct versions and working sets, so no
cleanup windfall exists there.
2 changes: 1 addition & 1 deletion pkgs/atlas-search/book/concepts/ingest.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ The production corpus was built, and is still extended, by scripts that live out
4. **Publish.** A copy of the hot index — keyword index plus the current-best vectors — is pushed to the hosted Turso database as distribution. The full store stays on the laptop; the hosted copy never holds the only copy of anything.
5. **Access.** Agents search through the surfaces in [The service and the Worker](service-and-worker.md), not by writing SQL against the corpus.

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

## Staging: one small database per unit of work

Expand Down
2 changes: 1 addition & 1 deletion pkgs/atlas-search/book/design/automatic-ingest.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ A purge that removes a chunk from the vector store but leaves it findable by ful
Grounding, so the design above is never mistaken for the present:

- **Ingestion today is manual and script-driven.** The only Atlas schedule on the laptop is the daily backup timer. The ingest scripts still live outside the code repo (#5670 migration open), and the recurring sweep runner is unbuilt (#7969: a runner core exists in atlas-core, but it creates and enables no schedule — cadence is an operator decision gated on the owner's go-ahead).
- **The production pipeline is the older five-step shape** — collect, normalize, index, publish, access — driven by `atlas-ingest.py` with per-client adapters, normalizing conversations into one local database that is the durable asset, building the FTS and vector indexes from it, and publishing a hot copy to Turso as distribution. Corpus counts consumers see are frozen at the 2026-10-31 census — 18,325 sessions, 122,124 messages, 107,639 chunks, in a monolith plus 29 topic shards (28 internal shards holding 107,001 chunks and 1 secret shard holding 638 chunks; zero public-tier shards) — while the store has since grown without a verified recount.
- **The production pipeline is the older five-step shape** — collect, normalize, index, publish, access — driven by `atlas-ingest.py` with per-client adapters, normalizing conversations into one local database that is the durable asset, building the FTS and vector indexes from it, and publishing a hot copy to Turso as distribution. Canonical and publication counts belong to different stores. The November 23 local comparison is in [Backup, restore and the census](../operations/backup-and-census.md).
- **GitHub comments are the one completed new source.** Extraction and the ingestion writer landed (#6023, #10688); GitHub objects, commits, files, and continuous delta have not.
- **The staging foundation is built.** Per-unit staging databases with a versioned schema, a staging-unit registry, classification-at-staging with boundary-safe chunking, the batch gate's audit record and state machine (#7709, the record half of #6057), and a one-shot embed-at-promotion command all exist in atlas-core. What does not exist is the standing machinery around them: the aggregator as a service, the session-close extraction hook, and the gate's stage checks beyond the record they write into are later slices, not running code.
- **Traces are already a corpus source.** Atlas's own query traces, statistics, and weekly reports are ingested as a statistics-and-reports source class inside atlas-core. That is the one place where something like automatic ingest — system output flowing back into the corpus by construction — already happens.
Expand Down
15 changes: 6 additions & 9 deletions pkgs/atlas-search/book/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,12 @@ so re-ingesting the same material adds nothing twice. Each session is
classified with a kind, topics, and projects, and each chunk carries an
effective sensitivity (its own, falling back to its session's label).

The last verified census is a frozen snapshot, and this book dates it
wherever it is quoted: on **2026-10-31** the corpus held **18,325 sessions /
122,124 messages / 107,639 chunks**. Physically, that census is now a local
canonical database plus **29 topic shards**: 28 internal shards holding
107,001 chunks and 1 secret shard holding 638 chunks, with zero public-tier
shards. Later records describe a monolith of about 7.3 GB without a verified
recount, so the store has grown since the census; the counts above are the
last verified ones, not a live count. The full treatment is in
[The corpus: provenance and content addressing](concepts/corpus-and-provenance.md).
On **2026-11-23** the canonical laptop database contained **18,325 sessions,
122,115 messages and 107,439 chunks**. A separate read of the October 31
publish-source file returned 18,325 sessions, 122,124 messages and 107,639
chunks. Each count belongs to the selected local file; the live service and
Worker require separate publication receipts.
[Backup, restore and the census](operations/backup-and-census.md).

Two properties define the system, and both are enforced before ranking, never
after:
Expand Down
34 changes: 20 additions & 14 deletions pkgs/atlas-search/book/operations/backup-and-census.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Source: `nixos/home/laptop-backups.nix` and `nixos/home/atlas-backup.sh`, the schedule registry row in `doc/fleet-schedule-registry.md`, and the census statement in the Atlas program investigation record `doc/2026-11-23T12-06-51Z_design_atlas_program_investigation/` under https://github.com/developing-today/code/blob/main/nixos/home/laptop-backups.nix — provenance only; this chapter is complete without following it.

Two different questions get confused under the word "backup": is the corpus recoverable if the laptop store is lost, and how big is the corpus right now? The first has a landed, scheduled answer. The second has a frozen answer from 2026-10-31 and an honest caveat. This chapter keeps them separate.
Atlas tracks backup completion, corpus row counts and publication freshness separately. Each observation below identifies the store or service and the date.

## The backup: `atlas-backup`

Expand Down Expand Up @@ -51,7 +51,7 @@ Issue **#3125** is the provenance and occurrence-registry issue. Its census does

> Last verified census (2026-10-31, on #3125): **18,325 sessions / 122,124 messages / 107,639 chunks.**

The store that census describes is the canonical store on the laptop — the `atlas.db` above **plus 29 topic shards**. Its sensitivity split, from the same record, cross-checks the total exactly:
The October record also describes 29 topic shards of that corpus. Shard copies must be reconciled separately from the canonical count. Its sensitivity split, from the same record, cross-checks the total exactly:

| Tier | Shards | Chunks |
|---|---|---|
Expand All @@ -60,23 +60,29 @@ The store that census describes is the canonical store on the laptop — the `at
| Public | 0 | 0 |
| **Total** | **29** | **107,639** |

Zero public-tier shards is a stated fact of the v1 record, not a gap in the table. Any chapter, dashboard, or answer that quotes 18,325 / 122,124 / 107,639 must date it **2026-10-31** — see [FAQ](faq.md).
The split above belongs to the October snapshot.

### The unrecounted monolith
### November 23 AMD observation

Later records describe a **~7.3 GB monolith without a verified recount**. Both halves of that sentence matter. The store has grown since October — ingest, however manual, did not stop — and no fresh verified census has been taken. The 7.3 GB is a size observation, not a count: it cannot be turned into sessions, messages, or chunks by arithmetic, and this book does not try.
Separate SQLite read transactions on November 23, 2026 counted physical table rows in these local stores. A repeat read of the canonical database at 17:57:15 UTC reproduced the 17:56:17 UTC result. Sizes are observed database-file bytes.

### How a fresh census would be taken
| Local store | Sessions | Messages | Chunks | File bytes | SQLite schema version |
|---|---:|---:|---:|---:|---:|
| Canonical `~/atlas/turso-atlas/data/atlas.db` | 18,325 | 122,115 | 107,439 | 1,492,127,744 | 14 |
| Dated publish-source file `atlas-publish-v2-2026-10-31.db` in the same directory | 18,325 | 122,124 | 107,639 | 1,704,194,048 | 12 |

A fresh census is an early deliverable of the Atlas programme (#13241), and its shape is fixed by what made the October one trustworthy:
The canonical table counts differ from the October record by 0 sessions, −9 messages and −200 chunks. The census cannot determine which changes produced those differences. At 17:58:34 UTC, the canonical CAS registry contained 24,184 rows and 12,092 distinct hashes. The named Snowflake vector table was absent from both files. The dated file contained 107,639 rows in its legacy BGE table. These observations describe only the two selected files. The 7.3 GB database in PR #12028 was rebuilt from a Turso export.

1. Count the canonical store directly: sessions, messages, and chunks in `~/atlas/turso-atlas/data/atlas.db`.
2. Count every shard: each shard carries an `atlas_manifest` with an `expected_chunks` value, checked against an actual `COUNT(*)` of its chunks — a manifest that disagrees with its own store is a finding, not a number.
3. Split the result by tier (public / internal / secret) so the split cross-checks the total, as the October split does.
4. Date it, name the store it was taken from, and publish it in the same place the October census is quoted from — a design or programme record — so the next reader finds one canonical statement, not a scatter of counts.
At 18:08:56–18:08:58 UTC, one read-only statement against the configured Turso logical database `atlas` counted **18,325 sessions, 71,551 messages and 107,639 chunks**. The three scalar subqueries used `COUNT(*)` on `sessions`, `messages` and `chunks`. This hosted database had 50,564 fewer message rows and 200 more chunk rows than the canonical file. The identical chunk counts in the hosted database and dated file do not establish that every row or revision matches.

Until that runs, there is no newer number to quote, from any source.
On the same day the laptop service returned healthy with its embedder ready. Its health response supplied no publication generation or source watermark. Proving Fleet or Worker freshness requires tracing an authorized source revision through promotion and a scoped publication to the consumer.

### Why consumers still see the October counts
The backup timer was active and waiting. Its November 23 backup service run timed out after 90 minutes (04:58:04–06:28:04 Central). The local dated gzip (491,721,304 bytes) and its manifest were present. The manifest recorded 18,325 sessions, 122,115 messages and 107,439 chunks, matching the live count. The November 15 local manifest recorded 18,325, 122,118 and 107,505 respectively. The ledger contained no November 23 completion and offsite copies were not independently verified. Verify a matching digest and destination receipt before relying on a particular copy. No backup or restore was triggered by the census. See #10304 for the existing backup investigation.

Because nothing downstream recounts. Consumers — the service, the Worker, the CLIs — search the **published** store, and the publish consumers see is the October publish: ingestion today is manual and script-driven (the recurring sweep runner, #7969, is unbuilt; the ingest scripts still live outside the repo, with migration #5670 open), and no recount-and-republish pass has landed since. The counts are therefore not stale by accident or by caching — they are the counts of the corpus as published, frozen at the last verified census, while the underlying store has grown past them uncounted. The Worker cache's indefinite retention (#6805) is a separate staleness story, covered in [Troubleshooting](troubleshooting.md); even a perfectly fresh cache would still be answering over the October-published corpus.
### Repeat the measurement

From the repository root, run `python3 pkgs/atlas-search/tools/atlas_census.py` on the laptop. Pass `--canonical PATH` to select a different canonical-shaped database. For each approved scan shard, add `--shard PATH`; for each per-tier hydration store, add `--content-store PATH`. Use `--seconds-per-store N` to bound each read (default 20 seconds).

The JSON report identifies inputs by role and ordinal. It measures each store in its own read-only transaction with WAL visibility, counts recognized tables, and distinguishes an empty table from a missing required table or an inapplicable one. A scan shard needs the expected manifest markers and a matching expected chunk count. Exit 1 means at least one requested store could not be counted and validated. Keep the path-to-ordinal mapping on the laptop. When reconciling shards against a generation, use its authorized inventory and count every required store before reporting coverage.

The runtime may need a compatible native read-only libSQL reader for schemas the local SQLite implementation cannot open. A failed read supplies no row count. Keep revisions, policy and the consumer's published generation with each freshness receipt.
2 changes: 1 addition & 1 deletion pkgs/atlas-search/book/operations/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Because the D1 hot cache is not wired into the request path. The flag (only the

### Is the corpus current?

The corpus you can search is current as of its last publish — and the last **verified census is frozen at 2026-10-31: 18,325 sessions / 122,124 messages / 107,639 chunks** (#3125). The underlying store has since grown to a ~7.3 GB monolith with no verified recount, and ingestion is still manual and script-driven, so no newer count exists to quote and no consumer recounts on your behalf. A fresh census is an early programme deliverable; how one would be taken, and why the October numbers are the ones consumers still see, is in [Backup, restore and the census](backup-and-census.md). Treat any undated Atlas size claim — including one in an older chapter or design — as that October snapshot until a dated replacement exists.
The November 23, 2026 read of the canonical laptop file counted **18,325 sessions, 122,115 messages and 107,439 chunks**. The dated October publish-source file still had **18,325 / 122,124 / 107,639** in a separate read that day. The serving generation and source watermark require a consumer-scoped check. See [Backup, restore and the census](backup-and-census.md).

### Can ID search Atlas today?

Expand Down
Loading