Lean search

From MechMath/MechMath-agent-team · View interactive version

Lean search is an AI agent skill from the GitHub repository MechMath/MechMath-agent-team. Lean premise retrieval (not literature search — that is `search.py`). Use for Lean theorem proving or formalization whenever you need Mathlib facts, local declarations, premise candidates, examples, definitions, or proof-state search. Covers leandex, loogle, leanfinder, leansearch, state-search, and

How to use this skill

Skill file

Search Tools

Tools for finding relevant Lean theorems, lemmas, definitions, examples, and premise candidates. Use this skill before defining a concept or proving a helper that might already exist in Mathlib or local code.

All six backends sit behind one facade:

uv run python cli_tools/lean.py search {leandex|loogle|leanfinder|leansearch|state|hammer} "QUERY" [-n N]

Available Tools

| Tool | Purpose | When to use |

|------|---------|-------------|

| leandex | Semantic search by natural language or Lean terms | First choice for any search; max 5 parallel queries |

| loogle | Pattern-based search by type shape | When you know the type signature pattern |

| leanfinder | Mathlib semantic search | Alternative semantic search |

| leansearch | Natural language + Lean term search | Alternative to leandex |

| state-search | Search by proof goal/state | When you have a specific proof state to match |

| hammer-premise | Premise retrieval for automation | When looking for premises for automated tactics |

Orchestration Use

F-Generator, Formalizer, Regulator, and Integrator roles may all use this skill. Search is especially important before:

Read only the reference file for the tool you are about to call, for example reference-leandex.md, reference-loogle.md, or reference-state-search.md.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.