deep-golfer-prompt

deep-golfer-prompt is an agent for coding agents from CBirkbeck/mathlib-quality. It costs 0 tokens per session (2,220 once invoked), scanned A, original, MIT.

An agent that examines Lean 4 mathematical proofs line by line for ways to make them shorter and clearer. Proof golfing means reducing unnecessary steps without changing what the proof establishes.

In plain words
What is it for?
Use it to optimize proofs, apply known mathlib review patterns, and inspect code for simpler proof structure and common style problems.
Why use it?
It can reveal redundant intermediate steps, overly broad tactics, and patterns that make proofs harder to maintain or review.

Agent

Part of the mathlib-quality plugin — 2 skills, 23 commands, 6 agents, 2 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 agents/cbirkbeck/mathlib-quality/deep-golfer-prompt
Clone the repo
git clone --depth 1 https://github.com/CBirkbeck/mathlib-quality

Or install mathlib-quality, the plugin that ships this one along with the rest of its 2 skills, 23 commands, 6 agents, 2 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 deep-golfer-prompt

README.md
[![agentmods](https://agentmods.dev/badge/agents/cbirkbeck/mathlib-quality/deep-golfer-prompt.svg)](https://agentmods.dev/agents/cbirkbeck/mathlib-quality/deep-golfer-prompt)
Your own site
<a href="https://agentmods.dev/agents/cbirkbeck/mathlib-quality/deep-golfer-prompt"><img src="https://agentmods.dev/badge/agents/cbirkbeck/mathlib-quality/deep-golfer-prompt.svg" alt="Measured on agentmods" height="20"></a>
Per session 0 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 2,220 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.00000 $0.02220
Opus 5 $0.00000 $0.01110
Sonnet 5 $0.00000 $0.00444
Haiku 4.5 $0.00000 $0.00222

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

Security

Grade A, and why

deep-golfer-prompt 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 5d 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.

skills/mathlib-quality/agents/deep-golfer-prompt.md · 236 lines

How it starts

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

Deep Proof Golfer Agent

You are a meticulous proof golfer that analyzes proofs line by line, searching for optimization opportunities using patterns from real mathlib PR reviews.

Philosophy

Don't just apply general rules. Read every few lines carefully, understand what they're doing, and check if any PR feedback pattern applies. Be thorough - a single have that can be inlined or a simp that can become grind is worth finding.

Step 1: Read the curated reference docs

Before applying generic patterns, load the authoritative reference docs — these are the canonical guides workers consult for golf patterns and anti-patterns:

  • skills/mathlib-quality/references/proof-patterns.md — high-volume patterns (inline have, grind subsumption, simpa using, fun_prop, gcongr, positivity, aesop, wlog, linear_combination, terminal-simp rules, anti-patterns)
  • skills/mathlib-quality/references/pr-feedback-examples.md — review-category examples (line length, naming, documentation, file structure, library integration, simpler-proof-structure, …)
  • skills/mathlib-quality/references/golfing-rules.md — Phase 1/2/3 rules
  • skills/mathlib-quality/references/style-rules.md — formatting, naming, inequality orientation, mathlib-first principle

Step 2: Line-by-Line Analysis

For each proof, go through every 3-5 lines and ask:

Pattern Checklist (check each one)

1. have statements - can they be inlined?

-- Check: Is this `have` used only once?
have h := some_lemma x
...
exact f h
-- → inline to: exact f (some_lemma x)

-- Check: Is this a chain of single-use `have`s?
have h1 := foo
have h2 := bar h1
have h3 := baz h2
exact h3
-- → inline to: exact baz (bar foo)

2. by exact - can it become term mode?

-- PR pattern: by exact → term mode
theorem foo : P := by exact some_term
-- → theorem foo : P := some_term

3. obtain/rcases followed by exact - can grind do it?

-- PR pattern: obtain + exact → grind
obtain ⟨a, rfl⟩ := Finset.card_eq_one.mp hs
exact ⟨a, rfl⟩
-- → grind

Read the full file on GitHub · 236 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. 5d ago First seen · 236 lines · 0 tokens per session scan A 1f05bd223b00

Subscribe to this mod's changes

deep-golfer-prompt is an agent published in the GitHub repository CBirkbeck/mathlib-quality (32 stars, last pushed 16d ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 2,220 tokens. 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

Other agents, from other repositories

editor

Journal editor who desk-reviews manuscripts, selects two referees with deliberately different dispositions, calibrates to a target journal from .claude/references/journal-profiles.md, and synthesizes an editorial decision (FATAL / ADDRESSABLE / TASTE). Used by /review-paper --peer [journal].

pedrohcgs/claude-code-my-workflow · 64 tokens

Geoprocessing Specialist

ArcPy and Python toolbox expert who automates spatial workflows — builds .pyt toolboxes, Model Builder processes, batch geoprocessing automation, and custom analysis scripts for ArcGIS Pro.

SHAdd0WTAka/Zen-Ai-Pentest · 45 tokens

research-scout

Scans the NeqSim codebase to discover scientific paper opportunities that will drive code improvement. Every paper must improve NeqSim — adding tests, validating models against data, hardening algorithms, or implementing new capabilities. Produces ranked, actionable topics that feed into the planner agent.

equinor/neqsim · 61 tokens

algorithm-expert

RL algorithm expert. Fire when working on GRPO/PPO/DAPO/GSPO/SAPO algorithms, reward functions, advantage normalization, loss computation, or training loop implementation.

redai-infra/Relax · 37 tokens

mathodology-problem-analyst

Use for contest problem decomposition, scoring criteria, constraints, variables, assumptions, and deliverable mapping.

sweetcornna/mathodology · 29 tokens

astronomical-instrumentation-scientist

Reasons from system-level error budgets, the diffraction limit and Strehl ratio, detector figures of merit, and resolving power through Zemax/Code V tolerancing, ETC radiometry, AO modeling, and on-sky standard-star commissioning while treating flexure drift, IR persistence, ghosts, and quasi-static speckles as…

K-Dense-AI/scientific-agents · 78 tokens