check-latex
Produce the evidence block the human adjudicator needs to approve or reject a notes.tex (or any notes-tier .tex) change before push/merge. Given a .tex file, a branch, or a diff, it (a) verifies the document COMPILES — degrading gracefully to "toolchain unavailable" when no TeX build tool is present, never faking a compile result; (b) summarizes the SEMANTIC diff (which sections, theorems, and equations were touched); (c) emits the approve/reject evidence (files touched, compile status, semantic summary, exact diff pointer) as check-latex-report.{json,md}. Trigger on "check-latex X", "screen this .tex", "run the latex gate on this branch", "is this notes.tex diff safe to merge", or whenever a covered .tex edit needs the LaTeX HARD GATE evidence before adjudication happens. This is the runnable artifact the latex-gate (F1b) calls and the he-86wu gate-release consumes. Composes the notes-tier sub-skills check-latex-style, check-citations/clean-citations, and check-labels-and-refs when present.
- License 许可
- GPL-3.0
- 最近更新
- 2026-11-13
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- check-latex
- description
- Produce the evidence block the human adjudicator needs to approve or reject a notes.tex (or any notes-tier .tex) change before push/merge. Given a .tex file, a branch, or a diff, it (a) verifies the document COMPILES — degrading gracefully to "toolchain unavailable" when no TeX build tool is present, never faking a compile result; (b) summarizes the SEMANTIC diff (which sections, theorems, and equations were touched); (c) emits the approve/reject evidence (files touched, compile status, semantic summary, exact diff pointer) as check-latex-report.{json,md}. Trigger on "check-latex X", "screen this .tex", "run the latex gate on this branch", "is this notes.tex diff safe to merge", or whenever a covered .tex edit needs the LaTeX HARD GATE evidence before adjudication happens. This is the runnable artifact the latex-gate (F1b) calls and the he-86wu gate-release consumes. Composes the notes-tier sub-skills check-latex-style, check-citations/clean-citations, and check-labels-and-refs when present.
02 资源文件 2
- 脚本check-latex.sh12.6 KB
- 脚本scope.py10.6 KB
03 SKILL.md 正文
Canonical copy:
mathcity.check-latexin this mathcity pack. STATUS: PRELIMINARY (DRY-RUN ONLY). Read-only. Writes ONLY under<city-root>/tmp-for-review/<bead>/. NoEdit/Write/git commit/git push/bd update. This skill NEVER approves a diff — it produces evidence for the human adjudicator to approve or reject.
check-latex
The runnable screening artifact behind the LaTeX HARD GATE: any edit to
notes.tex or any main-branch .tex file in the notes-tier of the
differential-valuations, hecke, homog, or jacobi rigs requires the human adjudicator's
explicit approval of the specific diff before it may be pushed or merged.
This skill produces the evidence the human adjudicator needs to make that call. It does not
adjudicate, does not merge, and does not push. Its output is the artifact the
latex-gate formula (F1b) requires and the he-86wu gate-release consumes.
Policy lineage: he-jwmy (LaTeX-gate-policy — canonical charter), he-hsoc
(umbrella spec), he-86wu (gate-release criterion, first instance
polecat/he-d4l), he-cnat (preliminary-skill-first).
When to use
Use whenever a diff touches a covered .tex file (see Scope) and you need
the gate evidence before adjudication happens a push/merge. Also used as the
callee of the latex-gate formula and to release the he-86wu block.
Scope (covered files) — per he-jwmy
A .tex file is covered when any of:
- it is named
notes.texat any depth, OR - it lives under a
latex/notes/tree, OR - it is
\input'd or\include'd by such a file at depth ≤ 2 (the depth-2 cap makes the rule mechanically checkable withgrep -E '\\(input|include)\{' notes-tier.tex).
Out of scope (per he-jwmy): a .tex file satisfying ALL of (a) under
scratch/, tests/, fixtures/, or a path containing tmp/scratch/fixture/test,
AND (b) no \label{} reachable from any notes-tier \ref{}/\eqref{}, AND
(c) not in the depth-2 \input/\include closure. Autogenerated .tex is out
of scope only if the generator is documented AND the file carries a
% AUTOGENERATED marker.
Workflow
- Compile the root document with the first available TeX tool
(latexmk → pdflatex → xelatex → lualatex → tectonic); if none is present,
report
toolchain-unavailableand NEVER fake a compile result. - Select the requested scope, when
--section/--scopeis provided, by numbered heading (2.1or2.1.1),label:<label>, or exact heading title. A root document is expanded through\input/\includeso numbering follows the compiled document; the target file supplies the source range to scan. - Semantic-diff the change: enumerate sections, theorem-class environments, equations, labels, citations, and unfinished-tag deltas touched.
- Emit the evidence block (
files touched · compile status · semantic summary · exact diff pointer) ascheck-latex-report.{json,md}under<city-root>/tmp-for-review/<bead>/for the human adjudicator to approve or reject.
How (invocation)
# From inside the repo containing the .tex (git diff needs a repo):
skills/check-latex/check-latex.sh <tex-file> \
[--root <root.tex>] # document to compile; defaults to <tex-file>
[--section <selector>] # numbered heading, label:<label>, or exact title
[--scope <selector>] # alias for --section
[--base <git-ref>] # merge-base or branch point; default: working-tree vs HEAD
[--out <dir>] # default: <city-root>/tmp-for-review/<bead>/
[--bead <id>] # bead this screening is for; default: unbeaded
For an included chapter, compile the real root while scanning only one subsection:
skills/check-latex/check-latex.sh latex/aws-notes-v1/ch1-groups.tex \
--root latex/aws-notes-v1/main.tex --section 2.1 --bead aws-notes-v1
Use --section 2.1.1 for a subsection, --section label:sec:hyperbolic for
a label, or --section 'Hyperbolic $n$-space' for an exact heading title.
The helper check-latex.sh is the mechanical evidence engine. It:
- picks the first available TeX build tool and records
compile.statusas one ofpass,pass-with-undefined-refs,fail, ortoolchain-unavailable— the last is the graceful-degradation path (compile skipped, explicitly NOT faked). It compiles--rootand records that path in the report; this lets an included fragment be checked in its actual document context; - acquires the diff via
git diff [<base>] -- <file>(or working-tree vs HEAD), falling back to whole-file content when the target is not in a git repo; - handles untracked targets as a
/dev/null→ file diff so newly created chapters and sections can be scoped before they are staged; - when
--section/--scopeis present, resolves the heading through the root's input/include closure, filters the target's diff to that heading block, and records the selector, heading, labels, and source line range; - scans the added/removed lines for
\section/\subsection, theorem-class environments (theorem,proposition,lemma,corollary,definition,remark,example,conjecture,question,claim), display-math environments,\label{},\cite{}, and unfinished tags (\reviewer/\david/\claude/\note/\todo); - writes
check-latex-report.json(machine-readable) andcheck-latex-report.md(the human evidence block) pluscompile.logandtex.diff; scoped runs also writescope.json,scope-source.txt, andscope-diff.txtunder the same output directory.
Evidence block (what the human adjudicator gets)
The .md report is the decision surface. It contains exactly:
- Compile status —
pass/pass-with-undefined-refs/fail/toolchain-unavailable, with the tool used and a log pointer. - Files touched — the covered
.texfiles changed by this diff. - Semantic diff summary — sections, theorem-class environments, equation / label / citation / unfinished-tag counts touched.
- Requested scope — selector, matched heading, labels, and source line
range when
--section/--scopewas used. - Diff pointer — the exact
tex.diffpath the human adjudicator can open, plus the diff basis (base ref or working-tree).
Sub-skills (composed when present)
The full notes-tier screening fans out to sibling sub-skills; this umbrella runs them if they are installed and collates their verdicts into the report:
check-latex-style— prose / notation / theorem-environment style.check-citations+clean-citations— pinpoint-citation policy (page + atom), MathSciNet+JabRef bibtex hygiene, broken\cite{}detection.check-labels-and-refs— orphan labels/refs, non-pinpoint cross-refs,\input/\includeclosure to depth 2.
When a sub-skill is absent, its section is marked absent in the report — the
compile + semantic-diff + evidence core still runs (that core is the gate's
minimum floor).
Constraints (DRY-RUN contract)
- Read-only outside
<city-root>/tmp-for-review/<bead>/. - Never runs
Edit/Write/git add/git commit/git push/bd update. - Never approves, merges, or pushes. Emits evidence; the human adjudicator decides.
- Never fabricates a compile result. Missing toolchain →
toolchain-unavailable, full stop.
Fixture test (acceptance)
Invoke against the canonical negative example
polecat/he-d4l:latex/notes/hyperboloid.tex. Pass-bar (per he-86wu): the
report enumerates the compile status, the touched sections/theorems/equations,
and a diff pointer; sub-skills (when present) flag the three known failures
(\perp/\top notation, broken citations, non-pinpoint refs). A clean
post-revision branch produces a report with no sub-skill failures.
Limitations
- Compile is single-pass by default;
pass-with-undefined-refsflags the second-pass cross-ref case rather than resolving it. - Semantic scan is grep-based (no macro expansion, does not strip
%comments); it is a triage summary, not a proof of equivalence. - Scope matching is heading-based: numbered selectors follow the expanded root's
\chapter/\sectionhierarchy, while title and label selectors are exact (case-insensitive for titles). It does not infer headings generated by macros. - The two-sided compile (merge-base + branch-HEAD) and the latexdiff/diff-pdf
PDF artifact required by he-jwmy items 1–2 are produced by running the helper
once per side and pairing the reports; the PDF-diff sub-artifact is a
downstream sub-skill (
he-ogkp) not yet folded into this preliminary.
04 同仓库更多 Skills
writing-skills
Use when creating new skills, editing existing skills, or verifying skills work before deployment
writing-plans
Use when you have a spec or requirements for a multi-step task, before touching code
verification-before-completion
Use when about to claim work is complete, fixed, or passing, before committing or creating PRs - requires running verification commands and confirming output before making any success claims; evidence before assertions always
using-superpowers
Use when starting any conversation - establishes how to find and use skills, requiring skill invocation before ANY response including clarifying questions
using-git-worktrees
Use when starting feature work that needs isolation from current workspace or before executing implementation plans - ensures an isolated workspace exists via native tools or git worktree fallback
test-driven-development
Use when implementing any feature or bugfix, before writing implementation code