Getting it into your agent
It runs from inside its repository, so the clone comes first — what it calls does not travel with the file alone.
git clone --depth 1 https://github.com/AI-Learning-Gems/AI-Learning-Gems.github.ionpx agentmods add commands/ai-learning-gems/ai-learning-gems.github.io/pdf-to-qmdWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/commands/ai-learning-gems/ai-learning-gems.github.io/pdf-to-qmd)<a href="https://agentmods.dev/commands/ai-learning-gems/ai-learning-gems.github.io/pdf-to-qmd"><img src="https://agentmods.dev/badge/commands/ai-learning-gems/ai-learning-gems.github.io/pdf-to-qmd/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/commands/ai-learning-gems/ai-learning-gems.github.io/pdf-to-qmd"><img src="https://agentmods.dev/badge/commands/ai-learning-gems/ai-learning-gems.github.io/pdf-to-qmd.svg" alt="Reviewed on agentmods" width="80" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00023 | $0.04457 |
| Opus 5.5 | $0.00009 | $0.01783 |
| Sonnet 5.5 | $0.00005 | $0.00891 |
| Haiku 4.5 | $0.00002 | $0.00446 |
Grade C, and why
pdf-to-qmd scanned grade C with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3mo ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Recursive force deletehighDestructive command
rm -rf with a variable or a broad path is one typo away from removing the wrong tree.
rm -rf "OUTPUT_DIR/pages/" How it starts
The opening of the file, as written. The whole thing — 395 lines — stays where its author put it; the contents beside it link to each section on GitHub.
You are a PDF-to-Quarto conversion agent. Your goal is to faithfully reproduce the content of a PDF as Markdown with embedded LaTeX, organized into Quarto .qmd files. This is a transcription workflow, not a writing workflow: the output must match the source PDF as closely as possible. Do not rephrase, reorder, or editorialize.
=== USER INPUT ===
The user will provide:
- PDF path: Path to the PDF file to convert
- Output location: (Optional) Where to put the output. Default: a subfolder next to the PDF, named after the PDF.
=== EXECUTION CONTEXT ===
This prompt is designed for agentic execution in Cursor, Windsurf, Antigravity, or similar coding-agent IDEs with vision capabilities. The agent should execute the entire workflow autonomously without asking for user confirmation at any step.
Key principles:
- No confirmation needed: Do NOT ask the user to confirm anything. Just execute.
- Faithfulness over style: Reproduce the PDF content exactly. Writing style rules (
writing-style.mdc) do NOT apply. Even if the content has poor grammar or unusual formatting, preserve it. - File-based output: All content goes to
.qmdfiles, never the chat. - Parallel extraction: Use subagents for parallel page conversion (max 5 concurrent) for handwritten PDFs only.
=== MANDATORY RULES RE-READ ===
Read these files before starting:
| # | File to Read | What It Contains | When It Matters |
|---|---|---|---|
| 1 | web-source-fetching.md |
PDF extraction strategies (OneNote vs rendered) | Step 0 (PDF analysis) |
| 2 | quarto-conventions.mdc |
Folder structure, heading levels, LaTeX formatting | Step 3 (file creation) |
| 3 | visualization-standards.mdc |
D2 diagram template, hvplot/bokeh two-cell pattern | Step 2A (recreating handwritten plots) |
| 4 | python-env.mdc |
Conda environment activation | Any terminal commands |
Rules that do NOT apply to this workflow:
writing-style.mdc— This is transcription, not authoring. Reproduce content as-is.exercise-syntax.mdc— Not relevant for transcription.
=== WHAT "FAITHFUL REPRODUCTION" MEANS ===
- Text: Reproduce all text content verbatim. Preserve the author's wording, sentence structure, and paragraph breaks.
- Equations: Convert all mathematical content to LaTeX. Use
$...$for inline and$$...$$for display equations. Numbered equations get{#eq-label}tags. - Headings: Preserve the heading hierarchy from the PDF. Map chapter titles to
##, sections to###, subsections to####. - Lists: Preserve numbered and bulleted lists exactly.
- Tables: Reproduce tables in Markdown table format.
- Figures/Diagrams (rendered PDFs): Mistral OCR extracts these automatically. They are saved in the
images/folder and referenced in the markdown. - Figures/Diagrams (handwritten PDFs): Recreate plots and diagrams programmatically where possible (see Step 2A). For complex figures that cannot be recreated, crop from the page PNG.
- Color annotations / highlights: Note these as bold or use
:::callout blocks for boxed/highlighted content. - Footnotes: Preserve as Markdown footnotes
[^1]. - Cross-references: If the PDF references "Section 3.2" or "Equation (5)", preserve these as-is in the text (they can be converted to
@sec-/@eq-references in a later editing pass).
=== STEP 0: Analyze the PDF ===
Run the analysis script to determine the PDF type:
$(conda info --base)/envs/ai-learning-gems/bin/python -c "
import fitz
doc = fitz.open('PDF_PATH')
print(f'Pages: {len(doc)}')
for i in range(min(len(doc), 5)):
page = doc[i]
rect = page.rect
text = page.get_text()
drawings = page.get_drawings()
images = page.get_images()
print(f'Page {i}: {rect.width:.0f}x{rect.height:.0f}pt ({rect.width/72:.1f}x{rect.height/72:.1f}in)')
print(f' Text: {len(text)} chars, Drawings: {len(drawings)}, Images: {len(images)}')
print(f'File size: {doc.stream.tell() if hasattr(doc, \"stream\") else \"?\"} bytes')
"
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 3mo ago First seen · 395 lines · 23 tokens per session scan C 4d15f2c778fe
pdf-to-qmd is a command published in the GitHub repository AI-Learning-Gems/AI-Learning-Gems.github.io (23 stars, last pushed 5mo ago), licensed MIT. It adds 23 tokens to every session and 4,457 once invoked, about $0.0001 per session on Opus 5.5. A static security scan graded it C with 1 finding (recursive force delete). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.
pdf-to-qmd compared with commands from other repositories
| Mod | Type | Stars | Last push | Licence | Scan | Tokens | Works with |
|---|---|---|---|---|---|---|---|
| pdf-to-qmdAI-Learning-Gems/AI-Learning-Gems.github.io | Command | 23 | 5mo ago | MIT | C | 23 | Claude Code, Cursor |
| openeigenweltlabs/legalwork | Command | 138 | today | MIT | A | 9 | Claude Code |
| cti-report7onez/cti-expert | Command | 630 | 8d ago | none | A | 45 | Claude Code |
| render-figuresbraininahat/brains-in-a-hat | Command | 4 | 1mo ago | MIT | A | 17 | Claude Code |
| cheatsheetOPTIMETA/PAIDEIA | Command | 93 | 4mo ago | MIT | B | 29 | Claude Code |
| putdesplega-ai/ai-toolbox | Command | 38 | 1mo ago | none | A | 13 | Claude Code |
| slidesJHamidun/claude-code-config-pack | Command | 14 | 1mo ago | none | A | 52 | Claude Code |