// تثبيت المهارة
تثبيت المهارة
المهارات هي كود تابع لأطراف ثالثة من مستودعات GitHub العامة. يفحص SkillHub الأنماط الخبيثة المعروفة، لكنه لا يستطيع ضمان السلامة. راجع الكود المصدري قبل التثبيت.
تثبيت عام (على مستوى المستخدم):
npx skillhub install HistoricalChristianFaith/Commentaries-Database/fresh-importتثبيت في المشروع الحالي:
npx skillhub install HistoricalChristianFaith/Commentaries-Database/fresh-import --projectاستخدمه مع Hermes أو أي runtime آخر. تُكتب المهارة في <directory>/<skill-name>/.
npx skillhub install HistoricalChristianFaith/Commentaries-Database/fresh-import --target-dir /path/to/skillsالمسار المقترح: ~/.claude/skills/fresh-import/
محتوى SKILL.md
---
name: fresh-import
description: Replace an old import of a church father's commentary with a fresh public-domain translation (resolve the work, survey, delete the old blocks, pilot, chunks, final review, close the issue). Takes a Writings-Database html path, or a historicalchristian.faith / GitHub url of one.
argument-hint: <work html path or url>
disable-model-invocation: true
---
# Fresh-translation import
Work to import: `$ARGUMENTS`
This is the process for replacing an old (usually machine-translated) import of a commentary with
a fresh public-domain translation. It was worked out over the "fresh Jerome" series
(Commentaries-Database issues #32 onwards). Everything it needs is in this folder:
- `SKILL.md` (this file): the process, the standing rules, how to review, mechanical fixes.
- `scripts/`: the importer, the audit, the deletion tool, the extra checks and a KJV lookup.
The importer's `WORKS` entries record every work imported so far, with the notes that
described its quirks; they are the models for a new run.
- `work/` (gitignored, created by the importer): the cut pieces and the run logs.
Read the whole of this file before starting, and the project `CLAUDE.md`. The rules below were
approved by the user across the series; follow them exactly. If a rule changes during a run,
update this file (see Phase 7).
Run every command from the Commentaries-Database root. `scripts/` below means
`.claude/skills/fresh-import/scripts/`.
**Prerequisites:** Python 3.11+ (`tomllib`), the `claude` CLI on the PATH (the importer runs it
headless), `gh` logged in to GitHub, and a checkout of
`HistoricalChristianFaith/Writings-Database`. The scripts look for that checkout next to the
Commentaries-Database (`../Writings-Database`); set `WRITINGS_DB=/path/to/Writings-Database` to
point them elsewhere.
---
## 1. The shape of the job
- **Source:** one HTML file in the Writings-Database, e.g. `Jerome/Commentary on Joel.html`,
laid out as:
```
<article class="writing">
<h1>Commentary on Joel</h1><i>translator's note</i><br><br> (the preamble)
<h2>Prologue</h2> ... (non-verse: the work's prologue)
<h2>Book Two</h2> ... (non-verse: a book preface, in multi-book works)
<h2>1:1</h2> <i>lemma</i> exposition... (a verse section)
<h2>1:2-3</h2> ...
```
**Read the translator's note:** it says how the lemmas are laid out (the Hebrew version, then "LXX:"),
how Psalms are numbered, how Greek and Hebrew are rendered, and whether there are footnotes.
- **Target:** `[[commentary]]` blocks in `<Father>/<Book C_V>.toml`, each with `quote`,
`source_url` and `source_title`. The source_url is the historicalchristian.faith url of the html
file (`source_url_for()` in the importer builds it).
- **Old blocks:** the earlier import of the same work shares that source_url. Sometimes there are
also variants: url-less excerpts of an even older translation (titled e.g. "COMMENTARY ON
EZEKIEL 11:34.1-31"), `#anchor` variants of the url, and old cross-references filed under other
books. All of them get deleted first. Blocks from the father's other works are never touched.
- **Who does what:** the Python driver cuts the work into pieces and hands each piece to a
headless `claude` agent, which decides the verse file for every stretch of text. You, the
orchestrating agent, prepare the notes, review each batch, fix mechanical problems, and bring
the judgment calls to the user. The user runs the long import commands in their own terminal,
except for the pilot, which you run yourself if the user asks you to (Phase 3).
## 2. Tools
All are in `scripts/`. Read them before using them.
| Tool | Use |
|---|---|
| `process_jerome_commentary.py <Work> …` | The importer. Splits the html on `<h2>` into pieces (one per chapter; a chapter over 30k chars is cut at section boundaries, and an oversized section stands alone). For each piece it runs `claude -p` twice in one conversation: the import prompt, then "Double check, was this fully imported properly?". Options: `--dry-run`, `--split-only`, a single piece name, `--start-after NAME`, `--through NAME`, `--check`. Per-work settings are in `WORKS` (html path, book, source_title, `notes` injected into every piece's prompt). Logs go to `work/jerome_<work>_import_logs/run-*.jsonl` (summaries) and `run-*.events.jsonl` (full event stream). |
| `delete_commentaries.py <Father> <source_url> [--title-prefix P] [--titles-file F] [--dry-run]` | Deletes blocks whose source_url matches exactly (and whose title starts with P, or is exactly one of F's lines, if given). It cuts blocks out of the file text, so the other blocks keep their exact bytes, and it refuses an empty url without a prefix. **Never run it with an empty url and no prefix.** |
| `audit_jerome_import.py <Work> --headings` | Before importing: heading formats, headings not in the KJV, "lemma opens like KJV x:y" hints, sections not opening with italics, lemma-only sections. |
| `audit_jerome_import.py <Work> <BASE> <pieces…>` / `--all` | After importing: verbatim + unique match of every block, overlaps, coverage gaps (with opening words), append-only status of pre-existing files, LEMMA/LEMMA CUT checks, PLACEMENT? and OUTSIDE HEADING hints, wide ranges, small blocks, where each non-verse section went, and a per-section LAYOUT. `BASE` is the deletion commit. |
| `import_checks.py <Work> continuity\|boundaries\|pieces\|notes\|order` | Heading continuity, lemma-only sections and piece openings, reassembly of the pieces, verification of every quotation in the notes, and the source-order check after out-of-sequence runs. |
| `kjv_lookup.py "<Book> <C>:<V>[-<V>]"` | KJV text of a verse or range (e.g. `"Psalms 118:8-9"`). The data is `kjv.sqlite` (table `bible_kjv`, `book` lowercase without spaces, `txt_location = chapter*1000000 + verse`), which the audit also reads. The import prompt tells the piece agents to use this lookup. |
**Chapter-headed works:** when the `<h2>` headings are chapters and each paragraph opens with its
own lemma (Matthew, Jeremiah), set `chapter_re` and `lemma_paragraphs` in `WORKS`. Rules 3 and 4 then
apply per paragraph, and `audit --headings` lists every paragraph's guessed verse ("LOW" = weak match).
A chapter is one section, so it is never cut: a long chapter makes one big piece (Jeremiah 31, 53k
chars, imported cleanly). The guesses are weak where a lemma quotes a long passage, so expect OUTSIDE
HEADING flags there.
**Other fathers:** `process_jerome_commentary.py` hard-codes `FATHER = "Jerome"` and assumes the
`<h2>` layout above. For another father, copy it to `scripts/process_<father>_commentary.py`,
change `FATHER`, the units/logs folder prefix and the prompt wording, give it its own `WORKS`, and
keep the same two-prompt flow and `--check`. `process_berengaudus_commentary.py` (Berengaudus on
Revelation) is the model. The audit and `import_checks.py` find the right module themselves: they
load every `process_*_commentary.py` and use the one whose `WORKS` has the work key, so a key must
not be in two importers. The process below stays the same. Keep the copy's paths the same way as
the original's (relative to the skill folder), so it works on any checkout.
- **A different source layout** is handled in the copy's `load_work`, which should still return
one section per lemma (heading = its verse label, `html` = the raw source text the agent sees,
`body` = the text that is imported and checked). Then pieces, prompts, `--check`, the audit and
`import_checks.py` all work unchanged. Berengaudus's chapters hold bold lemmas labelled
`<b>Revelation 1:1a <i>…</i></b>`: `load_work` cuts a section at each label, keeps the label in
`html` as a hint, and drops it from `body`. The text before a chapter's first lemma (a vision
preface) is its own non-verse section.
- **A work in a subfolder** (`Berengaudus/Commentary on Revelation/English.html`): the Jerome
`source_url_for` would encode the inner `/` as `%252F`; the copy keeps `%2F` between segments,
as the existing urls do. Compare the result with the old blocks' url before deleting.
- A translator's introduction or essay before the work goes in `strip` (as a `(?s)` regex), so
it is neither sent to the agents nor checked.
- **A father folder with spaces** (`Cyril of Alexandria`): the existing urls double-encode the
father segment too (`file=Cyril%2520of%2520Alexandria%2F…`, as the project `CLAUDE.md` example
shows); `process_cyril_commentary.py`'s `source_url_for` does this. Jerome's and Berengaudus's
never needed it.
- **A work split over many files** in the Writings-Database (Cyril on Luke: 14 sermon files of
Pearse's scanning batches, with parenthesised names that had produced 23 url spellings in the
old blocks): with the user's approval, merge it into one standard-format file in the
Writings-Database first (renumber the footnotes 1..k, state per-page boilerplate once in the
source note, check the visible text is the inputs joined), so the import has one url and one
`WORKS` entry. Fix source errors found on the way (wrong verse labels) there too, with the
user's OK; commit in the Writings-Database only when the user approves.
- **Labels in the running text** (Cyril on Luke: `7:36-50. <i>lemma</i>` at a paragraph start
under `<h2>` sermon headings): `load_work` cuts at each label as Berengaudus's does at each
bold one; text under a heading before its first label (a sermon continuing the last one's
passage, label-less catena fragments) is a non-verse section the notes describe. Editorial
matter inside the sermons (provenance notes `[From Mai.]`, notes on lost text, standalone
lacuna lines, manuscript rubrics and colophons) goes in `strip`; the translator's bracketed
supplements stay. Unlinked note marks (`turn<sup>2</sup> away`) are dropped in `load_work`,
or agents silently "correct" them and the check fails.
- **Bare verse numbers mid-sentence** (Theodoret on Romans: `<h2>Chapter IX.</h2>` and
`…his proposed design; 6. <i>Not as though…</i>`, the lemma sometimes in plain text):
`process_theodoret_commentary.py` is the model. `load_work` cuts a section at each number
that follows on from the last one in its chapter (prev < v <= prev+5, so references like
"(John i. 29, 36.)" aren't cut), joins a number holding only its lemma to the next one
("15:1-2"), drops every number from the body, opens a chapter's first section with its
lead-in words, and carries the chapter across `<h2>Book N</h2>` tome headings that fall
mid-chapter (their text before the first number is a non-verse preface). The notes tell the
agents that a block starts where the number stood, even mid-sentence. Since a comment often
rightly covers two numbered verses, `WORKS` sets `label_sections`, and the audit then reports
a section covered by a block from the section before as "joined" (or JOINED? if the block's
file doesn't include that verse) instead of LEMMA. Survey the numbers' sequence per chapter
first: misprints ("39." for 29) and numbers run into the word before them ("eternal.18.")
are fixed in the source.
- **OCR'd sources** (Theodoret's Romans, scanned from an 1839 magazine): the pilot agents'
"kept as printed" lists showed many misreads (he/be, "bom", "the (rod of all", "thou shall"
in KJV lemmas). A dictionary scan finds almost none of them; two read-only subagents
proofreading half the text each (exact unique snippet, correction, confidence) found 60+.
Do this after the pilot, before the chunks; check each finding in context; fix the source
with the user's OK and apply the same fixes to the pilot blocks (whitespace-tolerant
replacement of the plain-text forms), then re-audit the pilot.
- **If an authoritative transcription exists** (CCEL's NPNF pages), diff against it instead,
in Phase 1, before anything is imported: Augustine's Tractates on John (OCR'd) gave 606
word-level differences across 124 files. Tokenise both texts into words (ignoring case,
punctuation and quote style), `difflib` them, and map each difference back to an html offset
in the local file so the fix keeps the file's own markup and punctuation. The diff found
misreads (shall/shalt ×46, test/lest ×15, cloth/doth, horn/born, layer/laver), ~210 glued
words, beta-code Greek, 17 lost lines (Tractates 1, 2, 6, 7) and a duplicated passage
(Tractate 6, whose extra footnote marker shifted the notes). Strip CCEL's page-number spans
(`<span class="pb">`) first, and reject the differences where CCEL is the odd one out: its
page-break word splits ("con cealed", "be cause"; a local whole word in the dictionary or used
elsewhere in the work is right) and its own typos. Review every remaining difference, stage
the fixed files in the scratchpad, re-diff (only the rejects should remain), then write them
with the user's OK. The same CCEL pages give the footnotes, so compare markers by the words
before them too (lost markers shifted the notes in five tractates; 79 notes had lost their
Hebrew/Greek and were truncated).
- A word diff can't see punctuation: some missing paragraph breaks stay (Tractate 104's
`Thee."3. The glorification`, a lost break, failed `--check` after the import and was fixed
in the source; the agent had already put the break in its block).
- **A homily series, one file per sermon** (Augustine's Tractates on John: 124 files, each its
own url, numbered paragraphs, no lemmas): `process_augustine_commentary.py` is the model. Its
`WORKS` is generated, one entry per file (`JohnTr001` … `JohnTr124`, `"homily": True`), each
one section and one piece (6–47k chars; a sermon is never cut), headed by the passage read
from the italic line under the title (with `PASSAGES` overrides where it says "On the same
passage"). The NPNF paragraph numbers are stripped (the user's choice); the notes are inline
`[note: …]` hints. The command line takes ranges (`JohnTr031-JohnTr056 JohnTr058-JohnTr072`)
and runs `--check` after each tractate. With `homily`, the audit skips the lemma and
placement checks and only asks that a block starts at the sermon's start (START). Agents file
a sermon's recap of earlier verses under those verses (OUTSIDE HEADING): correct by rule 2.
The pilot's tractates run ahead of their neighbours, so files shared by several tractates end
up out of tractate order: `--order` finds them and `--fix-order BASE` reorders only the
appended blocks. Blocks were large where Augustine dwells on one verse (a 37k block for
Tractate 5, all on 1:33; 18.5k of Tractate 1 on 1:1): check the opening of each big block
against the next verse's first quotation before calling it under-split.
- **Homilies on the Psalms** (Jerome's 73, two series, `process_jerome_psalms_commentary.py`,
keys `PsHom001` … `PsHom073`): the same homily layout, with the psalm numbered as in the
Septuagint/Vulgate. `kjv_heading` turns it into the KJV range used as the hint heading (most
psalms +1; Latin 9 = KJV 9-10, 114/115 = 116:1-9/10-19, 146/147 = 147:1-11/12-20), and the
notes tell the agents to place by the verse's WORDING (the Latin counts titles as verses, and
the psalter is translated from the Greek: "Let the just feast" is KJV 68:3). A psalm's title
goes under its verse 1. The second series preaches again on psalms of the first, so many
files hold both; run the first series first and fix the pilot's leftovers with
`--fix-order BASE`. The pilot used six homilies, then the rest went in one run. In the
"re-import" case the old blocks were of the SAME translation (a weak earlier import: 94%
coverage, 39 blocks not verbatim); the url-less ACCS excerpts (FC's Ewald translation,
115 title spellings, FC numbers 1-73 = ours, 75+ = the Mark and other homilies) were matched
by title and confirmed by distinctive phrases, since a word-overlap score barely separates
homilies across translations.
- **Cross-psalm parallels look like own-book blocks:** `--check` and the audit count every
`Psalms` file as the book's own, so a homily's parallel under ANOTHER psalm shows as
OVERLAP + OUTSIDE HEADING (45, all genuine), and a stretch filed ONLY under another psalm
would still pass the coverage checks. So check coverage by each homily's own psalm's files
alone as well (it was complete), and confirm that no OUTSIDE HEADING block lies inside
the homily's own psalm. A heuristic scoring each block's opening against the psalm's KJV
verses flags possible verse slips; nearly all 76 flags were titles, Latin lemmas or the
Greek wording, and every one checked out.
- **Old vs new comparison** (asked for after the import; worth doing whenever the old
blocks are of the same translation): map every old block's text to the new blocks
covering it, and back. Here the placements agreed almost entirely (739 same file, 60
overlapping, 3 real disagreements, all decided for the new import). The useful output was
the old cross-references the new import lacks: of 114 (23 same-translation, 91 ACCS),
subagents judging each by rule 8 found 13 genuine expositions the agents had missed,
mostly a SECOND verse expounded inside a stretch already cross-filed for one verse, plus
a psalm title's history (1 Samuel 24:3). They were added from the source paragraphs
(check each end for a closing quotation mark), followed by `--fix-order`. The rest were
passing proof-texts, thematic tags or wrong verses in the old files.
- **An apologetic treatise, selective, one file per book** (Eusebius's *Proof of the Gospel*,
Ferrar 1920, Pearse's transcription; `process_eusebius_commentary.py`, keys `DE01` …
`DE10`): a copy of the Cassian importer. Chapters are `<b>CHAPTER N</b>` (not `<h2>`);
the text before Chapter 1 is the book's introduction (section 0, "…, Book N,
Introduction"/"Preface"), and the fragment of Book 15 printed at the end of Book 10 is its
own section (99, "The Proof of the Gospel, Book 15 (Fragment)", Book 10's url). Ferrar's
apparatus is dropped from the body by paragraph: bold headings, source lines ("From Micah.",
"(46) 3. From the same.", "Psalm xix."; matched on plain text) and every wholly italic
paragraph (chapter and sub-section summaries); his "[Passage quoted, Isa. xxxv. 3.]"
placeholders stay and open the block whose exposition follows. Fabricius's page marks
("(144)", "(b)", Book 1's "{2}"; only 2-3 digit numbers, since Book 5 has Eusebius's own
"(1) … (2) … (3)"), Pearse's `[[ref]]` margin references and his notes on the
transcription are in `STRIP`. 582 blocks in 503 files from 45 pieces (five unsplittable
chapters of 42-67k imported fine).
- **No authoritative transcription, so diff against scans of the print edition**:
archive.org has OCR text of Ferrar's volumes (two independent scans of vol. 1, one of
vol. 2). Word-diff each book, drop the scan's running headers and hyphenated line ends,
treat scan-only runs over 12 words as footnotes (check them for lost prose: none was
lost), and flag a Pearse word only where it disagrees with the scan(s). Four read-only
reviewers judged ~830 items (fix with an exact unique html replacement, or reject).
Then a second pass against the CLEANER scan alone: the noisier scan often shares
Pearse's misreads (same print), so "disagrees with every scan" had let some through
("thou shall tithe", "when them earnest"). A dictionary scan of rare words and a pattern
sweep (shall/shalt, hut, arc, clay, "1" for "I", line-break hyphens in names) found
the rest. Where both scans agree with Pearse (e.g. "Ephiatha"), it is Ferrar's own
misprint: keep it. ~180 fixes, committed in the Writings-Database with the user's OK.
- **An unconverted Pearse page** (Book 2 was still raw tertullian.org html): the
Writings-Database's `standardization/pearse_transform.py --file … --dry-run` said why it
had failed closed (a note list with notes 6-7 printed twice and note 49 lost; the scan
gave note 49). After repairing the notes in a scratch copy it converted with all its
gates passing; run it on the real file only after applying the word fixes to the raw
file.
- **Spacing around removed marks matters for `--check`**: a mark stripped beside a quote,
dash or hyphen leaves a space the agents (rightly) don't copy (`"{6a} Go`,
`rejoice" [[John xvi. 20]]----the`, `Only- (232) begotten`), and a footnote mark
with no space after it glues words (`Christ.<sup>39</sup>And`). `make_body` replaces
every removed mark with a placeholder and `_settle` decides: nothing after an opening
quote or paragraph start, before closing punctuation or a dash, or after a hyphen; a
space after a footnote mark between words; otherwise one space if there was one. Strip
unlinked `<sup>` marks case-insensitively (`<SUP>3</SUP>`), keeping a space for empty
ones (`commands,<SUP> </SUP>and`).
- **Source debris surfaces as NOT VERBATIM**: the agents silently mend stray characters
("( But" = a lost "(237)", "name 8. is" = a margin ref, "('-')" = "(c)", "Barak<br><br>
(d).of"). Diff each failing block against the body at the divergence; check the scan;
fix the source (not the block) when the agent was right, and fix blocks that copied an
old misprint. Re-run `--check` on every book after each source or `make_body` change.
- **Old excerpts** were 7 url'd blocks and 117 url-less ones (ACCS, many paraphrased, one
the Book 15 fragment on Daniel 2:31). A rarity-weighted word overlap against every
chapter confirmed each was this work even when the text barely matched. After the
import, comparing old verse ranges with new ones found 30 old excerpts with no new
block in an overlapping range; a subagent judged each by rule 13: 13 were
already filed under a nearby or parallel verse, 11 were passing proof-texts or tags, and
6 genuine expositions were added from the body text (Colossians 2:16-17, Isaiah 29:11,
John 4:10, Judges 1:1-2, Mark 1:2, Romans 5:12), mostly the NT verse of a fulfilment.
- A scope slip to watch in a selective run: one exposition of Zech 11:7-14 was copied
whole into `11_7`, `11_10` and `11_14`; merged into `Zechariah 11_7-14`. (One stretch
expounding two SEPARATE quoted passages, e.g. Isa 19:1-3 with 19:19-21, rightly goes under
each.)
- **A dogmatic treatise from a clean CCEL source, selective, one file per book** (John of
Damascus's *Exact Exposition of the Orthodox Faith*, Salmond, NPNF2 vol. 9;
`process_damascene_commentary.py`, keys `OF01` … `OF04`, `"kind": "exposition"`): a copy of
the Cassian importer, the easiest selective run so far. The books had just been rebuilt from
CCEL with corrections from the 1899 print, so no proofreading pass was needed; the marker/note
offset score (shift 0 clearly best in every book) and a read of the low scorers confirmed the
notes. All 100 chapters open with a summary line made only of italic runs, note marks, spaces
and a period, so one generic `SUMMARY_RE` replaced Cassian's list of irregular cases, and
`load_work` refuses a chapter without one. Salmond's Psalm numbers are the English ones.
- **Greek in non-NFC code points**: Salmond's accented Greek uses oxia forms (U+1F73 "έ"),
which agents retype as the identical-looking tonos form (U+03AD); `_norm` NFC-normalizes
both sides, so the check never fails on an invisible difference. Check `unicodedata.
is_normalized` on a new source's Greek before the pilot.
- Pilot of 6 pieces (one per risk: Book 1's first piece and its 35k Trinity chapter, Paradise,
the descent into Hades, the cross/eucharist chapters, the last piece), then the other 18 in
one chained background run: 292 blocks, all checks clean; the pilots left 6 files out of
source order (fixed by cutting the file text; across books too, Book 1 → 4). The agents were
generous rather than strict (short glosses of a verse inside a doctrinal argument, a type
of the cross filed under each of its nine verses), and corrected several wrong footnote
references themselves.
- **Old excerpts**: 5 url'd, 5 newadvent (III.29, IV.14) and 80 url-less ACCS blocks (52
title spellings, all containing "Orthodox Faith"; deleted by `--titles-file`). The 65
untitled url-less blocks were the father's Pauline commentary (no text match) and stayed.
Comparing old verse ranges with the new blocks' chapters left 34 misses; a subagent judged
them: 4 genuine expositions added (1 Peter 3:19 for the descent into Hades, Psalms 68:32-33
and Malachi 4:2 for worshipping toward the East, Romans 11:36 marked by Salmond's note),
7 already covered (several under the right verse where the old one was wrong), 23 passing.
- **A fresh translation from the Latin, numbered propositions with no verse labels**
(Augustine's *Exposition of Certain Propositions from the Epistle to the Romans*, PL 35 via
augustinus.it; `process_augustine_romans_commentary.py`, key `PropRomans`, since `Romans` is
Theodoret's; a second Augustine importer, as Jerome's Psalms has its own): a copy of the
Theodoret importer. No `<h2>`: 76 paragraphs `<b>N.</b> [M.] When he says: <i>lemma</i> …`, the
bracket being the standard numbering 1-84 (joined "[13.-18.]", split "[29. 1.]"). `load_work`
cuts one section per proposition, plus the opening sentences as the prologue (→ `Romans 1_1`
after the existing block), keeps the numbers in the pieces and shows the footnotes inline as
`[note: …]`. Each section's heading is a GUESS of its lemma's verse (`guess_verses`: KJV word
overlap on a path that pays for steps back and for long jumps forward), written `3:20 ¶13-18`;
it is an audit hint only, and the prompt lists the proposition labels instead (rule 1). Three
guesses stay wrong (KJV wording too far from the Latin-based lemma: [5.] 1:24, [7.-8.] 1:32,
[81.] 14:22) and show as expected OUTSIDE HEADING flags; check the rest with `audit --headings`.
The work's `intro_lemmas` flag makes the audit and `import_checks.py` skip the opening formula
before the lemma. Pieces are runs of whole propositions (5 of ~16k); pilot of the first and
last, then the other three in one run: 99 blocks (91 in 88 Romans files, 8 cross-references),
every check clean, nothing to fix.
- **Check a fresh translation against its Latin before importing.** Split both texts at the
proposition labels and compare per section: note markers (same ones, same places), length
ratio (English/Latin 1.0-1.4 throughout here, so nothing dropped) and the notes'
references. Then two read-only subagents proofread half each against the Latin (exact
unique snippet, Latin, drop-in correction, confidence; substantive errors only). Of their
10 findings, 9 were real (a fact turned into a possibility, wrong referents, garbled
clauses, an invented second group, a misquoted Rom 7:13) and were fixed in the source with the user's OK; one was a defensible
rendering. The standardization had also dropped the file's provenance comments, so a
one-line source note was restored after the `<h1>`.
- The old blocks were 89 url-less ACCS excerpts titled `AUGUSTINE ON ROMANS N` (Landes's
numbers = the brackets), deleted by `--title-prefix` after matching each one's text to its
proposition; two untitled, url-less duplicates (digits stripped, one with a Pelagius sentence
glued on that already had its own Pelagius block) were removed by hand.
- **Old excerpts under several titles:** survey url-less blocks by every title form of the work
(Cyril on Luke had both `COMMENTARY ON LUKE, HOMILY n` and `HOMILIES ON THE GOSPEL OF LUKE n`;
the second was found only after the import, by the log digest), and match their text against
the source to confirm they are this work. When the titles are ambiguous (Cassian's
`CONFERENCE 1:13` is Conference 1 ch. 13, but `CONFERENCE 2:17.25` is Conference 17), identify
each excerpt by its text instead: match it against every chapter of the father's works
(word overlap weighted by rarity finds even a different translation's excerpt), settle the
cases where title and text disagree by reading them, and delete the result by exact title with
`delete_commentaries.py --titles-file`, after checking that no excerpt of another work shares
one of those titles.
- Include the url-less blocks with an EMPTY title in the text match, and expect strays: the
Cassian Part III survey found an earlier Part's excerpt that the earlier deletion had missed
(Conference 14 ch. 17 under Proverbs 31:6), and a Byzantine Nativity sticheron (Kassia's)
filed under Cassian because the names look alike. Bring each one to the user; both were
deleted with the user's OK (the title file can name another Part's excerpt; an untitled
block, which `--titles-file` can't name, is removed by hand after checking it is the file's
only block).
**Selective works** (not a verse-by-verse commentary; first done for John Cassian's
*Conferences*, Part I). Some works worth importing are treatises, dialogues or sermons that quote
and expound Scripture throughout, with no verse sections or lemmas. With the user's approval
(ask in Phase 0) they are imported **selectively**: the agents read every section and file only
the stretches that comment on a verse, under rule 13; everything else is left out on purpose.
- Mark the work's `WORKS` entry `"selective": True`, `"book": None`. The importer's `load_work`
returns one section per chapter (or whatever unit the source has), with `chapter` None and a
`chapter_no`, and `make_units` packs runs of whole chapters into pieces up to `SPLIT_CHARS`.
`process_cassian_commentary.py` is the model: copy it for another father or work. For
another work of the same father, add its entries to that importer instead, with a `"kind"`
that picks the prompt's work-specific wording from `KIND_WORDING` (Cassian's *Institutes*,
`Inst01` … `Inst12`, a treatise in his own voice, uses `"institutes"`: no dialogue sentences,
and "this Institutes book" rather than "this book", which an agent could read as a book of
Scripture). Compare the *Conferences*' parsed bodies and `--dry-run` prompt before and after
any change to that file.
- A work whose parts are separate files with their own urls (Cassian's ten conferences) gets one
`WORKS` entry per file (`Conf01` … `Conf10`); a dedicatory preface file gets none (rule 6),
nor does an untranslated one (the *Institutes*' Book 6: "WE have thought best to omit
altogether the translation of this book.").
- **source_title** carries the chapter: `"<work title>, Chapter N"`, or `"Chapters N-M"` for a
block crossing chapters, as the url'd Cassian blocks already had it. `--check` and the audit
check it against the chapter(s) the text really comes from.
- **Editors' footnotes** that give Scripture references (Gibson's "S. Matt. vi. 19.") are the
best placement hints there are: `load_work` puts them inline in the pieces as
`<sup>[note: …]</sup>` and drops them from the body, so a block that copies one fails the check.
**Check, in Phase 1, that the notes line up with their markers before trusting them.** In
Cassian's Part I they were out of step by four from late in Conference 7 to the end of the
Part: four notes lost around one marker run, each file ending with the next file's first four
notes, Conference 10's last three belonging to the Part II preface (which had no markers),
and a one-note swap at the Conference 6/7 boundary. It was found only by the pilot agents.
- Measure it: match each note's KJV text against the words before its marker, at offset 0 and
at shifts of ±1..6, per file and per run of ten markers. A swap of one note at a file
boundary doesn't move these scores, so also compare every note with an authoritative copy.
- Fix it in the Writings-Database source, with the user's OK. CCEL's NPNF pages
(`ccel.org/ccel/cassian/conferences.ii.<conference+1>.<page>.html`, roman numerals, page
numbers one ahead of the chapters) carry every footnote in order with its text. Align them with
the file's markers by the text before each one, move or insert the notes (keeping Gibson's
printed wording and the file's markup; copy CCEL's only for lost notes), and add any lost
marker. Then check that the visible text is unchanged, markers and notes pair 1..n, and
every note matches CCEL's apart from "Ib."/"Ibid." expansions and CCEL's silent corrections
of Gibson's references (keep Gibson's).
- CCEL can be wrong too: in Conference 17 it swaps two notes (its "Increase and multiply" note
is "Ps. 5:7; …"). Before moving a note, read the text before its marker and confirm the
note's reference really is the quotation there.
- Survey every file of the father's works at once (heading sequence, glued headings like
`Chapter. XII.The answer …` or `Chapter Xiof …`, markers vs notes, offset alignment): for
Cassian the same defects ran through Parts II and III (Conferences 19, 20, 21, 24, the two
Part prefaces), and the scan also found shifts in the Institutes and On the Incarnation.
Conferences 12 and 22 are untranslated in NPNF ("Not translated."), so they have nothing to
import, and get no `WORKS` entry. Keep their old url-less excerpts (Part II kept
`CONFERENCE 12:7.4–5` under Hosea 2_19-20): there is no new text to replace them.
- Fix the source before the import if you can: this run first mended the mapping in the importer
instead (since removed), which moved piece boundaries mid-run (next bullet).
- **Changing `load_work` after the pilot can move the piece boundaries** (the split follows the
pieces' html sizes, hints included): after the hint mapping changed, Conference 9's pieces were renamed and
the chained `--through Part001_Ch01-14.html` stopped with "No piece named". Re-run `--dry-run`
for every work after such a change, and run the stretches the pilot didn't cover with the
Cassian importer's `--chapters A-B` (one ad-hoc piece of exactly those chapters).
- **Chapter summaries** (the italic line under each heading) are cut from the body as well as
left out by the agents, or every block crossing a chapter fails the check. Some summaries are
irregular (run straight into the text, split over several italic runs, missing, an italic run
broken off with the rest on one or more lines of its own, printed without italics, or running
on into Cassian's text that is itself printed in italics, as in 19.VI and 24.VI; in the
*Institutes*, a note marker splitting the summary into two italic runs, 2.XV, 4.XXVII, 10.XIV,
10.XXIV, a last word outside the italics, 2.IX "</i>Eiders<i>.</i>", and a summary running into
italic text whose opening quote mark belongs to the text, 10.VIII); list the chapters whose
opening doesn't fit the usual pattern (the body should start with the dialogue's first
capital), handle each in the summary regex, re-run `--check` on the works already imported,
and tell the agents about each one in that conference's notes.
- **Checks:** there is no coverage, lemma or placement check. `--check` and `audit … <BASE>
<pieces>|--all` (which branches to `selective_main` for these works) test that every block is
one verbatim stretch found once, its source_title, no two overlapping blocks of the work in one
file, append-only, and print the same text filed under several verses (allowed, rule 13),
overlapping texts in different files, wide ranges, small blocks and a per-chapter LAYOUT.
`audit … --headings` lists the chapters with their sizes and footnoted references.
- The prompt asks each agent to end with a list of the blocks it wrote and of the expositions it
considered and left out, with the reason: read those lists when reviewing, since a GAP check
can't tell you what was missed. The old excerpts (e.g. the ACCS selection) are a useful
cross-check at the final review: for each deleted excerpt's chapter and verse, see whether the
new import filed that chapter under that verse, and bring the misses to the user. (In Part II
most misses were deliberate rule-13 omissions the agents had listed: verses inside a chain of
paired proof-texts, or a verse used as one instance within the exposition of another; in
Part III 21 of 47, all on the agents' left-out lists; in the *Institutes* 6 of 27, all
listed: chains of proof-texts, the paired "the one says… the other…" texts of 12.8.) Match by verse RANGE, not filename: a
verse may already be covered by a range file (`Proverbs 31_6-7` for an old `Proverbs 31_6`),
so script the comparison over parsed ranges rather than looking for the exact file.
- Agents sometimes name a Psalm file `Psalm 69_28` (the KJV lookup accepts "Psalm"); `--check`
flags any filename whose book isn't in `book_names.json`.
- Source defects show up as chapters out of sequence (`load_work` refuses chapters not numbered
1..n): Cassian's Conference 2 had lost its `Chapter IV.` heading and Conference 8 had
`Chapter VI` as plain text. With the user's OK fix them in the Writings-Database (CCEL's NPNF
pages give the missing summaries); commit there only when the user approves.
**Gotchas with the tools**
- Every run deletes the units folder at the end (even a single piece). Only a run that reaches the
LAST piece runs `--check` by itself; otherwise run `--check` yourself.
- `--start-after A --through B` runs everything between A and B. If pilot pieces sit in that
range, chain several ranges with `&&` so they aren't run twice.
- The audit's "files added or changed since BASE" counts only tracked (pre-existing) files. New
files are untracked and don't appear there.
- In zsh an unquoted `$VAR` holding several piece names is passed as ONE argument. Write the names
out, or use `${=VAR}`. The same goes for a command held in a variable (`P="python3 …"; $P
Part001…` fails with "no such file or directory"): write the commands out.
- The audit's lemma detector knows Isaiah/Obadiah's `LXX: <i>…</i>`, Ezekiel's `(LXX: "…")` (to its
matching parenthesis, which can run on with remarks about the Origenian signs), inline
alternatives `(or <i>…</i>)`, Joel's dashed gloss inside an LXX run, and a Hebrew lemma whose
first paragraph holds only a half-verse and runs on in the next paragraph before the LXX
(Habakkuk 1:3b-4, 3:3b-4; Obadiah 1:13b-14), and LXX runs introduced by a phrase instead of
"LXX:" (Micah 1:1 "Or according to the Seventy:", Hosea 13:4 "In place of which one reads in
the LXX:", Amos 1:1 "But the Seventy, intending I know not what, translated:"). With the work's `intro_lemmas` set
(Augustine's Propositions on Romans), a formula ("When he says:", "When he says of Abraham:")
before the italic lemma is skipped. With the work's
`bold_lemmas` set (Berengaudus), the lemma is the whole first paragraph, a bold one with its
verse label already dropped by `load_work`, including asides between the bold stretches
("The seven stars, he says, are …"). For a new layout,
confirm that it finds every lemma before trusting LEMMA CUT, and extend it if needed. Then make
sure the earlier works' results don't change, except for improvements.
- Editorial marks the user wants left out of the import (e.g. Zechariah's ⟦ ⟧ Migne brackets and
notes, Jeremiah's edition section numbers: a Roman numeral opening every paragraph, sometimes as
a paragraph of its own, and Arabic sub-section numbers "2." mid-text) go in `WORKS[…]["strip"]`: a list of regexes that `load_work` removes from the sections
(not the preamble), so the pieces, `--check`, the audit and `import_checks.py` all see the same
text. Say in the notes that the full source html still has them.
- Never re-serialize TOML files with rtoml or tomlkit. Edit the text and verify by re-parsing.
- **Concurrent imports:** another session may be importing a different work into the same father
folder at the same time. Then `git status`, the audit's changed-file list, and a pilot rollback
will include that session's files too. Scope everything by this work's source_url, and never
roll back with a blanket checkout or delete of untracked files without checking which work each
file belongs to. Both sessions also edit `WORKS` in the same importer file, so edit only your
own entry and don't revert the other's.
## 3. Standing rules (approved by the user)
1. **The agent decides placement, not the script.** The Python driver only cuts the source and
passes hints (headings, numbering notes) to the piece agents; the agents choose the KJV verse
file for each stretch. Never precompute a section-to-file table in Python: headings can be
off, and judging placement is the whole point of using an agent. Give known numbering quirks
to the agents as prose in the notes. Deterministic checks afterwards are welcome, but they
check coverage and format, not exact placement. The prompt pushes toward the SMALLEST verse
ranges; never add wording that lets the agents default to the source's own section ranges.
2. **Placement by commentary, not lemma.** File every block under the verse(s) its COMMENTARY
addresses. A lemma quoting several verses never widens a block's range. The user put it this
way: "We are interested in the commentary, not so much the lemma."
- If the exposition after a lemma covers only its first verse, the first block (lemma
included, uncut) goes under that verse (Jerome's "9:14ff." quoting Isaiah 9:14-21 →
`Isaiah 9_14`).
- If the comment starts on a later verse (e.g. the lemma opens with a bare formula verse,
"And the word of the Lord came to me, saying:"), the first block starts its range there.
3. **Lemmas stay whole.** Each section's lemma (Hebrew version AND LXX version, plus any remarks
inside the LXX parenthesis) stays uncut at the start of the section's first block, and every
section's first block starts exactly at the section start. Agents sometimes join the end of one
section to the next section's lemma when both are the same verse. Fix that mechanically by
splitting at the section start and keeping both blocks in the same file. If the editors'
section break falls mid-sentence, the tail stays with its own section anyway.
4. **Smaller is better, but no fragments.** Split by verse where the text really moves verse by
verse. Keep a range when a pass sweeps the verses as one argument (Jerome usually expounds a
lemma twice: historically, then spiritually). Overlapping ranges are fine when one sentence
crosses a verse boundary; no text is ever duplicated within the book.
5. **Prologue:** first block of `<Book> 1_1`, before the 1:1 commentary, appended after any
existing blocks (e.g. Jerome's separate Vulgate "Prologue to <Book>" from the Biblical Prefaces
stays first). The whole prologue goes in, even if it discusses a later verse: it introduces the
work as a whole, so a reader opening the first verse should see it there. Scribal rubrics
("HERE BEGINS THE BOOK.") are left out.
6. **Book prefaces** (multi-book works):
- A substantive one gets its own block under the verse(s) it explains, which can be in another
book, and it can come after that verse's commentary. Galatians' Book Two preface ("senseless
Galatians") went in as the second block of `Galatians 3_1`, Isaiah's Book Sixteen preface to
Romans 3_13-18, and Ezekiel's Book Eleven ("This Gog is the Goth") to Ezekiel 38_2.
- A dedicatory or autobiographical one is skipped, even if it quotes Scripture in passing
(Galatians Book Three, on Jerome's style, eyesight and dictation). Autobiography filed under a
verse would mislead that verse's readers. An empty heading has nothing to import.
- You read every preface yourself and bring the user a table, because the user decides case
by case. The decisions then go into the notes as fixed instructions, so the piece agents
don't judge them.
7. **Closing notes** to a patron (at the end of the work or of a book) are cut, as are notes closing
a book, e.g. Ezekiel's end of Book Eleven: "Thus far we have spoken…". Short transitional
sentences ("let us pass on to…", "We have touched briefly on the obvious things…") are kept.
8. **Cross-references** stay on: a stretch that genuinely QUOTES AND EXPOUNDS another book's verse
is also filed under that verse, in addition to its own placement. Passing proof-texts are not
cross-filed. Check every Psalm cross-reference's number and verse against the KJV wording,
because Jerome uses the Latin numbering, often with the Hebrew number in brackets or parentheses.
9. **Append-only:** pre-existing files only get blocks appended. A "-1 line" diff where the old text
is still a prefix is just a file that lacked a final newline.
10. **Source order:** within a file, this work's blocks follow the source's order. Pieces run out of
sequence (pilots) can break this. Run `import_checks.py <Work> order` and reorder by cutting the
file text, only in files that are new since BASE.
11. **Verbatim.** Copy the translation exactly: Origenian signs (÷ ※ ⁚), Greek, transliterated
Hebrew with its bracketed or parenthesized glosses, quotation marks, dashes, and odd punctuation
as printed. Drop html tags (italics become plain text, not quotation marks). Drop the
translator's note, the `<h2>` headings, manuscript rubrics ("HERE BEGINS THE BOOK."), and the
editors' inline sub-lemma labels like "19 d.". Separate paragraphs with a blank line.
12. **Commits** (Commentaries-Database, directly on `master`, never pushed by you):
- one commit for the deletion: `remove old <father> on <book> import (ahead of fresh translation, #N)`;
- ONE commit for the whole import at the end: `<father> on <book>: import fresh translation (#N)`;
- one commit for this skill's changes from the run (the `WORKS` entry and any tool or rule
changes): `fresh-import: record <father> on <book> (#N)`.
- With no issue, leave out ` (#N)` / `, #N`.
- Ask before making the import commit and the record commit, because the user sometimes makes
them (and pushes) themselves. Never commit in the Writings-Database.
13. **What to import from a selective work** (§2, "Selective works"; the user chose this
threshold for Cassian's *Conferences*). Import a stretch when the father quotes or plainly
refers to a specific verse AND DOES SOMETHING WITH IT: says what it means, interprets its
words (literally, morally or spiritually), resolves a difficulty in it, applies a figure in
it, builds the argument on its wording, or APPLIES it to the spiritual or monastic life in a
way that shows how he reads it (a verse brought in to describe a stage of prayer, a vice or
its remedy, and then drawn out). Leave out a verse quoted in passing, a bare proof-text, a
chain of proof-texts without comment, and narrative or teaching that merely mentions
Scripture. The test: would a reader studying this verse learn something about how the father
understood or used it? Each block is one continuous verbatim stretch, from sentence boundary
to sentence boundary, able to stand alone (with the question it answers, in a dialogue, when
needed), under the smallest verse range its exposition addresses. The same stretch may be
filed under two verses when it really expounds both (the project `CLAUDE.md` welcomes this),
but never two overlapping blocks of the work in one file.
## 4. The process
Stop and wait for the user at every ⏸. At each stop, start your message with where you are and
what comes next, e.g. "**Phase 2 (deletion) done, BASE = abc1234. Next: Phase 3 (pilot).**", so
the run can resume cleanly after a pause or a context summary.
### Phase 0: Resolve the work (no changes anywhere)
1. **Turn the argument into a local html file** in the Writings-Database checkout (see
Prerequisites for where that is; if it can't be found, ask the user):
- **Local path:** use it as given. It must be inside the Writings-Database; if it isn't, stop
and ask the user where it should go there.
- **historicalchristian.faith url** (`by_father.php?file=…`): url-decode the `file` parameter
until no `%` escapes remain (the segments after the father folder are double-encoded) and
join it onto the Writings-Database root, as the project `CLAUDE.md` describes.
- **GitHub url** of `HistoricalChristianFaith/Writings-Database` (`…/blob/<branch>/…` or
`raw.githubusercontent.com/…/<branch>/…`): take the path after the branch and url-decode it.
- **Any other url:** stop and ask the user. Don't download it into the Writings-Database
yourself.
2. **Make sure the local file is current.** If the file is missing, or a GitHub url was given,
run `git -C <Writings-Database> fetch` and compare with the upstream branch. If the local copy
is behind and its working tree is clean, `git pull --ff-only`; otherwise stop and tell the user
what's different.
3. **Gather the work's facts** and show them to the user in one short block:
- father (the top folder), work title (the `<h1>`), the KJV book it comments on (a name from
`book_names.json`), and the `WORKS` key (the book name, as in the existing entries);
- the source_url, built exactly the way `source_url_for()` in the importer builds it;
- size and `<h2>` section count;
- the importer: `process_jerome_commentary.py` for Jerome, or a per-father copy (§2, "Other
fathers");
- whether the work is a verse-by-verse commentary at all. If it isn't (a treatise, dialogue
or sermons with no verse sections), stop and ask the user whether to import it selectively
(§2, "Selective works"; rule 13), and which old blocks to delete;
- whether a `WORKS` entry already exists, and whether
`git log --oneline -i --grep "on <book>: import fresh translation"` finds an earlier fresh
import (if either does, stop and ask the user before going on);
- **the GitHub issue:** `gh issue list --repo HistoricalChristianFaith/Commentaries-Database
--state open --search "<Father> <Book>"`. If one clearly matches, its number is `#N`. If none
does, say so; the commits then leave out the number and Phase 6 skips closing the issue.
4. **Read:** the scripts in §2, and the `WORKS` entries of the earlier works closest to this one
(similar size and structure), which are the models for the notes. For those works,
`git log --oneline -i --grep "<book>.*fresh translation"` gives the deletion and import
commits, and the closed issue's closing comment (`gh issue view N --comments`) summarizes the
run and the user's review decisions.
### Phase 1: Prep (no database changes)
1. **Survey the source.**
- Size, section count, the non-verse sections and their lengths, heading formats (a/b/c
half-verse markers, "ff.", commas, cross-chapter ranges), lemma layout, Psalm numbering,
footnotes/`<sup>`/notes sections, and inline editor references like "(Matt 7:7)".
- Compare with the translator's note.
- `python3 scripts/process_jerome_commentary.py <Work> --dry-run` prints the pieces once a
`WORKS` entry exists. Add a skeleton entry (html, book, source_title, empty notes) first.
2. **Check the headings.**
- Run `audit_jerome_import.py <Work> --headings` and `import_checks.py <Work> continuity`.
- The "lemma opens like" flags are noisy, because part-verse lemmas look like the previous
verse. Check every flag, and every discontinuity, by reading the lemma against the KJV.
- Known kinds of problems:
- editors' references off by a verse (Isaiah, about 7%);
- Vulgate chapter starts that differ from the KJV (Ezekiel "2:1b" = KJV 1:28, Haggai ch. 2
one verse ahead);
- a heading that skips the second half of a verse (Ezekiel "11:2b-12" starts at 11:1b);
- Hebrew-vs-KJV chapter divisions (Joel 2:28-32 = Hebrew 3:1-5; Ezekiel 20:45-49 = Hebrew
21:1-5). Settle which numbering the headings follow.
3. **Check the piece boundaries.**
- `import_checks.py <Work> boundaries` lists lemma-only sections, sections that don't open with
italics, and the opening of every piece.
- If a piece starts mid-lemma (Isaiah: "13:18ff." held only a lemma's start and "14:1" opened
with its end), write a specific note telling the next piece where to append. Merge the two
blocks yourself afterwards.
4. **Read every non-verse section** (prologue, book prefaces) and **the end of every book** (closing
notes). Draft a table: book · what it precedes · size · content · recommendation (skip / keep →
file).
5. **Survey the old blocks.**
- Run `delete_commentaries.py <Father> "<url>" --dry-run` and, if needed,
`delete_commentaries.py <Father> "" --title-prefix "COMMENTARY ON <BOOK>" --dry-run`.
- Search all blocks for the book's name in source_url and source_title, to catch anchor and
title variants.
- List the old blocks outside the book's own files, with their opening words.
- Compute the combined after-state: blocks, files touched, files emptied (= removed), and files
that keep blocks from other works (list them).
- Note what `<Book> 1_1` will hold afterwards.
6. **Write `WORKS["<Work>"]["notes"]`.** Model them on the closest earlier entries (Ezekiel's and
Joel's are thorough). Cover:
- **numbering:** headings are hints, with the concrete off-heading examples from step 2;
a/b/c means the whole verse; how cross-chapter ranges are written (`Ezekiel 1_27-2_1`);
- **lemma layout:** exactly how this work marks the Hebrew and LXX lemmas, the irregular
lemmas by heading, and "every section starts its own block; never join sections";
- **verbatim specifics:** the signs, glosses, quotation marks and dashes this work has;
"most sections are one long paragraph, so cut between sentences" if true;
- **Psalm numbering**, and "match a Psalm cross-reference's verse by its wording";
- **rule 2**, with an example in this book's headings, and the double historical/spiritual
pass with "don't fragment";
- **"Earlier pieces of THIS run"** will have left blocks of this work in the files: leave them
and append. Name the files that hold other works' blocks, if useful;
- **the prologue's placement** in `<Book> 1_1` (what's already there, what goes after);
- **the fixed decisions:** each preface and each closing note (quote its first and last words
so the agent can find the cut), plus any piece-boundary merge instructions.
Quote source text exactly, then run `import_checks.py <Work> notes`. Any quoted fragment it
can't find is either a paraphrase that shouldn't be in quotation marks or a typo.
7. `--dry-run` again (read the full first prompt), then `--split-only`, then
`import_checks.py <Work> pieces` (the written pieces must reassemble into the source). Then
delete `work/jerome_<work>_units/`.
8. **⏸ Show the user:** the preface/closing-note table with recommendations, a summary of the
notes, the heading findings, and the deletion dry runs with the combined after-state, including
the old cross-references outside the book.
### Phase 2: Deletion
Run the deletion(s) for real, then verify:
- every file still parses;
- no targeted block remains anywhere;
- each trimmed file holds exactly its other blocks, unchanged (compare the parsed blocks with
`git show HEAD:<path>` minus the deleted ones).
Commit only the deleted/trimmed `<Father>/` files, with the deletion message (not the skill's
`WORKS` edit, which goes in the record commit). That commit is **BASE** for every audit.
### Phase 3: Pilot
Choose 2–6 pieces that exercise the risky parts:
- Part001 (the prologue and the `<Book> 1_1` placement);
- a piece with half-verse or off headings;
- one with a substantive preface;
- one around a numbering boundary;
- one with a closing note;
- the last piece.
Propose the pilot pieces, each with the risk it exercises, and one command per piece, to run one
at a time from the Commentaries-Database root, e.g.
`python3 .claude/skills/fresh-import/scripts/process_jerome_commentary.py <Work> Part003_Ch02.html`.
Then ask the user (with AskUserQuestion) who runs the pilot:
- **The user runs it** in their own terminal and tells you when it's done. Wait for that.
- **You run it.** Run the commands yourself, in the order given, chained with `&&` in ONE
background Bash call (`run_in_background`), so a failed piece stops the rest. Each piece
takes minutes, beyond the foreground timeout. Send the output to a log in your scratchpad,
not into your context. Wait for the completion notification; don't poll. Then check the tail
of that log for an `ABORTING` line before reviewing.
**⏸ After the pilot:**
- `audit_jerome_import.py <Work> <BASE> <pilot pieces…>`.
- Read every run summary (prompt 1 and prompt 2) in the `run-*.jsonl` logs.
- Check every PLACEMENT? flag (see [Reviewing](#5-reviewing-a-batch)).
- Fix mechanical problems in place.
- Bring the user the judgment calls.
If the notes need changing, the pilot can be rolled back cleanly, because everything of this work
after BASE is pilot output. Restore the pre-existing files that hold this work's url from BASE, and
delete the new files that hold only this work's blocks. Check each file first (see *Concurrent
imports* above).
### Phase 4: Chunks
- **Size:** 20–35 pieces per chunk with `--start-after/--through`, run by the user. Chain ranges
around the pilot pieces, e.g. `Part002` alone, then `--start-after Part003 --through Part028`.
- **⏸ After each chunk:**
- Audit the chunk's pieces.
- Have a read-only subagent digest the run logs' summaries. The prompt is in
[Reviewing](#5-reviewing-a-batch); don't read the `.events.jsonl` files into your own context.
- Run `import_checks.py <Work> order`.
- Fix mechanical problems (see [Mechanical fixes](#6-mechanical-fixes)).
- Bring the user the judgment calls.
- **Once a chunk comes back clean,** the rest can go in one chained command.
Small works (Obadiah, Joel, Haggai: 1–6 pieces) need no chunk loop: a pilot of 2 pieces, then
everything else in one command.
### Phase 5: Final review
1. `process_jerome_commentary.py <Work> --check`. Expected failures:
- the skipped prefaces (start and end probes);
- the cut closing notes (end probe);
- the dropped editors' labels like "19 d." (start probe);
- a preface filed under another book (it's checked only in the book's own files).
Anything else is a real problem.
2. `audit_jerome_import.py <Work> <BASE> --all`, then:
- **coverage gaps:** account for every gap (it should only be the intended skips);
- **flags:** check every PLACEMENT? and OUTSIDE HEADING flag against the KJV wording;
- **problems list:** confirm there is no NOT VERBATIM, MULTI-MATCH, OVERLAP, LEMMA, LEMMA CUT
or NOT APPEND-ONLY entry;
- **prologue:** confirm the `<Book> 1_1` block list is in the right order.
3. `import_checks.py <Work> order`, and spot-check the Psalm cross-references (number and verse
by wording).
4. Counts for the closing comment: blocks and files in the book; cross-ref blocks and files; new
vs appended files (`git status --porcelain --untracked-files=all -- <Father>`, and
`git diff --stat BASE -- <Father>`, which should show only insertions).
5. **⏸ Summarize** for the user and include a draft of the closing comment.
### Phase 6: Finish
After approval, commit the import (unless the user did it). If there is an issue, close it with
`gh issue close N --repo HistoricalChristianFaith/Commentaries-Database --comment "…"`.
The comment is ONE paragraph, in the style of #35, #36 and #37 (read them with `gh issue view N
--comments` as models). It:
- cites both commits;
- gives what was deleted (counts, the out-of-book old blocks, the url-less excerpts);
- gives what was imported (blocks across files, plus cross-references in files, with the notable
cross-referenced verses and why);
- says where the prologue and kept prefaces went;
- says what was intentionally left out (skipped prefaces, closing notes);
- adds a sentence on lemma handling and heading quirks;
- ends "Blocks from other works in pre-existing files were kept unchanged."
### Phase 7: Record the run
The `WORKS` entry (with its final notes) is the record a later import will model itself on. If
the run changed or added a standing rule, or extended a tool (e.g. a new lemma layout in the
audit's detector), update this file's text for that too, e.g. the detector's list of known
layouts under *Gotchas with the tools*. Then, after asking, make the record commit (rule 12) with
the `WORKS` entry, the tool changes and these edits.
## 5. Reviewing a batch
**Reading the audit**
- **PLACEMENT? flags** are hints. In Ezekiel all 85 were correct placements, falling into three
kinds:
1. a bare formula verse skipped ("the word of the Lord came to me" → the block starts at the
next verse);
2. a part-verse lemma (it opens with the second half of a verse, so it looks like the previous
one);
3. rule 2: the first comment addresses a later verse (e.g. a textual note on 33:25-26 →
`33_25-26`).
Check each one by reading the lemma and the text after it against the KJV. A real misplacement
is a lemma filed under a verse it doesn't quote and whose comment it doesn't contain.
- **OUTSIDE HEADING** is expected where you already know a heading is off (e.g. "2:1b" → `1_28`).
- **"wide range"** is fine for whole-passage summaries and sweeping passes (Ezekiel's "Now the
whole vision is this…" → `1_4-28`). Read the block's opening to confirm.
- **"small block"** is fine when it's coherent. Merge only true fragments, and never across a
section start.
- **GAP** lines must all be intended skips. A gap inside a verse section is a lost stretch, so
re-import it as a block (in source order) or report it.
**Digesting the run logs** with a read-only subagent (`general-purpose`), prompt along these lines:
> Read-only. Read every record's full `output` in `<logs>` (JSON lines: unit, sections, prompt
> 1=import/2=double-check, output; or unit+error). Digest per piece only what a reviewer needs:
> errors or aborted pieces; anything prompt 2 found and fixed; every judgment call the agent flagged
> (placements to check, blocks under a verse other than the heading's, fragments, overlapping
> ranges, ordering problems in files); whether each Book preface was skipped or filed (and where);
> text deliberately left out; every cross-book file created or appended; any edit to pre-existing
> blocks of other works; any rename, move or delete of earlier pieces' files. Expected decisions:
> <list>. End with the top issues. Under ~1200 words.
Then verify the digest's top issues yourself before reporting them. In Ezekiel, for example, an
agent skipped an Esther 14:11 parallel "because the KJV lookup has no Esther 14". The reason was
wrong, but the call was right (a passing proof-text).
**Things that are NOT problems** (don't "fix" them):
- formula verses missing from filenames;
- overlapping ranges from sentences crossing verses, or from second passes;
- verses with no file because Jerome never comments on them separately;
- cross-ref excerpts ending at a semicolon where Jerome turns to a new point;
- a cross-ref filed as its own `Psalms 118_9` beside an existing `Psalms 118_8-9`.
## 6. Mechanical fixes
Always edit the file text, never re-serialize. Split a file into blocks at the lines matching
`^\[\[commentary\]\][ \t]*$`, rearrange or cut the block texts, re-join them, then parse the
result and assert it equals the intended list of blocks.
- **Two sections joined in one block:** split the quote at the section start into two blocks with
identical source fields, both in the same file, in order.
- **Blocks out of source order** (pilot side-effect): reorder the block texts. Do this only in files
that are new since BASE; in pre-existing files the old blocks must stay first.
- **A lemma-only block at a piece boundary:** merge it with its continuation (the quote texts are
consecutive in the source, so join them with the source's separator) into the first file, and
delete the continuation block.
- **A wrong source_url or source_title** on a block of this work: fix the string in place.
- Re-run the audit on the affected pieces after any fix.
الترخيص
لم يُعلَن أي ترخيص في مصدر هذه المهارة.
النص الكامل للترخيص متاح في المستودع المصدري.
عرض الترخيص في المستودع المصدري — النسخة المنشورة هناك هي المرجع.
// تثبيت المهارة
تثبيت المهارة
المهارات هي كود تابع لأطراف ثالثة من مستودعات GitHub العامة. يفحص SkillHub الأنماط الخبيثة المعروفة، لكنه لا يستطيع ضمان السلامة. راجع الكود المصدري قبل التثبيت.
تثبيت عام (على مستوى المستخدم):
npx skillhub install HistoricalChristianFaith/Commentaries-Database/fresh-importتثبيت في المشروع الحالي:
npx skillhub install HistoricalChristianFaith/Commentaries-Database/fresh-import --projectاستخدمه مع Hermes أو أي runtime آخر. تُكتب المهارة في <directory>/<skill-name>/.
npx skillhub install HistoricalChristianFaith/Commentaries-Database/fresh-import --target-dir /path/to/skillsالمسار المقترح: ~/.claude/skills/fresh-import/