# Parallels Database Build — Instructions & State
### Opened 2026-07-19 (planned in the hours-4-9 outer-ring chat, M's rulings same day). A new chat takes over from THIS FILE.

## What this is

Build a systematic database of the Torah/Book-of-Gates parallels, reorganizing `_book/hour-ledger.md` (the sole source) into a fixed frame: one record set per LEDGER ENTRY, one view per HOUR (all 12 + the uncounted stations), one view per UNIT of the wall's three books (Genesis 19, Leviticus 22, Deuteronomy 13). Planned and approved by M, 07/19.

**M's four rulings (07/19, binding):**
1. **Deuteronomy blocks:** hour 10 = units 1+2, 3+4, 5+6; hour 11 = units 7–9; hour 12 = units 10–12; unit 13 = the exit, outside the count.
2. **Scope: BOTH editions** — a full working database (certified + proposed + staged + struck, all flagged) AND a filtered certified-only edition.
3. **Voice: BOTH** — a technical database (entry numbers, Hebrew, status codes) AND a plain-language document following `parallels-summary.md`'s rules (no scoring codes, no transliteration, no scene numbers; content conventions apply).
4. **Maintenance:** a DERIVED artifact, regenerated at milestones — NOT a third hand-maintained copy. Not part of the rule-11 close-package sync. Say so in each file's header.

**Execution plan approved by M:** shred subagents on a lighter model tier (verbatim transcription only); the main session (strong tier, high effort) does assembly, adjudication, audit. Checkpoint contract below. M has ~50% of the weekly allotment; the expensive irreplaceable work (the shred) runs FIRST.

## Deliverables (all in `_book/`, all headed "derived from hour-ledger.md — regenerate, do not hand-edit")

- `parallels-database.json` — the master: records + unit table + hour table.
- `parallels-database.xlsx` — browsable spreadsheet (sheets: Entries, By Unit, By Hour, Coverage).
- `parallels-database-certified.json` / `.xlsx` — filtered edition (M-certified / ESTABLISHED only).
- `parallels-database-reader.md` — the plain-language document (summary voice rules).
- Catalogue rows + diary entry when the first milestone deploys (standard Cowork contract).

## The fixed frame (unit-to-hour table — verify spans against `sources/torah-units.json` at build time; do NOT restate from memory)

- **Genesis (19 units):** PROLOGUE (uncounted) = units 1–4; hour 1 = units 5–10 (Abraham double); hour 2 = units 11–16 (Jacob double); hour 3 = units 17–19 (Joseph).
- **Leviticus (22 units):** hour 4 = I–III; hour 5 = IV–VI; SCREEN (uncounted) = VII–IX; hour 6 = X–XII; CENTER (uncounted) = unit 13 (Lev 19); hour 7 = 14–16; hour 8 = 17–19; hour 9 = 20–22.
- **Deuteronomy (13 units):** hour 10 = 1+2, 3+4, 5+6 (three intertwined pairs — M, 07/19); hour 11 = 7–9; hour 12 = 10–12; EXIT (uncounted) = unit 13 (Moses' blessings/death).
- Uncounted Egyptian stations: the entrance/First Gate region, the Judgment Hall (inside hour 5, uncounted), the Final Representation. Gates 1–12 attach to their hours.

## Record schema (FROZEN once batch 1 is committed; changes are M's to order, not the chat's)

One JSON record per ledger claim (an entry, or a lettered sub-item where the entry bundles several — e.g. 9.9(a)–(d) = four records sharing parent "9.9"):

    {"id": "9.9a", "parent": "9.9", "level": "hour-pair",   // hour | hour-pair | ring | unit | register | framework | band | gate | carrier | prologue | screen | center | exit | test
     "hours": [4, 9], "units": [],                          // units as "Gen-7" / "Lev-XX" / "Deut-13"
     "torah_locus": "…", "egyptian_locus": "…",
     "link_verbatim": "…full Link-cell text copied from the ledger, unaltered…",
     "class": "G-leaning",                                   // G | G-leaning | A | SHARED | TOMB | none
     "status": "PROPOSED; M-CERTIFIED (07/19)", "certified": true, "struck": false,
     "grade": "H",                                           // H | B | mixed | none
     "proposer": "C", "date_worked": "07/19", "cross_refs": ["9.8"], "notes_flags": "…honest-miss / staged / caveat text if any…"}

Rules of transcription: **verbatim, not paraphrase** — `link_verbatim` is a copy; Hebrew and Hornung quotes carried exactly; nothing summarized at shred stage. **Nothing originated** (ledger rule 10): the database contains only what the ledger contains; a shredder that cannot place a claim returns it FLAGGED, never guesses. **Struck entries included** and marked (rule 4). Session blocks are shredded only for claims NOT already in numbered entries (avoid double-entry; when in doubt, flag).

## Batch plan (each batch = one subagent's slice; committed to `_book/db-build/records/` as `batch-NN.json` BEFORE the next starts)

- B1 — Standing rules, hour-count framework, FRAMEWORK block (FW.1–FW.11), THE PROLOGUE (PRO.1–PRO.9).
- B2 — Genesis: hours 1, 2, 3 + GATE ANATOMY + KING LIST.
- B3 — Leviticus: the HOURS 4–9 header block (L.1–L.8, 13.1 complex) + hours 4 and 5 entries.
- B4 — THE SCREEN, THE CENTER (13.2–13.16), hours 6 and 7.
- B5 — Hours 8 and 9.
- B6 — Deuteronomy: hours 10, 11, 12 + the exit block (EX.1–EX.14).
- B7 — Band-wide (B.1–B.17), carrier evidence (C.1–C.9), test results, open tasks, duality census, session-block residue sweep.
- Then: ASSEMBLY (merge, build unit/hour views, coverage map), AUDIT (below), EDITIONS (xlsx, certified filter, reader doc — script-generated).

## The audit (closes the job; modeled on ledger rule 6)

1. Grep the ledger for every entry ID (regex over `^| [0-9]+\.[0-9]+ |`, FW.n, PRO.n, EX.n, B.n, C.n, GA.n, L.n, S.n, 13.n) → every ID appears in the database exactly once (as a record or a parent), or on the deliberate-exclusion list with a reason.
2. Quote spot-check: 10% sample of `link_verbatim` fields diffed character-for-character against the ledger.
3. Coverage map: every one of the 54 units shows its records or an honest "no unit-level entry yet — inherits hour N" — empty cells are FINDINGS (future rule-10 agenda), not defects.

## Checkpoint contract & state table (update the table with EVERY commit — this file is the memory, not the chat)

| Step | State | Notes |
|---|---|---|
| B0 instructions | **DONE 07/19** | this file |
| B1 | **DONE 07/19** | batch-01.json committed, 62,009 B; 20 records (PRO.1–9, FW.1–11), 4 blocks, 10 certified, 0 struck; all verbatim fields substring-validated against the ledger. Method refinement on record: script extracts verbatim (character-exact), lighter-tier subagent classifies, main session adjudicates (4 overlay errors caught). Sub-item rule frozen (see batch_notes). |
| B2 | **DONE 07/19** | batch-02.json committed, 79,694 B; 44 records (1.1–1.17, 2.1–2.3, 3.1+3.3–3.13, GA.1–8, K.1–4), 6 blocks, 5 struck (1.1, 1.2, 3.1, 3.10, GA.3 — matches docket triage), 0 certified. Exclusion found: no 3.2 in ledger (absorbed into 3.6 per its status cell). Struck old form of 2.1 carried as a rule-4 block. Standing question flagged for M: are M-authored PROPOSED entries "certified" for the filtered edition? (currently NO — explicit certification acts only). |
| B3 | **DONE 07/19** | batch-03.json committed, 62,117 B; 33 records (L.1–L.8+L.3a, 13.1 merged complex, 4.1–4.9, 5.1–5.14), 3 blocks, 6 certified (4.9 «write to ledger»; 5.9/5.10/5.12–5.14 «record all»), 2 struck (13.1 original form, 5.3). Parser extended for bullet (- **L.n**) and digit-para (**13.1) formats. Flagged for M: the Triad-C-=-veil ESTABLISHED block; 5.2 recorded re-homed (not struck). |
| B4 | **DONE 07/19** | batch-04.json committed, 77,803 B; 35 records (S.1–S.9, 6.1–6.6, 7.1–7.5, 13.2–13.16), 5 blocks, 1 certified (13.16 'brilliant'), 2 struck (6.1, 7.4). S.1 status ESTABLISHED — certified-edition filter fixed as (certified OR status contains ESTABLISHED) per M's edition spec. Units policy recorded (explicit Unit-N mentions only). Hour-6/7 header apparatus + lettering correction carried as verbatim blocks. |
| B5 | **DONE 07/19** | batch-05.json committed, 71,200 B; 26 records (8.1–8.14 incl. struck 8.2/8.3/8.5 promoted from the strike block + resolved 8.4; 9.1–9.6, 9.8, 9.9a–d, 9.10), 3 blocks, 9 certified, 3 struck. 9.9 split on its ledger (a)–(d) markers per M's schema example (children share parent "9.9" + parent_header_verbatim). Exclusion found: no 9.7 in ledger (referenced only inside test #17) — flagged for M. |
| B6 | **DONE 07/19** | batch-06.json committed, 117,886 B; 56 records (10.1–10.3, 11.1–11.4 struck + 11.5–11.27, 12.1–12.12, EX.1–EX.14), 7 blocks, 46 certified (ENTERED-M-ruled counts as an M act; PROPOSED does not), 4 struck. 12.2→EX.6, 12.3→EX.1 absorptions recorded. A.2 position-flag paragraph carried as a block (the entry itself is B7's). Flagged: EX.10 stays a flag, EX.12 name-flag, 10.3 rule-extension certification owed. |
| B7 | **DONE 07/19** | batch-07.json committed, 167,172 B; 28 records (B.1–B.9+B.11–B.17, C.1–C.9, A.1/A.2 split from the test paragraph, F.1), 21 blocks (all session blocks + open tasks verbatim), 1 certified (B.13 census), 16-item residue_sweep of staged/parked/held items awaiting M. Exclusion found: no B.10 row (referenced by 6.6/13.9/B.11) — flagged for M. B.7/B.8/B.9 ESTABLISHED via status text (certified-edition filter catches them). |
| Assembly | **DONE 07/19** | parallels-database.json committed to _book/, 666,357 B; 242 records merged (no duplicate IDs), 54-unit table (spans verified against sources/torah-units.json at build time — Gen 19 / Lev 22 / Deut 13), 12-hour table + 4 uncounted stations, coverage map (10 honest empties = findings: Gen-9, Gen-12–16, Gen-19, Lev-7–9), deliberate exclusions (3.2→3.6, 9.7, B.10, 9.9→children), 16-item residue sweep, all blocks + provenance carried. |
| Audit | **DONE 07/19 — PASS** | db-build/audit-report.txt committed. ID sweep: 239 ledger IDs, zero missing, zero phantom, zero duplicates. Quote check run at 100% of verbatim fields (stronger than the 10% spec), zero failures; formal 10% sample listed in report. Coverage: 54/54 units accounted for. |
| Cross-connections | **DONE 07/19** | M's catch, same session: hour-homed records with units reaching other stations (11.10/11.11 → hour 12, EXIT, PROLOGUE) were invisible to a strict hour_table iteration. Fix in assemble_db.py: every record carries derived `stations_reached` (home hours + level station + every station its units touch); every hour/station view carries `cross_connections` beside home `records` — a UI must read BOTH. 11.10 units corrected (+Gen-III, named in its own text; batch-06 → 118,202 B). Master → 677,423 B, certified.json → 218,287 B, xlsx → 163,698 / 76,994 B (By Hour now two columns; Entries has stations_reached). Audit re-run: PASS. |
| Explorer UI | **DONE 07/19** | parallels-explorer.html committed, 17,480 B (M's request, same session). Single-file static viewer over parallels-database.json (relative fetch + cache-buster — works on the live site, not file://). Unit view = unit-level records + the block's records + cross-connections + finding banner when empty; block view = home records + cross-connections; whole-composition views (framework/band/rings/gates/carrier/tests); certified-edition and struck toggles; search; clickable cross-refs and station chips. Headless-tested (Chromium): hour 12 shows 11.10/11.11 via cross-connections, Gen-7 shows 1.14 + block inheritance, Lev-8 shows the finding banner, certified toggle hides 9.4 and keeps 9.10, zero console errors. Derived viewer — DB regeneration needs no change here. |
| Wall map | **DONE 07/19** | parallels-map.html committed, 27,589 B (M's request: general-reader map of the three wall books with chapter:verse per unit, parallel to the Gates' three registers). One aligned scroll: Gates band (register captions quoting the ledger's [H] scene maps, scene numbers per H&A) above, Torah band below with units placed BY THE TIER THEY FACE per the ledger's own mappings (Gen rows (5,6)/(7,8)/(9,10) per B.11/1.14; Lev 4–6+8–9 serial-direct per 4.7/5.12/8.11/9.3; hour 7 inverted XVI/XV/XIV per the D↔F block; Deut bottom-up per 10.3, row 1 facing lower). M catch #2 on the map: hours 1/2/7 first shipped with spanning captions instead of register cells — recovered from the ledger (H7 full exposition Scenes 42–47; H1 via 1.3/1.5 + the 07/16 session record; H2 upper attested, the three-fate sort shown spanning middle+lower since the ledger fixes 'one floor' but not which register). Uncounted gold columns: Prologue↔Entrance, Screen↔Judgment Hall, Center↔no-Gates-station (FW.8 wording), Exit↔Final Representation. Unit chips deep-link to the explorer (#unit=/#station= hash routing added to parallels-explorer.html → 18,166 B). Generator db-build/gen_map.py committed. Headless-tested: alignment, deep links, zero console errors. |
| Editions | **DONE 07/19** | All four committed to _book/: parallels-database.xlsx 162,067 B (Entries with headers in row 1 + autofilter / By Unit / By Hour / Coverage / About — corrected same session: first cut had the derivation notice in row 1, demoting the headers to data); parallels-database-certified.json 213,975 B + .xlsx 76,215 B (filter: certified OR ESTABLISHED — 77 records); parallels-database-reader.md 54,413 B (plain-language, codes/Hebrew/scene-numbers stripped, script-generated). Deploy contract done: diary entry `_log/2026-07-19-parallels-database.md` + index link + catalogue refreshed (5 root rows, db-build section, _log row). Status doc deliberately untouched (derived-artifact ruling; flagged in the diary entry for M). JOB COMPLETE — M reviews the diff and pushes. |

## Resume procedure for a new chat

1. Run the standard begin procedure first (`book-chat-directions.md` steps 1–3 at minimum — the status doc is binding).
2. Read THIS file, then the state table. Verify the last claimed batch actually landed (list `_book/db-build/records/`, check byte counts, spot-open the newest file — tool-verified, per the repo's own takeaway).
3. Continue from the first not-started step. Do not redesign the schema; do not re-shred done batches; flagged items go to M, not to the chat's judgment.
4. Repo access: session runs inside Cowork; request the folder `C:\GitHub\asitwaswritten` via the device bridge and write directly (the 07/19 chat's working method — grant, write, verify byte counts).
5. Ledger source of truth: read `_book/hour-ledger.md` from the repo (or live with cache-buster). 433,902 B as of 07/19; if it has grown, the NEW material must be shredded too — add a batch, note it in the table.

---

## SESSION CLOSE 07/19 (the build chat) — FULL RECORD & HANDOFF. A new chat starts from HERE.

**Everything below was committed to `C:\GitHub\asitwaswritten` and awaits M's review + push in GitHub Desktop. NOTHING IS LIVE until M pushes.** After push + cache purge, verify with a cache-busted fetch (`?cb=<timestamp>`); any fetch of exactly 29,198 bytes is the Cloudflare block, not content.

### The URLs (live after M pushes)

| What | URL |
|---|---|
| **The Wall Map** (general reader: three books w/ chapter:verse per unit ‖ Gates' three registers, aligned) | https://asitwaswritten.org/_book/parallels-map.html |
| **The Parallels Explorer** (unit / unit-block → parallels; certified + struck toggles; deep links `#unit=Gen-7`, `#station=12`) | https://asitwaswritten.org/_book/parallels-explorer.html |
| The master database (242 records, views, coverage, residue) | https://asitwaswritten.org/_book/parallels-database.json |
| Browsable spreadsheet (Entries/By Unit/By Hour/Coverage/About) | https://asitwaswritten.org/_book/parallels-database.xlsx |
| Certified edition, JSON (77 records) | https://asitwaswritten.org/_book/parallels-database-certified.json |
| Certified edition, spreadsheet | https://asitwaswritten.org/_book/parallels-database-certified.xlsx |
| Plain-language edition | https://asitwaswritten.org/_book/parallels-database-reader.md |
| This file (the build memory) | https://asitwaswritten.org/_book/db-build/db-build-instructions.md |
| Shred checkpoints | https://asitwaswritten.org/_book/db-build/records/batch-01.json … batch-07.json |
| Audit record (PASS) | https://asitwaswritten.org/_book/db-build/audit-report.txt |
| Map generator (regeneration script) | https://asitwaswritten.org/_book/db-build/gen_map.py |
| Deploy diary entry for this whole run | https://asitwaswritten.org/_book/_log/2026-07-19-parallels-database.md |

Repo paths mirror the URLs under `C:\GitHub\asitwaswritten\_book\`. Refreshed this session: `book-directory-index.md` (catalogue rows for all new files) and `_log/index.md` (diary link).

### What the session did (compressed; details in the state table above and the diary entry)

Shred B1–B7 → assembly (242 records; no duplicate IDs) → audit PASS (239 ledger IDs, zero missing/phantom; verbatim check at 100%; 54/54 units) → editions (xlsx ×2, certified json, reader doc) → the Explorer UI → the Wall Map. Method: script-extracted character-exact verbatim + lighter-tier classification overlays + main-session adjudication per batch. M's catches, all fixed same session: (1) xlsx header row; (2) cross-connections invisible to hour-iteration → `stations_reached` per record + `cross_connections` per view + 11.10 units corrected (+Gen-III); (3) map hours 1/2/7 shipped without register cells → recovered from the ledger; (4) Leviticus numerals mixed → all-Roman I–XXII on both pages (data keys stay arabic `Lev-14`).

### OPEN — M's rulings owed (the next chat's agenda)

1. **The post-center inversion question (M's last observation, unresolved).** As the ledger stands: hour 7 / Column F inverts serial order (row 1 = Unit XVI, per the D↔F block); hours 8 and 9 map SERIAL-DIRECT (8.11: Upper↔XVII, Middle↔XVIII, Lower↔XIX, M-certified «record all»; 9.3: Upper↔XX, Middle↔XXI, Lower↔XXII); Deuteronomy fully bottom-up (10.3; 07/16d note verbatim: Unit 7 row 1 ↔ Gates LOWER). The map draws exactly this. **M to rule:** is F-alone-inverted the intended structure (map correct as drawn), or should FW.1's "reversal from hour 7" govern hours 8–9's register alignment too (then 8.11/9.3 need re-reading and the map flips those columns)? Display-only either way; the database is untouched by the ruling.
2. **Numerals:** Leviticus now all-Roman (SBL-figure convention). If M prefers all-arabic for the general reader, it is a one-line change in `gen_map.py` + the explorer's `unitLabel`.
3. **Certified-edition boundary as frozen:** explicit M acts OR status ESTABLISHED. M-authored entries at plain PROPOSED are EXCLUDED — confirm or widen (batch-02 note).
4. **B.10** — referenced by 6.6/13.9/B.11 ("capstone of B.10", the name-forms thesis) but NO row exists in the ledger. Write it, or leave excluded?
5. **9.7** — referenced only inside open-task 17; no entry exists. Confirm exclusion.
6. **The 16-item residue sweep** (batch-07 / master JSON `residue_sweep`): staged/parked/held items awaiting M — mutual-swallowing, the 56th-Scene line, the 3-6-3 held claim, centers convergence, census-table certification, kadosh-wrinkle datum, etc.
7. **Status doc:** deliberately untouched this session (derived-artifact ruling; this deploy ran on the db-build contract: diary + catalogue only). If M wants a book-status.md line about the database, the next book chat should add it in a proper close package.

### PROMPT FOR THE NEXT CHAT (paste as the first message)

> Continue the Parallels Database work. Begin procedure first (curl -s https://asitwaswritten.org/_book/book-chat-directions.md and follow steps 1–3 at minimum). Then read `_book/db-build/db-build-instructions.md` in the repo — its SESSION CLOSE 07/19 handoff section is the record of the last chat: the state table (all steps DONE through the Wall Map), the URL table, and the seven open rulings. Verify the last session's files actually landed (list `_book/` and `_book/db-build/records/`, check byte counts against the state table). If I have pushed, verify live with cache-busted fetches. Repo access: request the folder `C:\GitHub\asitwaswritten` via the device bridge. Then take up the open rulings with me in order, starting with the post-center inversion question (item 1). Do not redesign the schema; do not re-shred; flagged items are mine to rule on, not the chat's.
