name: citation-resolver description: Manual-first agent workflow for messy DOCX citation repair. Use when citations are dirty/inconsistent and require preflight inspection + cleanup checklist before script rebuild.
Citation Resolver Skill
Operating Mode
Default is manual-first, not script-first.
The agent must build and execute a cleanup checklist before running the integrator.
Read-First Contract
Before any script execution, the agent must:
- Read document internals (
document.xml, plus comments/notes XML when present). - Summarize what was found (citation patterns, likely issues, missing/ambiguous parts).
- Present a working plan/todo list for this specific file.
- Only then run automation.
Phase 1: Manual Preflight Checklist
- Inspect
word/document.xmltext flow for citation styles and anomalies. - Inspect
word/comments.xml(if present) for citation-related notes. - Inspect
word/footnotes.xmlandword/endnotes.xml(if present) for citation markers. - Identify mixed citation forms:
- numeric in
(),[], superscript - malformed ranges/lists
- orphan numbers with no reference entry
- numeric in
- Identify identifier fragments in text/notes/comments:
- DOI variants (
doi:,https://doi.org/..., quoted/trailing punctuation) - PMID forms (
PMID: 12345678)
- DOI variants (
- Inspect references section detection readiness:
- heading candidates (
References,Bibliography, etc.) - numbered block continuity quality
- heading candidates (
- Produce a todo list with explicit actions and expected impact.
- Only proceed when preflight todo status is acceptable.
Phase 2: Script Rebuild (After Checklist)
- Run
docx_zotero_integrator.pyon input.docx. - Use preferred pattern for first attempt (
auto-safedefault), allow managed retries. - Validate quality gates (
fields_ok,bibliography_ok,doc_prefs_ok,unmatched_count). - Optionally run Word field update.
- Return final output path + JSON report + concise change log.
Primary Command
python docx_zotero_integrator.py "/path/to/file.docx"
Agent Todo Template
Use this checklist structure in responses before script execution:
[ ] Detect citation pattern inventory
[ ] Review comments/footnotes/endnotes for citation hints
[ ] Extract DOI/PMID fragments from manuscript text
[ ] Validate reference-section anchor and numbered continuity
[ ] Flag ambiguous citations for manual decision
[ ] Confirm script run settings (pattern preference, word update yes/no)