/academic-research:word-zotero-track-changesfrom academic-research
Edits existing Word (.docx) manuscripts with tracked changes, preserving Zotero live citation fields and co-authors' pending changes. Operates directly on OOXML with w:ins/w:del markup.
Ships in academic-research. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Edit a co-authored Word manuscript so that every change shows up in Word as an ordinary tracked change by one named author, Zotero citations stay live fields, and co-authors' pending changes survive untouched.
Word stores a .docx as zipped XML (OOXML). The tooling here edits
word/document.xml directly with w:ins / w:del tracked-change
markup. Generic "edit the XML" approaches break on run merging, on
nested insertions and on Zotero fields; the pitfalls below each caused a
real failure.
grounded-citations — every citation you insert follows its
rules: consult the source first; it must support the claim in context.zotero-operations / the Zotero MCP tools — item keys, and the
item's Zotero JSON (format="json") for items not yet cited in the
document.critic-loop — after an editing round, run the critics on the
accepted-text preview check_docx.py --preview writes. Their fixes
come back through this skill.docx skill (optional) — check_docx.py runs its
validate.py when installed under ~/.claude, verifying every change
is tracked under the author. Without it that check is skipped with a
warning. Use that skill for new documents, comments and PDF rendering.Steps 2, 3 and 5 are tools of the plugin's MCP server:
track_changes_unpack, track_changes_inspect, track_changes_check.
In Claude Code their full names start
mcp__plugin_academic-research_academic-research__. Their paths are
project-relative and must stay inside the project. Use a work directory
such as .claude/redline/round1 (WORK below).
$R is ${CLAUDE_PLUGIN_ROOT}/scripts/track_changes:
uv run $R/unpack_docx.py manuscript.docx WORKuv run $R/inspect_docx.py WORK/unpacked/word/document.xml [FROM [TO]] [--fields] [--authors]uv run $R/check_docx.py WORK/unpacked WORK/out.docx --original WORK/00_original.docx --author "…" --preview WORK/preview.mduv run $R/run_edits.py.uv. pandoc is needed for the preview.Pre-flight.
Surname, Given);
track_changes_inspect with authors lists them after step 2.~$ lock file
exists and no co-author has the file open.Snapshot and unpack. track_changes_unpack (docx, workdir)
writes WORK/00_original.docx and WORK/unpacked/. Do not run
run-merging scripts afterwards (see Pitfalls).
Inspect. track_changes_inspect (document_xml =
WORK/unpacked/word/document.xml) lists the paragraphs in its log
file (log_path); read the part you need. Each line is
[index] (style) text, with 0-based indices and {+inserted+},
{-deleted-} and [ZFIELD] marks. fields reports field balance,
Zotero field types and the cited library: zotero.org/groups/<id>
gives the library_id and library_type for Citer. authors
reports tracked-change authors.
Edit. Write an edit script (edits.py) in WORK. Run it from
there with uv run $R/run_edits.py edits.py, which makes the library
importable. Paths in the script resolve against the current
directory:
from redline import Doc
from zotero_fields import Citer
d = Doc('unpacked/word/document.xml', author='Surname, Given')
citer = Citer(open(d.path, encoding='utf8').read(),
library_id='<group or user id>', library_type='groups')
p = d.find_para('unique visible text')
d.replace_text(p, 'old wording', [
'new wording ',
citer.cite('(Author, 2020, p. 5)', citer.item('ITEMKEY', locator='5')),
'.'])
d.save()
| Method | Notes |
|---|---|
find_para(text) | Matches visible (accepted) text. |
replace_text(p, old, pieces) | old must not cross a field boundary; [] deletes. |
insert_text_after(p, after, pieces) | Skips past a field the anchor lands in. |
insert_paragraph_after(anchor, pieces) | Paragraph mark is tracked too. |
delete_paragraph(p) | Tracked deletion of content and mark. |
move_paragraph(src, after) | Delete + insert; renews copied citationIDs. |
delete_field(p, result_text) | Removes a whole citation field. |
find_para, old, after) match the visible text,
citation results like (Smith, 2020) included. find_para raises
on several matches — lengthen the text or pass occurrence=k
(1-based); the text methods take occurrence= too.'text', ('i', 'italic'), or a citer.cite(...) result.cite is placeholder text that Zotero's
refresh replaces; write it in the style of the document's existing
citations, including the locator form (p. 7).
For items not yet cited in the document, first call
citer.add_item(key, zotero_json_data). Take creators from the JSON:
the markdown view of an item lists editors as authors.Check. track_changes_check (unpacked, out =
WORK/out.docx, original = WORK/00_original.docx, author,
preview = WORK/preview.md) does four things:
out;citationIDs;Read the preview around every edit. ok: false means stop and fix.
The cause is one of these:
validator_new_errors).Errors the original shares are counted in validator_errors_ignored.
Save in stages (skip if the user wants the output kept separate).
out.docx over the manuscript only after confirming the file
on disk still equals the last snapshot; a co-author may have saved.Hand over. Tell the user to run Zotero's Document Preferences / Refresh on a copy first, after fixing any Zotero metadata problems (refresh rewrites citations from the library).
w:del inside their w:ins;
their deletions are left alone.empirical-integrity.| Symptom | Cause | What the library does |
|---|---|---|
| Citation deleted or broken by a text edit | Run merging fused w:t, w:fldChar, w:instrText into one run | normalize_runs splits such runs before every edit; never merge runs |
| New text lands after the rest of a co-author's sentence | w:ins cannot nest | Splits their w:ins so text stays in reading order |
| Own fresh insertion shows as deleted + reinserted | — | Same author and timestamp ⇒ edited in place; earlier own insertions get a visible deletion |
| Schema validation fails on a deleted paragraph | w:del before w:ins in w:pPr/w:rPr | Inserts w:del after w:ins |
| Inserted text becomes part of a citation | Anchor ended inside a field result | Moves the anchor past the field's end run |
| Preview shows empty headings/bullets or drops a paragraph | Pandoc artefact for deleted paragraphs and for runs mixing text and field characters | Nothing to fix — check the XML or Word before "fixing" |
| Validator reports unreferenced parts etc. | Already present in the original | check_docx.py validates the original and ignores errors it shares |
replace_text cannot span a field boundary: delete_field, then
insert a new field.move_paragraph is delete + insert, not Word's native move tracking.docx skill's comment tooling.references/zotero-fields.md for the field structure and
what is verified versus assumed.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub mronkko/claude-academic-research --plugin academic-research14 skills in this plugin
/academic-styleUse when drafting or editing academic prose — topic sentences, paragraph structure, APA-style citations, voice, tense, hedging, term definitions — in a .qmd / .Rmd / .md / .tex file of an academic-research project. Trigger phrases "write this section", "edit this paragraph", "tighten the prose", "APA style". Do NOT use to revise a finished draft — use `critic-loop`. Do NOT use for citation or number accuracy — use `grounded-citations` / `empirical-integrity` / `fact-check`./cluster-screeningUse when screening or coding papers on a GPU cluster or batch scheduler instead of an LLM API — emitting a request manifest, submitting a SLURM job, collecting responses, applying them to Zotero. Trigger phrases "screen on the cluster", "run this on SLURM", "sbatch", "GPU node", "emit a manifest", "apply the responses", "batch screening". Do NOT use for ordinary API-based screening — use `systematic-review`./critic-loopOther plugins' skills for the same job