Logo de Lean Beam

Lean Beam

Organização
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.

Visão geral

Publicado porleanprover
Repositóriolean-beam
Nome da habilidadelean-beam
Estrelas
48
Forks
6
Arquivos incluídos
9
LicençaApache-2.0
Links
  • Instruções em Markdown

    Um arquivo SKILL.md que o modelo carrega sob demanda, consumindo tokens apenas quando uma solicitação é realmente relevante para a habilidade.

  • Funciona com qualquer LLM

    Habilidades de IA são Markdown simples, não código específico de um provedor, por isso funcionam com GPT, Claude, Gemini, Grok ou um modelo local.

  • 9 arquivos incluídos

    Scripts, modelos de documentos e referências que o modelo pode ler enquanto trabalha. Os arquivos são somente leitura e nunca são executados.

  • Código aberto

    Publicada por leanprover no GitHub. Leia o conteúdo-fonte antes de instalar.

Instalação

Instale a habilidade de IA Lean Beam no TypingMind para usá-la com qualquer LLM ou adicione-a a outro agente que leia SKILL.md.

1

Instalar no TypingMind

O TypingMind instala uma habilidade diretamente da pasta dela no GitHub — lê o arquivo SKILL.md, reúne os arquivos de recursos em um pacote e armazena o resultado localmente.

  1. Abra o app e vá para Plugins → Habilidades.
  2. Escolha "Instalar do GitHub".
  3. Cole a URL da pasta da habilidade exibida abaixo e confirme.
    https://github.com/leanprover/lean-beam/tree/main/skills/lean-beam
  4. Ative a habilidade em cada chat em que quiser disponibilizá-la.
Plugins → Habilidades → Nova habilidade → Via URL GitHub, depois cole a URL da pasta e pressione Continuar.
2

Instalar em outro agente

Qualquer agente que leia o formato Agent Skills pode usar esta habilidade — copie a pasta para o diretório de habilidades desse agente.

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
Reinicie Claude Code após copiar para que a nova habilidade seja reconhecida.

Use no TypingMind

Ative Lean Beam em qualquer chat do TypingMind e o modelo cuida do resto. O nome e a descrição da habilidade ficam no prompt do sistema e, assim que uma solicitação relevante aparece, o modelo carrega as instruções completas automaticamente — sem precisar de acionamento manual e sem consumir tokens até que ela seja realmente usada.

O modelo carrega Lean Beam automaticamente assim que uma solicitação é relevante para essa habilidade.

Funciona com qualquer modelo de IA

Habilidades de IA são instruções em Markdown simples, não código específico de um provedor. Por isso, Lean Beam não fica vinculada ao modelo para o qual foi criada. Instale-a uma vez no TypingMind e use-a com GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama ou um modelo local executado por conta própria — tudo com suas próprias chaves de API.

  • Carregada apenas quando necessário

    O prompt do sistema contém apenas o nome e a descrição. As instruções são buscadas na primeira solicitação relevante, então uma habilidade sem uso não gera custo.

  • Troque de modelo durante a conversa

    Como a habilidade é composta de instruções, não de código, trocar de modelo não afeta seu funcionamento — o próximo modelo lê o mesmo arquivo SKILL.md.

Instruções da habilidade

Este é o conteúdo de SKILL.md que o modelo carrega. Leia antes de instalar — uma habilidade é um conjunto de instruções que seu modelo seguirá.

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:

Arquivos incluídos

O modelo lê esses arquivos sob demanda enquanto a habilidade está carregada. Eles são disponibilizados para leitura e nunca são executados.

Perguntas frequentes

O que a habilidade de IA Lean Beam faz?

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.

Por que usar Lean Beam no TypingMind?

Porque basta instalar uma vez para usar com qualquer modelo. Lean Beam é escrito em Markdown simples, e não em código específico de um provedor, então a mesma habilidade funciona com GPT-5, Claude, Gemini, Grok ou um modelo local — e é possível trocar de modelo no meio do chat sem que ela deixe de funcionar. O TypingMind usa suas próprias chaves de API, então o pagamento é feito diretamente aos provedores, em vez de uma assinatura por licença de usuário, e suas habilidades e chats permanecem no seu próprio armazenamento.

Como instalar Lean Beam no TypingMind?

Abra Plugins → Habilidades → Instalar do GitHub no TypingMind e cole https://github.com/leanprover/lean-beam/tree/main/skills/lean-beam. O TypingMind lê o arquivo SKILL.md, reúne os arquivos da habilidade e a instala para que possa ser ativada em cada chat.

Quais modelos de IA podem usar Lean Beam?

Qualquer modelo conectado no TypingMind. As habilidades de IA são instruções em Markdown simples, e não código específico de um provedor. Assim, GPT, Claude, Gemini, Grok e modelos locais podem carregar esta habilidade quando uma solicitação corresponder a ela.

Quantos modelos de IA posso usar com Lean Beam?

Quantos quiser. Desde que o modelo ofereça suporte a habilidades, é possível usar Lean Beam com ele — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama e outros — tudo no TypingMind com suas próprias chaves de API.

A habilidade de IA Lean Beam é gratuita?

Sim. A habilidade é publicada no GitHub por leanprover sob a licença Apache-2.0. O pagamento é feito apenas ao seu provedor de IA pelos tokens usados.

O que são habilidades de IA?

Uma habilidade de IA é um conjunto reutilizável de instruções que ensina um modelo de IA a realizar uma tarefa específica. Ela segue o formato aberto Agent Skills: um arquivo SKILL.md com nome e descrição, além de scripts, modelos de documento ou arquivos de referência de que o modelo possa precisar. O modelo lê as instruções apenas quando sua solicitação corresponde à habilidade, então uma habilidade instalada não gera custos até ser usada.

Qual é a diferença entre habilidades de IA e plugins ou servidores MCP?

Um plugin ou servidor MCP oferece ao modelo novas ferramentas para chamar — código que é executado em algum lugar e retorna um resultado. Já uma habilidade de IA fornece conhecimento e um processo ao modelo: como abordar uma tarefa, quais etapas seguir e como deve ser um bom resultado. As habilidades são escritas em Markdown simples, por isso não precisam de servidor, chave de API nem ambiente de execução, e funcionam com qualquer modelo.

Ver todos

Crie seu próprio espaço de IA agora

Inscreva-se na nossa newsletter para receber novidades sobre recursos e futuros sorteios 👇