math-scout 0.4.0a1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. math_scout-0.4.0a1/.github/dependabot.yml +10 -0
  2. math_scout-0.4.0a1/.github/workflows/ci.yml +44 -0
  3. math_scout-0.4.0a1/.github/workflows/release.yml +99 -0
  4. math_scout-0.4.0a1/.gitignore +20 -0
  5. math_scout-0.4.0a1/AGENTS.md +95 -0
  6. math_scout-0.4.0a1/CHANGELOG.md +343 -0
  7. math_scout-0.4.0a1/CLAUDE.md +1 -0
  8. math_scout-0.4.0a1/CONTRIBUTING.md +51 -0
  9. math_scout-0.4.0a1/LICENSE +21 -0
  10. math_scout-0.4.0a1/PKG-INFO +382 -0
  11. math_scout-0.4.0a1/README.md +358 -0
  12. math_scout-0.4.0a1/pyproject.toml +58 -0
  13. math_scout-0.4.0a1/src/math_scout/__init__.py +5 -0
  14. math_scout-0.4.0a1/src/math_scout/cli.py +238 -0
  15. math_scout-0.4.0a1/src/math_scout/prompts/adversarial_skeptic.md +64 -0
  16. math_scout-0.4.0a1/src/math_scout/prompts/claim_auditor.md +90 -0
  17. math_scout-0.4.0a1/src/math_scout/prompts/exposition_referee.md +57 -0
  18. math_scout-0.4.0a1/src/math_scout/prompts/final_referee.md +157 -0
  19. math_scout-0.4.0a1/src/math_scout/prompts/formal_verifier.md +77 -0
  20. math_scout-0.4.0a1/src/math_scout/prompts/notation_auditor.md +74 -0
  21. math_scout-0.4.0a1/src/math_scout/prompts/review_protocol.md +184 -0
  22. math_scout-0.4.0a1/src/math_scout/providers/__init__.py +61 -0
  23. math_scout-0.4.0a1/src/math_scout/providers/anthropic.py +233 -0
  24. math_scout-0.4.0a1/src/math_scout/providers/base.py +245 -0
  25. math_scout-0.4.0a1/src/math_scout/providers/openai.py +319 -0
  26. math_scout-0.4.0a1/src/math_scout/providers/registry.py +47 -0
  27. math_scout-0.4.0a1/src/math_scout/reviewer.py +1838 -0
  28. math_scout-0.4.0a1/tests/test_cli.py +371 -0
  29. math_scout-0.4.0a1/tests/test_providers.py +394 -0
  30. math_scout-0.4.0a1/tests/test_reviewer.py +1724 -0
  31. math_scout-0.4.0a1/uv.lock +569 -0
@@ -0,0 +1,10 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: "uv"
4
+ directory: "/"
5
+ schedule:
6
+ interval: "weekly"
7
+ - package-ecosystem: "github-actions"
8
+ directory: "/"
9
+ schedule:
10
+ interval: "weekly"
@@ -0,0 +1,44 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: ["main"]
6
+ pull_request:
7
+
8
+ concurrency:
9
+ group: ${{ github.workflow }}-${{ github.ref }}
10
+ cancel-in-progress: true
11
+
12
+ permissions:
13
+ contents: read
14
+
15
+ jobs:
16
+ test:
17
+ runs-on: ubuntu-latest
18
+ strategy:
19
+ fail-fast: false
20
+ matrix:
21
+ python-version: ["3.11", "3.12"]
22
+
23
+ steps:
24
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
25
+
26
+ - name: Install uv
27
+ uses: astral-sh/setup-uv@1c37ad07a6a961277cf70c0d37d6f313000f5884 # v10.3.0
28
+ with:
29
+ enable-cache: true
30
+
31
+ - name: Set up Python ${{ matrix.python-version }}
32
+ run: uv python install ${{ matrix.python-version }}
33
+
34
+ - name: Install dependencies
35
+ run: uv sync --frozen --python ${{ matrix.python-version }}
36
+
37
+ - name: Lint
38
+ run: uv run ruff check
39
+
40
+ - name: Check formatting
41
+ run: uv run ruff format --check
42
+
43
+ - name: Test
44
+ run: uv run pytest
@@ -0,0 +1,99 @@
1
+ name: Publish to PyPI
2
+
3
+ on:
4
+ release:
5
+ types:
6
+ - published
7
+
8
+ permissions:
9
+ contents: read
10
+
11
+ concurrency:
12
+ group: pypi-${{ github.event.release.tag_name }}
13
+ cancel-in-progress: false
14
+
15
+ jobs:
16
+ build:
17
+ name: Build and validate distributions
18
+ runs-on: ubuntu-latest
19
+
20
+ steps:
21
+ - name: Checkout release
22
+ uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
23
+
24
+ - name: Set up Python
25
+ uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7
26
+ with:
27
+ python-version: "3.14"
28
+
29
+ - name: Install uv
30
+ uses: astral-sh/setup-uv@c18668ad3cf93ea998bef934396af7bb5c839dc7 # v10.2.0
31
+ with:
32
+ version: "0.12.5"
33
+
34
+ - name: Verify release tag matches package version
35
+ env:
36
+ RELEASE_TAG: ${{ github.event.release.tag_name }}
37
+ run: >-
38
+ python -c 'import os, sys, tomllib; version =
39
+ tomllib.load(open("pyproject.toml",
40
+ "rb"))["project"]["version"]; expected = f"v{version}"; actual
41
+ = os.environ["RELEASE_TAG"]; print(f"release tag: {actual};
42
+ package version: {version}"); sys.exit(0 if actual == expected
43
+ else f"expected release tag {expected}, got {actual}")'
44
+
45
+ - name: Build source and wheel distributions
46
+ run: uv build
47
+
48
+ - name: Validate distribution metadata
49
+ run: uvx twine check dist/*
50
+
51
+ - name: Upload distributions
52
+ uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
53
+ with:
54
+ name: python-package-distributions
55
+ path: dist/
56
+ if-no-files-found: error
57
+
58
+ publish-testpypi:
59
+ name: Publish distributions to TestPyPI
60
+ needs: build
61
+ runs-on: ubuntu-latest
62
+ environment:
63
+ name: testpypi
64
+ url: https://test.pypi.org/p/math-scout
65
+ permissions:
66
+ id-token: write
67
+
68
+ steps:
69
+ - name: Download distributions
70
+ uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
71
+ with:
72
+ name: python-package-distributions
73
+ path: dist/
74
+
75
+ - name: Publish distributions to TestPyPI
76
+ uses: pypa/gh-action-pypi-publish@dc37677b2e1c63e2034f94d8a5b11f265b73ba33 # release/v1
77
+ with:
78
+ repository-url: https://test.pypi.org/legacy/
79
+ skip-existing: true
80
+
81
+ publish:
82
+ name: Publish distributions to PyPI
83
+ needs: publish-testpypi
84
+ runs-on: ubuntu-latest
85
+ environment:
86
+ name: pypi
87
+ url: https://pypi.org/p/math-scout
88
+ permissions:
89
+ id-token: write
90
+
91
+ steps:
92
+ - name: Download distributions
93
+ uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
94
+ with:
95
+ name: python-package-distributions
96
+ path: dist/
97
+
98
+ - name: Publish distributions to PyPI
99
+ uses: pypa/gh-action-pypi-publish@dc37677b2e1c63e2034f94d8a5b11f265b73ba33 # release/v1
@@ -0,0 +1,20 @@
1
+ __pycache__
2
+ *.py[cod]
3
+
4
+ # Environments
5
+ .venv/
6
+ .env
7
+
8
+ # Build artifacts
9
+ dist/
10
+ build/
11
+ *.egg-info/
12
+
13
+ # Tool caches
14
+ .pytest_cache/
15
+ .ruff_cache/
16
+
17
+ # Default output directory of the pipeline
18
+ review/
19
+
20
+ .DS_Store
@@ -0,0 +1,95 @@
1
+ # AGENTS.md
2
+
3
+ This file provides guidance to AI agents when working with code in this repository.
4
+
5
+ ## What this project does
6
+
7
+ `math-scout` is a multi-agent pipeline that reviews mathematical papers written in LaTeX. It splits a `.tex` file into sections, runs five specialized LLM-based reviewers in sequence — three over each section, two over the whole source — and synthesizes a final referee report in markdown. Anthropic and OpenAI models can be used separately or together.
8
+
9
+ ## Running the pipeline
10
+
11
+ ```bash
12
+ uv sync
13
+ uv run math-scout path/to/paper.tex [--output <dir>]
14
+ ```
15
+
16
+ Credentials are required only for the providers selected by the resolved model configuration. Anthropic uses `ANTHROPIC_API_KEY` or a profile stored by `ant auth login`; OpenAI uses `OPENAI_API_KEY`. Never pass a key inline on the command line.
17
+
18
+ Outputs land in `<input_dir>/review/` by default (override with `--output`):
19
+ - `review/chunks/<NN>_<section>.tex` — the exact LaTeX each reviewer saw
20
+ - `review/reviews/<NN>_<section>_<reviewer>.json` — per-chunk reviewer output; the source of truth for issues
21
+ - `review/state.json` — resume bookkeeping: completed reviews keyed by chunk hash, plus the settings that produced them
22
+ - `review/all_issues.json` — the issues behind the current report, rebuilt from `reviews/` each run
23
+ - `review/issues.jsonl` — append-only log of every issue ever produced here; may contain superseded entries
24
+ - `review/final_report.md` — final synthesis in markdown
25
+
26
+ Use `--dry-run` to count tokens and estimate cost without sending generation requests, and `--yes` to skip the confirmation prompt in non-interactive contexts. `--split subsection` cuts the section passes at each `\subsection` instead of each `\section`.
27
+
28
+ Exit codes: `0` clean (or declined at the prompt — declining is a choice, not an error), `1` finished with failed reviewer calls, `2` misconfigured (no credentials, unknown or unusable model, nothing to review, no terminal to confirm on without `--yes`).
29
+
30
+ ## Layout
31
+
32
+ ```
33
+ src/math_scout/reviewer.py # all pipeline logic
34
+ src/math_scout/cli.py # argparse, credential pre-flight, exit codes
35
+ src/math_scout/providers/*.py # provider-neutral contracts and native SDK adapters
36
+ src/math_scout/prompts/*.md # shared protocol, reviewer and final-referee prompts (package data)
37
+ tests/test_reviewer.py # orchestration and pure-function tests
38
+ tests/test_providers.py # native adapter contract tests with stubbed clients
39
+ tests/test_cli.py # argument parsing and exit codes
40
+ ```
41
+
42
+ ## Architecture
43
+
44
+ **Pipeline stages** (`run_pipeline`):
45
+ 1. Load `.tex`, inlining `\input{}`/`\include{}` (`resolve_inputs`), then extract global context (title + abstract + preamble + up to 15 theorems via regex)
46
+ 2. Split into `Chunk`s by `\section{}` boundaries; skip non-mathematical sections (References, Bibliography, Acknowledgments). Body text before the first `\section` becomes a "Front matter" chunk when it holds enough prose. With `SplitLevel.SUBSECTION`, each `\subsection` starts a chunk too, named `Section › Subsection`. A section's lead-in is folded into its first subsection unless it holds enough prose to stand alone. A section without subsections comes out exactly as it does at the section level
47
+ 3. For each chunk × each section-scoped reviewer: call its configured provider, save per-chunk JSON, append issues to `issues.jsonl`
48
+ 4. Then once over the whole source (a `Chunk` named `WHOLE_PAPER_NAME`) for each paper-scoped reviewer, so they see every section finding
49
+ 5. Run final referee over the full paper + all issues → `final_report.md`
50
+
51
+ `cli.py` calls `check_access` first: a free input-token-count probe through each selected provider for every distinct model. This validates credentials and model IDs before anything is written or any generation request is sent.
52
+
53
+ **Reviewers** (defined in `REVIEWER_SPECS` as `ReviewerSpec(prompt, tier, thinking, scope)`, resolved to `ReviewerConfig` by `load_prompts`):
54
+
55
+ | Name | Tier | Thinking | Scope | Focus |
56
+ |---|---|---|---|---|
57
+ | `FormalVerifier` | strong | adaptive | section | Proof gaps, invalid inferences, hidden assumptions, load-bearing computations |
58
+ | `AdversarialSkeptic` | strong | adaptive | section | Edge cases, brittle arguments, suspicious steps |
59
+ | `ExpositionReferee` | fast | disabled | section | Readability, missing intuition, proof strategy clarity |
60
+ | `NotationAuditor` | fast | adaptive | **paper** | Notation consistency, convention drift, undefined and broken references, circularity |
61
+ | `ClaimAuditor` | strong | adaptive | **paper** | Overclaiming: abstract and introduction against what the theorems prove |
62
+
63
+ Tiers map to provider-qualified model IDs via `--strong-model` / `--fast-model`, defaulting to `DEFAULT_MODEL_STRONG` and `DEFAULT_MODEL_FAST`. `--preset opus-sonnet` and `--preset sol-luna` select common same-provider pairs; an explicit tier flag can override either half. Every reviewer returns the same JSON schema: `{ issues: [ { title, severity, type, location, quote, analysis, suggested_fix, confidence } ] }`.
64
+
65
+ Thinking is a property of the task, not the tier — and scope can move a reviewer across that line, as it did for `NotationAuditor`: whole-paper consistency means tracing the order results are established in and collapsing every occurrence of a symbol into one finding, which is not the lookup that per-section consistency was. The provider adapters translate the `GenerationRequest.reasoning` flag and effort level into their native API parameters. The final referee always thinks. `--effort` applies uniformly to every call, with provider-specific validation and retry mapping.
66
+
67
+ Scope is also a property of the task. Consistency and overclaiming are relations between two places in the document, so they are not decidable from one section; asking a section-scoped reviewer for them yields guesses that the final referee has to pay to discard. `LoadedPrompts.scoped()` partitions the reviewers, and `_format_review_target` labels the payload `SECTION UNDER REVIEW` or `FULL PAPER UNDER REVIEW` accordingly.
68
+
69
+ **Prompt composition.** Every reviewer call sends three system blocks: global context, `prompts/review_protocol.md`, then that reviewer's own prompt. The protocol holds the payload map, the single severity and confidence scales, and the field-by-field output contract; the individual prompts hold only a lane and its exclusions. The final referee passes `review_protocol=None` — it writes markdown, not the issue schema.
70
+
71
+ Each stable block is marked as a cache breakpoint, and the first two are byte-identical across reviewers, so reviewers on one model can share a prefix. Anthropic receives native ephemeral cache controls; OpenAI GPT-5.6 receives equivalent developer `input_text` breakpoints, explicit-only cache mode, and a deterministic paper-specific cache key. The saving is still **unmeasured** — inspect the provider-normalized usage before quoting a number.
72
+
73
+ The final referee (`prompts/final_referee.md`) receives global context + all issues + full paper and produces a structured markdown report with eight fixed sections and no accept-or-reject recommendation. When reviewer calls have failed, `format_coverage_note` goes in as its own message block ahead of `DETECTED ISSUES` so the report states its own limits without the note reading as a finding.
74
+
75
+ ## Invariants worth preserving
76
+
77
+ - **Resume hangs off `state.json`, not off filenames.** Chunks are identified by `chunk_key` (a hash of title + text), so an inserted section does not shift every identity, and an edited section is re-reviewed while its neighbours are not. Filenames carry an index prefix so output sorts in document order, and `retarget_reviews` moves a reused review whenever its chunk's position changes, so that ordering stays true across runs. `sweep` then deletes anything neither the current chunks nor `state.json` account for. `state.json` remains the authority on which file holds which chunk's review; the filenames are for humans. A settings change (models, effort, max tokens, or the prompt text itself via `prompts_digest`) is refused rather than silently reusing incomparable reviews. The split level is deliberately not a setting: it changes which chunks exist, which `chunk_key` already tracks. So switching it reuses every chunk that is the same at both levels. Keep the `SECTION UNDER REVIEW` header independent of the split level, or that reuse stops being sound. The whole-paper chunk's key must be passed to `state.prune` alongside the section keys, or its reviews are discarded on every resume.
78
+ - **Existing output is untrusted input.** A paper bundle can arrive with `review/state.json`
79
+ and a pre-populated output tree. Stored review names must remain validated direct
80
+ children of `reviews/`, and pipeline-managed directories and files must never follow
81
+ symbolic links; otherwise resume moves or ordinary writes can escape the output tree.
82
+ - **`reviews/*.json` is the source of truth for issues, not `issues.jsonl`.** `all_issues.json` is rebuilt from the stored reviews each run, so a crash between writing a review and appending to the log costs at most a repeated call. `issues.jsonl` is an append-only log and may hold superseded entries.
83
+ - **Section structure is matched against `mask_non_content(tex)`**, never the raw text, so a commented-out or verbatim-quoted `\section` neither invents a chunk nor truncates its neighbour. The mask preserves character offsets, so matches still index into the original.
84
+ - **`\input` targets are confined to the document's directory** (`_is_within`). Papers come from other people; without this, `\input{/etc/passwd}` would exfiltrate to the API.
85
+ - **Reviewer prompts keep their lanes.** Each prompt says what *not* to flag, naming the reviewer that covers it. Widening one produces duplicates, not coverage. Anything that should hold for every reviewer belongs in `review_protocol.md`, not copied into five files where it will drift.
86
+ - **Every schema field a reviewer fills is read downstream.** `_format_issue_full` carries `type`, `location`, `quote` and `confidence` into the final referee: the quote is how it checks a finding against the source, and the confidence is how it tells a demonstrated defect from a lead. A field the prompts calibrate but the report never sees is wasted tokens on every call.
87
+ - **No pass may assert prior art.** Nothing here can read a reference, so a claim that a result is already known would be a fabrication. The protocol, `claim_auditor.md` and `final_referee.md` each forbid it independently; keep all three.
88
+ - **Errors that would recur identically** (`FATAL_PROVIDER_ERRORS`) stop the run; everything else is recorded as a per-reviewer failure and the run continues.
89
+ - **Every generation call streams** through its provider's native SDK. Anthropic finalizes a `ParsedMessage` with `get_final_message()`; OpenAI finalizes its response with `get_final_response()`. Structured output and usage are normalized behind `GenerationResult`. `MAX_OUTPUT_TOKENS` (64000) is only a CLI typo guard; model-specific output limits live in the provider capability tables, which are checked before a run.
90
+ - **`max_tokens` is headroom, not a budget to spend.** Thinking and the response share it, and a call cut off mid-JSON is billed in full and yields nothing — so a cap set too low *causes* cost rather than limiting it. `DEFAULT_MAX_TOKENS` is 32000 for that reason. When a reviewer truncates anyway, `call_reviewer` retries once at one `--effort` level down (`lower_effort`) and `run_final_referee` does the same; a second truncation is a real failure. Note that a retried review was produced at lower effort than `state.json` records for the run.
91
+ - **Tests must not need the network or credentials.** Stub the client, as `FakeClient` does.
92
+
93
+ ## Dependencies
94
+
95
+ `anthropic`, `openai`, `pydantic`, `rich`; `httpx2`, `pytest`, and `ruff` for development. All are declared in `pyproject.toml` and locked in `uv.lock` — install with `uv sync`.
@@ -0,0 +1,343 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project are documented here. The format is based on
4
+ [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to
5
+ [Semantic Versioning](https://semver.org/spec/v2.0.0.html) — with the caveat that before
6
+ 1.0 anything may change between releases.
7
+
8
+ ## [Unreleased]
9
+
10
+ ## [0.4.0a1] — 2026-10-29
11
+
12
+ Prompts brought back in line with the `referee` skill in Mathbox, which was ported from
13
+ these prompts and refined since.
14
+
15
+ **This invalidates existing output directories.** The review protocol and the reviewer
16
+ prompts changed, so a `review/` made with the old prompts is refused rather than mixed
17
+ with findings from the new ones. Delete it, or pass a different `--output`.
18
+
19
+ ### Added
20
+
21
+ - `--split subsection` hands the section-scoped reviewers one `\subsection` at a time
22
+ instead of one `\section`, for papers whose sections are too long to review well in one
23
+ call. A section's text before its first subsection goes with that subsection unless it
24
+ is long enough to stand alone, and a section with no subsections is still reviewed
25
+ whole. Switching levels on an existing output directory reuses every chunk that is the
26
+ same at both levels. A document organised only by `\subsection`, which used to be
27
+ rejected, can now be reviewed with this flag.
28
+
29
+ ### Changed
30
+
31
+ - The eight-section final report now uses `Main mathematical concerns`, `Other mathematical
32
+ concerns`, `Exposition and organization`, `Claim and scope assessment`, and an `Overall
33
+ assessment` that replaces `Recommendation`. The pipeline is told nothing about the venue
34
+ or its standards, so it no longer issues an accept-or-reject verdict. It says what the
35
+ paper establishes and what it does not. Claim calibration has its own section instead of
36
+ competing with mathematical defects for space among the main concerns.
37
+ - The final referee now rebuilds every alleged failed implication or counterexample
38
+ before reporting it, and grades severity and confidence from that check rather than
39
+ taking the reviewer's grades. It requires locating the source passage behind every
40
+ finding, drops any it cannot check, and does not count agreement between reviewers as
41
+ evidence.
42
+ - A counterexample now counts only once it is checked against every hypothesis of the
43
+ statement, global conventions included, and its conclusion is shown to fail.
44
+ `AdversarialSkeptic` also checks that any witness lies in the claimed domain. Induction
45
+ base cases are now listed among the degenerate cases it probes.
46
+ - `FormalVerifier` checks what population a computer calculation or table actually
47
+ covers, and does not accept finite evidence as proof beyond the range checked. On
48
+ citation drift it states what the cited result would have to say for the application
49
+ to go through.
50
+ - The shared protocol now distinguishes five kinds of conclusion: invalid inference, gap,
51
+ missing context, presentation, and uncertainty about cited work. It treats `DETECTED
52
+ ISSUES` as unchecked leads and asks for one finding per recurring defect. It also allows
53
+ a materially overclaimed headline to be `critical`, which `ClaimAuditor` already
54
+ required.
55
+ - Prior-art rules now also forbid inferring that a result is new, and forbid filling in a
56
+ cited result's content from memory. `ClaimAuditor`'s missing-positioning check is
57
+ limited to work the paper itself cites.
58
+ - `NotationAuditor` reports where it searched before filing an undefined symbol. It no
59
+ longer echoes a section reviewer's "undefined" or "broken reference" lead that the full
60
+ source resolves.
61
+ - Refreshed the locked Anthropic, OpenAI, Pydantic, httpx2, and Ruff dependencies, and
62
+ updated the uv setup action used by CI.
63
+ - Restored the release workflow that builds and validates distributions, then publishes
64
+ them to TestPyPI and PyPI when a GitHub release is published.
65
+
66
+ ## [0.3.0a1] — 2026-09-15
67
+
68
+ ### Added
69
+
70
+ - Independent final-referee model selection through `--final-model`. Changing only the
71
+ synthesis model reuses compatible stored reviewer findings and regenerates the report.
72
+ - The `astra-sol-luna` preset, which uses GPT-6 Astra for final synthesis, GPT-5.6 Sol for
73
+ strong reviewers, and GPT-5.6 Luna for fast reviewers.
74
+
75
+ ### Changed
76
+
77
+ - OpenAI prompt-cache breakpoints now apply to GPT-5.6 and later models, including Astra.
78
+ - Refreshed the locked Anthropic, OpenAI, Pydantic, httpx2, and Ruff dependencies.
79
+
80
+ ### Fixed
81
+
82
+ - Updated Claude Sonnet 5 and GPT-5.6 pricing metadata, including the GPT-5.6
83
+ long-context multipliers used by dry-run cost estimates.
84
+
85
+ ### Security
86
+
87
+ - Pinned third-party GitHub Actions to full commit hashes and restricted CI's default
88
+ token permissions to read-only repository contents.
89
+
90
+ ## [0.2.0a2] — 2026-08-26
91
+
92
+ ### Changed
93
+
94
+ - Renamed the project, package, and command from `llm-reviewer` to `math-scout`.
95
+
96
+ ### Fixed
97
+
98
+ - Resume state can no longer name a review outside `reviews/`, and pipeline-managed
99
+ output paths refuse symbolic links. A crafted `review/state.json` in a paper bundle
100
+ could previously move an arbitrary file during resume bookkeeping; pre-positioned
101
+ output symlinks could likewise redirect chunk or report writes.
102
+
103
+ ## [0.2.0a1] — 2026-08-17
104
+
105
+ **This invalidates existing output directories.** State now records qualified Anthropic
106
+ model IDs, so prior state containing bare IDs no longer matches. Delete `review/`, or pass
107
+ a different `--output`; existing paid reviews are not migrated.
108
+
109
+ ### Added
110
+
111
+ - Native OpenAI Responses API support alongside Anthropic. Explicit model flags require
112
+ `provider:model`, so strong and fast tiers can use different providers while the final
113
+ referee continues to follow the strong tier. Bare model IDs are rejected rather than
114
+ inferred as Anthropic.
115
+ - Provider-neutral generation, token-counting, capability, pricing, retry, and error
116
+ contracts, with credential-free adapter tests bound to both installed SDK signatures.
117
+ - `--preset opus-sonnet` and `--preset sol-luna` select the common Anthropic and OpenAI
118
+ strong/fast pairs; explicit tier flags can override either half of a preset.
119
+
120
+ ### Changed
121
+
122
+ - Dry runs group exact token counts by provider-qualified model and keep working when
123
+ pricing metadata is unavailable. Every model in resume settings is stored with its
124
+ provider; historical bare Anthropic state is rejected by the settings-mismatch guard.
125
+ - Prompt caching is translated natively: Anthropic cache controls are preserved, while
126
+ OpenAI GPT-5.6 requests use developer `input_text` breakpoints and a deterministic
127
+ paper-specific cache key.
128
+ - OpenAI Luna dry-run estimates use its current $0.20 input and $1.20 output rates per
129
+ million tokens.
130
+
131
+ ## [0.1.0a2] — 2026-08-16
132
+
133
+ **This invalidates existing output directories**, on two counts: the `--max-tokens`
134
+ default has changed, and the reviewer prompts have (see the prompt audit below). Both are
135
+ part of the settings a resume is keyed on. Delete `review/`, or pass a different
136
+ `--output`.
137
+
138
+ ### Fixed
139
+
140
+ - Reviewers ran out of output budget mid-answer on ordinary sections and the whole run
141
+ degraded. On one 100k-character paper, 11 of 23 reviewer calls and the final referee
142
+ were cut off before finishing their JSON, and the report was synthesised from partial
143
+ coverage. Truncated calls are billed in full and return nothing usable, so roughly 60%
144
+ of that run's spend bought discarded tokens.
145
+
146
+ The cause was `max_tokens`, which thinking and the response share, pinned at 16000
147
+ because every call was non-streaming — the SDK refuses a non-streaming request
148
+ estimated to run past ten minutes, which capped the budget at 21333. Every generation
149
+ call now streams, so the cap is the model's own output limit instead. This is why
150
+ raising the default is not a cost increase: unused budget is never billed, so the old
151
+ cap was *causing* the spend rather than limiting it.
152
+
153
+ Only the reviewer with thinking disabled was unaffected, on every section size — which
154
+ is what identified thinking as what the budget was going to.
155
+
156
+ - `chunks/` and `reviews/` accumulated files from earlier runs. Nothing removed them, and
157
+ a reused review kept the filename it was first written under, so after inserting or
158
+ deleting a section the index prefixes no longer matched the document — `chunks/` could
159
+ hold both `00_Alpha.tex` and `01_Alpha.tex` with no way to tell which was current.
160
+ Reviews are now renamed into their new positions when a chunk moves, and anything
161
+ neither the current chunks nor `state.json` account for is deleted. Nothing is re-run:
162
+ the rename is bookkeeping, not a re-review.
163
+ - The chunk index is three digits, so the prefix still sorts past a hundred sections.
164
+ Existing output directories rename themselves on the next run.
165
+
166
+ ### Changed
167
+
168
+ - `--max-tokens` defaults to 32000 (was 16000) and accepts up to 64000 (was 21333). Every
169
+ supported model allows at least 64K output tokens; the Opus 5 and Sonnet 5 families
170
+ allow 128K.
171
+ - A call that exhausts its budget is retried once at one `--effort` level down, trading
172
+ some depth on that section for producing a review at all. A second truncation is
173
+ reported as a failed call and the run continues, as before.
174
+ - `--dry-run` prints two output ceilings rather than one: assuming no call truncates, and
175
+ assuming every call truncates and is retried. The single figure it printed before stopped
176
+ being an upper bound once a call could bill two attempts.
177
+
178
+ Prompt audit: the reviewer set, the prompts, and the plumbing between them.
179
+
180
+ **This invalidates existing output directories.** `run_settings` now records a hash of
181
+ every prompt that shapes a stored review — the protocol and the five reviewer prompts, but
182
+ not `final_referee.md`, which shapes only the report and is regenerated on every run. A
183
+ `review/` produced before this change is refused rather than mixed with findings from the
184
+ new prompts. Delete it, or pass a different `--output`.
185
+
186
+ ### Added
187
+
188
+ - `ClaimAuditor`, a fifth reviewer, reading the whole paper: it compares what the abstract
189
+ and introduction promise against what the theorems actually state and prove. Nothing
190
+ previously checked for overclaiming, and the recommendation was purely defect-driven —
191
+ a correct but unremarkable paper scored **Accept**.
192
+ - `prompts/review_protocol.md`, sent to every reviewer ahead of its own prompt. It holds
193
+ one severity scale, one confidence scale, and one field-by-field description of the
194
+ output schema. The four prompts previously carried their own copies, which had drifted,
195
+ and which fed a single filter in the final referee as though they were comparable.
196
+ - A reviewer `scope`: `NotationAuditor` now reads the whole paper in one pass instead of
197
+ each section separately. Consistency is a relation between two occurrences, and it could
198
+ previously see only one of them; its own prompt told it to hedge with "appears to", and
199
+ the final referee had a rule for discarding the false positives that produced. On a
200
+ multi-section paper this is also fewer calls than before.
201
+ - A `# Questions for the authors` section in the report, so a low-confidence finding has
202
+ somewhere to go other than being inflated into a main concern or dropped.
203
+ - Explicit instructions, in three separate prompts, never to assert prior art: nothing
204
+ here can read a reference, so a claim that a result is already known would be invented.
205
+
206
+ ### Fixed
207
+
208
+ - Every reviewer prompt told the model to skip concerns already in a `KNOWN ISSUES` block.
209
+ No such block was ever sent — the pipeline sends `DETECTED ISSUES` — so the
210
+ de-duplication instruction had never once fired.
211
+ - `type`, `quote` and `confidence` were collected from every reviewer, written to
212
+ `reviews/*.json`, and then dropped before the final referee saw anything. Four prompts
213
+ were calibrating a confidence score that reached nothing. All three now reach the report,
214
+ and the referee is told how to use them: the quote to check a finding against the source,
215
+ the confidence to tell a demonstrated defect from a lead.
216
+ - The final referee prompt described its input as "deduplicated issues". They were never
217
+ deduplicated. It now says so, and deduplicating is stated as its job.
218
+ - The `COVERAGE GAPS` note about failed reviewer calls was concatenated onto the front of
219
+ the issue list, so it appeared under the `DETECTED ISSUES` heading as though it were a
220
+ finding. It is now its own message block.
221
+ - Nothing checked arithmetic: `FormalVerifier` was told not to look for algebraic mistakes
222
+ and no other reviewer covered them. It now works through computations the argument rests
223
+ on, while still leaving routine algebra alone.
224
+ - Reviewers are now told what they can and cannot see, including that the `## Theorem N`
225
+ headings in the global context are extraction indices rather than the paper's own
226
+ numbering — a reviewer citing "Theorem 3" could mean neither.
227
+ - `ExpositionReferee` findings are capped at `major` and routed to the report's exposition
228
+ section. A hard-to-follow proof was previously able to enter Main concerns beside a
229
+ theorem that does not hold.
230
+
231
+ ### Changed
232
+
233
+ - `NotationAuditor` now runs with thinking enabled. Whole-paper scope turned its job into
234
+ tracing the order in which results are actually established and collapsing every
235
+ occurrence of a symbol into one finding — neither is the lookup that per-section
236
+ consistency checking was. It stays on the fast tier: the work is bookkeeping, not
237
+ mathematics.
238
+ - The shared severity scale now says how it applies to findings that are not about
239
+ correctness. Grading exposition and notation purely against the paper's claims left
240
+ them no rung above `minor`, since by construction they leave the claims alone.
241
+ - "A statement carries a hypothesis its proof never uses" and "a proof needs a hypothesis
242
+ its statement does not grant" were claimable by three reviewers under three type slugs,
243
+ and `notation_auditor.md` asserted and disclaimed the same defect twelve lines apart.
244
+ Each direction now has exactly one owner.
245
+ - The final referee's routing rules are ordered and disjoint, so a finding lands in one
246
+ section rather than matching two rules with no stated precedence.
247
+ - "Used but never defined anywhere in the paper" belonged to nobody: section reviewers
248
+ are told to presume such a symbol is defined elsewhere, and nothing picked it up
249
+ afterwards. It is `NotationAuditor`'s, which is the only pass that can see the whole
250
+ document.
251
+
252
+ ## [0.1.0a1] — 2026-08-03
253
+
254
+ First public release. Everything before this lived only in the author's working tree.
255
+
256
+ ### Added
257
+
258
+ - MIT license, packaging metadata, and a `math-scout` command installable with
259
+ `uvx --from git+https://github.com/nidrissi/math-scout`.
260
+ - Multi-file LaTeX support: `\input{}` and `\include{}` are resolved and inlined before
261
+ chunking, with commented-out references ignored, cycles broken, and missing targets
262
+ warned about rather than fatal.
263
+ - `--yes/-y` for non-interactive runs, plus a clear error instead of an `EOFError`
264
+ traceback when stdin is not a terminal and the flag is absent.
265
+ - `--strong-model`, `--fast-model`, `--max-tokens`, and `--effort` flags. Cost estimation
266
+ covers the current Opus, Sonnet, and Haiku models; unknown model IDs still run, and
267
+ `--dry-run` reports their token counts without a price.
268
+ - Per-reviewer extended thinking, chosen on the shape of each task: `FormalVerifier`,
269
+ `AdversarialSkeptic`, and the final referee think; `NotationAuditor` and
270
+ `ExpositionReferee` do not, because symbol and reference checking is scanning rather
271
+ than reasoning.
272
+ - Invalid invocations are refused before any request: `--max-tokens` above the
273
+ non-streaming ceiling of 21333, and a disabled-thinking reviewer on a model that
274
+ rejects that at `xhigh` or `max` effort.
275
+ - A free pre-flight check that verifies credentials and every model ID before the run
276
+ writes anything or asks for confirmation.
277
+ - Failure reporting: reviewer failures are collected, summarised, passed to the final
278
+ referee so the report states its own coverage gaps, and reflected in the exit code
279
+ (`0` clean, `1` incomplete, `2` misconfigured).
280
+ - Body text between `\begin{document}` and the first `\section` is now reviewed as a
281
+ "Front matter" chunk when it holds enough prose.
282
+ - Test suite, ruff configuration, and GitHub Actions CI on Python 3.11 and 3.12.
283
+
284
+ ### Changed
285
+
286
+ - Default models are now `claude-opus-5` and `claude-sonnet-5`. Opus 5 costs the same as
287
+ Opus 4.7 and lowers the minimum cacheable prompt from 2048 to 512 tokens, so short
288
+ global contexts now benefit from prompt caching. Sonnet 5 uses a newer tokenizer that
289
+ produces roughly 30% more tokens for the same text, so the two fast reviewers cost
290
+ proportionally more per run at the same per-token rate.
291
+ - `--max-tokens` defaults to 16000, up from 8192, because it now covers extended thinking
292
+ and response text together. It is capped at 21333, above which the SDK requires
293
+ streaming.
294
+ - A reviewer that runs out of tokens mid-JSON now says so and names the fix, instead of
295
+ reporting a generic "no parsed output".
296
+ - Credentials resolve through the Anthropic SDK, so an `ant auth login` profile works in
297
+ addition to `ANTHROPIC_API_KEY`.
298
+ - Chunk output filenames are prefixed with the section index, so two sections whose titles
299
+ reduce to the same slug no longer overwrite each other.
300
+ - Errors that would recur identically on every call — rejected credentials, an unknown
301
+ model — now stop the run instead of repeating once per reviewer per section.
302
+ - A failure in the final referee pass no longer discards the run; collected issues stay on
303
+ disk and re-running resumes from them.
304
+ - `\title{}` containing braces (for example `\title{Cohomology of $\mathbb{Z}$}`) is now
305
+ extracted correctly.
306
+
307
+ ### Fixed
308
+
309
+ - Resume is tracked in `review/state.json` against a hash of each section's text, not by
310
+ the existence of a review file. Previously, editing the paper and re-running silently
311
+ reused reviews of text that no longer existed and reported them as current, while
312
+ inserting a section shifted every filename and duplicated every prior issue in the
313
+ final report. Changing models, effort, or token limits between runs is now refused
314
+ rather than silently ignored.
315
+ - Issues are rebuilt from the stored reviews rather than from `issues.jsonl`, closing the
316
+ window where a crash between writing a review and appending to the log lost findings
317
+ that were sitting intact on disk.
318
+ - Section headings are matched against comment- and verbatim-masked text. A commented-out
319
+ `\section` no longer splits the section it sits in or invents one, and a `\section`
320
+ quoted inside `verbatim` no longer deletes the text that follows it from the review.
321
+ - `\input` and `\include` are confined to the document's own directory. An absolute path
322
+ or a `../` escape previously read the target and sent it to the API.
323
+ - A non-UTF-8 source produces a clear error naming the file instead of an uncaught
324
+ `UnicodeDecodeError`; Latin-1 is common in older LaTeX.
325
+ - The pre-flight reports rate limits and server errors instead of raising them as
326
+ tracebacks, and retries briefly first.
327
+ - `--fast-model anthropic:claude-haiku-4-5` is refused with an explanation: Haiku 4.5
328
+ rejects the effort and thinking settings every call carries, so it could not have
329
+ worked.
330
+ - A typo in the input path no longer leaves an empty output directory behind.
331
+
332
+ ### Removed
333
+
334
+ - The unused `RapidFuzz` dependency, and `.github/requirements.txt` in favour of
335
+ `pyproject.toml`.
336
+
337
+ [Unreleased]: https://github.com/nidrissi/math-scout/compare/v0.4.0a1...HEAD
338
+ [0.4.0a1]: https://github.com/nidrissi/math-scout/compare/v0.3.0a1...v0.4.0a1
339
+ [0.3.0a1]: https://github.com/nidrissi/math-scout/compare/v0.2.0a2...v0.3.0a1
340
+ [0.2.0a2]: https://github.com/nidrissi/math-scout/releases/tag/v0.2.0a2
341
+ [0.2.0a1]: https://github.com/nidrissi/math-scout/releases/tag/v0.2.0a1
342
+ [0.1.0a2]: https://github.com/nidrissi/math-scout/releases/tag/v0.1.0a2
343
+ [0.1.0a1]: https://github.com/nidrissi/math-scout/releases/tag/v0.1.0a1
@@ -0,0 +1 @@
1
+ @AGENTS.md