Логотип Lean Beam

Lean Beam

Организация
leanprover
lean-beam

Work on external Lean projects through the installed `lean-beam` wrapper, using speculative checks and zero-build module checkpoints instead of repeated inner-loop builds.

Обзор

Издательleanprover
Репозиторийlean-beam
Название навыкаlean-beam
Звёзды
48
Форки
6
Встроенные файлы
9
ЛицензияApache-2.0
Ссылки
  • Инструкции в формате Markdown

    Файл SKILL.md, который модель загружает по необходимости, поэтому токены расходуются только при подходящем запросе.

  • Работает с любой языковой моделью

    Навыки ИИ — это обычный Markdown, а не код для конкретного поставщика, поэтому они работают с GPT, Claude, Gemini, Grok и локальными моделями.

  • Файлы в комплекте: 9

    Скрипты, шаблоны и справочные материалы, которые модель может читать во время работы. Файлы доступны только для чтения и никогда не выполняются.

  • Открытый исходный код

    Опубликовано на GitHub: leanprover. Перед установкой изучите исходные материалы.

Установка

Установите навык ИИ Lean Beam в TypingMind, чтобы использовать его с любой LLM, или добавьте его в другой агент, который умеет читать SKILL.md.

1

Установка в TypingMind

TypingMind устанавливает навык прямо из его папки на GitHub: читает SKILL.md, собирает файлы ресурсов и сохраняет результат локально.

  1. Откройте приложение и перейдите в раздел «Плагины → Навыки».
  2. Выберите «Установить из GitHub».
  3. Вставьте указанную ниже ссылку на папку навыка и подтвердите установку.
    https://github.com/leanprover/lean-beam/tree/main/skills/lean-beam
  4. Включите навык в каждом чате, где хотите его использовать.
Плагины → Навыки → Новый навык → По ссылке GitHub, затем вставьте ссылку на папку и нажмите «Продолжить».
2

Установка в другом агенте

Любой агент с поддержкой формата Agent Skills может использовать этот навык — скопируйте папку в каталог навыков этого агента.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/leanprover/lean-beam.git /tmp/lean-beam
mkdir -p .claude/skills
cp -r /tmp/lean-beam/skills/lean-beam .claude/skills/lean-beam
После копирования перезапустите Claude Code, чтобы загрузить новый навык.

Использование в TypingMind

Включите навык Lean Beam в любом чате TypingMind, и дальше модель всё сделает сама. Его название и описание хранятся в системном промпте, а при появлении подходящего запроса модель сама загружает полные инструкции. Вам не нужно вызывать навык вручную, и до фактического использования он не расходует токены.

Модель сама загружает навык Lean Beam, как только появляется подходящий для него запрос.

Работает с любой моделью ИИ

Навыки ИИ — это обычные инструкции в Markdown, а не код для конкретного поставщика, поэтому навык Lean Beam не привязан к модели, для которой он был создан. Установите его один раз в TypingMind и используйте с GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama или локальной моделью, которую запускаете самостоятельно, — со своими API-ключами.

  • Загружается только при необходимости

    Системный промпт содержит только название и описание. Инструкции загружаются при первом подходящем запросе, поэтому неиспользуемый навык не расходует токены.

  • Меняйте модели прямо в чате

    Навык состоит из инструкций, а не кода, поэтому смена модели не нарушает его работу: новая модель читает тот же файл SKILL.md.

Инструкции навыка

Это содержимое файла SKILL.md, которое загружает модель. Прочитайте его перед установкой: навык — это инструкции, которым будет следовать ваша модель.

Lean Beam

Beam provides speculative Lean probes in the real module environment and zero-build module checkpoints. This skill is Lean-only.

Use the lean-beam wrapper, not raw JSON or raw LSP. If your client exposes the lean-beam-mcp tools (lean_run_at, lean_sync, ...), the same rules apply; MCP owns its session automatically, so do not start lean-beam serve for MCP calls.

Session

bash
# keep one foreground owner running for the project (separate terminal or background process)
lean-beam serve
# when finished: interrupt it, or
lean-beam --root ROOT stop
  • Document commands attach to a live serve owner and never start one implicitly. doctor, help, and version inspection can run without an owner.
  • In a read-only or sandboxed tree, set BEAM_SESSION_ROOT to a writable directory.
  • After editing a lakefile, manifest, Lean options, plugins, or other Lake configuration, run lean-beam --root ROOT stop and start a new serve; refresh does not restart the server.
  • If startup, toolchain selection, or session state looks wrong, run lean-beam doctor before guessing. See setup and recovery.

The Edit Loop

Beam reads only the on-disk file and never edits .lean sources; you edit files with your own tools.

  1. Edit and save the file.
  2. lean-beam update Foo.lean and take result.version from its JSON.
  3. Probe with that version (run-at, goals, hover, ...).
  4. lean-beam sync Foo.lean when you need diagnostics and readiness (result.readiness.save_ready; MCP: structuredContent.readiness.save_ready).
  5. Optionally lean-beam save MyPkg/Sub/Module.lean to checkpoint a synced workspace module.
bash
version="$(lean-beam update Foo.lean | python3 -c 'import json,sys; print(json.load(sys.stdin)["result"]["version"])')"
lean-beam goals before Foo.lean "$version" 10 2
lean-beam run-at Foo.lean "$version" 10 2 "omega"
printf 'first | omega | simp\n' | lean-beam run-at Foo.lean "$version" 10 2 --stdin
lean-beam sync Foo.lean            # errors stream on stderr; add +all-diagnostics for warnings
lean-beam save MyPkg/Sub/Module.lean
  • Every version-bound command needs the version from the latest update or sync. On contentModified with error.data.reason = "documentVersionMismatch", retry with error.data.accepted_version or run update again; never guess a version.

  • Cancellation is soft: interrupting the client does not prove backend work has stopped. Active preparation may finish before cleanup; cancellation does not undo committed effects. Do not remove temporary files solely because the client exited.

  • Use refresh for fresh diagnostics after an upstream dependency changed; it reads before reopening.

  • save checkpoints only that module. It does not validate importers, and it records the Lean server's environment, which can differ from batch elaboration. Modules with batch-only moreLeanArgs fail with saveUnsupportedSetup; move shared -D settings to leanOptions, or stop Beam, then lake build, when the arguments are intentionally batch-only.

  • If close-save fails with error.data.reason = "savedDocumentChanged", error.data.saved is an already committed checkpoint of the earlier version; run update or sync and save again if needed.

  • close-save reserves the accepted document. On contentModified with reason documentClosing, coordinate with its caller before issuing a new command; do not run an update/sync retry loop. During claimed canonical publication, same-workspace changes wait for settlement.

  • documentAdmissionExpired means closure or backend replacement invalidated this request. After coordination, issue a new request and reacquire handles if the backend was replaced.

  • Other postcommit failures also retain error.data.saved, with prior data under error.data.original_data. An uncertain close does not assert closed = false; cancellation does not undo a committed checkpoint.

Choosing A Command

NeedCommand
Proof state at a tacticgoals before FILE VERSION LINE CHAR (or goals after)
Try Lean text without editingrun-at FILE VERSION LINE CHAR TEXT (or --stdin, --text-file)
Profiling--profile on run-at/run-with probes (including handle variants; see details)
Continue from an exact speculative staterun-at-handle, then run-with / run-with-linear, release
Type and docs at a positionhover, signature-help
Navigation and symbolsdefinition, references, document-symbols FILE VERSION, workspace-symbols QUERY
Sorries, holes, errors, open goals, code actionstodo FILE VERSION [SL SC EL EC]
Fresh diagnostics after a real editsync (or refresh)
Checkpoint one synced modulesave, close-save
Daemon or tracked-file troubleopen-files, doctor, stats
Shell search loops over handleslean-beam-search
Bug report cardfeedback-report (see feedback)

Handles are pre-stable: use them only when exact continuation matters. They are invalidated by edits to the same document, close, worker restart, or daemon restart.

Code actions need a range: Lean runs them on the one command at the range end, so query a point (todo FILE VERSION L C L C --kind code_action). An empty result is not a file-wide verdict.

run-at Rules

run-at means "try this Lean text here", not "edit the file here".

  • Positions are LSP coordinates: line and character are zero-based, characters count UTF-16 code units, and on an empty line only character 0 is valid.
  • To replace a tactic, probe at its first character after indentation (its before-state).
  • Each probe is isolated and starts from the version it names, so independent probes can run in parallel. This isolates elaboration state, not external effects: Lean code may perform IO.
  • Command positions accept one command; for several, use handles or edit the file and sync.
  • Pass the exact text Lean should parse, including indentation and newlines; prefer --stdin for multiline text. Beam does not re-indent.
  • At a tactic position, the text may be a tactic sequence: start each tactic at the same column, or separate them with ;. Do not start it with by; the probe already runs inside the proof.
  • At an unfilled sorry, _, or ?x term, run-at starts from its goal; text is still tactics. At a todo item's run_at_position, it starts from the item's proof_state; without one, edit.
  • run-at returns no file diagnostics; use sync after a real edit for those.
  • Tactic probes reject new local let rec definitions, even valid ones. Save the enclosing declaration and sync instead, or probe one complete declaration at a command position.

Prefer small probes at the real source position. Scratch files reload imports and lose context; use them only for context-free syntax checks.

Output Contract

  • Check the exit status first. Completed broker operations print one JSON object on stdout.
  • A successful transport does not mean a successful Lean probe: inspect result.success for wrapper probes. For MCP probes, require isError to be absent or false and structuredContent.success true.
  • stderr is for humans: progress and streamed diagnostics. Never parse it. Selector, setup, or transport failures may print only to stderr.
  • sync failures carry structured error.data; save failures with document errors put the blocking verdict in error.data.sync.

When To Stop Probing

Before lake build, stop the CLI owner or drop the MCP workspace and wait for cleanup; recreate the session afterward.

  • The probe result should become real source: edit, save, update/sync.
  • Probes stop clarifying the problem: change approach rather than repeating variants.
  • save fails with saveImportsChanged: refresh, then save.
  • On syncBarrierIncomplete, follow error.data.recovery_plan in order; stop on failure. Inspect diagnostics/readiness after refresh succeeds. If blocked or save is unsupported, stop retries and inspect upstream diagnostics/configuration.
  • You edited a dependency and need trustworthy importers: save is not enough; rebuild.
  • contentModified, stale state, or rebuild trouble keeps appearing unexpectedly: inspect open-files and doctor, then stop and report it rather than working around it.

For batch evidence, prefer clean CI lake build. The local fallback requires confirmation of cleanup from the original owner or supervisor before cleaning/building; otherwise stop and coordinate. Do not repeat after every checkpoint.

Beam is a non-adversarial development tool. Checkpoint readiness can include sorry warnings; it is not proof acceptance. For independent confirmation, use the separate trust and proof confirmation workflow, including a trusted challenge and external checkers. Do not add it to every inner-loop operation.

References

Open as needed:

Встроенные файлы

Модель читает эти файлы по мере необходимости, пока навык загружен. Они доступны только для чтения и никогда не выполняются.

Часто задаваемые вопросы

Что делает навык ИИ Lean Beam?

Work on external Lean projects through the installed `lean-beam` wrapper, using speculative checks and zero-build module checkpoints instead of repeated inner-loop builds.

Зачем использовать Lean Beam в TypingMind?

Потому что вы устанавливаете навык один раз и используете его с любой моделью. Lean Beam — это обычный текст в формате Markdown, а не код для конкретного поставщика, поэтому один и тот же навык работает с GPT-5, Claude, Gemini, Grok или локальной моделью. Вы можете менять модель прямо во время чата, и навык продолжит работать. TypingMind использует ваши собственные ключи API, поэтому вы платите поставщикам напрямую, а не оформляете подписку с оплатой за каждое место. Ваши навыки и чаты остаются в вашем собственном хранилище.

Как установить Lean Beam в TypingMind?

В TypingMind откройте «Плагины → Навыки → Установить из GitHub» и вставьте https://github.com/leanprover/lean-beam/tree/main/skills/lean-beam. TypingMind прочитает файл SKILL.md, включит сопутствующие файлы в пакет и установит навык, который можно включать отдельно для каждого чата.

Какие модели ИИ могут использовать Lean Beam?

Любая модель, которую вы подключите в TypingMind. Навыки ИИ — это обычные инструкции в формате Markdown, а не код для конкретного поставщика, поэтому GPT, Claude, Gemini, Grok и локальные модели могут загружать этот навык, когда запрос ему соответствует.

Со сколькими моделями ИИ можно использовать Lean Beam?

С любым количеством. Если модель поддерживает навыки, вы можете использовать с ней Lean Beam: GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama и другие — всё в TypingMind с вашими собственными ключами API.

Бесплатен ли навык ИИ Lean Beam?

Да. Навык опубликован на GitHub автором leanprover по лицензии Apache-2.0. Вы платите только своему поставщику ИИ за использованные токены.

Что такое навыки ИИ?

Навык ИИ — это многоразовый набор инструкций, который объясняет модели ИИ, как выполнять конкретную задачу. Он соответствует открытому формату Agent Skills: файл SKILL.md с названием и описанием, а также любые скрипты, шаблоны или справочные файлы, которые могут понадобиться модели. Модель читает инструкции, только когда ваш запрос соответствует навыку, поэтому установленный навык ничего не стоит, пока не используется.

Чем навыки ИИ отличаются от плагинов и серверов MCP?

Плагин или сервер MCP даёт модели новые инструменты для вызова — код, который где-то выполняется и возвращает результат. Навык ИИ вместо этого даёт модели знания и порядок действий: как подойти к задаче, какие шаги выполнить и каким должен быть хороший результат. Навыки — это обычный текст в формате Markdown, поэтому им не нужны сервер, ключ API или среда выполнения, и они работают с любой моделью.

Все

Создайте свою рабочую ИИ-среду сейчас

Подпишитесь на нашу рассылку, чтобы узнавать о новых функциях и предстоящих розыгрышах 👇