Logo di Lean Beam

Lean Beam

Organizzazione
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.

Panoramica

Autoreleanprover
Repositorylean-beam
Nome della skilllean-beam
Stelle
48
Fork
6
File inclusi
9
LicenzaApache-2.0
Link
  • Istruzioni in Markdown

    Un file SKILL.md che il modello carica quando serve, consumando token solo quando una richiesta è effettivamente pertinente.

  • Funziona con qualsiasi LLM

    Le skill IA sono in semplice Markdown, non in codice specifico di un fornitore, quindi funzionano con GPT, Claude, Gemini, Grok o un modello locale.

  • 9 file inclusi

    Script, modelli di documento e riferimenti che il modello può leggere mentre lavora. I file sono di sola lettura e non vengono mai eseguiti.

  • Open source

    Pubblicata da leanprover su GitHub. Leggi i sorgenti prima di installarla.

Installazione

Installa la skill IA Lean Beam in TypingMind per usarla con qualsiasi LLM, oppure copiala in un altro agente in grado di leggere SKILL.md.

1

Installa in TypingMind

TypingMind installa una skill direttamente dalla sua cartella GitHub: legge SKILL.md, raccoglie i file delle risorse e salva il risultato in locale.

  1. Apri l'app e vai su Plugin → Skill.
  2. Scegli "Installa da GitHub".
  3. Incolla l'URL della cartella della skill riportato qui sotto e conferma.
    https://github.com/leanprover/lean-beam/tree/main/skills/lean-beam
  4. Attiva la skill in ogni chat in cui vuoi averla a disposizione.
Plugin → Skill → Nuova skill → Da URL GitHub, poi incolla l'URL della cartella e premi Continua.
2

Installa in un altro agente

Qualsiasi agente che legge il formato Agent Skills può usare questa skill: copia la cartella nella cartella delle skill di quell'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
Dopo la copia, riavvia Claude Code per caricare la nuova skill.

Usala in TypingMind

Attiva Lean Beam in qualsiasi chat di TypingMind e al resto pensa il modello. Il nome e la descrizione della skill sono nel prompt di sistema e, non appena arriva una richiesta pertinente, il modello carica da solo le istruzioni complete: non devi mai richiamarla manualmente e non consuma token finché non viene effettivamente usata.

Il modello carica automaticamente Lean Beam non appena riceve una richiesta pertinente.

Funziona con qualsiasi modello IA

Le skill IA sono semplici istruzioni in Markdown, non codice specifico di un fornitore, quindi Lean Beam non è vincolata al modello per cui è stata scritta. Installala una sola volta in TypingMind e usala con GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama o un modello locale che esegui tu, sempre con le tue chiavi API.

  • Caricata solo quando serve

    Il prompt di sistema contiene solo il nome e la descrizione. Le istruzioni vengono recuperate alla prima richiesta pertinente, quindi una skill inutilizzata non costa nulla.

  • Cambia modello durante la chat

    Poiché la skill è composta da istruzioni e non da codice, continua a funzionare anche se cambi modello: il nuovo modello legge lo stesso file SKILL.md.

Istruzioni della skill

Questo è il contenuto di SKILL.md che il modello carica. Leggilo prima dell'installazione: una skill è un insieme di istruzioni che il tuo modello 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:

File inclusi

Il modello legge questi file quando servono, mentre la skill è caricata. Sono accessibili in sola lettura e non vengono mai eseguiti.

Domande frequenti

Cosa fa la skill IA 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.

Perché usare Lean Beam su TypingMind?

Perché la installi una volta e la usi con qualsiasi modello. Lean Beam è scritta in semplice Markdown anziché in codice specifico di un fornitore, quindi la stessa skill funziona con GPT-5, Claude, Gemini, Grok o un modello locale, e puoi cambiare modello durante la chat senza che smetta di funzionare. TypingMind usa le tue chiavi API, quindi paghi direttamente i fornitori anziché un abbonamento per posto utente, e le tue skill e chat restano nel tuo spazio di archiviazione.

Come installo Lean Beam in TypingMind?

Apri Plugin → Skill → Installa da GitHub in TypingMind e incolla https://github.com/leanprover/lean-beam/tree/main/skills/lean-beam. TypingMind legge il file SKILL.md, include i file associati e installa la skill, che puoi abilitare per ogni singola chat.

Quali modelli IA possono usare Lean Beam?

Qualsiasi modello che colleghi in TypingMind. Le skill IA sono semplici istruzioni in Markdown anziché codice specifico di un fornitore, quindi GPT, Claude, Gemini, Grok e i modelli locali possono tutti caricare questa skill quando una richiesta corrisponde al suo scopo.

Quanti modelli IA posso usare con Lean Beam?

Quanti ne vuoi. Se un modello supporta le skill, puoi usarlo con Lean Beam: GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama e molti altri, tutti su TypingMind con le tue chiavi API.

La skill IA Lean Beam è gratuita?

Sì. È pubblicata su GitHub da leanprover con licenza Apache-2.0. Paghi solo il tuo fornitore IA per i token che usi.

Cosa sono le skill IA?

Una skill IA è un pacchetto di istruzioni riutilizzabili che insegna a un modello IA come svolgere un'attività specifica. Segue il formato aperto Agent Skills: un file SKILL.md con un nome e una descrizione, più eventuali script, modelli o file di riferimento di cui il modello potrebbe aver bisogno. Il modello legge le istruzioni solo quando la tua richiesta corrisponde alla skill, quindi una skill installata non comporta costi finché non viene usata.

In cosa si differenziano le skill IA dai plugin o dai server MCP?

Un plugin o un server MCP fornisce a un modello nuovi strumenti da richiamare: codice che viene eseguito da qualche parte e restituisce un risultato. Una skill IA, invece, fornisce al modello conoscenze e procedure: come affrontare un'attività, quali passaggi seguire e quali caratteristiche deve avere un buon output. Le skill sono semplici istruzioni in Markdown, quindi non richiedono server, chiavi API né ambienti di esecuzione e funzionano con qualsiasi modello.

Vedi tutti

Crea subito la tua area di lavoro IA

Iscriviti alla nostra newsletter per ricevere aggiornamenti sulle nuove funzionalità e sulle prossime iniziative a premi 👇