ingest-corpus
Skill2 starsChanged 2 months agoApache-2.0View on GitHub
Use when adding mathematical statements to the Hardy corpus from a textbook or other source - harvesting exercises and theorems into corpus/problems/, registering sources and ids, and cutting the release. Covers the field-by-field rules, the twin convention, and the checks that must pass before the work is done.
1 other project uses a version of this.
Adopted by
Most recently taken up by
- egregore-labs/egregoretheir own version, first seen Nov 6, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- egregore-labs/egregore★ 293same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
The file
We split this skill into the rules it gives an agent
11 rules. About 0 are common, 1 is distinctive, and 10 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
10
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 14
Read corpus/SCHEMA.md before starting.
- Very specific: line 23
Run check after every few entries, not once at the end.
- Very specific: line 28
Add it to corpus/problems/<NN>.json, where <NN> is the first two characters of its primary MSC code.
- Very specific: line 73
Put premises in binders, so they can be existentially closed.
- Very specific: line 76
Write the term against ∃ <binders>, True: for (n : ℕ) (h : n > 0) that is ⟨1, by norm_num, trivial⟩.
- Very specific: line 136
Do not edit corpus_version or CHANGELOG.md by hand.
- Very specific: line 162
Do not set status: "active" or write a review record.
- Very specific: line 164
Do not invent MSC codes. The vendored table is the whole of MSC2020.
- Very specific: line 167
Do not edit evals/baseline.json.
- Distinctive: line 168
Do not delete or retag an existing entry to make room.
- Very specific: line 170
Do not guess a witness to clear the unwitnessed count.
≈ “Common” is an estimate: at least 1 in 5 of the 372,429 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Adding entries to the Hardy corpus
The corpus measures what provers and models can do, sliced by mathematical field. Its value rests entirely on the entries being right: a statement whose Lean says something other than its prose, or a result filed under the wrong field, is worse than a missing entry, because it silently corrupts the claim the whole dataset exists to make.
Read corpus/SCHEMA.md before starting. This is the procedure.
The loop
hardy evals corpus check # must exit 0 before you are done
hardy evals corpus serve # look at what you wrote, renderedRun check after every few entries, not once at the end. It names the entry
and the problem, and fixing five objections is much easier than fifty.
One entry, field by field
Add it to corpus/problems/<NN>.json, where <NN> is the first two characters
of its primary MSC code. Create the shard if it does not exist, copying the
envelope (schema_version, corpus_version, entries) from a sibling.
| Field | Rule |
id | lowercase slug, hyphens, permanent. Never reused, even after retirement. |
input | Your own restatement, never the book's wording. Inline LaTeX. |
name | Lean identifier, PascalCase, unique across the whole corpus, not just this shard. |
binders | Hypotheses go here, not in conclusion — see A6 below. No :=, no newlines. |
conclusion | The proposition alone. No :=, no newlines. |
imports | Usually ["Mathlib"]. |
expected | "true", or "false" for a deliberate perturbation — see twins. |
msc | Published MSC2020 forms only: 11Axx (section) or 11J72 (subsection). Primary first. |
difficulty | routine / substantial / qualifying / research-adjacent. Your honest read. |
occurrences | [{"source_id": ..., "locator": [chapter, section, item]}], first is primary. |
rationale | Required only when there are no occurrences; says what the entry is for. |
witness | See A6. null needs a witness_note saying why. |
status | Always "candidate". Never write active or a review record. |
input must state every hypothesis the Lean carries
This is the most common real error. If binders has (hn : 0 < n), the prose
must say so. A prompt that omits a premise the declaration requires is asking
the model to prove a different theorem — and a reviewer comparing them will
approve the mismatch, because the prose reads fine on its own.
One entry in this corpus already had this bug: "among any $n+1$ integers, two
are congruent modulo $n$" beside a Lean statement carrying 0 < n. At $n = 0$
the prose is false and the Lean is guarded.
Copyright: restate, never copy
The mathematics in a theorem is not copyrightable; a book's prose is. Write
input yourself. occurrences records a citation, which is what any paper
does. Never reproduce the source's sentences, and never copy from a solutions
manual.
A6: hypotheses belong in binders
A witness is checked as theorem <Name>Witness : ∃ <binders>, True := <witness>
with #print axioms appended. It proves the hypotheses are satisfiable —
without it, a statement whose premises are impossible is vacuously true and
nothing catches it.
- Put premises in
binders, so they can be existentially closed. A premise hidden insideconclusion(∀ n < 10, ...with empty binders) leaves the entryunwitnessed, because nothing here parses Lean to find it. - Write the term against
∃ <binders>, True: for(n : ℕ) (h : n > 0)that is⟨1, by norm_num, trivial⟩. sorryis a warning, not an error. A witness using it is recordedbroken. Do not use it to make the check pass.- Implicit
{α : Type*}and instance[Group G]binders cannot be closed by∃. Setwitness: nullwith awitness_notesaying exactly that.
Twins
A twin is a false entry that perturbs a true one — the soundness instrument
that catches a model agreeing with anything. It needs expected: "false",
twin_of naming the true entry, and the same primary MSC code as its
target. A good twin is plausible: flip an inequality, drop a hypothesis, weaken
a bound. Not obviously absurd.
Registering what an entry refers to
Both are separate files and both are checked.
Every new source goes in corpus/sources.json before any entry cites it:
"atiyah-macdonald": {
"citation_key": "AM69",
"authors": ["M. F. Atiyah", "I. G. Macdonald"],
"title": "Introduction to commutative algebra",
"publisher": "Addison-Wesley Publishing Co.",
"address": "Reading, Mass.-London-Don Mills, Ont.",
"year": 1969,
"level": "graduate",
"locator_style": "chapter-item",
"locator_convention": "(chapter, 0, n) is body item chapter.n; (chapter, 1, n) is exercise n."
}The citation fields are the AMS book fields (authors, title, edition,
note, series, volume, publisher, address, year), taken from the
book's own title and copyright pages, not from memory. locator_style is one
of chapter-item, section-item, numbered-section, section-theorem,
paragraph, competition-problem — cite_locator in
src/hardy/app/corpus_viewer.py says what each makes of a triple — and decides
how the viewer prints [AM69, 1.11]. Pick the style that matches how the
source is actually cited, and write the prose convention beside it.
A competition paper is one source per sitting, not one source per contest:
its problems are numbered A1–B6 within a single year, and nothing outside
that year is in scope for a locator. So a Putnam harvest registers
putnam-2024, putnam-2023, … separately, each with
locator_style: "competition-problem" and locators (1, 0, n) for An and
(2, 0, n) for Bn. The citation then reads [Putnam 2024, A1], and the
lexicographic order on locators is the order the problems were sat, which is
what the antecedent rule needs.
Every new id goes in corpus/tombstones.json under issued, with today's
date. The registry is append-only: never remove a key, never change a date. An
id that vanishes takes any external citation with it, and CI compares this file
against the merge base.
Cutting the release
Do not edit corpus_version or CHANGELOG.md by hand. The manifest digest
covers the content, so it can only be computed after the entries land, and
every shard must agree on the version. One command does all of it in the order
that works:
hardy evals corpus release --version 0.3.0 \
--note '`nilpotent-in-every-prime`, `zorn-maximal-ideal`: first entries from Atiyah-Macdonald.'Versions: patch corrects (a fixed statement, a wrong MSC tag), minor
adds entries, major breaks the schema. It only ever goes up. The command
prints whatever check would still object to, and exits non-zero if anything
remains.
Before you say you are done
hardy evals corpus checkexits 0.hardy evals corpus reportshows the entries where you expect them.- You have looked at a sample in
hardy evals corpus serve— the rendered prose beside the Lean is where a mismatch becomes obvious. The Faithful button there is for a human's read, not yours: do not press it for entries you wrote.
What not to do
- Do not set
status: "active"or write areviewrecord. Promotion is a human faithfulness read, and the record binds digests you cannot forge. - Do not invent MSC codes. The vendored table is the whole of MSC2020; if a
code is rejected it does not exist.
hardy evals corpus serveshows each code with its official name — use it to check you picked the right one. - Do not edit
evals/baseline.json. It is measurement, not content. - Do not delete or retag an existing entry to make room. Retiring is a status change with a reason, and the id stays.
- Do not guess a
witnessto clear the unwitnessed count.nullwith an honest note is correct and expected.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

