Agent Skill
2/7/2026

lean4-memories

This skill should be used when working on Lean 4 formalization projects to maintain persistent memory of successful proof patterns, failed approaches, project conventions, and user preferences across sessions using MCP memory server integration

C
cameronfreer
110GitHub Stars
2Views
npx skills add cameronfreer/lean4-skills

SKILL.md

Namelean4-memories
DescriptionThis skill should be used when working on Lean 4 formalization projects to maintain persistent memory of successful proof patterns, failed approaches, project conventions, and user preferences across sessions using MCP memory server integration

Lean 4 Skills

Run in Smithery

Lean 4 workflow pack for AI coding agents. Gives your agent a structured prove/review/golf loop, mathlib search, axiom checking, and safety guardrails. The workflows are host-agnostic — Claude Code, Codex, Gemini CLI, Cursor, and others all use the same core skill; only the invocation surface differs.

Workflows

WorkflowDescription
proveGuided cycle-by-cycle theorem proving
autoproveAutonomous multi-cycle proving with stop rules
checkpointVerified save point (build + axiom check + commit)
reviewRead-only quality review
golfOptimize proofs for brevity
learnInteractive teaching, mathlib exploration, and autoformalization
doctorDiagnostics and migration help

Claude Code: invoke as /lean4:<name>. Other hosts: follow the corresponding workflow in SKILL.md.

Typical session: prove (or autoprove) → reviewgolfcheckpointgit push.

How It Works

  • prove — Guided, interactive. Asks preferences at startup, prompts before each commit, pauses between cycles. Start here.
  • autoprove — Autonomous, unattended. Auto-commits, loops until a stop condition fires (max cycles, max time, or stuck).
  • Both share one cycle engine: Plan → Work → Checkpoint → Review → Replan → Continue/Stop. Each sorry gets a mathlib search, tactic attempts, and validation. --commit controls per-fill commit behavior. When stuck, both force a review + replan.
  • Editing .lean files without a command activates the skill for one bounded pass — fix the immediate issue, then suggest prove or autoprove for more.

See plugin README for the full command guide.

Lean LSP MCP Server (Highly Recommended)

Oliver Dressler's lean-lsp-mcp provides sub-second feedback instead of 30+ second lake build cycles. Works with any MCP-capable host.

What you get:

  • lean_goal — exact goal state at any line
  • lean_local_search / lean_leanfinder / lean_leansearch / lean_loogle — mathlib search
  • lean_multi_attempt — test multiple tactics in parallel
  • lean_hammer_premise — premise suggestions for simp/aesop/grind

Setup: a few minutes. See INSTALLATION.md → MCP Server

Installation

Claude Code (native plugin)

/plugin marketplace add cameronfreer/lean4-skills
/plugin install lean4

OpenAI Codex CLI

git clone https://github.com/cameronfreer/lean4-skills.git

See INSTALLATION.md → Codex for AGENTS.md setup and MCP config.

Gemini CLI

git clone https://github.com/cameronfreer/lean4-skills.git

See INSTALLATION.md → Gemini for GEMINI.md setup.

OpenCode

git clone https://github.com/cameronfreer/lean4-skills.git

See INSTALLATION.md → OpenCode for skill setup.

Cursor / Windsurf / Other Agents

git clone https://github.com/cameronfreer/lean4-skills.git

See INSTALLATION.md → Generic for setup.

Compatibility

HostStatusWorkflow
Claude CodeFull native/lean4:* slash commands, hooks, guardrails
OpenAI CodexDocumented, not CI-verifiedSKILL.md + scripts + optional MCP
Gemini CLIDocumented, not CI-verifiedGEMINI.md context + scripts + optional MCP
CursorDocumented, not CI-verifiedProject rules + scripts
WindsurfDocumented, not CI-verifiedProject rules + scripts
OpenCodeDocumented, not CI-verifiedSKILL.md + scripts + optional MCP
Other agentsBest-effortMarkdown + shell scripts + optional MCP

Documentation

Changelog

See CHANGELOG.md for version history.

Contributing

Issues and PRs welcome at https://github.com/cameronfreer/lean4-skills

License & Citation

MIT licensed. See LICENSE for more information.

Citing this repository is highly appreciated but not required by the license. See also CITATION.cff.

@software{lean4-skills,
  author = {Cameron Freer},
  title = {Lean 4 {Skills}: Theorem proving skill and workflow pack for {AI} coding agents},
  url = {https://github.com/cameronfreer/lean4-skills},
  month = oct,
  year = {2025}
}
Skills Info
Original Name:lean4-memoriesAuthor:cameronfreer