latex-diff
Skill150 starsChanged 9 days agoMITView on GitHub
Compare two LaTeX files, project directories, or Git revisions and produce human-readable plus machine-readable severity-graded semantic changes. Use when determining what changed between manuscript versions or preparing a revision audit bundle. Not for proofreading one version; use $proofread.
In this repository89 other files it gives its agents.
- AGENTS.mdAGENTS.md
- docs/agents.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- beamer-deckSkill
- bib-coverageSkill
- bib-filterSkill
- bib-parseSkill
- brief-compliance-checkSkill
- camera-readySkill
- causal-designSkill
- checkpointSkill
- code-archaeologySkill
- compile-knowledgeSkill
- computational-experimentsSkill
- cross-language-checkSkill
- data-analysisSkill
- devils-advocateSkill
- docs-consistencySkill
- docxSkill
- experiment-designSkill
- grill-meSkill
- handoffSkill
- ideasSkill
- init-project-courseSkill
- init-project-lightSkill
- init-project-orchestrationSkill
- init-projectSkill
- insights-deckSkill
- interview-meSkill
- knowledge-lintSkill
- latex-health-checkSkill
- latex-polishSkill
- latex-postersSkill
- latex-scaffoldSkill
- latexSkill
- latex-templateSkill
- lean-checkSkill
- math-proofSkill
- mcp-builderSkill
- method-auditSkill
- multi-perspectiveSkill
- numerical-checkSkill
- pdfSkill
- pipeline-manifestSkill
- playwright-cliSkill
- postmortemSkill
- pre-commit-auditSkill
- pre-submission-reportSkill
- project-deckSkill
- project-safetySkill
- proof-readabilitySkill
- proofreadSkill
- python-envSkill
- quarto-deckSkill
- reorgSkill
- replication-auditSkill
- replication-packageSkill
- retarget-journalSkill
- review-clusterSkill
- review-responseSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
4 rules. About 0 are common, 2 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 78
Use a flat, same-stem bundle: Put files directly in the producer directory with a YYYY-MM-DD-HHMM basename.
- Distinctive: line 128
If the user asks to generate, create, save, or deliver a diff inside a research project, resolve the project root and paper scope, then …
- Distinctive: line 142
Add same-stem companions only when useful:
- Very specific: line 162
If the user wanted a changelog or response-letter "summary of changes", phrase the semantic changes as prose bullets — but do not edit the …
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
LaTeX Diff
Compare two versions of a LaTeX document and report what actually changed — text, equations, citations, labels/refs, section titles, macros, environments, file add/remove, and moves — each graded by severity. Wraps the
latexdiff-agentCLI (packages/latex-diff). Member of thelatex-*source/build family.
When to Use
- "What changed between these two versions of the paper?"
- Building an R&R "summary of changes" or a preprint vN→vN+1 changelog
- Focusing a re-review on the changes that matter (semantic-impact only)
- Sanity-checking a co-author's edits before merging
When NOT to Use
- Compiling a document →
latex - Prose quality / proofreading →
proofread - A raw line diff is enough →
git diff(this skill is LaTeX-aware: it knows a changed\citekey from a reflowed paragraph)
What it produces
Two views from the same canonical diff:
- Human summary — grouped by file and section, every line carrying a change
id, a severity badge, and afile:linelocation. - Machine-readable JSON — severity-graded
ChangeRecords.semantic_impact: trueflags the changes a reviewer should actually read.
For a persistent run inside a research project, these are the mandatory core files. Use one timestamp-only basename for the whole run:
reviews/<scope>/<check>/<YYYY-MM-DD-HHMM>.md
reviews/<scope>/<check>/<YYYY-MM-DD-HHMM>.changes.jsonHere and below, <check> is this skill's frontmatter name.
Co-locate applicable typed companions with the same basename:
.full.json— unfiltered machine-readable inventory.changes.md— full or raw human-readable inventory when the primary report is a shorter curated summary.diff.texand.diff.pdf— rendered manuscript comparison.source.patch— exact source patch for source-only changes such as citation rekeys
The core pair is stable; companions vary with the comparison. Do not replace the core pair with a PDF, patch, or run-specific directory.
Severity ladder: trivial < low < medium < high < critical. Change types:
formatting_only, text, equation, citation, label_ref, environment,
section_title, macro_definition, file_add, file_remove, move, other.
Full flag reference: packages/latex-diff/README.md.
Critical rules
- Read-only. This skill never edits the paper. It reports; the human (or a downstream skill) decides what to do.
paper/is LaTeX-only — when extracting git revisions to temp dirs, write temp copies under/tmp, never inside an Overleaf-syncedpaper/.- Clean up any
git worktree/ temp dirs you create. - Route generated artifacts by provenance. In a research project, persist
them under
reviews/<scope>/<check>/, where<scope>is the target paper slug or_projectand<check>is this skill's frontmattername. Never place generated diff output undercorrespondence/; genuine reviewer/editor/co-author material may be an input, but it remains external correspondence. - Use a flat, same-stem bundle. Put files directly in the producer
directory with a
YYYY-MM-DD-HHMMbasename. Do not create a timestamped run subdirectory and do not useREADME.md,summary.md, or bespoke basenames.
Protocol
1. Resolve the two inputs
| Input form | How to run |
| Two files | latexdiff-agent OLD.tex NEW.tex … |
Two project dirs (multi-file, \input/\include-aware) | latexdiff-agent OLD_DIR/ NEW_DIR/ … |
| Two git revisions of one file | extract each, then diff (below) |
| Two git revisions of a whole project | git worktree each, then diff dirs (below) |
Single file across revisions:
git show <REV_OLD>:<path/to/main.tex> > /tmp/ld-old.tex
git show <REV_NEW>:<path/to/main.tex> > /tmp/ld-new.tex # omit for working tree
latexdiff-agent /tmp/ld-old.tex /tmp/ld-new.tex --summary -Whole project across revisions (multi-file):
git worktree add /tmp/ld-old <REV_OLD>
git worktree add /tmp/ld-new <REV_NEW>
latexdiff-agent /tmp/ld-old/<paper-dir> /tmp/ld-new/<paper-dir> --summary - --compact --semantic-only
git worktree remove /tmp/ld-old && git worktree remove /tmp/ld-newResolve revisions with
git log --oneline -- <path>when the user names a round ("since submission", "v1") rather than a SHA. If ambiguous, ask.
2. Run the diff
Get both views in one pass — the human summary to read aloud, and the semantic-only JSON to reason over:
latexdiff-agent <OLD> <NEW> --summary - # human view
latexdiff-agent <OLD> <NEW> --compact --semantic-only # the changes that matterUseful filters (compose freely): --min-severity high, --type citation,
--section Methods, --file sections/intro.tex.
3. Persist a requested diff bundle
If the user asks to generate, create, save, or deliver a diff inside a research project, resolve the project root and paper scope, then create the canonical destination. A conversational request to explain changes without saving files may remain stdout-only.
STAMP=$(date '+%Y-%m-%d-%H%M')
OUT="<project-root>/reviews/<scope>/<check>"
BASE="$OUT/$STAMP"
mkdir -p "$OUT"
latexdiff-agent <OLD> <NEW> --summary "$BASE.md"
latexdiff-agent <OLD> <NEW> --compact --semantic-only --json "$BASE.changes.json"Add same-stem companions only when useful:
latexdiff-agent <OLD> <NEW> --json "$BASE.full.json"
latexdiff-agent <OLD> <NEW> --latexdiff "$BASE.diff.tex"
git diff <OLD> <NEW> > "$BASE.source.patch" # source-level comparison onlyCompile .diff.tex through the latex workflow when the user requests a visual
diff; keep intermediate build artifacts in out/ and copy only the final
.diff.pdf beside the bundle. Record the two stable comparison inputs in the
Markdown report; never expose disposable /tmp paths as the authoritative
baseline/current identifiers.
4. Report
- Lead with the summary line: total changes, semantic-impact count, impact score.
- List the semantic-impact changes grouped by section, each with its
file:line, type, and severity. These are the ones worth attention. - Note (don't dump) the trivial/formatting/move changes as a count.
- If the user wanted a changelog or response-letter "summary of changes", phrase
the semantic changes as prose bullets — but do not edit the manuscript
(
rules/manuscript-edit-budget.md); hand the bullets back for them to place.
Cross-References
| Skill | Relationship |
latex | Compiles documents; this skill compares versions of them |
review-artefact-routing | Governs the scoped producer route and same-stem companion contract |
strategic-revision --external | Consumes this as evidence for the R&R "summary of changes"; it does not turn internal findings into venue claims |
preprint | Consumes this for a vN→vN+1 changelog on version bump |
paper-critic / referee2-reviewer | Can take --semantic-only JSON to focus a re-review on what changed |
packages/latex-diff/README.md | Full CLI flags, schema, and design notes |
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

