Check the numbers in a paper that was not written with manuscript-guard against the analysis outputs, and report honestly what a match is worth. Use when handed an existing .docx, Markdown or LaTeX manuscript whose numbers were typed by hand, before resubmitting an old paper, or before moving one into a manuscript-guard project; and, without reading it, when the paper is one a journal sent the person to review or to handle. Not for a manuscript-guard project, whose numbers are bound (use resu...
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Paper Audit?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/basilechretien-paper-audit)
---
name: paper-audit
description: Check the numbers in a paper that was not written with manuscript-guard against the analysis outputs, and report honestly what a match is worth. Use when handed an existing .docx, Markdown or LaTeX manuscript whose numbers were typed by hand, before resubmitting an old paper, or before moving one into a manuscript-guard project; and, without reading it, when the paper is one a journal sent the person to review or to handle. Not for a manuscript-guard project, whose numbers are bound (use results-binding).
---
# Auditing a paper that was written by hand
In a manuscript-guard project a number from the analysis cannot be typed at all, so nothing
passes by coincidence. A paper written the ordinary way has no bindings. Every number is a
literal, and the only question left to ask is a weak one: does this number appear
somewhere in the outputs?
`manuscript-guard audit` asks that question and then measures how little the answer means
for this particular paper. The measurement is not a footnote. In the project this toolkit
grew out of, the same question was asked with the analysis outputs as the backing set:
every integer up to 100 matched by chance, and of fifteen deliberately corrupted headline numbers it caught
none while reporting success.
## 0. A paper the person was sent to review or to handle
If the person is the paper's editor or one of its referees, the journal sent it to them in
confidence: stop before you open it. Journals forbid putting a submitted manuscript into an
AI tool that does not keep it confidential, and whatever you read reaches your model's
provider: the paper, and `audit`'s report of it, which quotes its lines. Do not open the
file, run the audit on it, or ask for it to be pasted. Say so, and give the person the
commands to run themselves, in a terminal you cannot read:
```bash
manuscript-guard audit paper.docx --journal journal.yaml
manuscript-guard audit paper.docx --journal journal.yaml --authors authors.yaml
manuscript-guard audit paper.docx --lookup
manuscript-guard compare paper-v1.docx paper-v2.docx --response letter.docx
```
The first is the editor's: the paper held to the journal's profile, which the editor keeps.
The second also looks for the authors' names where the journal reviews blind. The third is
a referee's: everything else this skill describes, and the registries asked about each
reference, which sends their DOIs and PMIDs, the title, first author and year of each that
gives neither, and each ClinicalTrials.gov or ISRCTN number the text names to that
registry, but no sentence of the paper. The fourth sets a
revision beside the version before it, with the authors' letter. The hook asks the
person before an agent runs `audit` with `--journal`, `--authors`, `--design` or
`--cited`, or `compare`; that question is theirs to answer, not yours. The project's
documentation, "For editors and reviewers", says what
each option checks.
## 1. Choose what to check against
`--against` is the backing set, and it decides whether the audit tells you anything. It
may be left out when there are no outputs to hand: then no number is compared, the report
says so on its first line, and the checks that need no outputs still run (step 3). Say that
to the author in those words; never call such a report a check of the numbers.
**Use the analysis outputs as printed, not the raw data.** On the worked example, audited
against its results, 24% of the integers from 1 to 100 match by chance. Audited against
the row-level data, 100% do, and at the same time every odds ratio and percentage is
reported missing, because raw rows contain no derived statistics. Raw data therefore fails
twice: every count passes and every estimate fails.
**Match what the paper prints.** Separators, a trailing `%` and trailing zeros are removed,
and non-integers are compared to 10 decimal places. `3.84` in the paper does not match
`3.843972469205093` in a log,
and `36.4%` does not match `0.364`. Point it at rounded tables and formatted output where
they exist.
**Include every source of quoted values.** Literature values, numbers from a collaborator's
analysis, figures taken from a protocol: anything not in `--against` comes back unmatched.
**It reads `.json .csv .tsv .txt .yaml .yml .md`.** Anything else, such as `.xlsx`, `.rds`,
`.log` or `.html`, is listed in the report under `Outputs not read as given`, and so is a
`.json` that does not parse (JSON Lines saved as `.json`, say), which is then read as plain
text. A path that does not exist stops the audit with exit 2, and so does a set of outputs
with nothing readable in it. A byte-order mark names the encoding, so UTF-8 with a BOM and
UTF-16 (Windows PowerShell 5's default for `>` and `Out-File`) are read correctly; a file
with NUL bytes and no BOM is listed as not read. Export spreadsheets to CSV first, and read
that section of the report before the findings: every number in an output it names is
reported missing from the paper.
Keep it narrow. A directory is read recursively, READMEs and notes included, and every
extra number raises the chance of a coincidental match.
Where a table reports means of whole numbers, a Likert-type scale or a count, ask the user
which rows they are and name them with `--whole-numbers "pain score" visits`: each mean in
those rows is held to its column's n, and one no whole total gives is listed. Never name a
row the paper does not describe as whole numbers; a mean of a continuous measure would be
listed as a misprint. A row whose means are of several items per person is read as one
number each, and a right mean can be listed: check those by hand against n times the items.
An SD printed with such a mean is held to it too (GRIMMER), unless the label or header calls
the spread an SE. Rows of numbers each 0 or 1 reported as a mean with its SD ("Male, mean
(SD) 0.53 (0.50)") are named with `--binary "male sex"`: each mean and SD is held to the
other and n (DEBIT). Name only rows the paper codes 0/1.
Where a table reports a mean (SD) of a variable that cannot be negative, a weight, a
concentration, a length of stay, ask the user which rows they are and name them with
`--non-negative weight "length of stay"`: each mean less than twice its SD is listed as
skewed data, which a median and IQR would describe (Altman and Bland, BMJ 1996;313:1200).
Never name a row whose variable can be negative, a change from baseline; a row that gives
an SE is not read, and says so.
## 2. Run it
```bash
manuscript-guard audit manuscript.docx supplement.docx \
--against results/ tables/ --figures figures/
```
It needs no project and reads no `paper.yaml`. A `.docx` is read with tracked changes
accepted and table cells kept apart, from the body, footnotes and endnotes; headers,
footers and comments are not read. Two paragraphs joined by deleting or moving the mark
between them are read as one, in the last one's style, as Word shows them once the change
is accepted. A join is not read across a table or a content control: Word runs a paragraph
into the first cell of a table after it, and the audit reads the two apart, so check by hand
the numbers either side of a deleted mark just before either. The
notes are read after the reference list has been cut from the body, so they are always
audited. Markdown and text files are read as written,
and `--` between digits is read as a separator and a minus in every format: `-0.72--0.30`
runs to -0.30, as it does in R's output. A Markdown paper that writes a range as
`2010--2019`, meaning pandoc's en dash, gets `-2019` reported as not found; check such
ranges by hand. A `.tex` is read with the files it inputs from its folder, at `.tex` lines;
in a folder every `.tex` with `\documentclass` starts a paper, an old draft or a LaTeX
template too, so name the paper's own file when the folder holds others; a file nothing
inputs is named under `Passed over`, and so is a `.txt` or Markdown file in that paper's
folder or under it, though a pandoc template sets none aside itself. A PDF manuscript named on its own is read through
`pdftotext` (refused without it), each place a page and a line; its tables are lines of text
there, so no table's arithmetic is checked, and a line is a heading only where it holds a
section's name alone. Audit the source where the author has it. `--figures` takes SVG and PDF files with a text layer; one with no text at all,
such as a matplotlib SVG with its labels drawn as outlines, is listed as unreadable rather
than audited. `--strict` exits 1 when a number is in no output, a paper, a figure or a
stretch of one could not be read, no number was read, the arithmetic of a table or a flow is
exactly wrong (a total off, categories over their column's n, a count held back that a
printed total gives away, a flow printed as a nested list that does not add up under a
heading, caption or paragraph naming a flow, in English: "Patient flow", "Trial profile",
"CONSORT diagram"), or an
interval or a test of the Abstract differs from its one counterpart where the paper reports
in a single number, and the audit exits 2 when nothing given could be read at all,
`--minimum-cell-count` is below 1, or `--dry-run` or `--lookup-cache` is given without
`--lookup`. Ask the author for the data custodian's minimum and pass it as
`--minimum-cell-count N`; without it a count held back is taken to hide every count from 1
to its bound.
`--json` gives the report for a script, and on exit 2 an object whose `ok` is false, with
the reason.
G6 and G14 read the words as `check` does, a .docx through the conversion `init --from`
makes (skipped with a note without pandoc); ask the author which English the paper is in
and pass `--english british` or `american`. Neither is counted by `--strict`. The short
forms the paper uses and does not define are one question to the author, under "Questions
for the author", which lists them and passes over those journals' style guides say need no
definition (it says how many, and by which list); its answer is `--known` with the ones the
paper's readers take for words or names, which you ask the author for, never guess, and a
definition at its first use of each other. `--json` gives each form's first use. The reference
list is counted and its numbered citations held to it; nothing is sent to a registry
unless you pass `--lookup`, and then ask the author first: run `--lookup --dry-run`, show
what would be sent (each DOI to Crossref and OpenAlex, and to DataCite and doi.org where
Crossref has no record; each PMID to PubMed; the title, first author and year of an article
or a book with neither to Crossref; each ClinicalTrials.gov or ISRCTN number the paper
names outside its reference list to that registry), and keep the answers with `--lookup-cache DIR`
if they will audit again.
Where no rule can decide, the report asks under "Questions for the author" (`"question":
true` in `--json`), never counted. Put each question to the author as it is written and
pass only the answer they give: `--no-abstract` where the paper has no Abstract,
`--results "<heading>"` for the heading that holds its results, `--no-results` for a paper
that reports none. Never choose the heading yourself. A number of the Abstract found only in
the Introduction, the Discussion, a "Limitations" or a conclusion, and a Background figure
given nowhere, are asked about too: whether the paper reports it there, or where its source
is, is the author's to say. So is a P larger than its statistic gives, where the paper says
its P values are adjusted for multiple comparisons (Holm, Bonferroni, the false discovery
rate): ask whether it is the adjusted P, and if it is, the answer is the paper's, "adjusted"
said beside the test; never decide it yourself. A share off its column's n in a table that
says it is weighted is asked about the same way: whether it is the weighted share. A
smaller P, an interval's P, and a share in a table that says nothing of weights stay numbers
that do not fit.
## 3. Read the report
What was read and what was not comes first, then `What was checked`, a line for each check,
then a section for each check with something to show: `Numbers in the outputs`, `Arithmetic`,
`Abstract against Results`, `Small cells recoverable by subtraction`, `Writing (G6) and
Language (G14)`, `References (G7)`. The findings on the words are grouped by kind, with
their first places, each kind's hint once where its places share it (at each place where
they do not); `--details` gives every section and every
place in full, and `--json` everything for a script. A place in a .docx is its heading and
its paragraph under it, "Methods, paragraph 3". Numbers in the outputs lists the
unmatched numbers by file, up to 40 per file and then only a count, followed
by `What a match is worth here`: the
share of integers 1–100, of integers 1–1000, and of two-decimal values that would match by
chance against this backing set, with a verdict. Arithmetic lists the numbers that do not
fit the ones beside them, a P and its statistic or an n (%) and its denominator, which
needs no outputs, and apart a table's total its counts do not add up to and a flow printed
as a nested list that does not add up, with notes on what it read as overlapping or did not
read. A breakdown mid-flow and a step that lists no exclusion are notes too. A broken list
under no name for a flow, a list of subgroups say, is a note only; when
the author's flow sits under such a heading, say so, since `--strict` passed it. Abstract against Results lists each conflict, each number of the Abstract not found
in the tables or any part of the paper but the Introduction and its material, the
Discussion with its limitations, a conclusion, a summary of the paper, the title page, the
back matter and the notes, which may be a stale value or one the paper never reports (or
one only those give, which are not searched), and
those matched only as a rounding, and ends with its own chance-match rate; where it says
"not compared" the paper has no Abstract or no Results heading it could find, under that name
or another it lists ("Experiments", "Numerical results"). Small cells lists
each count held back ("<5") that a total gives away, with the count it can only be: a
disclosure to report to the author before the paper goes anywhere, never to work round. Report each section apart; a finding of G6 or G14 is about the words, and
no evidence about the numbers.
Two things about the list. `line N` is a line of the extracted text, which in a `.docx` is
a paragraph, not a page or a line in Word. The context shown is the first 140 characters of
that paragraph, so the number itself is often not in it. Find it before you report on it.
## 4. Triage what did not match
Each unmatched number is a stale or wrong value, a value from a source not in `--against`,
one written another way than the outputs write it, or vocabulary, an axis tick or a
reference entry. Only the first is what you are looking for. Before you report on any,
read [references/triage.md](references/triage.md): what to do with each kind, and where the
audit cuts a reference list, so that you can check the ranges it names under `Not audited`.
## 5. Say what a clean report does not mean
A match means the number appears somewhere in the outputs. It does not mean it appears in
the right place: a value correct in the abstract and wrong in the Results passes the
membership check, and the Abstract against Results finds it only where the two are an
interval or a test paired exactly; a number of the Abstract found in the Results may be
another quantity that happens to be printed the same. An
interval matches when both bounds appear anywhere, not necessarily together. Numbers the
classifier accepts as conventions or references are never compared at all, and that
includes `p < 0.05` anywhere in the text and the lines the report lists under
`Not audited`. Nor are numbers inside fenced code blocks in a Markdown paper. Conventions, and
numbers on lines taken for reference entries that happened to
match, are counted as "set aside as conventions and references"; the numbers on a cut reference list and
in fenced code are not counted at all. Describe all of them as not checked, never as
matched.
So report what was done, not a verdict: how many numbers were examined, how many matched,
what the chance-match rate was, and which unmatched ones you checked by hand and what you
found. Never tell the author the numbers were verified.
## 6. Moving the paper into a project
`import` refuses a `.docx` this toolkit did not build. For a paper still being written, the
route is:
1. `manuscript-guard init my-paper --from paper.docx`. It writes the paper as
`manuscript/main.md`, each table as a pipe table where its cells hold only paragraphs, the
pictures in `manuscript/media/`, and the title page in a comment at the top that no gate
reads. Read what it prints: a table with a list or another table in a cell is left as a
grid table, and a comment that holds the abstract hides its numbers until it is moved out.
A typed APA reference list is read into `literature/references.bib`, and each citation
typed as text that names exactly one of its entries, by its authors and year, becomes
`[@key]`; what it could not read exactly, entries and citations, is listed with the line
and why, and stays as typed for the author to cite by hand. A numbered list is left as
typed. Do not convert with `pandoc paper.docx -t markdown`: it writes most Word tables as
multiline tables, which `check` refuses at every stage. A paper written in LaTeX needs no
conversion: `manuscript-guard init --latex`, then its files go in `manuscript/`, the
entry file as `main.tex`, loading `mgvalues`.
2. Make the analysis publish its values. The [results-binding](../results-binding/SKILL.md)
skill covers the emitters.
3. Save the copies of the works it quotes under `literature/sources/`, named by citation
key, and run `manuscript-guard sync-sources`: it records them in
`literature/sources.yaml`, which is committed while the copies are kept out of git.
4. `manuscript-guard bind` lists every unbound number and proposes a key wherever exactly
one published value displays the same. A proposal is a coincidence of value, and a paper
converted from Word is full of coincidences, so read each one and apply only the right
ones with `bind --apply --only manuscript/main.md:<line>`. Never run `bind --apply` alone
here: a wrong binding passes every gate afterwards.
## If you are a model doing this
The pull is to summarise a mostly matched report as "the numbers check out". It does not
show that, and the report says so at the bottom for a reason. Quote the chance-match rate
whenever you mention a match.
Do not edit the author's paper to agree with the outputs. An unmatched number is a question,
and sometimes the output is the thing that is wrong. Show each mismatch and let the author
decide.