lean4-proof-golfer

lean4-proof-golfer is an agent for Claude Code from frenzymath/Archon. It costs 47 tokens per session (1,939 once invoked), scanned A, original, Apache-2.0.

A Lean 4 proof-improvement agent for shortening and clarifying proofs that already compile. Lean 4 is a programming language and proof checker for formal mathematics.

In plain words
What is it for?
It helps inline safe local definitions, collapse chains of exact proof steps, and find shorter equivalent proofs.
Why use it?
It reduces repetitive proof code while checking that the result keeps the same meaning and still builds.

Agent for Claude Code

Written for Claude Code: shipped in a Claude Code plugin. Also seen: model in frontmatter; mentions subagents.

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

Good fit It helps inline safe local definitions, collapse chains of exact proof steps, and find shorter equivalent proofs.

Compare 6 agents from other repositories ↓
Install with agentmods
npx agentmods add agents/frenzymath/archon/lean4-proof-golfer
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.

Clone the repo
git clone --depth 1 https://github.com/frenzymath/Archon

Made for: Claude Code.

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 lean4-proof-golfer

README.md
[![agentmods](https://agentmods.dev/badge/agents/frenzymath/archon/lean4-proof-golfer/github.svg)](https://agentmods.dev/agents/frenzymath/archon/lean4-proof-golfer)
Your own site
<a href="https://agentmods.dev/agents/frenzymath/archon/lean4-proof-golfer"><img src="https://agentmods.dev/badge/agents/frenzymath/archon/lean4-proof-golfer/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for lean4-proof-golfer

Your own site · 80×15
<a href="https://agentmods.dev/agents/frenzymath/archon/lean4-proof-golfer"><img src="https://agentmods.dev/badge/agents/frenzymath/archon/lean4-proof-golfer.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 47 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,939 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
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.1 $0.00047 $0.01939
Opus 5.5 $0.00019 $0.00776
Sonnet 5.5 $0.00009 $0.00388
Haiku 4.5 $0.00005 $0.00194

Measured 3mo ago against content hash 8786cbc4f468, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

lean4-proof-golfer 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 3mo 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/agents/lean4-proof-golfer.md · 152 lines

How it starts

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

Inputs

  • File path to optimize
  • Passing build required (will verify before starting)
  • Search mode: off, quick (default), or full

Actions

  1. Find patterns (in policy order: directness → structural → conditional) with false-positive filtering:

    ${LEAN4_PYTHON_BIN:-python3} "$LEAN4_SCRIPTS/find_golfable.py" FILE.lean --filter-false-positives
    

    For direct-proof discovery when search_mode ≠ off or syntactic pass stalls:

    ${LEAN4_PYTHON_BIN:-python3} "$LEAN4_SCRIPTS/find_exact_candidates.py" FILE.lean
    
  2. Verify safety before inlining any binding:

    ${LEAN4_PYTHON_BIN:-python3} "$LEAN4_SCRIPTS/analyze_let_usage.py" FILE.lean --line LINE
    
    • 1-2 uses: Safe to inline
    • 3-4 uses: Check carefully (40% worth optimizing)
    • 5+ uses: NEVER inline
  3. Exact-collapse pass (for apply-exact-chain anchors from step 1):

    • Mechanical (≤30 anchors/file): construct collapsed exact → lean_multi_attempt + lean_diagnostic_messages baseline check; accept by scoring order (per golf.md: directness → inference burden → perf → length)
    • Exploratory (when search_mode ≠ off; shared budget): candidate exact from chain lemmas + local hyps + dot-notation rewrites → lean_multi_attempt; ≤2 probes/anchor, quick ≤5/file 30s, full ≤15/file 60s. Skip: calc, multi-goal, blocks >7 lines, semicolon-heavy, have/refine
  4. Lemma replacement search (if search_mode ≠ off):

    • lean_local_search first, then lean_leanfinder or lean_loogle
    • quick: 1 search, ≤2 candidates; full: 2 searches, ≤3 candidates
    • Test with lean_multi_attempt; accept the best passing replacement by scoring order (per golf.md: directness → inference burden → perf → length)
    • Budget: ≤3 search calls, max 3 candidates; uses remaining shared time budget (quick 30s, full 60s total across steps 3–4)
    • If replacement needs statement changes or multi-file refactor → stop, hand off to axiom-eliminator

Read the full file on GitHub · 152 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. 3mo ago First seen · 152 lines · 47 tokens per session scan A 8786cbc4f468

Subscribe to this mod's changes

lean4-proof-golfer is an agent published in the GitHub repository frenzymath/Archon (235 stars, last pushed 3mo ago), licensed Apache-2.0. It adds 47 tokens to every session and 1,939 once invoked, about $0.0002 per session on Opus 5.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.

Related

lean4-proof-golfer compared with agents from other repositories

lean4-proof-golfer next to 6 agents from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
lean4-proof-golferfrenzymath/ArchonAgent2353mo agoApache-2.0A47Claude Code
Geoprocessing SpecialistSHAdd0WTAka/Zen-Ai-PentestAgent53527d agoMITA45Claude Code, OpenCode
ras-commander-api-expertgpt-cmdr/ras-commanderAgent92todayMITA31Claude Code
julia-proHermeticOrmus/LibreUIUX-Claude-CodeAgent1151mo agoMITA60Claude Code
bnlearn-researchererdogant/bnlearnAgent6498d agononeA47Claude Code
codermorankor/theorist-toolboxAgent1013mo agoMITA78Claude Code
julia-proEngineerWithAI/engineerwith-agentsAgent410mo agoMITA60Claude Code