---
name: formula-quality
description: Plan and review formula extraction quality for PDFtoMD. Use when Codex needs Nougat handoff rules, inline/block formula classification, LaTeX delimiter checks, equation numbering, reference anchors, or Marker fallback behavior.
---

# Formula Quality

## Workflow

1. Read `AGENTS.md`, `docs/CONVERSION_POLICY.md`, `docs/TOOLCHAIN.md`, and `docs/ADR.md`.
2. Identify formula candidates from Marker equation blocks or mathematical text patterns.
3. Classify formulas as inline or block based on layout context.
4. Validate:
   - `$ ... $` and `$$ ... $$` balance
   - `\begin{...}` / `\end{...}` pairs
   - formula numbering
   - body references such as `Eq. (3)` or Korean equation references
5. Use Marker source text as fallback when Nougat fails.

## Guardrails

- Do not pass whole documents through Nougat as the primary parser.
- Do not discard formula text on parse failure.
- Do not rewrite references as links unless the target confidence is sufficient.
