Anki Exam Forge
Turn scattered past exam papers, scanned PDFs, and lecture slides into an evolving, zero-duplicate Anki .apkg study system built around memory retrievability and exam ROI.
Dual Execution Paths (MCP or Standalone CLI)
Use whichever interface is available in your agent environment:
-
MCP Tools (when installed as an Antigravity plugin or MCP server):
anki_doctor— check Python, SQLite, OOXML (.pptx/.docx), and PDF extraction readiness.anki_extract_source— extract text, speaker notes, rendered PNG pages (for scanned PDFs), and embedded images from.pdf,.pptx,.docx,.md/.txt, or image folders.anki_analyze_frequency— group exam items by canonicalconcept_key, count exact appearances deterministically, emit a Markdown frequency report, and produce a prioritizeddeck.json.anki_validate_deck— check prompt/answer presence,{{c1::...}}cloze syntax,>= 2MCQ options, uniquecard_id/guid, and media file paths.anki_build_apkg— compiledeck.jsoninto a deterministic-GUID.apkg(ExamForge-Basic,ExamForge-MCQ,ExamForge-Cloze) ordered by exam frequency.anki_inspect_apkg— inspect an existing.apkg(preferringcollection.anki21), extract bundled media, and filter notes by tag (leech), deck, query, orminLapses.anki_diff_supplement— diff lecture/PPT candidate cards against an existingdeck.jsonor.apkg, keeping all original GUIDs intact and appending only genuinely new cards.anki_apply_mnemonics— write structured memory-technique mnemonics back into matching cards while keeping original GUIDs for zero-progress-loss Anki updates.
-
Standalone CLI (when installed via
--skill-onlyor running without MCP):- Pure Python (works directly from the skill folder, zero pip requirements for core
.apkg/.pptx/.docxflow):python <skill-or-plugin-dir>/engine/cli.py <doctor|extract|freq|validate|build|inspect|diff|mnemonic> ... - Node.js wrapper (when running from the plugin repo):
node <plugin-dir>/server/cli.mjs <doctor|extract|freq|validate|build|inspect|diff|mnemonic> ...
- Pure Python (works directly from the skill folder, zero pip requirements for core
4-Phase Closed-Loop Workflow
Phase 1: Past-Exam Ingestion & Frequency Analysis
- Run
anki_doctor(orcli.py doctor) to confirm PDF/Python readiness. - Extract sources in manageable windows: call
anki_extract_sourceon past-exam PDFs (fromPage: 1, maxPages: 15..20, renderMode: "auto"). For scanned/image-heavy pages, read the generatedpages/page_XXX.pngimages with your multimodal vision capability instead of relying solely on sparse OCR text. Continue withnext_from_pageuntil all papers are covered. - Normalize each exam question into structured JSON items containing:
concept_key: concise canonical concept name so differently worded questions testing the same underlying fact merge cleanly (e.g.,"桡神经损伤临床表现","胃食管反流病一线用药").card_type:"basic"|"mcq"|"cloze".front/stem/text,options(formcq),back/answer,explanation,topic,source_years(e.g.,["2021", "2023"]), andmedia(any diagram filenames).
- Never count frequencies in your head: pass the extracted items array/file to
anki_analyze_frequency(choosesubjectPreset:clinical-medicine,postgrad-exam,law-exam, orgeneral) to generate the deterministic Markdown frequency report and prioritizeddeck.json.
Phase 2: Card Authoring, Validation & .apkg Packaging
- Before finalizing cards, consult:
- Card Design Guide — atomicity, cloze vs MCQ vs basic selection, and diagram hygiene.
- Subject Presets — field conventions and tag hierarchies for clinical medicine, postgraduate/licensing exams, and STEM/humanities.
- Validate before packaging: run
anki_validate_deck(passmediaDirif cards reference extracted figures). Fix any blocking errors (invalid_cloze,missing_media,duplicate_card_id, etc.) and consider splitting verbose cards flagged by warnings. - Build the
.apkg: runanki_build_apkg(subdeckStrategy: "tier"places cards into01-高频必背,02-中频常考,03-真题常规,04-课件补充, sorted so the highest-frequency past-exam cards surface first in Anki'sduequeue).
Phase 3: Lecture PPT / Notes Incremental Supplement (Exam Score Booster)
Once past-exam high-yield cards form the passing baseline, use lecture slides (.pptx, .docx, .pdf) to fill remaining syllabus gaps without overwriting or duplicating existing cards:
- Extract the lecture deck with
anki_extract_source(extractImages: truepulls embedded diagrams/tables intomedia/). - Draft candidate cards from the new slides/notes.
- Run
anki_diff_supplementagainst the existingdeck.jsonor exported.apkg:- Exact duplicates are skipped automatically.
- Near duplicates (
similarity >= nearThreshold) are surfaced for review; passmergeNear: truewhen slide details enrich an existing past-exam card. - New concepts are assigned
source::ppt-supplementand placed into04-课件补充, while every existing card keeps its exact originalguid.
- Re-validate and rebuild
.apkg(anki_build_apkg). Re-importing into Anki updates modified notes in place without losing review history.
Phase 4: Stuck / Leech Card Mnemonic Repair
When a user exports their active Anki deck (with scheduling info, or check "Support older Anki versions / 兼容旧版 Anki" when exporting .apkg) or points to stubborn items:
- Run
anki_inspect_apkgwithtagFilter: "leech"and/orminLapses: 3(orqueryfor specific keywords) to isolate cards that keep failing recall. - Apply Mnemonic Playbook to craft short, vivid memory hooks (
acronym,rhyme,homophone,mechanism,contrast,visual,loci) specifically targeting why the user confuses that card. - Write the hooks into the
Mnemonicfield viaanki_apply_mnemonics(updateOnly: trueemits a lightweight surgical update.apkgcontaining only patched cards with their exact original GUIDs). - Remind the user: mnemonics solve initial encoding for stubborn items; Anki spaced repetition maintains long-term retrievability — keep reviewing the updated card normally.