{
  "markdown": "# IMRecDeck\n\nAn internal-medicine recommendation deck — a pipeline that turns a curated catalog of clinical practice guidelines into an importable Anki deck.\n\n🌐 **Browse the manifest:** <https://cfu288.github.io/im-rec-deck/>\n\n> [!NOTE]\n> This repo is an experiment to see if I can utilize AI agents to help me stay up to date on medical guidelines by automatically parsing them and building out an Anki deck. I don't pretend to have manually curated any of this. This blurb here is probably the only thing written by a human in this repo. Use at your own risk. Copyrighted material is not included in this repo - you'll need to source that yourself.\n\n## What it produces\n\n`build/im-rec-deck.apkg` — a self-contained Anki package containing:\n\n- A custom `GuidelinesCloze` notetype (7 fields: Text, Back Extra, Source, System, Topic, Society, Year)\n- Cloze cards extracted from each enriched guideline body\n- Hierarchical deck tree (`IMRecDeck::<System>::<Topic> (<Year> <Society>)`) — tap-into one guideline at a time on mobile, study the parent for the unified queue\n- Namespaced tags under a single root: `im-rec-deck::system::<slug>`, `im-rec-deck::topic::<slug>`, `im-rec-deck::society::<slug>`, `im-rec-deck::year::<n>`, `im-rec-deck::status::superseded`, `im-rec-deck::high-yield`\n- A styled card template\n- Stable GUIDs derived from the manifest key, so re-importing future regenerations updates existing notes in place (preserves FSRS review history)\n\nImport via Anki → `File → Import` → select `build/im-rec-deck.apkg`.\n\n## Pipeline at a glance\n\n```mermaid\nflowchart TD\n    manifest[\"<b>manifest.yaml</b><br/><i>hand-curated, source of truth</i>\"]\n    sources[\"<b>sources/**/*.{pdf,html,epub}</b><br/><i>raw guideline documents</i>\"]\n    validate[\"validate_manifest.py\"]\n    parse[\"parse_sources.py<br/><i>epub &gt; html &gt; pdf<br/>(PDF → LlamaParse, PAID)</i>\"]\n    sidecars[\"<b>sources/**/*.md</b><br/><i>parsed sidecars w/ provenance markers</i>\"]\n    build_refs[\"build_references.py\"]\n    skeleton[\"<b>references/guidelines/**</b><br/><i>OKF skeleton concept files</i>\"]\n    enrich[\"enrich_references.py<br/><i>Anthropic batch, PAID<br/>auto-resumes prior batches</i>\"]\n    enriched[\"<b>references/guidelines/**</b><br/><i>enriched bodies + _source_hash</i>\"]\n    gen_cards[\"generate_cards.py<br/><i>Anthropic batch, PAID</i>\"]\n    cards_jsonl[\"<b>build/cards.jsonl</b>\"]\n    build_apkg[\"build_apkg.py\"]\n    apkg[\"<b>build/im-rec-deck.apkg</b><br/>📥 IMPORT INTO ANKI\"]\n\n    manifest --> validate\n    manifest --> build_refs\n    sources --> parse\n    parse --> sidecars\n    sidecars --> build_refs\n    build_refs --> skeleton\n    skeleton --> enrich\n    enrich --> enriched\n    enriched --> gen_cards\n    gen_cards --> cards_jsonl\n    cards_jsonl --> build_apkg\n    build_apkg --> apkg\n\n    classDef paid stroke:#d97706,stroke-width:2px\n    class parse,enrich,gen_cards paid\n    classDef artifact fill:#f3f4f6,stroke:#6b7280\n    class manifest,sources,sidecars,skeleton,enriched,cards_jsonl,apkg artifact\n```\n\n## Quickstart\n\n```bash\n# One-time: drop guideline PDFs/EPUBs/HTMLs into sources/<system>/<topic>/.\n# Add corresponding entries to manifest.yaml.\n\n# Local-only, idempotent — run any time:\njust all-local             # validate, parse, build skeleton, report, repackage apkg\n                           # NOTE: `parse` may hit LlamaParse (paid) for PDF sources\n                           # that have no EPUB/HTML alternative — see `just parse`\n                           # for details.\n\n# Explicit Anthropic-paid steps — run when you mean to spend:\njust enrich                # ~$10 for a full run on ~100 concepts\njust cards                 # ~$1.50 for ~1500 cards\njust apkg                  # re-package — instant, free\n\n# Then import build/im-rec-deck.apkg in Anki.\n```\n\n`just` (run with no args) lists every target with its docstring.\n\n## Key invariants\n\n1. **`manifest.yaml` is the only thing you edit by hand** (plus dropping source documents into `sources/`).\n1. **`references/`, `build/`, and any `.md` under `sources/`** are 100% generated. Don't edit them — they'll get overwritten.\n1. **Idempotency at every step.** Re-running anything is safe and cheap if nothing changed; only diffs trigger API spend.\n1. **Cards have stable GUIDs.** Re-importing a regenerated `.apkg` updates existing notes in place; Anki preserves your review history.\n1. **`high_yield: true` on a topic** drives the `high-yield` card tag AND the auto-derived study guide. Single source of truth.\n\n## Repo layout\n\n```\nmanifest.yaml                 # the catalog — source of truth\nsources/                      # raw guideline documents + parsed .md sidecars\nreferences/guidelines/        # generated OKF bundle (skeleton + enriched bodies)\nbuild/                        # generated artifacts (gitignored; .apkg, .jsonl, state files)\nscripts/                      # the pipeline (uv-runnable)\nspec/                         # conventions + architecture review + cloze rules\n.claude/                      # hooks (manifest validator, mdformat) + skills (parse-sources)\nJustfile                      # task runner — `just` to list targets\n```\n\n## Where to read more\n\n- `spec/architecture-review.md` — full data flow + script inventory + problem list\n- `spec/conventions.md` — manifest schema conventions, high-yield flag semantics, format preference\n- `spec/anki-apkg-pipeline.md` — apkg packaging details, GUID model, custom notetype design\n- `spec/anki-cloze-cards-key-concepts.md` — cloze-card writing principles (Wozniak + AnKing)\n- `manifest.yaml` (top comments) — manifest schema reference\n",
  "bytes": 5597,
  "sha": "bf36941530a341eea760844b112d39981d783109b08ab82ada0811e5b65e2b13",
  "repo_slug": "cfu288/im-rec-deck",
  "fonte": "repo",
  "truncated": false,
  "api": "https://agentalog.com/api/listings/okf_cfu288_im_rec_deck_references_guidelines_54701a65/readme"
}