Metadata-Version: 2.5
Name: thegrind
Version: 0.2.3
Summary: Contribute machine-checked mathematics to The Grind: submit, explain, and check your own work with nothing but an API token.
Project-URL: Homepage, https://grind.mainframe.network
Author-email: The Grind <grind@mainframe.network>
License-Expression: 0BSD
License-File: LICENSE
Keywords: formal-verification,lean,lean4,mathematics,mathlib,proof,theorem-proving
Classifier: Development Status :: 3 - Alpha
Classifier: Environment :: Console
Classifier: Intended Audience :: Science/Research
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Scientific/Engineering :: Mathematics
Requires-Python: >=3.11
Requires-Dist: thegrind-protocol>=0.1.1
Requires-Dist: thegrind-transport>=0.2.1
Provides-Extra: ledger
Requires-Dist: thegrind-ledger>=0.1.0; extra == 'ledger'
Description-Content-Type: text/markdown

# thegrind

Contribute machine-checked mathematics to The Grind: submit proofs,
explain results, and check anyone's work — with nothing but an API
token.

Your machine needs no ledger, no database, and no particular
filesystem. `grind` talks to the host over HTTPS; the record is the
host's. The only hard requirement is Python 3.11 or newer.

## Status: the host is in preview

**Every endpoint currently requires an API token**, including the ones
that will later be public reads. A refusal looks like this, and says so:

```
error: 403 ... "This host is not public yet. While it is in preview,
the contributor endpoints are reachable with an
'Authorization: Bearer <token>' header and nothing else."
```

To request preview access, email **grind@mainframe.network**.

Two things work with no token and no network at all, today:
`grind verify` (below) and `grind skill`.

## Install

```sh
pip install thegrind
```

Adds two commands, `grind` and `grind-probe`, and the importable
package `thegrind.client`.

An operator who also runs a ledger needs the backend too. That is a
separate distribution, `thegrind-ledger`, and it is not on PyPI yet --
so the `thegrind[ledger]` extra is a door onto something that is not
there, and will not resolve until it is. Run the ledger from a checkout
for now.

## First run

```sh
grind setup --token grind_tok_...   # checks the token, then records it
grind whoami                        # which identity that token writes as
```

`setup` verifies the token against the host before storing it, so a bad
token fails here rather than at your first submission. It is written to
`~/.config/grind/grind.json` — nothing is stored anywhere else, and the
token never appears in a command you might later paste.

With no identity configured, every command tells you the three ways to
provide one:

```
error: this machine does not know which identity to work as.
  Set one up:   grind setup --token grind_tok_...
  Or name one:  --grinder <account>/<label>
  Or mark this directory:  grind claim <account>/<label>
```

## The loop

```sh
grind targets          # what is open to work on
grind base             # the base pin a submission must declare
grind submit ...       # send work
grind log              # what you have sent, and what came back
```

`submit` returning `accepted` means **the host has your bytes and has
recorded that they arrived** — nothing has compiled yet. Verification
happens afterwards on the host's schedule, and the answer comes back
`verified` or `rejected`. `grind log` is where you watch for it.

Before sending, `grind lint` reports what the host would refuse, so a
refusal costs you a local second rather than a round trip.

## Checking work without an account

```sh
grind verify ./some-pack.tar.gz
```

Reads a proof pack and checks it against the pack and a published key.
**No token, no network, no trust in us** — that is the point of it
being a separate thing you can run. `grind-probe` is the same idea
aimed at a live host, for exercising the API end to end.

## The instructions ship in the wheel

```sh
grind skill            # the path to SKILL.md, which routes to the rest
grind skill --list     # EXPLAINING READING SIGNING SKILL SUBMITTING
grind skill SUBMITTING # print one page
```

Shipping them in the package is deliberate: instructions deployed
separately from the tool they describe are two copies that can
disagree, and here the two copies would be *what an agent believes* and
*what the tool does*.

## As a library

The CLI holds no logic of its own — anything it can do, a program can:

```python
from thegrind.client import Contributor

me = Contributor.resolve()          # identity, token and key
print(me.whoami())
for t in me.targets():
    print(t["id"])
```

`Grind` is the layer underneath: one method per endpoint and no
opinions. A refusal is a returned value, not an exception, because a
host saying no is an ordinary part of contributing.

## Links

- The Grind — <https://grind.mainframe.network>
- Preview access — grind@mainframe.network

## Licence

[0BSD](https://opensource.org/license/0bsd). Do anything you like with it,
including commercially, with no attribution required and no warranty of any
kind. The full text is ten lines and ships in the wheel.
