Available in
Marketplaces, most starred first
Tags
Add to README
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
Marketplaces, most starred first
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
Marketplaces, most starred first
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
By LucianoXuv0.5.0MITIn 2 marketplaces
Lean 4 language server for Claude Code with automatic Lake project-root detection, elan toolchain resolution, multi-project routing, and the lean-goal CLI: proof states, candidate tactics elaborated without touching the file, and Mathlib-wide lemma search.
Claude loads one when your task matches it, or you run it by name.
Executables (bin/) — files in this plugin's bin/ directory are added to the Bash tool's PATH while the plugin is enabled.
2 marketplaces, most starred first
lean, lean4, theorem-proving, mathematics, formal-verification, lake, interactive-proving
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
Lean 4 language server plugin for Claude Code — with automatic project-root detection, toolchain resolution, and interactive proof-state queries.
Claude Code launches LSP servers from the session root. Lean's server must run from the Lake project root (where lakefile.toml and lean-toolchain live) — otherwise imports don't resolve and the wrong toolchain is used. A naive "command": "lake serve" config only works when you happen to open Claude Code exactly at the project root.
This plugin fixes that with a launcher proxy, and goes further:
.lean file to the nearest lakefile.toml/lakefile.lean and runs lake serve there. Dependency sources under .lake/packages/ are correctly served by the outer project. Standalone files (no lakefile) get lean --server. One plugin covers both modes — no need to choose at install time.lake/lean via PATH, $ELAN_HOME/bin, or ~/.elan/bin, so it works even when elan's bin dir was never added to PATH. Overridable with LEAN4_LSP_LAKE / LEAN4_LSP_LEAN.lean-goal CLI exposes Lean's $/lean/plainGoal, which generic LSP clients cannot reach: goals at any position and the goal at every sorry, backed by a warm background server.lean-goal try splices a tactic over a sorry in the server's in-memory copy, reports whether it closes the goal, and reverts. About a second per candidate, and a wrong guess never reaches the file.lean-goal search queries the full imported environment through completion, ranked and resolved to real signatures. The LSP workspaceSymbol request only indexes the current project, so Mathlib names are invisible to it.ENOENT.claude plugin marketplace add LucianoXu/claude-lean4-lsp
claude plugin install lean4-lsp@claude-lean4-lsp
Or for a single session from a checkout: claude --plugin-dir ./claude-lean4-lsp/plugins/lean4-lsp
Upgrading from
lean4-lake-lsp/lean4-lean-lsp(≤ 0.1.0): uninstall both — this plugin replaces the pair, and Claude Code lets only one server claim.leanfiles anyway.
Automatically, after every edit to a .lean file — diagnostics from the live server: type errors, unsolved goals, sorry warnings. No lake build round-trips while iterating.
Via the LSP tool — hover (types + docstrings), go-to-definition (including into Mathlib sources), find-references, document/workspace symbols, call hierarchy.
Via lean-goal (on PATH in Claude Code's Bash tool):
lean-goal sorries Closure.lean # every sorry, with its goal
lean-goal goal Closure.lean:42:7 # tactic goals at a position
lean-goal try Closure.lean:42 'ring' # does this tactic work? (file untouched)
lean-goal try --apply Closure.lean:42 'ring' # …and keep it if it does
lean-goal check --errors-only --compact X.lean # one line per error
lean-goal hint Closure.lean:42 # exact? / simp? / rw? suggestions
lean-goal search Closure.lean trace_smul # find lemmas by name fragment
lean-goal cmd Closure.lean '#check @Foo.bar' # exact statement of a name
lean-goal check Closure.lean # diagnostics, in seconds
lean-goal build Closure.lean --axioms Foo.bar # lake build, sorries fail it, then #print axioms
lean-goal status / stop # warm servers, free their memory
Positions are 1-based. Without a column, the position defaults to the first sorry on the line — comments and string literals are skipped, so -- TODO: sorry is not mistaken for an open goal. The first query on a project starts a background server (up to ~1 min with Mathlib imports); subsequent queries are near-instant. Daemons idle out after 30 minutes, and are replaced automatically when the plugin is upgraded underneath them.
try on a line that already holds a tactic replaces that tactic instead of a sorry — repair, not just filling in. In either form, a candidate that works is written to disk only with --apply.
Built from public signals: copy clicks on this site, GitHub stars and activity, the README and the manifest. Not a security audit or an endorsement.
npx claudepluginhub lucianoxu/claude-lean4-lsp --plugin lean4-lspPlugins from other owners that cover similar ground