ced9c73474fdd9b86f482c654368e95c791e8531
Four-iteration sweep over the 14-exemplar corpus, driven by loop
failures at each step. Scalar progression:
iter 3 (v0 prompt, 14 exemplars) → 0.842
iter 4 (+rules 13-23) → 0.951
iter 5 (+rules 24-25) → 0.988
iter 6 (+rule 26, rule 12 refined) → 1.000 canary 1.000
New SYSTEM_PROMPT rules:
13. Drop chapter page range from bibliography (CMOS 18 change from 17).
14. Use full canonical publisher names — no "U of Chicago Press" etc.
15. Do not comma-invert non-Western family-first names (Liu Xinwu,
Murakami Haruki).
16. Author threshold: up to 6 listed; 7+ → first 3 + "et al." with full
given names when source provides them.
17. Expand abbreviated newspaper names (NYT → New York Times); drop
leading "The" from newspaper/magazine names; use comma between
italicized name and date.
18. E-book format: "Kindle." not "Kindle edition."
19. Database indicator: just the name, not "Accessed via X".
20. Social media: preserve original casing of post content; comma
between Platform and Date.
21. Podcast: series italicized, episode in quotes, preserve
Season/episode/duration.
22. Video / TED Talk: preserve venue, date, Video label, duration, URL.
23. URLs preserved verbatim including "www." subdomain when present.
24. CMOS 9.61 inclusive-number elision for page ranges: 1818–59 not
1818–1859; 101–8; 1100–1113; 1496–1504.
25. Preserve terminal punctuation (? !) inside titles.
26. Edition indicators abbreviated: "2nd ed." not "Second edition".
Also scoped rule 12 (date qualifier preservation) to web-page sources
only — podcasts and videos use bare dates, so "Released September 13,
2022" should emit as just "September 13, 2022".
Also refined three messy inputs (podcast, social media, video) to
include "www." in the URL, and the snyder messy input to explicitly
list 7 authors so the et-al threshold is unambiguous to the formatter.
cmos — Chicago Manual of Style 18 bibliography reformatter
A Python tool that reformats the bibliography section of an English-language markdown draft to CMOS 18th edition, notes-and-bibliography form.
Accuracy-first, iterative, built with a karpathy/autoresearch-style dev loop.
See program.md for the goal specification and
/home/claudecode1/.claude/plans/pure-mixing-yao.md for the implementation plan.
Quick start
uv sync
uv run pytest
uv run cmos format path/to/draft.md > out.md
Layout
src/cmos/formatter.py— the iterable artifact (edited every loop iteration).src/cmos/parser.py— extracts the bibliography section from a draft.src/cmos/linter.py— deterministic CMOS 18 rule checks (versioned).src/cmos/cli.py—cmos formatentry point.harness/score.py,harness/diff.py— frozen scoring.exemplars/— TOML test corpus.tests/— pytest suite (linter, parser, formatter, cli).rough_drafts/— user-supplied messy drafts for ad-hoc iteration.logs/— per-run scores, model ids, linter version hashes.
Languages
Python
100%