Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx agentmods add skills/nasqret/lean-interact/formalizenpx skills add nasqret/lean-interact --skill formalizegit clone --depth 1 https://github.com/nasqret/lean-interactWhat it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.00168 | $0.04398 |
| Opus 5 | $0.00084 | $0.02199 |
| Sonnet 5 | $0.00034 | $0.00880 |
| Haiku 4.5 | $0.00017 | $0.00440 |
Grade A, and why
formalize scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 315 lines — stays where its author put it; the contents beside it link to each section on GitHub.
formalize
The core loop of this repository. The user — a working mathematician who knows the mathematics and is learning Lean — types a sentence of ordinary mathematics; you return compiled Lean plus a short teaching note.
Repository root: /path/to/lean-interact, the directory this clone lives in. Use absolute
paths when reading and editing files. Run the tools/ scripts from the repository root with
repo-relative paths (python3 tools/mlq.py …): that is the form .claude/settings.json
allows without a permission prompt, and it is the form to show the user.
Before the first formalization of a session, read MEMORY.md and
vault/Formalization Style.md. They contain decisions you would otherwise contradict.
Run the steps in order. Do not skip steps because the claim looks easy; the cheap steps are the ones that prevent the expensive mistakes.
Step 1 - UNDERSTAND
Restate the claim as precise mathematics before touching any file. Make explicit, in one short paragraph:
- every quantifier and its range;
- every hypothesis, including the ones ordinary prose leaves silent (
pprime often means odd; "a/b" often meansb ∣ a; "the order of a" presupposesgcd(a, n) = 1); - the ambient type.
Choose the ambient type using vault/Nat vs Int vs ZMod.md. If that note is not present
yet, use the table in vault/Formalization Style.md section 1. The short version:
| The claim is about | Type |
|---|---|
| counting, divisibility, gcd, primes, no subtraction | ℕ, with Nat.ModEq for congruences |
| genuine differences, negatives, Bezout coefficients | ℤ, with Int.ModEq |
| a fixed numeral modulus, ring or unit structure mod n, squares, orders | ZMod n |
a quantified modulus n |
Nat.ModEq / Int.ModEq, never ZMod n (dependent type pain) |
Ambiguity rule. Ask at most ONE short question, and only if the answer would change the
statement. Otherwise state the assumption in one clause and continue:
"Taking n > 0 and a coprime to n; say if you meant otherwise." Never open a
formalization with a list of questions.
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 3d ago First seen · 315 lines · 168 tokens per session scan A 4f6a803e68ff
formalize is a skill published in the GitHub repository nasqret/lean-interact (10 stars, last pushed 25d ago), licensed MIT. It adds 168 tokens to every session and 4,398 once invoked, about $0.0008 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.
Other skills, from other repositories
mathlib-api
Evidence-driven workflow for designing a Mathlib definition and the API around it. Use when adding a new structure/def intended for mathlib; when choosing between design alternatives (index type as field vs parameter, Set vs indexed family, coarse set vs finer indexed structure and when the fine one should exist at…
lean-probe
Fast Lean 4 proof verification for coding agents via the LeanProbe MCP server's warm REPL. Use when you need to know whether Lean 4 code compiles (no errors, no sorry), iterate on a declaration inside a Lake/Mathlib project, test a replacement proof candidate, or explore a goal tactic by tactic — far faster than lake…
screen
Screen informal↔Lean 4 statement pairs for faithfulness defects. Use whenever writing, editing, translating, or reviewing Lean 4 theorem or definition statements that are meant to formalize informal mathematics: after drafting a statement, before committing formalizations, when auditing a benchmark file, or when the…
learn-from-math-agent-trajectories
Review completed or paused mathematical agent transcripts, visible reasoning, code, searches, tool calls, corrections, and final claims to extract evidence-backed lessons for Jacobian operations, discovery, contracts, skills, evaluations, and documentation. Use for mathematical workflow retrospectives and "what should…
decompose-mathematical-solution-corpora
Decompose a bounded corpus of mathematical proofs, formalizations, scripts, and certificates into recurring solution techniques and the smallest reusable Jacobian postconditions. Use for repository- or corpus-level “what can Jacobian learn?” audits; do not use for one operation contract or one agent trajectory.
verifier-evaluations
Design, audit, and repair fail-closed mathematical verifiers and evaluation contracts, including public schemas, frozen-input binding, task-specific witnesses, diagnostic scoring, adversarial fixtures, and Oracle validation. Use when a verifier can crash, accept malformed claims, reject equivalent witnesses, leak…