@kinloom/cli 0.1.1 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/cached-ocr.py +786 -0
- package/dist/assets/ocr.md +76 -0
- package/dist/assets/prep-scan.md +97 -0
- package/dist/assets/prep-scan.py +1313 -0
- package/dist/bundled-skills/acpl-persi/SKILL.md +103 -0
- package/dist/bundled-skills/acpl-persi/scripts/persi +539 -0
- package/dist/bundled-skills/archive-org/SKILL.md +162 -0
- package/dist/bundled-skills/archive-org/scripts/archive-org +1576 -0
- package/dist/bundled-skills/blm-glo/SKILL.md +54 -0
- package/dist/bundled-skills/california-archives/SKILL.md +130 -0
- package/dist/bundled-skills/california-archives/scripts/ca-archives +614 -0
- package/dist/bundled-skills/chronicling-america/SKILL.md +120 -0
- package/dist/bundled-skills/chronicling-america/scripts/chronam +553 -0
- package/dist/bundled-skills/cyndis-list/SKILL.md +53 -0
- package/dist/bundled-skills/findagrave/SKILL.md +129 -0
- package/dist/bundled-skills/findagrave/scripts/findagrave +965 -0
- package/dist/bundled-skills/hathitrust/SKILL.md +117 -0
- package/dist/bundled-skills/hathitrust/scripts/hathi +379 -0
- package/dist/bundled-skills/kentucky-archives/SKILL.md +124 -0
- package/dist/bundled-skills/kentucky-archives/scripts/ky-archives +646 -0
- package/dist/bundled-skills/library-of-michigan/SKILL.md +118 -0
- package/dist/bundled-skills/library-of-michigan/scripts/michiganology +515 -0
- package/dist/bundled-skills/missouri-archives/SKILL.md +109 -0
- package/dist/bundled-skills/missouri-archives/scripts/mo-archives +751 -0
- package/dist/bundled-skills/nara-catalog-search/SKILL.md +130 -0
- package/dist/bundled-skills/nara-catalog-search/scripts/nara +1387 -0
- package/dist/bundled-skills/narrative-audio/SKILL.md +103 -0
- package/dist/bundled-skills/narrative-audio/references/script-rules.md +109 -0
- package/dist/bundled-skills/narrative-audio/scripts/narrative-audio +290 -0
- package/dist/bundled-skills/new-jersey-archives/SKILL.md +135 -0
- package/dist/bundled-skills/new-jersey-archives/scripts/nj-archives +869 -0
- package/dist/bundled-skills/openarchieven/SKILL.md +97 -0
- package/dist/bundled-skills/openarchieven/scripts/openarchieven +624 -0
- package/dist/bundled-skills/texas-archives/SKILL.md +102 -0
- package/dist/bundled-skills/texas-archives/scripts/texas-archives +666 -0
- package/dist/bundled-skills/uk-archives/SKILL.md +110 -0
- package/dist/bundled-skills/uk-archives/scripts/uk-archives +631 -0
- package/dist/bundled-skills/usgs-gnis/SKILL.md +99 -0
- package/dist/bundled-skills/usgs-gnis/scripts/gnis +418 -0
- package/dist/bundled-skills/virginia-archives/SKILL.md +144 -0
- package/dist/bundled-skills/virginia-archives/scripts/va-archives +1039 -0
- package/dist/bundled-skills/wikitree/SKILL.md +154 -0
- package/dist/bundled-skills/wikitree/scripts/wikitree +455 -0
- package/dist/cli.d.ts +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +488 -26
- package/dist/cli.js.map +1 -1
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +30 -5
- package/dist/client.js.map +1 -1
- package/dist/commands/ops/audit.d.ts +138 -0
- package/dist/commands/ops/audit.d.ts.map +1 -0
- package/dist/commands/ops/audit.js +872 -0
- package/dist/commands/ops/audit.js.map +1 -0
- package/dist/commands/ops/context.d.ts +100 -0
- package/dist/commands/ops/context.d.ts.map +1 -0
- package/dist/commands/ops/context.js +917 -0
- package/dist/commands/ops/context.js.map +1 -0
- package/dist/commands/ops/dates.d.ts +87 -0
- package/dist/commands/ops/dates.d.ts.map +1 -0
- package/dist/commands/ops/dates.js +228 -0
- package/dist/commands/ops/dates.js.map +1 -0
- package/dist/commands/ops/help.d.ts +8 -0
- package/dist/commands/ops/help.d.ts.map +1 -0
- package/dist/commands/ops/help.js +107 -0
- package/dist/commands/ops/help.js.map +1 -0
- package/dist/commands/ops/index.d.ts +8 -0
- package/dist/commands/ops/index.d.ts.map +1 -0
- package/dist/commands/ops/index.js +8 -0
- package/dist/commands/ops/index.js.map +1 -0
- package/dist/commands/ops/integrate.d.ts +61 -0
- package/dist/commands/ops/integrate.d.ts.map +1 -0
- package/dist/commands/ops/integrate.js +1063 -0
- package/dist/commands/ops/integrate.js.map +1 -0
- package/dist/commands/ops/sync.d.ts +194 -0
- package/dist/commands/ops/sync.d.ts.map +1 -0
- package/dist/commands/ops/sync.js +1251 -0
- package/dist/commands/ops/sync.js.map +1 -0
- package/dist/commands/ops/telemetry.d.ts +79 -0
- package/dist/commands/ops/telemetry.d.ts.map +1 -0
- package/dist/commands/ops/telemetry.js +249 -0
- package/dist/commands/ops/telemetry.js.map +1 -0
- package/dist/commands/ops/verify.d.ts +76 -0
- package/dist/commands/ops/verify.d.ts.map +1 -0
- package/dist/commands/ops/verify.js +325 -0
- package/dist/commands/ops/verify.js.map +1 -0
- package/dist/commands/records/help.d.ts +18 -0
- package/dist/commands/records/help.d.ts.map +1 -0
- package/dist/commands/records/help.js +174 -0
- package/dist/commands/records/help.js.map +1 -0
- package/dist/commands/records/index.d.ts +5 -0
- package/dist/commands/records/index.d.ts.map +1 -0
- package/dist/commands/records/index.js +5 -0
- package/dist/commands/records/index.js.map +1 -0
- package/dist/commands/records/registry.d.ts +32 -0
- package/dist/commands/records/registry.d.ts.map +1 -0
- package/dist/commands/records/registry.js +227 -0
- package/dist/commands/records/registry.js.map +1 -0
- package/dist/commands/records/resolve.d.ts +14 -0
- package/dist/commands/records/resolve.d.ts.map +1 -0
- package/dist/commands/records/resolve.js +61 -0
- package/dist/commands/records/resolve.js.map +1 -0
- package/dist/commands/records/runner.d.ts +27 -0
- package/dist/commands/records/runner.d.ts.map +1 -0
- package/dist/commands/records/runner.js +255 -0
- package/dist/commands/records/runner.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: narrative-audio
|
|
3
|
+
description: Turn Kinloom narrative biographies (data/narratives.yaml) into narrated MP3 audio with Gemini text-to-speech via the bundled uv-based `narrative-audio` CLI. Covers writing a spoken script by hand (citations removed, dates and colonial money said aloud, editor notes split out from the story), IPA pronunciation files for hard surnames and places, synthesis with a story voice and a separate editor's-notes voice, and transcript QA. Use when the user wants audio, narration, an audiobook, a podcast-style reading, or text-to-speech for a family biography or narrative.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Narrative audio
|
|
7
|
+
|
|
8
|
+
This skill comes with a standalone Python CLI, `skills/narrative-audio/scripts/narrative-audio`.
|
|
9
|
+
It uses a PEP 723 `#!/usr/bin/env -S uv run --script` shebang and declares its own
|
|
10
|
+
dependencies (`click`, `httpx`, `pyyaml`). It needs `ffmpeg` on PATH. Only the commands
|
|
11
|
+
that call the API (`synth`, and `transcribe`, which is optional) need a Gemini API key.
|
|
12
|
+
|
|
13
|
+
## Workflow
|
|
14
|
+
|
|
15
|
+
Writing the script and choosing pronunciations is **model work done by an agent, not API
|
|
16
|
+
calls**. Only the speech itself is paid for.
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
CLI=skills/narrative-audio/scripts/narrative-audio
|
|
20
|
+
ARCHIVE=path/to/archive # a Kinloom archive with data/narratives.yaml
|
|
21
|
+
|
|
22
|
+
# 1. Pick a narrative (free). Shortest first is a good way to try things out.
|
|
23
|
+
$CLI list $ARCHIVE/data/narratives.yaml
|
|
24
|
+
$CLI extract $ARCHIVE/data/narratives.yaml <narrative-id> > /tmp/source.txt
|
|
25
|
+
|
|
26
|
+
# 2. Write <slug>.script.txt and <slug>.names.json by hand, following
|
|
27
|
+
# references/script-rules.md. For batches, give each narrative to its own subagent.
|
|
28
|
+
|
|
29
|
+
# 3. Lint (free). Fix everything it reports before paying for speech.
|
|
30
|
+
$CLI check audio/<slug>.script.txt --names audio/<slug>.names.json
|
|
31
|
+
$CLI synth audio/<slug>.script.txt --names audio/<slug>.names.json --dry-run # exact text sent
|
|
32
|
+
|
|
33
|
+
# 4. Synthesize (paid)
|
|
34
|
+
$CLI synth audio/<slug>.script.txt --names audio/<slug>.names.json -o audio/<slug>.mp3
|
|
35
|
+
|
|
36
|
+
# 5. Optional QA transcript (paid; costs about as much as a short text call)
|
|
37
|
+
$CLI transcribe audio/<slug>.mp3
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
`synth` does the following:
|
|
41
|
+
1. Swaps each name in the names file for its `/IPA/` (longest names first, whole words only).
|
|
42
|
+
2. Rewrites any leftover dates like "9 May 1766" as "May ninth, 1766".
|
|
43
|
+
3. Sends each `## ` section as its own request in the story voice (default `Charon`).
|
|
44
|
+
4. Sends every editor note as one final "Editor's notes." segment in a second voice
|
|
45
|
+
(default `Kore`), after a 2-second pause.
|
|
46
|
+
5. Removes the WAV headers and joins everything into a single MP3.
|
|
47
|
+
|
|
48
|
+
Change the voices with `--voice` and `--notes-voice`, and the model with `--model`
|
|
49
|
+
(default `gemini-3.8-flash-tts`).
|
|
50
|
+
|
|
51
|
+
## Script rules (summary)
|
|
52
|
+
|
|
53
|
+
The full rules, with examples, are in `references/script-rules.md`. Load them before
|
|
54
|
+
writing a script.
|
|
55
|
+
|
|
56
|
+
- **Story vs editor notes:** research commentary goes under `# EDITOR'S NOTES` at the
|
|
57
|
+
end. That means corrections of other researchers or legends, proof reasoning, identity
|
|
58
|
+
mix-ups, unproved attributions, and names the records don't support. The story itself
|
|
59
|
+
states only what happened.
|
|
60
|
+
- **Citations:** remove them entirely. That covers Lib./DB/Vol./page references,
|
|
61
|
+
author-year citations and record IDs.
|
|
62
|
+
- **Spoken forms:** "May ninth, 1766", not "9 May 1766"; "1728 or 1732"; "682 pounds,
|
|
63
|
+
5 shillings, and 2 pence", not "£682.5.2"; spell out abbreviations.
|
|
64
|
+
- **Accuracy:** add no facts. Every fact except citations ends up in either the story or
|
|
65
|
+
a note.
|
|
66
|
+
- **Names file:** General American IPA in slashes for hard proper names and legal terms.
|
|
67
|
+
|
|
68
|
+
## Lessons learned (verified live, 2026-11)
|
|
69
|
+
|
|
70
|
+
- **Style directions get read aloud.** Text like "Read this warmly…" in the prompt is
|
|
71
|
+
spoken word for word, at the start of every section. Send only the words to speak. The
|
|
72
|
+
TTS models reject `systemInstruction` with HTTP 400 "Developer instruction is not
|
|
73
|
+
enabled for this model".
|
|
74
|
+
- **Responses are `audio/wav`.** If you join chunks as raw PCM without stripping each
|
|
75
|
+
RIFF header, the joins play as a short burst of noise (a transcriber heard it as
|
|
76
|
+
"[applause]").
|
|
77
|
+
- **£ is read as "lb".** For example, "£682.5.2" came out as "682.5 lb and 2 pence".
|
|
78
|
+
Write the money out in full.
|
|
79
|
+
- **Dates:** "9 May" can come out as "nine May". Write ordinals ("May ninth").
|
|
80
|
+
- **Inline IPA in slashes works well for names.** The voice pronounces it rather than
|
|
81
|
+
reading the symbols out, and the audio length stays the same. Plain-English respellings
|
|
82
|
+
("Dool-hah-gen") are less dependable.
|
|
83
|
+
- **Don't repeat the title.** If the script already opens with it, don't add it again.
|
|
84
|
+
- **Retries fix glitches.** An occasional word comes out garbled (for example
|
|
85
|
+
"contrary"). Generating that section again usually fixes it.
|
|
86
|
+
- **Speed and cost:** about 2× faster than real time, roughly 25 audio tokens per second
|
|
87
|
+
of speech. A 700-word biography comes to about 5–6 minutes of audio and about 10–15k
|
|
88
|
+
tokens.
|
|
89
|
+
|
|
90
|
+
## API key
|
|
91
|
+
|
|
92
|
+
Set `GEMINI_API_KEY` (or `GOOGLE_API_KEY`), or pass `--key-file`. If you use Google
|
|
93
|
+
Cloud, you can read an existing Generative Language key with
|
|
94
|
+
`gcloud services api-keys list --project <project>` and then
|
|
95
|
+
`gcloud services api-keys get-key-string <uid> --project <project>`. Save it to a file
|
|
96
|
+
that only you can read (mode 0600), and never commit it.
|
|
97
|
+
|
|
98
|
+
## Privacy
|
|
99
|
+
|
|
100
|
+
Don't narrate living people for anything shared or public. Kinloom's public builds
|
|
101
|
+
redact living individuals, and audio has to respect that too. Keep generated audio,
|
|
102
|
+
scripts and names files in the archive's own (private) repository, not in this public
|
|
103
|
+
repo.
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
# Spoken-script rules
|
|
2
|
+
|
|
3
|
+
Rules for turning one narrative (`title` and `body_md` from `data/narratives.yaml`) into a
|
|
4
|
+
script that a text-to-speech narrator reads aloud. Write it the way a person speaks, not the
|
|
5
|
+
way a page reads. All examples below are made up.
|
|
6
|
+
|
|
7
|
+
## Output format
|
|
8
|
+
|
|
9
|
+
Plain text, in exactly this shape:
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
<Spoken title line>
|
|
13
|
+
|
|
14
|
+
## <Section heading>
|
|
15
|
+
<story paragraphs>
|
|
16
|
+
|
|
17
|
+
## <Section heading>
|
|
18
|
+
<story paragraphs>
|
|
19
|
+
|
|
20
|
+
# EDITOR'S NOTES
|
|
21
|
+
- <note, one or two spoken sentences>
|
|
22
|
+
- <note>
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Leave out `# EDITOR'S NOTES` only if the narrative has no research commentary. Don't add
|
|
26
|
+
any markdown beyond the `## ` and `# EDITOR'S NOTES` lines.
|
|
27
|
+
|
|
28
|
+
## Separate the story from the editor notes
|
|
29
|
+
|
|
30
|
+
The **story** is what happened in the person's life: births, marriages, children, land,
|
|
31
|
+
moves, church, work, money, death, and what the heirs did. Tell it plainly and
|
|
32
|
+
confidently, using the best-supported facts.
|
|
33
|
+
|
|
34
|
+
**Editor notes** are commentary on the research, not on the life:
|
|
35
|
+
- corrections of other researchers, family legends, online trees, indexes, memorial
|
|
36
|
+
sites or lineage societies ("refuting the 1736 birth year in…", "contrary to the
|
|
37
|
+
family legend…", "secondary claims place the marriage in…")
|
|
38
|
+
- proof reasoning ("this proves she was born after…", "establishing that…")
|
|
39
|
+
- identity mix-ups (another person with the same name, the wrong headstone)
|
|
40
|
+
- attributions that are unproved or disputed ("the militia service remains unproved")
|
|
41
|
+
- names that the records do not support (for example, a middle name invented online)
|
|
42
|
+
- the original record spelling of a name, if the story uses the modern spelling
|
|
43
|
+
|
|
44
|
+
Move each of these out of the story and into a note. Keep the best-supported fact in the
|
|
45
|
+
story and drop the argument. Example:
|
|
46
|
+
|
|
47
|
+
- Source: *"born between ca. 1740 and 3 March 1744 (the 1765 tax list rates him as an
|
|
48
|
+
adult, refuting the 1748 birth year in an online tree)"*
|
|
49
|
+
- Story: "He was born between about 1740 and March third, 1744."
|
|
50
|
+
- Note: "A 1765 tax list rates him as an adult, which rules out the 1748 birth year given
|
|
51
|
+
in an online tree."
|
|
52
|
+
|
|
53
|
+
Each note must make sense when heard without the story right before it.
|
|
54
|
+
|
|
55
|
+
## Remove citations completely
|
|
56
|
+
|
|
57
|
+
Remove archive, book and page references (Lib., DB, Vol., p./pp., Book N), author-year
|
|
58
|
+
citations ("Smith 1872, p. 771"), record IDs (film numbers, memorial numbers), and any
|
|
59
|
+
parenthetical that only cites a source. Don't move these into the notes either. The
|
|
60
|
+
written narrative already has them.
|
|
61
|
+
|
|
62
|
+
## Write it to be heard
|
|
63
|
+
|
|
64
|
+
| Written | Spoken |
|
|
65
|
+
|---|---|
|
|
66
|
+
| 9 May 1766 / May 9, 1766 | May ninth, 1766 |
|
|
67
|
+
| 17 September | September seventeenth |
|
|
68
|
+
| 1728/1732, 1724/5 | 1728 or 1732, 1724 or 1725 |
|
|
69
|
+
| (1691-1784) after a name | , who lived from 1691 to 1784, |
|
|
70
|
+
| £682.5.2 | 682 pounds, 5 shillings, and 2 pence |
|
|
71
|
+
| 1s. 5d. | one shilling and five pence |
|
|
72
|
+
| £470 | 470 pounds (otherwise TTS says "lb") |
|
|
73
|
+
| ca. / c. / b. / decd / Co. | circa or about / born / deceased / County |
|
|
74
|
+
| Jr. / Sr. / Capt. | Junior / Senior / Captain |
|
|
75
|
+
| 21+ / & | twenty-one or older / and |
|
|
76
|
+
| "Zero primary records…" | "No primary records…" |
|
|
77
|
+
|
|
78
|
+
- **Record spellings in quotes:** use the modern spelling of the name and state the
|
|
79
|
+
fact directly. Don't put quotation marks around record wording.
|
|
80
|
+
- **Legal terms:** briefly explain an unusual term the first time it comes up ("died
|
|
81
|
+
intestate, meaning without a will"). That's the only kind of addition allowed.
|
|
82
|
+
|
|
83
|
+
## Accuracy
|
|
84
|
+
|
|
85
|
+
Don't add, infer or embellish facts. Don't summarize anything substantive away: every fact
|
|
86
|
+
in the original (except citations) has to end up in either the story or a note. If a
|
|
87
|
+
sentence in the source is ambiguous, keep its ambiguity rather than resolving it, and
|
|
88
|
+
mention it when you report back.
|
|
89
|
+
|
|
90
|
+
## Pronunciation file (`<slug>.names.json`)
|
|
91
|
+
|
|
92
|
+
This is a JSON object. Each key is a proper name, or an unusual legal term, that a TTS
|
|
93
|
+
voice might mispronounce: Dutch, German, Huguenot or colonial surnames, unusual place
|
|
94
|
+
names, archaic legal words. Write each key exactly as it appears in the script. Each value
|
|
95
|
+
is the General American IPA pronunciation with stress marks, inside slashes:
|
|
96
|
+
|
|
97
|
+
```json
|
|
98
|
+
{
|
|
99
|
+
"Vanderhoef": "/ˈvændərhuːf/",
|
|
100
|
+
"Schoonmaker": "/ˈskuːnmeɪkər/",
|
|
101
|
+
"Raritan": "/ˈrærɪtən/",
|
|
102
|
+
"administratrix": "/ædˌmɪnɪˈstreɪtrɪks/"
|
|
103
|
+
}
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
Skip ordinary English names (John, Mary, Virginia, New Jersey). Use how descendants and
|
|
107
|
+
local people actually say a name, not the textbook form; if a pronunciation is uncertain,
|
|
108
|
+
say so when you report back. IPA in slashes works well: the TTS voice pronounces it
|
|
109
|
+
instead of reading the symbols out.
|
|
@@ -0,0 +1,290 @@
|
|
|
1
|
+
#!/usr/bin/env -S uv run --script
|
|
2
|
+
# /// script
|
|
3
|
+
# requires-python = ">=3.11"
|
|
4
|
+
# dependencies = [
|
|
5
|
+
# "click>=8.1",
|
|
6
|
+
# "httpx>=0.27",
|
|
7
|
+
# "pyyaml>=6.0",
|
|
8
|
+
# ]
|
|
9
|
+
# ///
|
|
10
|
+
"""narrative-audio: turn Kinloom narrative biographies into narrated MP3s.
|
|
11
|
+
|
|
12
|
+
Workflow (see ../SKILL.md):
|
|
13
|
+
1. `list` / `extract` read narratives from an archive's data/narratives.yaml (free)
|
|
14
|
+
2. an agent writes a spoken script + IPA names file by hand (free; see
|
|
15
|
+
../references/script-rules.md)
|
|
16
|
+
3. `check` lint the script and names file (free)
|
|
17
|
+
4. `synth` Gemini TTS -> MP3: story voice, then "Editor's notes" in a
|
|
18
|
+
second voice (paid API call)
|
|
19
|
+
5. `transcribe` optional verification transcript (paid API call)
|
|
20
|
+
|
|
21
|
+
API key: GEMINI_API_KEY or GOOGLE_API_KEY, or --key-file. Requires ffmpeg on PATH.
|
|
22
|
+
"""
|
|
23
|
+
|
|
24
|
+
from __future__ import annotations
|
|
25
|
+
|
|
26
|
+
import base64
|
|
27
|
+
import io
|
|
28
|
+
import json
|
|
29
|
+
import os
|
|
30
|
+
import re
|
|
31
|
+
import shutil
|
|
32
|
+
import subprocess
|
|
33
|
+
import sys
|
|
34
|
+
import tempfile
|
|
35
|
+
import time
|
|
36
|
+
import wave
|
|
37
|
+
from pathlib import Path
|
|
38
|
+
|
|
39
|
+
import click
|
|
40
|
+
import httpx
|
|
41
|
+
import yaml
|
|
42
|
+
|
|
43
|
+
API = "https://generativelanguage.googleapis.com/v1beta/models"
|
|
44
|
+
DEFAULT_TTS_MODEL = "gemini-3.8-flash-tts"
|
|
45
|
+
DEFAULT_TEXT_MODEL = "gemini-4-hydrogen"
|
|
46
|
+
NOTES_MARKER = "# EDITOR'S NOTES"
|
|
47
|
+
|
|
48
|
+
MONTHS = ("January|February|March|April|May|June|July|August|September|October|"
|
|
49
|
+
"November|December")
|
|
50
|
+
_ORD = ("first second third fourth fifth sixth seventh eighth ninth tenth eleventh "
|
|
51
|
+
"twelfth thirteenth fourteenth fifteenth sixteenth seventeenth eighteenth "
|
|
52
|
+
"nineteenth twentieth").split()
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
# --------------------------------------------------------------------------- helpers
|
|
56
|
+
|
|
57
|
+
def ordinal(n: int) -> str:
|
|
58
|
+
if n <= 20:
|
|
59
|
+
return _ORD[n - 1]
|
|
60
|
+
if n == 30:
|
|
61
|
+
return "thirtieth"
|
|
62
|
+
return ("twenty-" if n < 30 else "thirty-") + _ORD[n % 10 - 1]
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
def speak_dates(text: str) -> str:
|
|
66
|
+
"""'9 May 1766' / 'May 9, 1766' / '9 May' -> 'May ninth, 1766' / 'May ninth'."""
|
|
67
|
+
text = re.sub(
|
|
68
|
+
rf"\b(\d{{1,2}})(?:st|nd|rd|th)? ({MONTHS})(,? (\d{{4}}))?\b",
|
|
69
|
+
lambda m: f"{m.group(2)} {ordinal(int(m.group(1)))}"
|
|
70
|
+
+ (f", {m.group(4)}" if m.group(4) else ""),
|
|
71
|
+
text,
|
|
72
|
+
)
|
|
73
|
+
return re.sub(
|
|
74
|
+
rf"\b({MONTHS}) (\d{{1,2}})(?:st|nd|rd|th)?\b",
|
|
75
|
+
lambda m: f"{m.group(1)} {ordinal(int(m.group(2)))}",
|
|
76
|
+
text,
|
|
77
|
+
)
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
def apply_names(text: str, names: dict[str, str]) -> str:
|
|
81
|
+
"""Replace each name with its IPA string, longest keys first, whole words only."""
|
|
82
|
+
for name, ipa in sorted(names.items(), key=lambda kv: -len(kv[0])):
|
|
83
|
+
text = re.sub(rf"(?<![\w/]){re.escape(name)}(?![\w/])", ipa, text)
|
|
84
|
+
return text
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
def split_script(script: str) -> tuple[list[str], list[str]]:
|
|
88
|
+
story, _, notes = script.partition(NOTES_MARKER)
|
|
89
|
+
sections = [s.strip() for s in re.split(r"(?m)^(?=## )", story) if s.strip()]
|
|
90
|
+
sections = [re.sub(r"^##\s*(.+)$", r"\1.", s, flags=re.M) for s in sections]
|
|
91
|
+
note_items = [re.sub(r"^\s*[-*]\s*", "", n).strip()
|
|
92
|
+
for n in notes.strip().splitlines() if n.strip()]
|
|
93
|
+
return sections, note_items
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
def api_key(key_file: str | None) -> str:
|
|
97
|
+
if key_file:
|
|
98
|
+
return Path(key_file).expanduser().read_text().strip()
|
|
99
|
+
key = os.environ.get("GEMINI_API_KEY") or os.environ.get("GOOGLE_API_KEY")
|
|
100
|
+
if not key:
|
|
101
|
+
raise click.ClickException(
|
|
102
|
+
"Set GEMINI_API_KEY (or GOOGLE_API_KEY), or pass --key-file.")
|
|
103
|
+
return key
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
def generate(key: str, model: str, body: dict, retries: int = 3) -> dict:
|
|
107
|
+
for attempt in range(retries + 1):
|
|
108
|
+
r = httpx.post(f"{API}/{model}:generateContent", json=body,
|
|
109
|
+
headers={"x-goog-api-key": key}, timeout=600)
|
|
110
|
+
if r.status_code in (429, 500, 502, 503, 504) and attempt < retries:
|
|
111
|
+
time.sleep(5 * (attempt + 1))
|
|
112
|
+
continue
|
|
113
|
+
if r.status_code != 200:
|
|
114
|
+
raise click.ClickException(f"{model}: HTTP {r.status_code}: {r.text[:800]}")
|
|
115
|
+
return r.json()
|
|
116
|
+
raise AssertionError("unreachable")
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
def load_narratives(path: str) -> list[dict]:
|
|
120
|
+
data = yaml.safe_load(Path(path).read_text())
|
|
121
|
+
return data if isinstance(data, list) else data.get("narratives", [])
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
# --------------------------------------------------------------------------- CLI
|
|
125
|
+
|
|
126
|
+
@click.group()
|
|
127
|
+
def cli() -> None:
|
|
128
|
+
"""Narrate Kinloom narrative biographies with Gemini TTS."""
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
@cli.command("list")
|
|
132
|
+
@click.argument("narratives_yaml", type=click.Path(exists=True))
|
|
133
|
+
@click.option("--kind", default="biography", show_default=True)
|
|
134
|
+
def list_cmd(narratives_yaml: str, kind: str) -> None:
|
|
135
|
+
"""List narratives (word count, id, title), shortest first."""
|
|
136
|
+
rows = [(len((n.get("body_md") or "").split()), n["id"], n.get("title", ""))
|
|
137
|
+
for n in load_narratives(narratives_yaml) if not kind or n.get("kind") == kind]
|
|
138
|
+
for words, nid, title in sorted(rows):
|
|
139
|
+
click.echo(f"{words:6d} {nid} {title}")
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
@cli.command()
|
|
143
|
+
@click.argument("narratives_yaml", type=click.Path(exists=True))
|
|
144
|
+
@click.argument("narrative_id")
|
|
145
|
+
def extract(narratives_yaml: str, narrative_id: str) -> None:
|
|
146
|
+
"""Print one narrative's slug, title and body_md (input for the script writer)."""
|
|
147
|
+
n = next((n for n in load_narratives(narratives_yaml) if n["id"] == narrative_id), None)
|
|
148
|
+
if not n:
|
|
149
|
+
raise click.ClickException(f"no narrative with id {narrative_id}")
|
|
150
|
+
click.echo(f"SLUG: {n.get('slug', narrative_id)}\nTITLE: {n.get('title', '')}\n")
|
|
151
|
+
click.echo(n.get("body_md", ""))
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
@cli.command()
|
|
155
|
+
@click.argument("script", type=click.Path(exists=True))
|
|
156
|
+
@click.option("--names", type=click.Path(exists=True), help="IPA names JSON")
|
|
157
|
+
def check(script: str, names: str | None) -> None:
|
|
158
|
+
"""Lint a spoken script (and names file) before paying for synthesis."""
|
|
159
|
+
text = Path(script).read_text()
|
|
160
|
+
problems: list[str] = []
|
|
161
|
+
patterns = {
|
|
162
|
+
"day-before-month date (write 'May ninth, 1766')": rf"\b\d{{1,2}} ({MONTHS})\b",
|
|
163
|
+
"numeric month-day date (write 'May ninth')": rf"\b({MONTHS}) \d{{1,2}}\b(?!\d)",
|
|
164
|
+
"currency symbol (write '470 pounds')": r"[£$]",
|
|
165
|
+
"s./d. money abbreviation": r"\b\d+[sd]\.",
|
|
166
|
+
"citation remnant": r"\b(Lib\.|Vol\.|pp?\.\s*\d|DB \d|FHL|Book \d+)",
|
|
167
|
+
"slash (write 'or')": r"\S/\S",
|
|
168
|
+
"abbreviation to spell out": r"\b(ca\.|b\.|d\.|decd|Co\.|Jr\.|Sr\.|Capt\.)(?=\s|$)",
|
|
169
|
+
"markdown emphasis or link": r"[*_`]|\]\(",
|
|
170
|
+
"quotation mark": r"[\"“”]",
|
|
171
|
+
}
|
|
172
|
+
for i, line in enumerate(text.splitlines(), 1):
|
|
173
|
+
for label, pat in patterns.items():
|
|
174
|
+
if re.search(pat, line):
|
|
175
|
+
problems.append(f"{script}:{i}: {label}: {line.strip()[:100]}")
|
|
176
|
+
if NOTES_MARKER not in text:
|
|
177
|
+
problems.append(f"no '{NOTES_MARKER}' section (fine only if there are no notes)")
|
|
178
|
+
if names:
|
|
179
|
+
mapping = json.loads(Path(names).read_text())
|
|
180
|
+
for k, v in mapping.items():
|
|
181
|
+
if not re.search(rf"(?<!\w){re.escape(k)}(?!\w)", text):
|
|
182
|
+
problems.append(f"names: '{k}' does not appear in the script")
|
|
183
|
+
if not (v.startswith("/") and v.endswith("/")):
|
|
184
|
+
problems.append(f"names: '{k}' value is not /IPA/ in slashes: {v}")
|
|
185
|
+
sections, notes = split_script(text)
|
|
186
|
+
click.echo(f"{len(sections)} story sections, {len(notes)} notes, "
|
|
187
|
+
f"{len(text.split())} words")
|
|
188
|
+
for p in problems:
|
|
189
|
+
click.echo(p)
|
|
190
|
+
if problems:
|
|
191
|
+
sys.exit(1)
|
|
192
|
+
click.echo("ok")
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
@cli.command()
|
|
196
|
+
@click.argument("script", type=click.Path(exists=True))
|
|
197
|
+
@click.option("--names", type=click.Path(exists=True), help="IPA names JSON")
|
|
198
|
+
@click.option("-o", "--out", type=click.Path(), help="output .mp3 (default: next to script)")
|
|
199
|
+
@click.option("--model", default=DEFAULT_TTS_MODEL, show_default=True)
|
|
200
|
+
@click.option("--voice", default="Charon", show_default=True, help="story voice")
|
|
201
|
+
@click.option("--notes-voice", default="Kore", show_default=True)
|
|
202
|
+
@click.option("--section-pause", default=0.8, show_default=True, type=float)
|
|
203
|
+
@click.option("--notes-pause", default=2.0, show_default=True, type=float)
|
|
204
|
+
@click.option("--bitrate", default="96k", show_default=True)
|
|
205
|
+
@click.option("--key-file", type=click.Path(), help="file containing the API key")
|
|
206
|
+
@click.option("--dry-run", is_flag=True, help="print the exact text each request would send")
|
|
207
|
+
def synth(script, names, out, model, voice, notes_voice, section_pause, notes_pause,
|
|
208
|
+
bitrate, key_file, dry_run) -> None:
|
|
209
|
+
"""Synthesize SCRIPT to MP3 (story voice, then editor's notes voice)."""
|
|
210
|
+
text = Path(script).read_text()
|
|
211
|
+
if names:
|
|
212
|
+
text = apply_names(text, json.loads(Path(names).read_text()))
|
|
213
|
+
text = speak_dates(text)
|
|
214
|
+
sections, notes = split_script(text)
|
|
215
|
+
chunks = [(s, voice, section_pause) for s in sections]
|
|
216
|
+
if notes:
|
|
217
|
+
chunks.append(("Editor's notes.\n\n" + "\n\n".join(notes), notes_voice, notes_pause))
|
|
218
|
+
|
|
219
|
+
if dry_run:
|
|
220
|
+
for i, (t, v, _) in enumerate(chunks, 1):
|
|
221
|
+
click.echo(f"===== request {i} [{v}] =====\n{t}\n")
|
|
222
|
+
return
|
|
223
|
+
if not shutil.which("ffmpeg"):
|
|
224
|
+
raise click.ClickException("ffmpeg not found on PATH")
|
|
225
|
+
key = api_key(key_file)
|
|
226
|
+
out_path = Path(out) if out else Path(script).with_suffix("").with_suffix(".mp3")
|
|
227
|
+
|
|
228
|
+
pcm, rate, total_tokens = b"", 24000, 0
|
|
229
|
+
for i, (t, v, pause) in enumerate(chunks, 1):
|
|
230
|
+
# Send ONLY the words to speak. These TTS models read any style direction aloud,
|
|
231
|
+
# and reject systemInstruction ("Developer instruction is not enabled").
|
|
232
|
+
resp = generate(key, model, {
|
|
233
|
+
"contents": [{"parts": [{"text": t}]}],
|
|
234
|
+
"generationConfig": {
|
|
235
|
+
"responseModalities": ["AUDIO"],
|
|
236
|
+
"speechConfig": {"voiceConfig": {"prebuiltVoiceConfig": {"voiceName": v}}},
|
|
237
|
+
},
|
|
238
|
+
})
|
|
239
|
+
part = resp["candidates"][0]["content"]["parts"][0]["inlineData"]
|
|
240
|
+
raw = base64.b64decode(part["data"])
|
|
241
|
+
if raw[:4] == b"RIFF": # audio/wav: strip header or it plays as a burst of noise
|
|
242
|
+
with wave.open(io.BytesIO(raw)) as w:
|
|
243
|
+
rate, raw = w.getframerate(), w.readframes(w.getnframes())
|
|
244
|
+
elif m := re.search(r"rate=(\d+)", part.get("mimeType", "")):
|
|
245
|
+
rate = int(m.group(1))
|
|
246
|
+
if pcm:
|
|
247
|
+
pcm += b"\x00\x00" * int(rate * pause)
|
|
248
|
+
pcm += raw
|
|
249
|
+
tokens = resp.get("usageMetadata", {}).get("totalTokenCount", 0)
|
|
250
|
+
total_tokens += tokens
|
|
251
|
+
click.echo(f" section {i}/{len(chunks)} [{v}]: {len(t.split())} words, "
|
|
252
|
+
f"{len(raw) / 2 / rate:.0f}s, {tokens} tokens", err=True)
|
|
253
|
+
|
|
254
|
+
with tempfile.NamedTemporaryFile(suffix=".pcm") as tmp:
|
|
255
|
+
tmp.write(pcm)
|
|
256
|
+
tmp.flush()
|
|
257
|
+
subprocess.run(["ffmpeg", "-y", "-loglevel", "error", "-f", "s16le", "-ar", str(rate),
|
|
258
|
+
"-ac", "1", "-i", tmp.name, "-b:a", bitrate, str(out_path)], check=True)
|
|
259
|
+
click.echo(f"wrote {out_path} ({len(pcm) / 2 / rate / 60:.1f} min, {total_tokens} tokens)")
|
|
260
|
+
|
|
261
|
+
|
|
262
|
+
@cli.command()
|
|
263
|
+
@click.argument("audio", type=click.Path(exists=True))
|
|
264
|
+
@click.option("--model", default=DEFAULT_TEXT_MODEL, show_default=True)
|
|
265
|
+
@click.option("--key-file", type=click.Path())
|
|
266
|
+
@click.option("-o", "--out", type=click.Path(), help="output .md (default: next to audio)")
|
|
267
|
+
def transcribe(audio, model, key_file, out) -> None:
|
|
268
|
+
"""Verbatim, timestamped transcript that flags glitches (paid; for QA)."""
|
|
269
|
+
key = api_key(key_file)
|
|
270
|
+
mime = {".mp3": "audio/mpeg", ".wav": "audio/wav", ".ogg": "audio/ogg"}.get(
|
|
271
|
+
Path(audio).suffix.lower(), "audio/mpeg")
|
|
272
|
+
prompt = ("Transcribe this audio VERBATIM with [mm:ss] timestamps at the start of each "
|
|
273
|
+
"sentence. Write exactly what is spoken, including mistakes, repetitions and "
|
|
274
|
+
"mispronunciations (note them in [brackets]), and any non-speech sounds such as "
|
|
275
|
+
"clicks, noise bursts, garbled audio, long silences, or abrupt cuts. If any "
|
|
276
|
+
"phonetic symbols or slashes are read out literally, mark them [read IPA aloud]. "
|
|
277
|
+
"Do not correct or clean up anything.")
|
|
278
|
+
resp = generate(key, model, {"contents": [{"parts": [
|
|
279
|
+
{"inlineData": {"mimeType": mime,
|
|
280
|
+
"data": base64.b64encode(Path(audio).read_bytes()).decode()}},
|
|
281
|
+
{"text": prompt}]}]})
|
|
282
|
+
text = "".join(p.get("text", "") for p in resp["candidates"][0]["content"]["parts"])
|
|
283
|
+
out_path = Path(out) if out else Path(audio).with_suffix(".transcript.md")
|
|
284
|
+
out_path.write_text(text)
|
|
285
|
+
click.echo(text)
|
|
286
|
+
click.echo(f"\nwrote {out_path}", err=True)
|
|
287
|
+
|
|
288
|
+
|
|
289
|
+
if __name__ == "__main__":
|
|
290
|
+
cli()
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: new-jersey-archives
|
|
3
|
+
description: Search the New Jersey State Archives searchable-databases portal and the Monmouth County OPRS 1875 census via the bundled `nj-archives` CLI, or in the browser where there is no online search. Covers Early Land Records, Supreme Court Case Files, colonial and 1848-1900 marriages, death indexes, name changes, the 1885 state census, Revolutionary War damage claims, Civil War service records and vouchers, WWI deaths, and National Guard photographs, plus the order-form-only vital-records and probate requests. Use when tracing ancestors in New Jersey, finding colonial landholdings or court cases, or deciding whether a record is online, orderable by mail, or visit-only.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# New Jersey Archives
|
|
7
|
+
|
|
8
|
+
This skill includes a standalone executable Python CLI at `skills/new-jersey-archives/scripts/nj-archives` using a PEP 723 `#!/usr/bin/env -S uv run --script` shebang with inline dependencies (`click`, `httpx`). No virtualenv setup or API key is required.
|
|
9
|
+
|
|
10
|
+
The State Archives in Trenton is the official repository for New Jersey public records of enduring value, from the colony founded in 1664 to the present. It holds over 57,000 cubic feet of paper records and over 32,000 reels of microfilm. Admission is free; copies and research carry fees. Most holdings are not digitized.
|
|
11
|
+
|
|
12
|
+
## Bundled CLI (`scripts/nj-archives`)
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
# List the databases live from the portal index
|
|
16
|
+
skills/new-jersey-archives/scripts/nj-archives databases
|
|
17
|
+
|
|
18
|
+
# Early Land Records for a surname, Monmouth County only
|
|
19
|
+
skills/new-jersey-archives/scripts/nj-archives search land --surname Lincoln --county Monmouth
|
|
20
|
+
|
|
21
|
+
# Land records where the person is the grantee, 1670-1700
|
|
22
|
+
skills/new-jersey-archives/scripts/nj-archives search land --surname Lincoln --role Grantee --from-year 1670 --to-year 1700
|
|
23
|
+
|
|
24
|
+
# Supreme Court Case Files, 1704-1844
|
|
25
|
+
skills/new-jersey-archives/scripts/nj-archives search supreme-court --surname Smith --role Defendant
|
|
26
|
+
|
|
27
|
+
# Read two pages of results (11 rows per page) as JSON
|
|
28
|
+
skills/new-jersey-archives/scripts/nj-archives search land --surname Smith --pages 2 --json
|
|
29
|
+
|
|
30
|
+
# Monmouth County OPRS 1875 census, name contains Smith, all towns
|
|
31
|
+
skills/new-jersey-archives/scripts/nj-archives monmouth --surname Smith
|
|
32
|
+
|
|
33
|
+
# Monmouth 1875 census, Freehold, Population category, name starts with Smith
|
|
34
|
+
skills/new-jersey-archives/scripts/nj-archives monmouth --surname Smith --town Freehold --category Population --match starts
|
|
35
|
+
|
|
36
|
+
# Browser URL for a database search page or an order form
|
|
37
|
+
skills/new-jersey-archives/scripts/nj-archives url land
|
|
38
|
+
skills/new-jersey-archives/scripts/nj-archives url births-1848-1925
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
`search` options: `--surname` (alias `--last`; required except for `natguard-photos`, which uses `--keyword`, and for the two marriage databases, which also accept `--spouse-surname` alone), `--given` (alias `--first`), `--spouse-surname` (alias `--spouse`) / `--spouse-given` (marriage databases), `--county`, `--location`, `--from-year`, `--to-year`, `--role` (land: Grantor/Grantee/Named/Official; supreme-court: Plaintiff/Defendant/Official/Victim/Other), `--case-type` / `--case-number` (supreme-court), `--keyword` (natguard-photos), `--limit`, `--pages` (stops cleanly when no further pager link exists), `--refresh`, `--cache-ttl-hours`, `--json`. County and role values are matched case-insensitively (and with or without a trailing `" County"`) against the live dropdown options on the search page. `search` refuses order-form-only databases with the form URL; use `url` for those.
|
|
42
|
+
|
|
43
|
+
Database names are forgiving: case, spaces, and underscores are normalized, and common variants resolve (`marriages-colonial`, `marriage-colonial`, `colonial-marriage` → `colonial-marriages`; `marriages` → `marriages-1848-1900`; `deeds` → `land`). A typo exits 2 with a "Did you mean" hint and makes no network call.
|
|
44
|
+
|
|
45
|
+
### Disk cache
|
|
46
|
+
|
|
47
|
+
`search` and `monmouth` cache each result on disk, keyed by database, every criterion, and `--pages`. A repeat search reads the cache file and makes no network call. JSON output carries `"cache_hit": true|false`, and text output marks hits with `[cache]`.
|
|
48
|
+
|
|
49
|
+
- Location: `~/.cache/kinloom-nj-archives/` (override with `KINLOOM_NJ_ARCHIVES_CACHE_DIR`).
|
|
50
|
+
- TTL: 168 hours (override with `--cache-ttl-hours` or `KINLOOM_NJ_ARCHIVES_CACHE_TTL_HOURS`; `0` disables reads).
|
|
51
|
+
- `--refresh` re-queries the portal and rewrites the entry.
|
|
52
|
+
- Writes are atomic (temp file + rename). A per-query `flock` makes concurrent agents that run the same search wait for the first one and then read its file.
|
|
53
|
+
|
|
54
|
+
## How the machine interface works (verified live 2026-11-24)
|
|
55
|
+
|
|
56
|
+
There is no public API and no stable GET search URL. The portal is ASP.NET WebForms, and the CLI drives its real form flow over plain HTTP:
|
|
57
|
+
|
|
58
|
+
1. GET the portal index with a browser User-Agent and a cookie jar. A bare curl/httpx default User-Agent gets 403 (bot protection, not an outage); with a browser UA the same request returns 200. The session sets `ASP.NET_SessionId` plus Imperva cookies, which must be carried through the flow.
|
|
59
|
+
2. POST the database row's `__doPostBack` event target to `index.aspx` with the page's `__VIEWSTATE` / `__EVENTVALIDATION`. The response is that database's search page (e.g. `EarlyLandRecords.aspx`).
|
|
60
|
+
3. POST the search form fields plus the `Search` button to the search page, again with fresh hidden fields. Results come back as a `GridView1` table; land-record rows link to scanned PDFs at `https://www.state.nj.us/state/darm/EarlyLandRecordsPDF/<Liber...>.pdf`.
|
|
61
|
+
4. Pagination is a further postback: `__EVENTTARGET=ctl00$ContentPlaceHolder1$GridView1`, `__EVENTARGUMENT=Page$N`. Searches are capped at 500 records; the CLI warns only when 500 rows were actually returned.
|
|
62
|
+
|
|
63
|
+
The Monmouth OPRS search is the same pattern on a second ASP.NET site: GET `ASearch.aspx`, POST `txtName` + town/category dropdowns + the `radStarts`/`radContains` radio + `btnSearch`. Results are a `dgdArcSearch` table (Town Name, Category, Person Name, Page #); each row links to a census-page PDF at `https://oprs.co.monmouth.nj.us/Oprs/census/<Town>/<Category>/<page>.pdf`.
|
|
64
|
+
|
|
65
|
+
## Searchable databases
|
|
66
|
+
|
|
67
|
+
Counts are what the portal showed live on 2026-11-24; staff add entries daily, so re-check. Test status: "live search" means a search was submitted and results parsed by the CLI on 2026-11-24; "form mapped" means the search page and its fields were read live but no search was submitted for that database yet.
|
|
68
|
+
|
|
69
|
+
| CLI key | Database | Count (2026-11-24) | Test status |
|
|
70
|
+
|---|---|---|---|
|
|
71
|
+
| `land` | Early Land Records, ca. 1650-1900s | 75,685 records, over 397,267 names | live search |
|
|
72
|
+
| `supreme-court` | Supreme Court Case Files, 1704-1844 | 55,114 case files, over 234,709 names | live search |
|
|
73
|
+
| `colonial-marriages` | Colonial Marriage Bonds, ca. 1666-1799 | 11,533 bonds | form mapped |
|
|
74
|
+
| `marriages-1848-1900` | Marriage Records, May 1848-Dec 1900 | ~492,000 records | form mapped |
|
|
75
|
+
| `deaths-1848-1878` | Death Records, May 1848-May 1878 | over 303,172 records | form mapped |
|
|
76
|
+
| `deaths-1878-1900` | Death Records, Jun 1878-Dec 1900 | 628,584 records | form mapped |
|
|
77
|
+
| `name-changes` | Legal Name Changes, 1847-1947 | 12,254 changes, 46,010 names | form mapped |
|
|
78
|
+
| `census-1885` | 1885 State Census, Passaic County and Atlantic City only | 69,302 names | form mapped |
|
|
79
|
+
| `revwar-damage` | Revolutionary War Damage Claims, 1776-1783 | 2,662 claims, 7,435 names | live search |
|
|
80
|
+
| `civilwar-service` | Civil War Service Records, 1861-1865 | 82,471 names | form mapped |
|
|
81
|
+
| `civilwar-vouchers` | Civil War Payment Vouchers, 1861-1865 | 15,770 vouchers, 114,212 names | form mapped |
|
|
82
|
+
| `wwi-deaths` | World War I Deaths | 3,427 names, 9,310 scanned images | form mapped |
|
|
83
|
+
| `natguard-photos` | New Jersey National Guard Photographs | 1,316 images | form mapped |
|
|
84
|
+
|
|
85
|
+
Searchable fields per database (verified from the live search forms): land searches by surname, given name, role (Grantor/Grantee/Named/Official), location, county, year span, and deed book; supreme-court by surname, given name, role (Plaintiff/Defendant/Official/Victim/Other), case type, county, year span, and case number; colonial marriages by groom and bride surnames/given names and year span; 1848-1900 marriages the same plus county; deaths by surname, given name, year span, and county; name changes by surname and given name; 1885 census by surname, given name, and location; Rev War damage claims by surname, given name, county, location, and year span; Civil War service by surname and given name; WWI deaths by surname, given name, and NJ county of residence; National Guard photographs by keyword, location, and year span.
|
|
86
|
+
|
|
87
|
+
Notes: the portal's own warning on land records is that most deeds executed after 1785 were recorded at the county level, not with the State, so county deed books are the follow-up. The 1875 state census survives for Essex, Hunterdon, Monmouth, and Sussex counties only, and the 1895 state census is available through subscription sites.
|
|
88
|
+
|
|
89
|
+
## Order-form only (no online search)
|
|
90
|
+
|
|
91
|
+
These portal rows lead to records-request (shopping-cart) forms, not searchable result grids. The CLI's `search` refuses them and prints the form URL; open the form in a browser to order. Certified copies cost $25.00 per document in addition to copy and research fees, and only for original records the Archives legally owns; allow up to 8 weeks for an order.
|
|
92
|
+
|
|
93
|
+
| CLI key | Form | Coverage |
|
|
94
|
+
|---|---|---|
|
|
95
|
+
| `births-1848-1925` | BirthRecordsRequest.aspx | Births May 1848-Dec 1925 |
|
|
96
|
+
| `marriages-1848-1950` | MarriageRecordsRequest.aspx | Marriages May 1848-Dec 1950 |
|
|
97
|
+
| `deaths-1848-1950` | DeathRecordsRequest.aspx | Deaths May 1848-Dec 1950 |
|
|
98
|
+
| `county-clerks-marriages` | CountyMarriageRecordRequest.aspx | Limited counties and date ranges |
|
|
99
|
+
| `probate` | ProbateRecordRequest.aspx | Probate, ca. 1660-1952, wills and inventories |
|
|
100
|
+
| `naturalization` | NaturalizationRecordRequest.aspx | County naturalization, limited counties/date ranges |
|
|
101
|
+
| `revwar-search` | RevWarRecordRequest.aspx | Revolutionary War records |
|
|
102
|
+
| `wwi-search` | WorldWarIRecordRequest.aspx | World War I records |
|
|
103
|
+
|
|
104
|
+
Later vital records belong to the Department of Health and are on microfilm at the Archives for in-person use only. Chancery Court cases 1743-1948 are largely in-house, some off-site with several days' retrieval; indexes are on microfilm 1825-1948.
|
|
105
|
+
|
|
106
|
+
## Monmouth County OPRS 1875 census
|
|
107
|
+
|
|
108
|
+
Monmouth County has its own county-level online index: https://oprs.co.monmouth.nj.us/oprs/Archives/ASearch.aspx (http redirects to https). The `monmouth` command searches the 1875 Census Information collection by person name, town (Atlantic, Freehold, Holmdel, Howell, Marlboro, Middletown, Ocean, Shrewsbury, Upper Freehold, Wall, or ALL), and category (Agriculture, Commerce, Manufactures, Mining, Population, Return of Births, Return of Deaths, or ALL), with `--match starts` (default on the site) or `contains`. The 1875 Monmouth County census is the only known copy of that enumeration for the county. Each hit gives the census page number and a PDF of the census page itself.
|
|
109
|
+
|
|
110
|
+
Cross-check any colonial-era Monmouth County hit against the State Archives Early Land Records database (`nj-archives search land`), since landowners who held land before 1785 often appear in state land patents as well.
|
|
111
|
+
|
|
112
|
+
Inferred, not verified: the Monmouth results page shows pager links whose postback targets (`dgdArcSearch$ctl01$ctl0N`) appear in the page HTML but were not exercised, so the CLI reads page 1 only. The other Monmouth collections (Common Pleas 1723-1899, Civil War Muster Lists, Civil War Bounty Pay, Slave Births 1804-1848, Slave Manumissions 1787-1844, Freeholder Lists, Incorporations and Partnerships) live on separate pages and are not covered by this CLI.
|
|
113
|
+
|
|
114
|
+
## Verification log (verified live 2026-11-24)
|
|
115
|
+
|
|
116
|
+
- Portal index `https://wwwdnet-dos.nj.gov/DOS_ArchivesDBPortal/index.aspx` fetched with a browser User-Agent: HTTP 200, 72 KB. Direct curl with the default User-Agent returned 403 (bot protection, not an outage).
|
|
117
|
+
- Early Land Records search and pagination (`--pages 2`) returned parsed rows with links to scanned Liber PDFs.
|
|
118
|
+
- Supreme Court Case Files search returned parsed case rows (for example surname Smith returns 1835 Trespass & Ejectment cases) and accurately reported "No Records Found" for empty queries.
|
|
119
|
+
- Revolutionary War Damage Claims search executed end-to-end and parsed cleanly.
|
|
120
|
+
- Monmouth OPRS 1875 census search fetched over HTTPS and returned parsed rows with census-page PDF links.
|
|
121
|
+
- Every searchable database's search page and field list was read live by navigating its portal row (see the table above); births and probate request forms were confirmed to be order forms (`btnAddToCart`, no `Search` button).
|
|
122
|
+
- Portal counts update continuously as staff enter records; re-run `nj-archives databases` rather than quoting counts from memory.
|
|
123
|
+
|
|
124
|
+
### Re-verification 2026-11-25
|
|
125
|
+
|
|
126
|
+
- All 13 searchable databases returned exit 0 live with surname `Smith` (natguard-photos with a keyword) in 0.8-1.9 s each. Paged searches with `--role`, `--from-year`/`--to-year`, and `--county` (up to `--pages 12`, 132 rows) also returned exit 0.
|
|
127
|
+
- The earlier HTTP 500 failures came from posting `Page$N` past the last page (ASP.NET EventValidation rejects it). The CLI now pages only when the grid renders a link for the next page, and it retries a transient 5xx once with a fresh session.
|
|
128
|
+
- The other failures were exit-2 usage errors: a spouse-only marriage search (`--spouse-surname` without `--surname`) and guessed database names (`marriages-colonial`). Both now work.
|
|
129
|
+
|
|
130
|
+
## What this skill does not cover
|
|
131
|
+
|
|
132
|
+
- Department of Agriculture Photographs (7,111 photographs), Federal Writers' Project Photographs (3,911 images), and the Military Service Records request form appear on the portal but have no CLI support; open them in the browser from the portal index.
|
|
133
|
+
- The other Monmouth OPRS collections listed above (Common Pleas, muster lists, slave births/manumissions, freeholders, incorporations) are separate pages, not covered.
|
|
134
|
+
- In-person-only holdings, microfilm-only records, and subscription indexes (FamilySearch, Ancestry).
|
|
135
|
+
- Do not invent an API endpoint, a query-string search URL, or an auth requirement for any of these portals. There is none verified. If the portal redesigns or the postback targets change, `databases` will show it (rows without a `[key]`) and the CLI's registry needs re-verifying against the live index.
|