autoformalize

autoformalize is a command for coding agents from frenzymath/Archon. It costs 14 tokens per session (1,496 once invoked), scanned A, original, Apache-2.0.

A command that turns claims from a file, web address, or PDF into Lean 4 statements and attempted proofs. It combines drafting the formal statements with trying to prove them.

In plain words
What is it for?
Use it to formalize selected claims from papers, notes, PDFs, or URLs into a target Lean file, with sketch or checked proof output.
Why use it?
It reduces the manual work of reading an informal source, selecting claims, writing Lean code, and checking whether the resulting proofs work.

Command

Part of the lean4 plugin — 1 skill, 11 commands, 4 agents, 3 hooks shipped together

Install

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.

agentmods
npx agentmods add commands/frenzymath/archon/autoformalize
Clone the repo
git clone --depth 1 https://github.com/frenzymath/Archon

Or install lean4, the plugin that ships this one along with the rest of its 1 skill, 11 commands, 4 agents, 3 hooks.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for autoformalize

README.md
[![agentmods](https://agentmods.dev/badge/commands/frenzymath/archon/autoformalize.svg)](https://agentmods.dev/commands/frenzymath/archon/autoformalize)
Your own site
<a href="https://agentmods.dev/commands/frenzymath/archon/autoformalize"><img src="https://agentmods.dev/badge/commands/frenzymath/archon/autoformalize.svg" alt="Measured on agentmods" height="20"></a>
Per session 14 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,496 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What 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.

ModelPer sessionOnce invoked
Fable 5 $0.00014 $0.01496
Opus 5 $0.00007 $0.00748
Sonnet 5 $0.00003 $0.00299
Haiku 4.5 $0.00001 $0.00150

Measured 4d ago against content hash 77dc99f4520f, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

autoformalize 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 4d 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.

src/archon/.archon-src/skills/lean4/commands/autoformalize.md · 116 lines

How it starts

The opening of the file, as written. The whole thing — 116 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Lean4 Autoformalize

Autonomous end-to-end formalization: extracts claims from a source, drafts Lean skeletons, and proves them — all unattended. Combines /lean4:draft and /lean4:autoprove in a single command.

Usage

/lean4:autoformalize --source ./paper.pdf --claim-select=first --out=Paper.lean
/lean4:autoformalize --source ./paper.pdf --claim-select=regex:"Theorem.*" --out=Paper.lean --rigor=checked
/lean4:autoformalize --source ./notes.md --claim-select=named:"Main Lemma" --out=Lemma.lean

Inputs

Arg Required Default Description
--source yes File path, URL, or PDF for claim extraction.
--claim-select yes first | named:"..." | regex:"...". Queue-extraction filter applied once at startup.
--out yes Target file for formalized claims.
--statement-policy no rewrite-generated-only preserve | rewrite-generated-only | adjacent-drafts.
--rigor no sketch sketch | checked. Rigor for drafted skeletons.
--draft-mode no skeleton skeleton | attempt. Passed to draft phase.
--draft-elab-check no best-effort best-effort | strict. Passed to draft phase.
--max-cycles no 20 Hard stop: max total cycles per claim
--max-total-runtime no 120m Hard stop: max total runtime
--max-stuck-cycles no 3 Hard stop: max consecutive stuck cycles per claim
--deep no stuck never, stuck, or always
--deep-sorry-budget no 2 Max sorries per deep invocation
--deep-time-budget no 20m Max time per deep invocation
--max-deep-per-cycle no 1 Max deep invocations per cycle
--deep-snapshot no stash V1: stash only
--deep-rollback no on-regression on-regression | on-no-improvement | always | never
--deep-scope no target target | cross-file
--deep-max-files no 2 Max files per deep invocation
--deep-max-lines no 200 Max added+deleted lines per deep invocation
--deep-regression-gate no strict strict | off
--commit no auto auto | never
--golf no never prompt | auto | never
--review-source no internal internal | none (coerced from external/both — see autoprove)
--review-every no checkpoint N (sorries) | checkpoint | never

Read the full file on GitHub · 116 lines

Changes

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.

  1. 4d ago First seen · 116 lines · 14 tokens per session scan A 77dc99f4520f

Subscribe to this mod's changes

autoformalize is a command published in the GitHub repository frenzymath/Archon (213 stars, last pushed 17d ago), licensed Apache-2.0. It adds 14 tokens to every session and 1,496 once invoked, about $0.0001 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-30.