Skip to main content

Math Scout

CI

A multi-agent pipeline that reviews mathematical papers written in LaTeX. It splits a .tex file into sections, runs a set of specialised LLM-based reviewers over them — some section by section, some over the whole paper — and synthesises a final referee report in markdown. Anthropic and OpenAI models can be used separately or together.

Alpha software. It works and it is useful, but interfaces, prompts, and output formats will change without notice, and there is no backwards-compatibility promise before 1.0. Please report what breaks.

What it is, and what it isn't

It is a first-pass reading aid. It is good at the mechanical parts of refereeing: spotting undefined notation, unstated hypotheses, gaps between "clearly" and the actual argument, and passages that assume more than they say.

It is not a referee, and its output is not a referee report you can rely on. It will miss real errors and it will confidently flag correct arguments as broken. Every issue it raises needs a human to verify it before you act on it, and a clean report is not evidence that a paper is correct. Treat it as a colleague who read the paper quickly, not as a proof checker.

Reviewers

Agent Tier Thinks Reads Role
FormalVerifier strong yes a section Proof gaps, invalid inferences, missing hypotheses, load-bearing computations
AdversarialSkeptic strong yes a section Edge cases, brittle arguments, degenerate examples
ExpositionReferee fast no a section Readability, missing intuition, proof strategy clarity
NotationAuditor fast yes the whole paper Symbol consistency, convention drift, broken references
ClaimAuditor strong yes the whole paper Overclaiming: what the abstract promises against what the theorems prove

Each reviewer returns structured JSON issues (title, severity, type, location, quote, analysis, suggested_fix, confidence). A final referee pass then synthesises all of them into one report. Non-mathematical sections (References, Bibliography, Acknowledgments) are dropped from the section passes automatically; the two whole-paper reviewers still see the raw source, deliberately, since one needs every \label and the other needs the introduction — which the front-matter threshold can otherwise discard.

Scope follows the shape of the question. Whether an inference holds is decidable from the argument in front of you, so those reviewers work section by section. Whether a symbol means the same thing on page 4 as on page 19, or whether the abstract promises what Theorem 1.1 delivers, is not decidable from any one section — asking a section-scoped reviewer for it only produces guesses the final referee then has to discard. Those two read the whole source, once, after the section passes, so they also see everything the section reviewers found.

Every reviewer is sent a shared review_protocol.md ahead of its own prompt: one severity scale, one confidence scale, and one description of what each output field must contain. Individual prompts hold only their lane and what they must leave to others.

Extended thinking is enabled per reviewer, on the shape of the task rather than the tier. Deciding whether a proof step actually follows, building a counterexample, or tracing notation and dependencies across a whole paper is multi-step reasoning and benefits from it. The section-scoped exposition pass is scanning and matching, so it runs without thinking. The final referee thinks too: it weighs and prioritises every finding across the whole paper, and runs only once per review.

Requirements

  • Python 3.11 or newer
  • Credentials with credit for each provider you select (Anthropic and/or OpenAI)

Install

With uv, no checkout needed:

uvx math-scout paper.tex --dry-run

Or from a clone:

git clone https://github.com/nidrissi/math-scout
cd math-scout
uv sync
uv run math-scout paper.tex --dry-run

Credentials

Only providers selected by the resolved preset and model flags are initialized or contacted. The default command still needs only Anthropic credentials.

For Anthropic, either export a key:

export ANTHROPIC_API_KEY=...

…or sign in once with the Anthropic CLI and the stored profile is picked up automatically:

ant auth login

Don't pass the key inline on the command line — it ends up in your shell history.

For OpenAI, export an API key:

export OPENAI_API_KEY=...

The preflight checks each distinct selected model with its provider's free input-token count endpoint before creating output or asking you to approve a paid run. Credential, permission, and missing-model failures name the provider that rejected the check.

Cost

Start with --dry-run. A full review makes one API call per section (or subsection, with --split subsection) per section-scoped reviewer, one whole-paper call for each paper-scoped reviewer, and one final referee call. Every one of them reads at least a section and several read the whole paper, so on a long paper it adds up to real money.

math-scout paper.tex --dry-run

This asks each selected provider for the exact input-token count of every dry-run request and prints a cost estimate without sending a generation request. The individual counts are exact; the run total is still a lower bound because it excludes the accumulated "known issues" context that only exists after reviewers start producing findings. Cost estimates are optional metadata: a model with no trustworthy price on file still works and is shown as pricing unknown.

The astra-sol-luna preset limits Astra to the single synthesis call. Its registered standard rates are $10/M input tokens, $1/M cached input, $12.50/M cache writes, and $50/M output. Requests above 272K input tokens use 2x input and cache rates and 1.5x output rates for the full request; --dry-run applies those multipliers per call.

The output figures are the opposite — ceilings nobody reaches, since they assume every call emits its full --max-tokens. Two are printed: one assuming no call truncates, and one assuming every call truncates and is retried. Real spend lands well below the first.

Before a real run starts, the tool prints the chunks it extracted and asks you to confirm.

Splitting at subsections

By default the section passes read one \section at a time. If a paper's sections are long, --split subsection hands them one \subsection at a time instead. Each call has less to get through, so it is less likely to run out of --max-tokens. The trade-off is that it sees less of the surrounding argument. A section with no subsections is still reviewed whole. A section's text before its first subsection is reviewed together with that subsection, unless it is long enough to stand alone. The whole-paper passes and the final referee are unaffected. Try --dry-run at both levels to compare call counts.

Privacy

Running this sends the full text of your paper to every API provider selected by your model flags. In a mixed run, both Anthropic and OpenAI receive paper content. If the paper is unpublished, under embargo, covered by a collaboration agreement, or contains anything you are not free to disclose to a third party, decide deliberately. Consult the selected providers' current privacy and data-usage terms before running it.

Usage

math-scout paper.tex                          # review, with a confirmation prompt
math-scout paper.tex --output /tmp/review     # choose the output directory
math-scout paper.tex --dry-run                # token count + cost estimate only
math-scout paper.tex --yes                    # skip the prompt (needed in CI/scripts)
math-scout paper.tex --preset astra-sol-luna  # Astra final, Sol strong, Luna fast
math-scout paper.tex --preset sol-luna        # OpenAI Sol for strong, Luna for fast
math-scout paper.tex --preset opus-sonnet     # Anthropic Opus for strong, Sonnet for fast
math-scout paper.tex \
  --strong-model openai:gpt-6.1-sol \
  --fast-model anthropic:claude-sonnet-5-5 \
  --final-model openai:gpt-6-astra               # independent synthesis model
Flag Meaning
--output DIR Where to write results (default: <input_dir>/review/)
--dry-run Count tokens and estimate cost; send no generation requests
-y, --yes Skip the confirmation prompt. Required when stdin is not a terminal
--preset NAME Select astra-sol-luna, sol-luna, or opus-sonnet
--strong-model PROVIDER:MODEL Model for the three deep reviewers
--fast-model PROVIDER:MODEL Model for the two lighter reviewers
--final-model PROVIDER:MODEL Model for final synthesis (default: resolved strong model)
--max-tokens N Output token limit per call (default 32000, maximum 64000)
--effort LEVEL low, medium, high, xhigh, or max (default high)
--split LEVEL Cut the paper at each section or each subsection for the section passes (default section)
--version Print the version

Exit codes: 0 success, or you declined at the confirmation prompt; 1 finished but some reviewer calls failed; 2 bad configuration — missing provider credentials, an unknown or unusable provider/model, nothing to review, or no terminal to confirm on without --yes.

Multi-file papers

\input{...} and \include{...} are resolved and inlined before chunking, relative to the main file's directory and then the including file's. Commented-out references are ignored, cycles are broken, and a reference that can't be found is left alone with a warning rather than aborting the run.

Choosing providers, models, and effort

Defaults are anthropic:claude-opus-5-5 for the strong tier and anthropic:claude-sonnet-5-5 for the fast tier. Final synthesis follows the resolved strong model unless --final-model or a preset selects one independently. Every explicit model must use provider:model; bare IDs are rejected. Use a preset to keep common combinations concise:

math-scout paper.tex --preset opus-sonnet
math-scout paper.tex --preset sol-luna
math-scout paper.tex --preset astra-sol-luna
math-scout paper.tex \
  --strong-model anthropic:claude-opus-4-7 \
  --fast-model anthropic:claude-sonnet-4-6
math-scout paper.tex \
  --strong-model openai:gpt-6.1-sol \
  --fast-model anthropic:claude-sonnet-5-5

The legacy presets set both tiers together: opus-sonnet resolves to anthropic:claude-opus-5-5 and anthropic:claude-sonnet-5-5, while sol-luna resolves to openai:gpt-6.1-sol and openai:gpt-6-luna; their final referee follows the effective strong model, including when --strong-model overrides the preset. astra-sol-luna uses openai:gpt-6-astra for final synthesis, openai:gpt-6.1-sol for the strong tier, and openai:gpt-6-luna for the fast tier. Each explicit flag replaces its corresponding preset selection; for the legacy presets, the final model continues to follow the resolved strong model. For example, --preset sol-luna --fast-model anthropic:claude-sonnet-5-5 is a concise mixed-provider configuration. State records the resolved qualified model IDs, not the preset name, so a preset command and its fully explicit equivalent can resume the same run.

Other current options include openai:gpt-6.1-terra, anthropic:claude-haiku-5-5, and anthropic:claude-fable-5-1. Capability and pricing metadata follow the official OpenAI model catalog and Claude model catalog. Older registered models remain available through explicit flags.

The updated defaults and presets change the resolved reviewer models. To resume a review made with an earlier release, pass its original --strong-model and --fast-model explicitly; otherwise use a new --output directory. The usual settings guard prevents mixing findings from different models.

Existing output directories whose state.json contains bare Anthropic model IDs are not reusable. Delete the output directory or pass a different --output; they are rejected through the normal settings-mismatch check rather than migrated.

The final referee uses the independently resolved final model. Changing only --final-model reuses compatible stored reviewer JSON and regenerates the report, because the final report is synthesized on every run and the final model is intentionally absent from resumable reviewer settings. There are no per-reviewer model flags.

Capability validation is provider-specific. Known incompatible combinations are refused before spending. Reasoning reviewers receive the selected effort. For an OpenAI reviewer that does not reason, the adapter requests none where the model supports it, or omits the reasoning field for known non-reasoning models. GPT-6 Astra, GPT-6.1 Sol, Claude Opus 5.5, and Claude Fable 5.1 require reasoning, so they cannot serve the fast tier: ExpositionReferee runs without up-front thinking. They work as strong or final models. On Claude Sonnet 5.5, the adapter uses between_tools for this reviewer; without tools, that mode returns text only.

--effort is the main cost and latency lever — it controls how much the models reason and spend overall. high is the default; drop to medium or low on a long paper or a quick pass, raise to xhigh or max on something that warrants it.

Two constraints are worth knowing:

  • --max-tokens covers thinking and response text together. It is headroom, not a budget to spend. Unused budget costs nothing, but a call that runs out mid-answer is billed in full and returns nothing usable — so a cap set too low causes cost rather than limiting it. Lower it to save money and you will generally spend more. The default of 32000 leaves room for a deep reviewer to think its way through a long section; if you see truncation warnings, raise it rather than lowering it.
  • Claude Sonnet 5.5 and Haiku 5.5 allow running without up-front thinking only at high effort or below. This includes the default fast model: --effort xhigh and --effort max require another fast model, such as --fast-model openai:gpt-6-luna. Incompatible combinations are refused before any request.

If a call does exhaust its budget, it is retried once at one provider-mapped --effort level down when that produces a different request. A second truncation is a real failure. An OpenAI non-reasoning call already sent with effort=none, for example, is not repeated under a lower CLI label that would send the same request. Because a truncated call bills in full, --dry-run reports a conservative retry ceiling.

Resuming

If a run is interrupted, re-running the same command picks up where it left off, so you only pay for what's missing. Progress is tracked in review/state.json against a hash of each section's text, which means:

  • Editing the paper works. Sections you changed are reviewed again; sections you didn't are reused. Inserting or deleting a section doesn't disturb the others.
  • The two whole-paper passes re-run on any edit. They are keyed on the whole source, so changing one character anywhere invalidates both. That is correct — a notation drift or an overclaim can be created by an edit in a section neither pass would otherwise revisit — but it means a resumed run is rarely free, and those two are the most expensive calls in it. The pre-run call count tells you before you pay.
  • Changing --strong-model, --fast-model, --effort, --max-tokens, or a prompt file is refused. The stored reviews were produced under different settings, and presenting them as the output of the new ones would be a lie. Use a different --output or delete the directory. Changing only --final-model is allowed because it does not change the stored reviewer findings; it regenerates final_report.md.
  • Changing --split is allowed. It changes which chunks exist, not how any one of them is reviewed. A section that comes out the same at both levels keeps its reviews, and so do the whole-paper passes. Only the newly cut chunks are reviewed, and the reviews they replace are deleted.

Before it starts, the run prints how many calls it will make and how many it is reusing, so you see the cost implication before confirming.

Output

Everything lands in the output directory (default <input_dir>/review/):

File Contents
final_report.md The final referee report — start here
chunks/NNN_<section>.tex The exact LaTeX each reviewer saw, including the whole-paper chunk
reviews/NNN_<section>_<reviewer>.json Raw JSON from each reviewer per chunk
all_issues.json Every issue behind the current report, as a JSON array
issues.jsonl Append-only log of every issue ever produced here, one per line
state.json Resume bookkeeping — which reviews are complete, and under what settings

all_issues.json is the authoritative set for the current report. issues.jsonl is a log: if you edit the paper and re-run, it keeps the superseded findings too.

The numbered prefix is the chunk's position in the document, so both directories sort in reading order. A re-run keeps that true: reviews it reuses are renamed into their new positions, and files left over from a previous structure are deleted rather than left sitting next to the current ones. Everything you see under chunks/ and reviews/ belongs to the run that produced the report beside it.

If any reviewer call fails, the run says so, the final report is told to state its own coverage gaps, and the exit code is 1. A failing run never silently presents partial findings as complete.

Known limitations

  • Sequential. Reviewers run one at a time, because each pass is shown the issues found so far. A ten-section paper is over thirty serial API calls, so expect it to be slow.
  • \section only. Documents structured with \chapter, or with no sectioning at all, produce nothing to review and exit with an error.
  • Three of the five reviewers see one section at a time, plus a shared global context (title, abstract, preamble, first 15 theorems/definitions). An error that only shows up when two distant sections are read together will be caught only if it falls in the notation or overclaiming lanes, which are the two that read the whole paper.
  • No access to the literature. Nothing here can read a reference, so the report never says a result is already known. Novelty is assessed only against what the paper itself claims and cites; genuine prior-art judgement remains entirely yours.
  • \input is confined to the document's own directory. A reference pointing outside it — an absolute path, or ../ climbing out — is refused with a warning rather than inlined, since running this on a paper from someone else would otherwise let the file read anything you can read and send it to the API.
  • Prompt caching is not measured. Anthropic receives ephemeral cache controls on the stable system blocks. OpenAI GPT-5.6 and later models receive explicit breakpoints on equivalent developer input_text blocks, explicit-only cache mode, and a deterministic paper-specific prompt_cache_key. The providers have different eligibility, lifetime, and cache-write pricing rules, so --dry-run reports exact token counts without claiming a cache saving. Inspect returned usage before quoting one.

Contributing

See CONTRIBUTING.md. Bug reports and papers that break the chunker are especially welcome — open an issue.

License

MIT — see LICENSE.

Metadata

Release files for math-scout 0.5.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for math-scout 0.5.0
File Size Uploaded Provenance Actions
math_scout-0.5.0.tar.gz 122.0 kB With provenance Details for math_scout-0.5.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for math-scout 0.5.0
File Interpreter ABI Platform Actions
math_scout-0.5.0-py3-none-any.whl Python 3 none any Details for math_scout-0.5.0-py3-none-any.whl

Total release size: 188.3 kB

Release files / math_scout-0.5.0.tar.gz

Download URL math_scout-0.5.0.tar.gz
Size 122.0 kB
Tags Source
SHA-256 checksum
How to use checksums
5f8153966be94587dd3ecb5d2a2dce09325b94cf740a1e15cd5fbe36dc545e27
BLAKE2b-256 checksum
How to use checksums
54f1d1e8433f4dc4b9faeac9952258333889675fac718081080b741624970d7e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 29, 2026.

Transparency log

Release files / math_scout-0.5.0-py3-none-any.whl

Download URL math_scout-0.5.0-py3-none-any.whl
Size 66.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e9c04744dc2ba0d55cade7c997bfc3cd49e6cf7567acc13140146e3d832546c2
BLAKE2b-256 checksum
How to use checksums
ae3d024b6a21f1d6961df8119e155e9e84b98d006f1872ba6430158cbc0b4ef1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 29, 2026.

Transparency log

Security for math-scout 0.5.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for math_scout-0.5.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 29, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page