leanwarp 0.2.4__tar.gz → 0.2.5__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- leanwarp-0.2.5/CHANGELOG.md +14 -0
- {leanwarp-0.2.4 → leanwarp-0.2.5}/PKG-INFO +15 -13
- {leanwarp-0.2.4 → leanwarp-0.2.5}/README.md +12 -10
- leanwarp-0.2.5/docs/README.md +19 -0
- leanwarp-0.2.5/docs/agents.md +115 -0
- leanwarp-0.2.5/docs/getting-started.md +195 -0
- leanwarp-0.2.5/docs/http-api.md +295 -0
- {leanwarp-0.2.4 → leanwarp-0.2.5}/pyproject.toml +4 -4
- leanwarp-0.2.5/src/leanwarp_cloud/endpoints.py +73 -0
- leanwarp-0.2.5/src/leanwarp_cloud/skills/leanwarp/references/usage.md +525 -0
- {leanwarp-0.2.4 → leanwarp-0.2.5}/tests/test_config.py +54 -7
- {leanwarp-0.2.4 → leanwarp-0.2.5}/tests/test_resources.py +1 -1
- {leanwarp-0.2.4 → leanwarp-0.2.5}/tests/test_tools.py +10 -15
- leanwarp-0.2.4/docs/README.md +0 -16
- leanwarp-0.2.4/docs/agents.md +0 -97
- leanwarp-0.2.4/docs/getting-started.md +0 -188
- leanwarp-0.2.4/docs/http-api.md +0 -272
- leanwarp-0.2.4/src/leanwarp_cloud/endpoints.py +0 -39
- leanwarp-0.2.4/src/leanwarp_cloud/skills/leanwarp/references/usage.md +0 -472
- {leanwarp-0.2.4 → leanwarp-0.2.5}/.gitignore +0 -0
- {leanwarp-0.2.4 → leanwarp-0.2.5}/LICENSE +0 -0
- {leanwarp-0.2.4 → leanwarp-0.2.5}/docs/assets/leanwarp-banner.svg +0 -0
- {leanwarp-0.2.4 → leanwarp-0.2.5}/examples/lean-4.35/.gitignore +0 -0
- {leanwarp-0.2.4 → leanwarp-0.2.5}/examples/lean-4.35/LeanWarpExample.lean +0 -0
- {leanwarp-0.2.4 → leanwarp-0.2.5}/examples/lean-4.35/README.md +0 -0
- {leanwarp-0.2.4 → leanwarp-0.2.5}/examples/lean-4.35/lake-manifest.json +0 -0
- {leanwarp-0.2.4 → leanwarp-0.2.5}/examples/lean-4.35/lakefile.toml +0 -0
- {leanwarp-0.2.4 → leanwarp-0.2.5}/examples/lean-4.35/lean-toolchain +0 -0
- {leanwarp-0.2.4 → leanwarp-0.2.5}/src/leanwarp_cloud/__init__.py +0 -0
- {leanwarp-0.2.4 → leanwarp-0.2.5}/src/leanwarp_cloud/_version.py +0 -0
- {leanwarp-0.2.4 → leanwarp-0.2.5}/src/leanwarp_cloud/agents.py +0 -0
- {leanwarp-0.2.4 → leanwarp-0.2.5}/src/leanwarp_cloud/amounts.py +0 -0
- {leanwarp-0.2.4 → leanwarp-0.2.5}/src/leanwarp_cloud/cli.py +0 -0
- {leanwarp-0.2.4 → leanwarp-0.2.5}/src/leanwarp_cloud/client.py +0 -0
- {leanwarp-0.2.4 → leanwarp-0.2.5}/src/leanwarp_cloud/config.py +0 -0
- {leanwarp-0.2.4 → leanwarp-0.2.5}/src/leanwarp_cloud/edits.py +0 -0
- {leanwarp-0.2.4 → leanwarp-0.2.5}/src/leanwarp_cloud/mcp_server.py +0 -0
- {leanwarp-0.2.4 → leanwarp-0.2.5}/src/leanwarp_cloud/outcome.py +0 -0
- {leanwarp-0.2.4 → leanwarp-0.2.5}/src/leanwarp_cloud/project.py +0 -0
- {leanwarp-0.2.4 → leanwarp-0.2.5}/src/leanwarp_cloud/py.typed +0 -0
- {leanwarp-0.2.4 → leanwarp-0.2.5}/src/leanwarp_cloud/resources.py +0 -0
- {leanwarp-0.2.4 → leanwarp-0.2.5}/src/leanwarp_cloud/session.py +0 -0
- {leanwarp-0.2.4 → leanwarp-0.2.5}/src/leanwarp_cloud/skills/leanwarp/SKILL.md +0 -0
- {leanwarp-0.2.4 → leanwarp-0.2.5}/src/leanwarp_cloud/transport.py +0 -0
- {leanwarp-0.2.4 → leanwarp-0.2.5}/src/leanwarp_cloud/updates.py +0 -0
- {leanwarp-0.2.4 → leanwarp-0.2.5}/tests/__init__.py +0 -0
- {leanwarp-0.2.4 → leanwarp-0.2.5}/tests/fixtures/lake-manifest-1.1.0.json +0 -0
- {leanwarp-0.2.4 → leanwarp-0.2.5}/tests/fixtures/lake-manifest-1.2.0.json +0 -0
- {leanwarp-0.2.4 → leanwarp-0.2.5}/tests/test_amounts.py +0 -0
- {leanwarp-0.2.4 → leanwarp-0.2.5}/tests/test_client.py +0 -0
- {leanwarp-0.2.4 → leanwarp-0.2.5}/tests/test_deadline_transport.py +0 -0
- {leanwarp-0.2.4 → leanwarp-0.2.5}/tests/test_environment_compatibility.py +0 -0
- {leanwarp-0.2.4 → leanwarp-0.2.5}/tests/test_feedback.py +0 -0
- {leanwarp-0.2.4 → leanwarp-0.2.5}/tests/test_install.py +0 -0
- {leanwarp-0.2.4 → leanwarp-0.2.5}/tests/test_project.py +0 -0
- {leanwarp-0.2.4 → leanwarp-0.2.5}/tests/test_session.py +0 -0
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
Update an installed SDK with `leanwarp update`.
|
|
4
|
+
|
|
5
|
+
## 0.2.5
|
|
6
|
+
|
|
7
|
+
- The MCP server is listed in the official
|
|
8
|
+
[MCP Registry](https://registry.modelcontextprotocol.io) as
|
|
9
|
+
`io.github.Isagoge-Labs/leanwarp`.
|
|
10
|
+
- The documentation is now at
|
|
11
|
+
[isagoge.in/leanwarp/docs](https://isagoge.in/leanwarp/docs). The README and
|
|
12
|
+
the package's links point there.
|
|
13
|
+
- The getting-started guide, agent setup, reference and HTTP API pages are
|
|
14
|
+
rewritten to be shorter and simpler.
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: leanwarp
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.5
|
|
4
4
|
Summary: Check and verify Lean proofs on LeanWarp from the command line, MCP or Python
|
|
5
5
|
Project-URL: Repository, https://github.com/Isagoge-Labs/LeanWarp-SDK
|
|
6
6
|
Project-URL: Homepage, https://isagoge.in/leanwarp
|
|
7
|
-
Project-URL: Documentation, https://isagoge.in/docs
|
|
7
|
+
Project-URL: Documentation, https://isagoge.in/leanwarp/docs
|
|
8
8
|
Project-URL: Issues, https://github.com/Isagoge-Labs/LeanWarp-SDK/issues
|
|
9
|
-
Project-URL: Changelog, https://github.com/Isagoge-Labs/LeanWarp-SDK/
|
|
9
|
+
Project-URL: Changelog, https://github.com/Isagoge-Labs/LeanWarp-SDK/blob/main/CHANGELOG.md
|
|
10
10
|
License-Expression: MIT
|
|
11
11
|
License-File: LICENSE
|
|
12
12
|
Keywords: agents,formal-verification,lean,lean4,mathlib,mcp,theorem-proving
|
|
@@ -37,9 +37,11 @@ on workers that stay warm between edits, against a Lean release and the librarie
|
|
|
37
37
|
your project pins. This SDK is how you and your agents use it: the `leanwarp`
|
|
38
38
|
command, an MCP server and a Python library.
|
|
39
39
|
|
|
40
|
-
**[Get started](https://isagoge.in/docs/getting-started)** · [Agent setup](https://isagoge.in/docs/agents) ·
|
|
41
|
-
[Reference](https://isagoge.in/docs/reference) · [HTTP API](https://isagoge.in/docs/http-api) ·
|
|
42
|
-
[Documentation](https://isagoge.in/docs) · [Website](https://isagoge.in/leanwarp)
|
|
40
|
+
**[Get started](https://isagoge.in/leanwarp/docs/getting-started)** · [Agent setup](https://isagoge.in/leanwarp/docs/agents) ·
|
|
41
|
+
[Reference](https://isagoge.in/leanwarp/docs/reference) · [HTTP API](https://isagoge.in/leanwarp/docs/http-api) ·
|
|
42
|
+
[Documentation](https://isagoge.in/leanwarp/docs) · [Website](https://isagoge.in/leanwarp)
|
|
43
|
+
|
|
44
|
+
<!-- mcp-name: io.github.Isagoge-Labs/leanwarp -->
|
|
43
45
|
|
|
44
46
|
## What it does
|
|
45
47
|
|
|
@@ -56,7 +58,7 @@ command, an MCP server and a Python library.
|
|
|
56
58
|
| Check files | Up to 64 files checked in one operation. | `leanwarp check-files` |
|
|
57
59
|
| Verify batch | Up to 64 inline proofs checked in one operation, without uploading them as files; each result keeps its `custom_id`. | `leanwarp verify-batch` |
|
|
58
60
|
|
|
59
|
-
The [reference](https://isagoge.in/docs/reference#commands)
|
|
61
|
+
The [reference](https://isagoge.in/leanwarp/docs/reference#commands)
|
|
60
62
|
lists every command and option; `leanwarp skill --reference` prints it.
|
|
61
63
|
|
|
62
64
|
### Coming soon
|
|
@@ -141,7 +143,7 @@ Give your agent the project directory and this instruction:
|
|
|
141
143
|
|
|
142
144
|
For MCP clients, add the server `leanwarp --project /absolute/path/to/project mcp`,
|
|
143
145
|
or `uvx leanwarp --project /absolute/path/to/project mcp`
|
|
144
|
-
without installing. It uses the same key and project state as the CLI. See [agent setup](https://isagoge.in/docs/agents).
|
|
146
|
+
without installing. It uses the same key and project state as the CLI. See [agent setup](https://isagoge.in/leanwarp/docs/agents).
|
|
145
147
|
Keep API keys out of prompts, source files and tool arguments.
|
|
146
148
|
|
|
147
149
|
## Your project and its environment
|
|
@@ -169,7 +171,7 @@ environments LeanWarp serves.
|
|
|
169
171
|
|
|
170
172
|
The LeanWarp engine supports every stable Lean 4 release from 4.26.0, with the
|
|
171
173
|
Lake libraries a project locks. The hosted service runs it in the environments
|
|
172
|
-
[listed on the website](https://isagoge.in/docs/environments), which today pair
|
|
174
|
+
[listed on the website](https://isagoge.in/leanwarp/docs/environments), which today pair
|
|
173
175
|
Lean with Mathlib. Each one is built and tested before it is served, so your first
|
|
174
176
|
check starts from compiled libraries. If your project needs another Lean release
|
|
175
177
|
or library, [open an issue](https://github.com/Isagoge-Labs/LeanWarp-SDK/issues) with its `lean-toolchain` and
|
|
@@ -212,10 +214,10 @@ for each workspace in the [dashboard](https://isagoge.in/dashboard).
|
|
|
212
214
|
|
|
213
215
|
| Start here | Reference |
|
|
214
216
|
| --- | --- |
|
|
215
|
-
| [Verify your first proof](https://isagoge.in/docs/getting-started) | [Commands](https://isagoge.in/docs/reference#commands) |
|
|
216
|
-
| [Set up an agent with the CLI or MCP](https://isagoge.in/docs/agents) | [Results and exit codes](https://isagoge.in/docs/reference#results) |
|
|
217
|
-
| [Use the Python library](https://isagoge.in/docs/reference#python) | [Recover an interrupted request](https://isagoge.in/docs/reference#recovery) |
|
|
218
|
-
| [Call the HTTP API directly](https://isagoge.in/docs/http-api) | [Credentials, credit and limits](https://isagoge.in/docs/reference#credentials-credit-and-limits) |
|
|
217
|
+
| [Verify your first proof](https://isagoge.in/leanwarp/docs/getting-started) | [Commands](https://isagoge.in/leanwarp/docs/reference#commands) |
|
|
218
|
+
| [Set up an agent with the CLI or MCP](https://isagoge.in/leanwarp/docs/agents) | [Results and exit codes](https://isagoge.in/leanwarp/docs/reference#results) |
|
|
219
|
+
| [Use the Python library](https://isagoge.in/leanwarp/docs/reference#python) | [Recover an interrupted request](https://isagoge.in/leanwarp/docs/reference#recovery) |
|
|
220
|
+
| [Call the HTTP API directly](https://isagoge.in/leanwarp/docs/http-api) | [Credentials, credit and limits](https://isagoge.in/leanwarp/docs/reference#credentials-credit-and-limits) |
|
|
219
221
|
|
|
220
222
|
The agent instructions ship with the package: `leanwarp skill` prints the
|
|
221
223
|
workflow and `leanwarp skill --reference` the full reference. Run
|
|
@@ -5,9 +5,11 @@ on workers that stay warm between edits, against a Lean release and the librarie
|
|
|
5
5
|
your project pins. This SDK is how you and your agents use it: the `leanwarp`
|
|
6
6
|
command, an MCP server and a Python library.
|
|
7
7
|
|
|
8
|
-
**[Get started](https://isagoge.in/docs/getting-started)** · [Agent setup](https://isagoge.in/docs/agents) ·
|
|
9
|
-
[Reference](https://isagoge.in/docs/reference) · [HTTP API](https://isagoge.in/docs/http-api) ·
|
|
10
|
-
[Documentation](https://isagoge.in/docs) · [Website](https://isagoge.in/leanwarp)
|
|
8
|
+
**[Get started](https://isagoge.in/leanwarp/docs/getting-started)** · [Agent setup](https://isagoge.in/leanwarp/docs/agents) ·
|
|
9
|
+
[Reference](https://isagoge.in/leanwarp/docs/reference) · [HTTP API](https://isagoge.in/leanwarp/docs/http-api) ·
|
|
10
|
+
[Documentation](https://isagoge.in/leanwarp/docs) · [Website](https://isagoge.in/leanwarp)
|
|
11
|
+
|
|
12
|
+
<!-- mcp-name: io.github.Isagoge-Labs/leanwarp -->
|
|
11
13
|
|
|
12
14
|
## What it does
|
|
13
15
|
|
|
@@ -24,7 +26,7 @@ command, an MCP server and a Python library.
|
|
|
24
26
|
| Check files | Up to 64 files checked in one operation. | `leanwarp check-files` |
|
|
25
27
|
| Verify batch | Up to 64 inline proofs checked in one operation, without uploading them as files; each result keeps its `custom_id`. | `leanwarp verify-batch` |
|
|
26
28
|
|
|
27
|
-
The [reference](https://isagoge.in/docs/reference#commands)
|
|
29
|
+
The [reference](https://isagoge.in/leanwarp/docs/reference#commands)
|
|
28
30
|
lists every command and option; `leanwarp skill --reference` prints it.
|
|
29
31
|
|
|
30
32
|
### Coming soon
|
|
@@ -109,7 +111,7 @@ Give your agent the project directory and this instruction:
|
|
|
109
111
|
|
|
110
112
|
For MCP clients, add the server `leanwarp --project /absolute/path/to/project mcp`,
|
|
111
113
|
or `uvx leanwarp --project /absolute/path/to/project mcp`
|
|
112
|
-
without installing. It uses the same key and project state as the CLI. See [agent setup](https://isagoge.in/docs/agents).
|
|
114
|
+
without installing. It uses the same key and project state as the CLI. See [agent setup](https://isagoge.in/leanwarp/docs/agents).
|
|
113
115
|
Keep API keys out of prompts, source files and tool arguments.
|
|
114
116
|
|
|
115
117
|
## Your project and its environment
|
|
@@ -137,7 +139,7 @@ environments LeanWarp serves.
|
|
|
137
139
|
|
|
138
140
|
The LeanWarp engine supports every stable Lean 4 release from 4.26.0, with the
|
|
139
141
|
Lake libraries a project locks. The hosted service runs it in the environments
|
|
140
|
-
[listed on the website](https://isagoge.in/docs/environments), which today pair
|
|
142
|
+
[listed on the website](https://isagoge.in/leanwarp/docs/environments), which today pair
|
|
141
143
|
Lean with Mathlib. Each one is built and tested before it is served, so your first
|
|
142
144
|
check starts from compiled libraries. If your project needs another Lean release
|
|
143
145
|
or library, [open an issue](https://github.com/Isagoge-Labs/LeanWarp-SDK/issues) with its `lean-toolchain` and
|
|
@@ -180,10 +182,10 @@ for each workspace in the [dashboard](https://isagoge.in/dashboard).
|
|
|
180
182
|
|
|
181
183
|
| Start here | Reference |
|
|
182
184
|
| --- | --- |
|
|
183
|
-
| [Verify your first proof](https://isagoge.in/docs/getting-started) | [Commands](https://isagoge.in/docs/reference#commands) |
|
|
184
|
-
| [Set up an agent with the CLI or MCP](https://isagoge.in/docs/agents) | [Results and exit codes](https://isagoge.in/docs/reference#results) |
|
|
185
|
-
| [Use the Python library](https://isagoge.in/docs/reference#python) | [Recover an interrupted request](https://isagoge.in/docs/reference#recovery) |
|
|
186
|
-
| [Call the HTTP API directly](https://isagoge.in/docs/http-api) | [Credentials, credit and limits](https://isagoge.in/docs/reference#credentials-credit-and-limits) |
|
|
185
|
+
| [Verify your first proof](https://isagoge.in/leanwarp/docs/getting-started) | [Commands](https://isagoge.in/leanwarp/docs/reference#commands) |
|
|
186
|
+
| [Set up an agent with the CLI or MCP](https://isagoge.in/leanwarp/docs/agents) | [Results and exit codes](https://isagoge.in/leanwarp/docs/reference#results) |
|
|
187
|
+
| [Use the Python library](https://isagoge.in/leanwarp/docs/reference#python) | [Recover an interrupted request](https://isagoge.in/leanwarp/docs/reference#recovery) |
|
|
188
|
+
| [Call the HTTP API directly](https://isagoge.in/leanwarp/docs/http-api) | [Credentials, credit and limits](https://isagoge.in/leanwarp/docs/reference#credentials-credit-and-limits) |
|
|
187
189
|
|
|
188
190
|
The agent instructions ship with the package: `leanwarp skill` prints the
|
|
189
191
|
workflow and `leanwarp skill --reference` the full reference. Run
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# LeanWarp documentation
|
|
2
|
+
|
|
3
|
+
### Guides
|
|
4
|
+
|
|
5
|
+
- [Getting started](getting-started.md): from an API key to your first verified proof.
|
|
6
|
+
- [Use with an agent](agents.md): set up Claude Code, Codex, Cursor or another MCP client.
|
|
7
|
+
- [HTTP API](http-api.md): build your own client.
|
|
8
|
+
|
|
9
|
+
### Reference
|
|
10
|
+
|
|
11
|
+
- [Commands](../src/leanwarp_cloud/skills/leanwarp/references/usage.md#commands): what each command does.
|
|
12
|
+
- [Environments](https://isagoge.in/leanwarp/docs/environments): the Lean versions and libraries you can use.
|
|
13
|
+
- [Results](../src/leanwarp_cloud/skills/leanwarp/references/usage.md#results): what `success` means and where Lean's messages are.
|
|
14
|
+
- [Python](../src/leanwarp_cloud/skills/leanwarp/references/usage.md#python): use LeanWarp from Python.
|
|
15
|
+
- [Recovery](../src/leanwarp_cloud/skills/leanwarp/references/usage.md#recovery): lost responses, timeouts and conflicting edits.
|
|
16
|
+
- [Credentials, credit and limits](../src/leanwarp_cloud/skills/leanwarp/references/usage.md#credentials-credit-and-limits): keys, spending and size limits.
|
|
17
|
+
|
|
18
|
+
`leanwarp skill --reference` prints the reference without a key, and
|
|
19
|
+
`leanwarp COMMAND --help` lists a command's options.
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
# Use LeanWarp with an agent
|
|
2
|
+
|
|
3
|
+
An agent uses LeanWarp through the `leanwarp` command or its MCP server. Both use
|
|
4
|
+
the same key and the same project state in `.leanwarp/`, so the agent can switch
|
|
5
|
+
between them. [Install and sign in](getting-started.md) first, then choose the
|
|
6
|
+
Lean project the agent may work in.
|
|
7
|
+
|
|
8
|
+
## Set up your agents
|
|
9
|
+
|
|
10
|
+
```sh
|
|
11
|
+
leanwarp setup
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
This does two things for each agent it finds:
|
|
15
|
+
|
|
16
|
+
- It installs the LeanWarp skill: the instructions an agent follows. It goes in
|
|
17
|
+
`~/.claude/skills` for Claude Code, `~/.codex/skills` for Codex and
|
|
18
|
+
`~/.agents/skills` for other agents.
|
|
19
|
+
- It adds the MCP server to Claude Code (with `claude mcp add`), Codex
|
|
20
|
+
(`~/.codex/config.toml`) and Cursor (`~/.cursor/mcp.json`).
|
|
21
|
+
|
|
22
|
+
Setup only touches agents whose configuration folder already exists. Use
|
|
23
|
+
`--agent NAME` to set up one anyway, or `--no-mcp` to install only the skills.
|
|
24
|
+
It never replaces an existing `leanwarp` MCP entry.
|
|
25
|
+
|
|
26
|
+
Then run `leanwarp auth login` yourself and restart the agent. Later,
|
|
27
|
+
`leanwarp update` upgrades the command and refreshes the installed skills.
|
|
28
|
+
|
|
29
|
+
## The instruction
|
|
30
|
+
|
|
31
|
+
Open the agent in your Lean project and give it this instruction:
|
|
32
|
+
|
|
33
|
+
> Run `leanwarp skill` and follow it. Use LeanWarp to check this Lean project
|
|
34
|
+
> and verify proofs against their intended statements. Reuse the workspace
|
|
35
|
+
> while you edit, and run `leanwarp stop` when you are done.
|
|
36
|
+
|
|
37
|
+
`leanwarp skill` prints the workflow the agent follows: connect, check, read
|
|
38
|
+
results, verify against a fixed statement, recover from lost responses and stop
|
|
39
|
+
the worker. `leanwarp skill --reference` prints the full reference. Neither needs
|
|
40
|
+
a key or costs anything.
|
|
41
|
+
|
|
42
|
+
The skill also asks the agent to report real problems with LeanWarp itself
|
|
43
|
+
through `leanwarp feedback`, and to tell you when it does. A report names the
|
|
44
|
+
command that went wrong; it doesn't quote your source.
|
|
45
|
+
|
|
46
|
+
Sign in yourself with `leanwarp auth login`, or give the agent's environment a
|
|
47
|
+
`LEANWARP_API_KEY`. Never put the key in the instruction.
|
|
48
|
+
|
|
49
|
+
## Agents with shell access
|
|
50
|
+
|
|
51
|
+
The command line is built for agents:
|
|
52
|
+
|
|
53
|
+
- Proof commands print a JSON result with `success`: `true`, `false`, or `null`
|
|
54
|
+
while the operation is still running. On `null`, run `leanwarp wait` for the
|
|
55
|
+
same operation; don't submit it again.
|
|
56
|
+
- Exit codes tell apart "did not pass" (`1`), "could not run" (`2`) and "still
|
|
57
|
+
running" (`3`).
|
|
58
|
+
|
|
59
|
+
For an agent that `leanwarp setup` doesn't know, point its skill installer at
|
|
60
|
+
the [skill folder](../src/leanwarp_cloud/skills/leanwarp), including
|
|
61
|
+
`references/`.
|
|
62
|
+
|
|
63
|
+
## MCP
|
|
64
|
+
|
|
65
|
+
Add this server to your MCP client, with the absolute path of your project:
|
|
66
|
+
|
|
67
|
+
```json
|
|
68
|
+
{
|
|
69
|
+
"mcpServers": {
|
|
70
|
+
"leanwarp": {
|
|
71
|
+
"command": "leanwarp",
|
|
72
|
+
"args": ["--project", "/absolute/path/to/lean-project", "mcp"]
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
If the client can't find `leanwarp`, use its absolute path. To run the server
|
|
79
|
+
without installing the command, let
|
|
80
|
+
[uv](https://docs.astral.sh/uv/getting-started/installation/) fetch it from PyPI:
|
|
81
|
+
|
|
82
|
+
```json
|
|
83
|
+
{
|
|
84
|
+
"mcpServers": {
|
|
85
|
+
"leanwarp": {
|
|
86
|
+
"command": "uvx",
|
|
87
|
+
"args": ["leanwarp", "--project", "/absolute/path/to/lean-project", "mcp"]
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
The server starts even before you sign in, so the agent can read its guides.
|
|
94
|
+
Tools that need LeanWarp then explain how to sign in.
|
|
95
|
+
|
|
96
|
+
The agent should first read the resources `leanwarp://guide` and
|
|
97
|
+
`leanwarp://reference`. The tools match the CLI commands:
|
|
98
|
+
|
|
99
|
+
- **Setup:** `doctor`, `files`, `environments`, `connect`.
|
|
100
|
+
- **Proofs:** `check`, `inspect`, `try_tactics`, `verify_target`, `holes`,
|
|
101
|
+
`suggest`, `sorry2lemma`, `extract_decls`, `check_files`, `verify_batch`, and
|
|
102
|
+
`apply` to write a result into its file.
|
|
103
|
+
- **Control:** `wait`, `status`, `cancel`, `stop`, `recover`.
|
|
104
|
+
- **Workspaces and account:** the rest.
|
|
105
|
+
|
|
106
|
+
The [MCP reference](../src/leanwarp_cloud/skills/leanwarp/references/usage.md#mcp)
|
|
107
|
+
lists every tool and its arguments. Proof tools wait up to 20 seconds for their
|
|
108
|
+
result by default; set `wait_seconds` up to 40.
|
|
109
|
+
|
|
110
|
+
### Spending caps
|
|
111
|
+
|
|
112
|
+
If you give the agent a budget for the workspace, it passes it to `connect` as
|
|
113
|
+
`max_spend_microusd` ($1 is 1,000,000). Reconnecting without that argument keeps
|
|
114
|
+
the existing cap, and a different cap is refused. You can change a cap in the
|
|
115
|
+
dashboard.
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
# Getting started
|
|
2
|
+
|
|
3
|
+
This guide takes you from an API key to a verified proof in a few minutes. You
|
|
4
|
+
need the `leanwarp` command ([install](../README.md#install)), but you don't need
|
|
5
|
+
Lean on your machine.
|
|
6
|
+
|
|
7
|
+
If your shell can't find `leanwarp` after you install it, run
|
|
8
|
+
`uv tool update-shell` and open a new terminal.
|
|
9
|
+
|
|
10
|
+
You can check whether a project will run on LeanWarp before you sign up: run
|
|
11
|
+
`leanwarp doctor` in the project's folder. Without a key, it compares your
|
|
12
|
+
project with the environments LeanWarp offers. It uploads nothing.
|
|
13
|
+
|
|
14
|
+
## 1. Sign in
|
|
15
|
+
|
|
16
|
+
Run this in your own terminal:
|
|
17
|
+
|
|
18
|
+
```sh
|
|
19
|
+
leanwarp auth login
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
It opens the [dashboard](https://isagoge.in/dashboard?section=keys), where you
|
|
23
|
+
create an API key. Paste the key at the prompt; it stays hidden as you type. Add
|
|
24
|
+
`--no-browser` to print the link instead of opening it.
|
|
25
|
+
|
|
26
|
+
In CI or other automation, set `LEANWARP_API_KEY` from your secret manager
|
|
27
|
+
instead. Never put a key in a source file or in a conversation with an agent.
|
|
28
|
+
|
|
29
|
+
Commands that run Lean use prepaid credit, which you add in the dashboard.
|
|
30
|
+
|
|
31
|
+
## 2. Choose a project
|
|
32
|
+
|
|
33
|
+
LeanWarp uploads only your `.lean` files. It runs them in an **environment**: a
|
|
34
|
+
Lean release with fixed versions of libraries such as Mathlib, already built on
|
|
35
|
+
LeanWarp's servers. To see the environments:
|
|
36
|
+
|
|
37
|
+
```sh
|
|
38
|
+
leanwarp environments
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
The quickest way to start is an example project. Copy one of the
|
|
42
|
+
[examples](../examples) and work inside it:
|
|
43
|
+
|
|
44
|
+
```sh
|
|
45
|
+
git clone https://github.com/Isagoge-Labs/LeanWarp-SDK.git
|
|
46
|
+
cd LeanWarp-SDK/examples/lean-4.35
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
For your own project, run `leanwarp doctor` in its folder. It tells you which
|
|
50
|
+
environment the project will use, without starting a server:
|
|
51
|
+
|
|
52
|
+
- If the project's `lean-toolchain` and `lake-manifest.json` match an
|
|
53
|
+
environment, LeanWarp uses that one, so your results match your local build.
|
|
54
|
+
- If the folder has neither file, LeanWarp uses the newest stable Lean it offers.
|
|
55
|
+
- If nothing matches, `doctor` lists the environments that exist and reports
|
|
56
|
+
`compatible: false`. To use one anyway, pass `--environment NAME` to
|
|
57
|
+
`doctor` and `connect`. Your files then compile against that environment's
|
|
58
|
+
Lean and Mathlib.
|
|
59
|
+
|
|
60
|
+
When several environments offer the newest Lean, choose one with
|
|
61
|
+
`--environment`. Once a project is connected, it keeps its environment, even if
|
|
62
|
+
the default changes later.
|
|
63
|
+
|
|
64
|
+
LeanWarp reads both Git and local path dependencies in `lake-manifest.json`, in
|
|
65
|
+
newer manifest formats too. Git dependencies must be pinned to full commit
|
|
66
|
+
hashes. LeanWarp does not upload or build dependency folders: the environment
|
|
67
|
+
must already provide every library your files import.
|
|
68
|
+
|
|
69
|
+
Then create the project's workspace. This doesn't start a server or cost anything:
|
|
70
|
+
|
|
71
|
+
```sh
|
|
72
|
+
leanwarp connect
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
Add `.leanwarp/` to `.gitignore`. It holds this project's connection.
|
|
76
|
+
|
|
77
|
+
A project can upload at most 256 `.lean` files and 1 MiB in total.
|
|
78
|
+
`leanwarp files` lists what will upload. Files listed in `.gitignore` are left
|
|
79
|
+
out. To leave out more, such as an archive folder, list it in
|
|
80
|
+
`.leanwarpignore` in the project's root, using the same syntax as `.gitignore`
|
|
81
|
+
(`archive/`).
|
|
82
|
+
|
|
83
|
+
## 3. Check and verify
|
|
84
|
+
|
|
85
|
+
The example's `LeanWarpExample.lean` contains:
|
|
86
|
+
|
|
87
|
+
```lean
|
|
88
|
+
theorem add_zero_example (n : Nat) : n + 0 = n := by
|
|
89
|
+
rfl
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
First check the file:
|
|
93
|
+
|
|
94
|
+
```sh
|
|
95
|
+
leanwarp check LeanWarpExample.lean
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
Each command waits up to 30 seconds. If the check returns `success: null`
|
|
99
|
+
(exit code `3`), run `leanwarp wait` to wait for that same check to finish;
|
|
100
|
+
don't submit it again. If it fails, fix the reported errors and check again.
|
|
101
|
+
|
|
102
|
+
Once the check succeeds, verify that the theorem proves the statement you mean:
|
|
103
|
+
|
|
104
|
+
```sh
|
|
105
|
+
leanwarp verify LeanWarpExample.lean \
|
|
106
|
+
--declaration add_zero_example --target '∀ n : Nat, n + 0 = n'
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
The first command starts a server, called a worker, so it takes a little
|
|
110
|
+
longer. Later commands reuse it. Each command uploads the files you changed,
|
|
111
|
+
waits up to 30 seconds and prints the result. A shortened example:
|
|
112
|
+
|
|
113
|
+
```json
|
|
114
|
+
{
|
|
115
|
+
"success": true,
|
|
116
|
+
"kind": "verify_target",
|
|
117
|
+
"state": "completed",
|
|
118
|
+
"revision": 1,
|
|
119
|
+
"result": {
|
|
120
|
+
"result": {
|
|
121
|
+
"file": "LeanWarpExample.lean",
|
|
122
|
+
"status": "ok",
|
|
123
|
+
"receipt": {
|
|
124
|
+
"policy": "fixed_target_kernel_check_v1",
|
|
125
|
+
"candidate_declaration": "add_zero_example"
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
},
|
|
129
|
+
"execution": {"worker": "warm"},
|
|
130
|
+
"timing": {"queued_ms": 3, "worker_ms": 41, "upload_ms": 18, "run_ms": 612}
|
|
131
|
+
}
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
How to read it:
|
|
135
|
+
|
|
136
|
+
- `success` is `true` when the check passed or the proof was verified, and
|
|
137
|
+
`false` when it wasn't. Lean's messages are in `result.result`.
|
|
138
|
+
- If the command takes longer than the wait, `success` is `null` and the exit
|
|
139
|
+
code is `3`. Run `leanwarp wait` to get the result. Don't run the command
|
|
140
|
+
again.
|
|
141
|
+
- `execution` says what LeanWarp reused. Here, `"worker": "warm"` means the
|
|
142
|
+
worker the check started was still running, with Lean loaded.
|
|
143
|
+
- `timing` says where the time went.
|
|
144
|
+
|
|
145
|
+
While you edit, use `leanwarp check --draft LeanWarpExample.lean`. The worker
|
|
146
|
+
keeps the file open, so after each edit Lean rechecks only what changed, and
|
|
147
|
+
`sorry` is just a warning. A plain `check` rechecks the whole file, as a final
|
|
148
|
+
build would. Run it, or `verify`, when you're done.
|
|
149
|
+
|
|
150
|
+
## 4. Verify a Mathlib statement
|
|
151
|
+
|
|
152
|
+
When the statement needs Mathlib or your own definitions, put what it needs in a
|
|
153
|
+
context file. Save this as `SqNonneg.lean`:
|
|
154
|
+
|
|
155
|
+
```lean
|
|
156
|
+
import Mathlib
|
|
157
|
+
|
|
158
|
+
theorem sq_nonneg_example (x : ℝ) : 0 ≤ x ^ 2 := by
|
|
159
|
+
positivity
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
and save the statement's imports as `statement-context.txt`:
|
|
163
|
+
|
|
164
|
+
```lean
|
|
165
|
+
import Mathlib
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
Then verify:
|
|
169
|
+
|
|
170
|
+
```sh
|
|
171
|
+
leanwarp verify SqNonneg.lean --declaration sq_nonneg_example \
|
|
172
|
+
--target '∀ x : ℝ, 0 ≤ x ^ 2' --context-file statement-context.txt
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
LeanWarp reads the statement on its own, with only that context, and checks the
|
|
176
|
+
proof against it with Lean's kernel. So the proof can't change what the
|
|
177
|
+
statement means. Proofs that use `sorry`, `admit`, `native_decide`,
|
|
178
|
+
`set_option`, custom elaborators or new axioms are rejected.
|
|
179
|
+
|
|
180
|
+
## 5. Stop the worker
|
|
181
|
+
|
|
182
|
+
```sh
|
|
183
|
+
leanwarp stop
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
A worker also stops by itself after it has been idle for a while;
|
|
187
|
+
`leanwarp resources` shows how long. You pay for the time it runs, idle minutes
|
|
188
|
+
included, so stop it when you're done. Closing your terminal does not stop it.
|
|
189
|
+
|
|
190
|
+
Stopping keeps your uploaded files and results in the workspace. The next
|
|
191
|
+
command starts a new worker.
|
|
192
|
+
|
|
193
|
+
Next: [set up an agent](agents.md), or read the
|
|
194
|
+
[reference](../src/leanwarp_cloud/skills/leanwarp/references/usage.md) for every
|
|
195
|
+
command, limit and recovery step.
|