lean-beam
Use this when an AI should work on an external Lean project through the installed `lean-beam` wrapper, giving it direct efficient access to Lean's proof engine to avoid repeated inner-loop rebuilds through cheap speculative checks and zero-build module checkpoints.
leanprover · 已有静态检查记录
安装与使用
运行命令前先阅读来源与依赖说明。复制命令不会自动安装或执行。
npx skills add leanprover/lean-beam --skill lean-beam技能说明
name: lean-beam
description: Use this when an AI should work on an external Lean project through the installed lean-beam wrapper, giving it direct efficient access to Lean's proof engine to avoid repeated inner-loop rebuilds through cheap speculative checks and zero-build module checkpoints.
Lean Beam
Use this skill for Lean projects when you want the AI to replace repeated inner-loop lake build
runs with cheap speculative Lean probes, optional follow-up handle execution, and targeted file
checkpoints. A successful checkpoint is normally enough for local development. CI should run a
clean lake build; do not force an expensive clean local rebuild after every checkpoint. Before
calling work batch-validated, require a successful clean CI build, or run one clean local build when
no such CI result is available or server-sensitive elaboration is suspected.
This is the Lean-only skill. It should stay focused on Lean and should not require Rocq setup or Rocq concepts. Do not factor shared Lean/Rocq skill instructions into a common helper; duplicate short guidance if both skills need it.
Setup
From the lean-beam repo root:
./scripts/install-beam.sh --codex
Use --claude, --pi, --opencode, or --vibe instead when installing for Claude Code,
Pi Agent, OpenCode, or Mistral Vibe. Use --all-skills when you want every supported agent skill
target.
The installer puts lean-beam, lean-beam-search, and lean-beam-mcp in ~/.local/bin, stages
the self-contained runtime under BEAM_INSTALL_ROOT (default ~/.local/share/beam), requires
elan on PATH, prebuilds the pinned lean-toolchain bundle by default, and installs the bundled
Lean skill only for the agent flags you request. Use the setup docs for additional supported or
custom toolchain prebuilds.
Use lean-beam --version for CLI bug reports and installed runtime identity checks. Use
lean-beam-mcp --version to verify which installed MCP server wrapper, server binary, runtime
payload hash, manifest, and source commit a client command resolves. Source checkout runs also
report git commit/branch/dirty state when available. From a live MCP session, call beam_version
to report the running server process identity as structured content. Installed identities include
runtime_current; if a live session reports false after reinstalling, restart the agent or MCP
client so it launches the current runtime. If a newly resolved installed wrapper still reports
false, the install root's current link is missing or broken; stop normal Beam work and reinstall.
If an installed identity reports runtime_error, do not treat it as a source checkout or try to
clean it with lean-beam prune. After stopping active Beam agents and MCP clients, move an invalid
manifest runtime out of BEAM_INSTALL_ROOT/versions, preserve it for inspection, and rerun the
installer. For an invalid install-root marker, preserve and rename the exact BEAM_INSTALL_ROOT as
a unit before reinstalling; do not recreate its ownership marker in place or delete the preserved
state.
MCP workspace-bound tools carry an explicit local workspace descriptor on every call. Dropping that workspace only evicts its cached runtime and retained handles; it does not prove the MCP server binary itself was refreshed. Retain the canonical descriptor when a Lean operation, non-confidential feedback result, or drop result echoes it so a cached runtime can still be dropped if the project path or its Lean/Lake markers become unavailable.
Restart active agent or MCP client sessions after installation.
For the authoritative install and bundle-resolution order, see the repo docs/SETUP.md and Validated And Compatible Toolchains sections.
Skill Surface
This skill documents the current Lean-facing lean-beam workflow surface. Use the smallest command
family that fits the task.
Agents may access Beam through the lean-beam wrapper or through a registered lean-beam-mcp
server. This skill names wrapper commands because they are always available after installation. When
your client exposes the matching MCP tools, use them with the same saved-file, version, update, sync,
and isolation rules; do not treat MCP as a raw Lean LSP proxy.
Supported command families:
- start and own a wrapper session:
lean-beam serve - inspect the selected session state:
lean-beam status - inspect existing code, navigation data, or proof state:
lean-beam hover,lean-beam signature-help,lean-beam definition,lean-beam references,lean-beam document-symbols,lean-beam workspace-symbols,lean-beam goals before,lean-beam goals after - inspect actionable Lean items in a range:
lean-beam todo - inspect file or daemon state:
lean-beam open-files,lean-beam doctor,lean-beam stats - produce a local, pasteable bug report card from JSON input:
lean-beam feedback-report - try one isolated speculative Lean snippet:
lean-beam run-at - continue from one exact speculative state:
lean-beam run-at-handle,lean-beam run-with,lean-beam run-with-linear,lean-beam release - refresh or checkpoint one tracked workspace module:
lean-beam sync,lean-beam refresh,lean-beam save,lean-beam close-save - run shell-oriented search loops over the same handle APIs:
lean-beam-search
What to treat as the normal agent workflow surface:
- default workflow commands:
lean-beam hover,lean-beam signature-help,lean-beam definition,lean-beam references,lean-beam document-symbols,lean-beam workspace-symbols,lean-beam goals,lean-beam todo,lean-beam run-at,lean-beam sync,lean-beam refresh - operational commands:
lean-beam open-files,lean-beam doctor,lean-beam stats,lean-beam feedback-report,lean-beam save,lean-beam close-save - pre-stable support APIs:
lean-beam run-at-handle,lean-beam run-with, `lean-beam ru