Skip to content

Repository files navigation

mishnah-style

A house style for Mishnah text — clear punctuation, elegant layout, and structural formatting that makes the rhetoric visible on the page.

This repo contains:

  • Formatted masechot — one HTML file per masechet, all 63 tractates, verified clean against Sefaria
  • Documentation:
  • Scripts — full pipeline for downloading, formatting, verifying, fixing, and merging:
    • scripts/download.py — fetch raw JSON from Sefaria API
    • scripts/format.py — format JSON using Ollama, Anthropic API, or Claude Code
    • scripts/verify.py — cross-check HTML against Sefaria source
    • scripts/fix.py — programmatic fixes + LLM regen for errors
    • scripts/merge.py — apply JSON corrections into HTML files
    • scripts/update-readme.py — regenerate masechot table from meta tags
  • Entities knowledge base (entities/) — an accumulating store of people, places, and plants in the Mishnah (KB spec, display spec). YAML is the source of truth (run pip install -r entities/requirements.txt first):
    • scripts/kb-validate.py — validate entities/data/ against the JSON schemas + semantic cross-checks
    • scripts/kb-build.py — compile the YAML into the derived entities/knowledge.db
    • scripts/kb-render.py — render the static entity/index/map/gallery site into entities/site/ (display phase 2)
    • scripts/kb-enrich.py — weave the entity overlay (CSS-only per-type toggle + links) into copies of the masechot under entities/site/read/ (display phase 3); canonical masechot are never modified
    • scripts/kb-import-wikidata.py, scripts/kb-import-pleiades.py — enrich entities from external sources (additive, idempotent; --input runs offline against entities/fixtures/)
    • scripts/kb-detect.py + scripts/kb-promote.py — populate the KB from the corpus: detect entities mishna-by-mishna (--mode bold offline, --mode llm on your machine), review in entities/review/index.html, promote into stubs / rejections / rules (detection spec)
    • scripts/kb-selftest.py — quick offline smoke of the §8 merge-rule invariants
    • tests/ — full suite, one module per deliverable: python3 -m unittest discover -s tests -t tests
  • A Claude skill (.claude/skills/mishnah/) for interactive formatting in Claude Code

The Style

The formatting approach treats each mishna as a rhetorical document. Line breaks, em-dashes, colons, and bold attributions work together to make the structure — case vs. ruling, opinion vs. counter-opinion, parallels and kal vachomer — visible at a glance.

Key conventions:

  • Bold rabbinic names and collective bodies (not verbs)
  • Em-dashes bind case to ruling, with structural line breaks
  • Colons introduce direct statements and enumerations
  • ~8 Hebrew words per line, broken at natural syntactic joints
  • Deep-linking anchors on every perek and mishna

Scripts

All scripts accept masechet <name>, seder <name>, or shas as scope. Use --ref to target a chapter (3) or mishna (3:5).

Pipeline

download.py  → sefaria/*.json     (raw source from Sefaria)
format.py    → output/*.json      (LLM-formatted mishnayot)
verify.py    → output/*.json/html (verification report)
fix.py       → output/*.json      (corrections)
merge.py     → masechot/*.html    (applies JSON into HTML files)

Download source text

python3 scripts/download.py masechet Berakhot
python3 scripts/download.py seder Zeraim
python3 scripts/download.py shas

Format into JSON

python3 scripts/format.py masechet Berakhot --backend anthropic
python3 scripts/format.py masechet Berakhot --ref 3:5 --backend ollama
python3 scripts/format.py seder Zeraim --backend claude-code
python3 scripts/format.py shas --backend anthropic

Backends: ollama (local), anthropic (API, needs ANTHROPIC_API_KEY), claude-code (headless CLI).

Verify against source

python3 scripts/verify.py masechet Berakhot
python3 scripts/verify.py masechet Berakhot --ref 3
python3 scripts/verify.py seder Zeraim
python3 scripts/verify.py shas --report output/report

With --report PATH, writes PATH.json (for fix.py) and PATH.html (human-readable).

Fix errors

python3 scripts/fix.py --report output/report.json                      # programmatic only
python3 scripts/fix.py --report output/report.json --backend anthropic  # + LLM regen
python3 scripts/fix.py --report output/report.json --dry-run            # preview

Merge into HTML

python3 scripts/merge.py output/keilim-fixes.json
python3 scripts/merge.py output/keilim-formatted.json
python3 scripts/merge.py output/*.json

Only merge.py writes to masechot/. Handles both patching existing mishnayot and inserting missing ones.

Using the Claude Code Skill

git clone https://github.com/mig2/mishnah-style.git
cd mishnah-style
claude  # the skill is available automatically

Masechot

All 63 masechot formatted. Last updated: 44bdd8d (2026-05-24).

Seder Masechot
Zeraim Brachot, Peah, Demai, Kilayim, Sheviit, Terumot, Maaserot, Maaser Sheni, Challah, Orlah, Bikkurim
Moed Shabbat, Eruvin, Pesachim, Shekalim, Yoma, Sukkah, Beitzah, Rosh Hashanah, Taanit, Megillah, Moed Katan, Chagigah
Nashim Yevamot, Ketubot, Nedarim, Nazir, Sotah, Gittin, Kiddushin
Nezikin Bava Kamma, Bava Metzia, Bava Batra, Sanhedrin, Makkot, Shevuot, Eduyot, Avodah Zarah, Avot, Horayot
Kodashim Zevachim, Menachot, Chullin, Bekhorot, Arakhin, Temurah, Keritot, Meilah, Tamid, Middot, Kinnim
Taharot Kelim, Ohalot, Negaim, Parah, Taharot, Mikvaot, Niddah, Makhshirin, Zavim, Tevul Yom, Yadayim, Uktzin

License

The Mishnah text is in the public domain. The formatting, style guide, and skill are available under MIT.

About

A house style for Mishnah text — clear punctuation, elegant layout, and structural formatting

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages