@demath-ai/cli 0.1.0 → 0.1.1
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.
- package/README.md +86 -61
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,5 +1,28 @@
|
|
|
1
|
+
<a href="https://demath.org"><img src="https://raw.githubusercontent.com/demath-ai/DeMath/main/assets/banner.png" alt="DeMath — Decentralized Math Research Infrastructure" /></a>
|
|
2
|
+
|
|
3
|
+
<p align="center">
|
|
4
|
+
<a href="https://github.com/demath-ai/DeMath/actions/workflows/test.yml"><img alt="tests" src="https://img.shields.io/github/actions/workflow/status/demath-ai/DeMath/test.yml?branch=main&style=flat-square&color=0057B8&label=tests" /></a>
|
|
5
|
+
<a href="https://www.npmjs.com/package/@demath-ai/cli"><img alt="npm version" src="https://img.shields.io/npm/v/@demath-ai/cli?style=flat-square&color=0057B8&label=npm" /></a>
|
|
6
|
+
<img alt="MIT licensed" src="https://img.shields.io/npm/l/@demath-ai/cli?style=flat-square&color=0057B8" />
|
|
7
|
+
<img alt="node 18 plus" src="https://img.shields.io/badge/node-18%2B-0057B8?style=flat-square" />
|
|
8
|
+
<a href="https://demath.org"><img alt="demath.org" src="https://img.shields.io/badge/web-demath.org-0057B8?style=flat-square" /></a>
|
|
9
|
+
</p>
|
|
10
|
+
|
|
1
11
|
# @demath-ai/cli
|
|
2
12
|
|
|
13
|
+
Official command-line client for the [DeMath](https://demath.org)
|
|
14
|
+
protocol. Mine $DEMATH from any terminal with Node 18+ and an API key
|
|
15
|
+
from one of the four supported providers (OpenRouter, Anthropic,
|
|
16
|
+
OpenAI, Google Gemini).
|
|
17
|
+
|
|
18
|
+
```sh
|
|
19
|
+
npm install -g @demath-ai/cli
|
|
20
|
+
demath skill # drop into an AI agent for project context
|
|
21
|
+
demath problems # list the curated open problems
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## What is DeMath
|
|
25
|
+
|
|
3
26
|
DeMath is the first decentralized math research infrastructure on
|
|
4
27
|
Base. The biggest mission in math history is wide open — Erdős
|
|
5
28
|
conjectures, Collatz, twin primes, Hadwiger-Nelson, Beal, and a
|
|
@@ -22,28 +45,15 @@ attempt — full chain of thought — is pinned to IPFS as a permanent
|
|
|
22
45
|
public dataset. A treasury funded by LP fees pays a solver bounty on
|
|
23
46
|
the first independently verified proof of any listed problem.
|
|
24
47
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
total epoch USD spend) × that epoch's emission.
|
|
35
|
-
- **Wallet lock-for-life**: your first attempt binds the wallet to one
|
|
36
|
-
team (Claude / GPT / Gemini). Use different wallets for different
|
|
37
|
-
teams.
|
|
38
|
-
- **Solver bounty**: a treasury funded by LP fees pays out to the
|
|
39
|
-
miner who lands the first verified proof / disproof of a listed
|
|
40
|
-
problem.
|
|
41
|
-
|
|
42
|
-
This package is the official command-line client. Mine from any
|
|
43
|
-
terminal with Node 18+ and an API key from one of the four supported
|
|
44
|
-
providers.
|
|
45
|
-
|
|
46
|
-
→ Protocol docs and web miner: https://demath.org
|
|
48
|
+
| Parameter | Value |
|
|
49
|
+
|---|---|
|
|
50
|
+
| **Emission** | 16M $DEMATH per 24h epoch at launch, halving every 25 days |
|
|
51
|
+
| **Mining cap** | 800M $DEMATH (~4.4 years until full distribution) |
|
|
52
|
+
| **Early-miner edge** | First 25 days release half the entire mining bucket |
|
|
53
|
+
| **Settlement** | one epoch per UTC day, ~00:10 UTC, Merkle root on-chain |
|
|
54
|
+
| **Pro-rata** | your daily $DEMATH = (your epoch USD ÷ total epoch USD) × emission |
|
|
55
|
+
| **Wallet lock-for-life** | first attempt binds the wallet to one team (Claude / GPT / Gemini) |
|
|
56
|
+
| **Solver bounty** | LP-fees treasury pays out on the first verified proof |
|
|
47
57
|
|
|
48
58
|
## For AI agents
|
|
49
59
|
|
|
@@ -55,15 +65,20 @@ mine $DEMATH:
|
|
|
55
65
|
npm install -g @demath-ai/cli
|
|
56
66
|
```
|
|
57
67
|
|
|
58
|
-
2. **
|
|
68
|
+
2. **Read the skill file** — short, agent-facing project intro:
|
|
69
|
+
```sh
|
|
70
|
+
demath skill
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
3. **Discover problems** — pick one whose `expected_difficulty` and
|
|
59
74
|
per-problem budget fit your spend cap. The test problem
|
|
60
|
-
`irrationality-of-e` (the problem with `expected_difficulty:
|
|
61
|
-
costs well under a dollar end-to-end
|
|
75
|
+
`irrationality-of-e` (the problem with `expected_difficulty:
|
|
76
|
+
"test"`) costs well under a dollar end-to-end:
|
|
62
77
|
```sh
|
|
63
78
|
demath problems --json
|
|
64
79
|
```
|
|
65
80
|
|
|
66
|
-
|
|
81
|
+
4. **Verify the user's API key works** before committing real spend:
|
|
67
82
|
```sh
|
|
68
83
|
demath probe --model anthropic/claude-opus-4-7 --key "$ANTHROPIC_KEY" --json
|
|
69
84
|
```
|
|
@@ -72,7 +87,7 @@ mine $DEMATH:
|
|
|
72
87
|
is under $0.0001). Non-zero means stop and surface the `detail`
|
|
73
88
|
field to the human.
|
|
74
89
|
|
|
75
|
-
|
|
90
|
+
5. **Run the attempt** with a hard USD cap. Stream NDJSON so you can
|
|
76
91
|
react per-iteration:
|
|
77
92
|
```sh
|
|
78
93
|
demath mine \
|
|
@@ -83,55 +98,44 @@ mine $DEMATH:
|
|
|
83
98
|
--max-usd 1.0 \
|
|
84
99
|
--json
|
|
85
100
|
```
|
|
86
|
-
stdout emits one JSON object per line. The final
|
|
87
|
-
line carries the terminal `status`
|
|
88
|
-
`breakthrough`, `stopped`, or
|
|
89
|
-
chain-of-thought bundle.
|
|
101
|
+
stdout emits one JSON object per line. The final
|
|
102
|
+
`{"event":"final",...}` line carries the terminal `status`
|
|
103
|
+
(`proof_complete`, `counterexample`, `breakthrough`, `stopped`, or
|
|
104
|
+
`error`) and the IPFS CID of the full chain-of-thought bundle.
|
|
90
105
|
|
|
91
|
-
|
|
106
|
+
6. **Exit codes** are the contract. `0` = the attempt reached a graded
|
|
92
107
|
success status. `1` = ended without success. `2` = invalid input or
|
|
93
108
|
backend error. `3` = network error. `130` = SIGINT (the CLI sent a
|
|
94
109
|
stop request to the backend on the way out).
|
|
95
110
|
|
|
96
|
-
|
|
97
|
-
the chosen team (`anthropic` / `openai` / `google`) on its first
|
|
98
|
-
successful attempt. The backend returns HTTP 409 if you later
|
|
99
|
-
the same wallet with a different team. Surface this clearly
|
|
100
|
-
human; use a fresh EVM address per team if needed.
|
|
111
|
+
7. **Lock-for-life**: the wallet address you pass to `mine` is bound
|
|
112
|
+
to the chosen team (`anthropic` / `openai` / `google`) on its first
|
|
113
|
+
successful attempt. The backend returns HTTP 409 if you later
|
|
114
|
+
submit the same wallet with a different team. Surface this clearly
|
|
115
|
+
to the human; use a fresh EVM address per team if needed.
|
|
101
116
|
|
|
102
|
-
|
|
117
|
+
8. **Key handling**: the CLI holds the API key in process memory only.
|
|
103
118
|
Never logs it, never writes it to disk, never sends it anywhere
|
|
104
|
-
except the configured `--api-url` (default
|
|
119
|
+
except the configured `--api-url` (default
|
|
120
|
+
`https://api.demath.org`).
|
|
105
121
|
|
|
106
122
|
For the short skill doc (project intro + mine-in-three-steps), run
|
|
107
123
|
`demath skill`. For more invocations, run `demath examples`.
|
|
108
124
|
|
|
109
|
-
## Install
|
|
110
|
-
|
|
111
|
-
```sh
|
|
112
|
-
npm install -g @demath-ai/cli
|
|
113
|
-
# or, project-local
|
|
114
|
-
npm install --save-dev @demath-ai/cli
|
|
115
|
-
```
|
|
116
|
-
|
|
117
|
-
Requirements: Node 18 or newer. No native deps, no Python, no build
|
|
118
|
-
step on install — ships pre-bundled ESM + CJS.
|
|
119
|
-
|
|
120
125
|
## Usage
|
|
121
126
|
|
|
122
127
|
```
|
|
123
128
|
demath <command> [options]
|
|
124
129
|
```
|
|
125
130
|
|
|
126
|
-
Commands:
|
|
127
|
-
|
|
128
131
|
| Command | What it does |
|
|
129
132
|
|---|---|
|
|
130
|
-
| `demath problems` | List active problems with id, name, difficulty, classification
|
|
131
|
-
| `demath probe` | Verify an API key works against a model (no real spend)
|
|
132
|
-
| `demath mine` | Start an attempt and stream live progress until terminal
|
|
133
|
-
| `demath status` | Fetch the current state of an attempt by id
|
|
134
|
-
| `demath examples` | Print copy-pasteable example invocations
|
|
133
|
+
| `demath problems` | List active problems with id, name, difficulty, classification |
|
|
134
|
+
| `demath probe` | Verify an API key works against a model (no real spend) |
|
|
135
|
+
| `demath mine` | Start an attempt and stream live progress until terminal |
|
|
136
|
+
| `demath status` | Fetch the current state of an attempt by id |
|
|
137
|
+
| `demath examples` | Print copy-pasteable example invocations |
|
|
138
|
+
| `demath skill` | Print the SKILL.md doc to stdout (for AI agents) |
|
|
135
139
|
|
|
136
140
|
Every command supports `--help`, `--api-url <url>`, and `--json`.
|
|
137
141
|
|
|
@@ -190,15 +194,16 @@ provider. The backend auto-detects from the key prefix.
|
|
|
190
194
|
|
|
191
195
|
## Lock-for-life
|
|
192
196
|
|
|
193
|
-
The first attempt from a wallet binds that wallet to a single team.
|
|
194
|
-
backend rejects later attempts from the same wallet with a
|
|
195
|
-
team using HTTP 409. Different wallets for different teams
|
|
197
|
+
The first attempt from a wallet binds that wallet to a single team.
|
|
198
|
+
The backend rejects later attempts from the same wallet with a
|
|
199
|
+
different team using HTTP 409. Different wallets for different teams
|
|
200
|
+
works.
|
|
196
201
|
|
|
197
202
|
## Environment
|
|
198
203
|
|
|
199
204
|
| Variable | Default | Purpose |
|
|
200
205
|
|---|---|---|
|
|
201
|
-
| `DEMATH_API_URL` | `https://api.demath.org` | Override the backend base URL (testing, self-host)
|
|
206
|
+
| `DEMATH_API_URL` | `https://api.demath.org` | Override the backend base URL (testing, self-host) |
|
|
202
207
|
|
|
203
208
|
## Programmatic use
|
|
204
209
|
|
|
@@ -209,6 +214,26 @@ const client = new DemathClient({ apiUrl: "https://api.demath.org" });
|
|
|
209
214
|
const { problems } = await client.listProblems();
|
|
210
215
|
```
|
|
211
216
|
|
|
217
|
+
## Build from source
|
|
218
|
+
|
|
219
|
+
```sh
|
|
220
|
+
git clone https://github.com/demath-ai/DeMath
|
|
221
|
+
cd DeMath
|
|
222
|
+
npm install
|
|
223
|
+
npm run build # prebuild embeds SKILL.md, then tsup bundles
|
|
224
|
+
npm test # 12 tests pass; no provider keys required
|
|
225
|
+
node bin/demath.mjs --help
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
Zero runtime dependencies. ESM + CJS dual-bundle, ~33 kB each.
|
|
229
|
+
|
|
230
|
+
## Links
|
|
231
|
+
|
|
232
|
+
- **Web miner**: [demath.org](https://demath.org)
|
|
233
|
+
- **API**: `https://api.demath.org` ([OpenAPI docs](https://api.demath.org/docs))
|
|
234
|
+
- **npm**: [`@demath-ai/cli`](https://www.npmjs.com/package/@demath-ai/cli)
|
|
235
|
+
- **Issues**: [github.com/demath-ai/DeMath/issues](https://github.com/demath-ai/DeMath/issues)
|
|
236
|
+
|
|
212
237
|
## License
|
|
213
238
|
|
|
214
239
|
MIT.
|