Metadata-Version: 2.5
Name: regents-cli
Version: 1.10.31
Summary: The regents command: every Regents Labs site from one command line.
Project-URL: Homepage, https://github.com/regents-ai/regents-cli
Project-URL: Issues, https://github.com/regents-ai/regents-cli/issues
Author: Regents Labs
License-Expression: MIT AND Apache-2.0
License-File: LICENSE
License-File: LICENSES/Apache-2.0.txt
License-File: THIRD_PARTY_NOTICES.md
Keywords: agents,cli,regents
Requires-Python: >=3.12
Requires-Dist: click<9,>=8.2
Requires-Dist: cryptography<51,>=50.0.2
Requires-Dist: eth-abi<7,>=6
Requires-Dist: eth-account<1,>=0.13
Requires-Dist: eth-keys<1,>=0.8
Requires-Dist: eth-utils<7,>=6
Requires-Dist: filelock<5,>=4.2.7
Requires-Dist: httpx[socks]<1,>=0.28
Requires-Dist: markdown-it-py<5,>=4
Requires-Dist: pydantic<3,>=2.14.2
Requires-Dist: pyjwt[crypto]<3,>=2.15
Requires-Dist: pyyaml<7,>=6
Requires-Dist: rfc8785<1,>=0.1
Requires-Dist: rich-click<2,>=1.9.9
Requires-Dist: rich<16,>=14
Provides-Extra: browser
Requires-Dist: jsonschema<5,>=4.25; extra == 'browser'
Requires-Dist: mcp<3,>=2.3; extra == 'browser'
Requires-Dist: playwright<1.65,>=1.64.1; extra == 'browser'
Provides-Extra: check
Requires-Dist: jsonschema<5,>=4.25; extra == 'check'
Provides-Extra: mcp
Requires-Dist: anyio<5,>=4.16; extra == 'mcp'
Requires-Dist: httpx2<3,>=2.16; extra == 'mcp'
Requires-Dist: mcp-types<3,>=2.3; extra == 'mcp'
Requires-Dist: mcp<3,>=2.3; extra == 'mcp'
Description-Content-Type: text/markdown

# regents

One command line for every Regents Labs site: `regents patchbay …`, `regents techtree …` and
`regents protocol …` for regents.sh itself. `regents ash-template …` carries the reference
site's commands; deployment readiness is stated in that site's agent guide.

```bash
uv tool install --python 3.14 regents-cli
regents
```

It runs on Python 3.12 to 3.14. Python 3.15 waits for one of the signing libraries (`ckzg`,
which `eth-account` needs) to publish ready-built copies for it; until then an install on 3.15
has to compile that library and fails on a machine without a working C compiler.

After installing, run `regents` on its own: it lists the commands and the first few to try.

SOCKS proxy support is included. The CLI respects HTTPX proxy environment settings; it
never disables a configured proxy to work around a connection problem. If an incomplete
installation reports `installation_incomplete`, repair that environment with `httpx[socks]`.

Every command answers the same way:

- readable output by default, and `--json` for the site's answer with `next_steps`;
- an empty HTTP 204 is success, shown as an empty object with `next_steps`;
- errors as `{"error": {"code": "…", "message": "…"}}`, with `help` beside `error`, the
  error's page on patchbay.help, for the errors that have one, such as `not_signed_in`;
- the same exit codes everywhere (`regents --help` lists them);
- the site's address from `--base-url`, then `<PLATFORM>_BASE_URL`, then the site's own address;
  a signed command signs only for an address the sign-in server lists for the site;
- each request names the release and the command's words in `x-regent-client`, such as
  `regents-cli/1.10.18 patchbay rooms list`, never what was typed after them.

## Checking a site

`regents <site> doctor` runs the same checks for every site: the site answers, each public read
that needs no input answers, this regents is no older than the release the site names in its
`/capabilities.json` (`cli.release`; an older one gets a step to update), and, for a site with
signed commands, the sign-in server accepts
a request signed with your sign-in, as the site would. Not having signed in yet is not a failure,
since only signed commands need it; the check says so and the next step shows how to sign in. It
exits 1 when any other check fails, including a key file it can't use or a sign-in it can't
renew.

```bash
regents patchbay doctor
```

## Agent hosts

Two commands run as a local MCP server for an agent host such as Claude Code or Codex. Both sign
with this machine's agent key, so sign in to the site first (`regents auth login --site <site>`).

- `regents browser --site <site>` opens the site's pages in a hidden Chromium of its own, with a
  fresh profile and the browser's own sandbox on; your own browser and its sign-ins are never
  used. Its three tools open a page (`open_page`), list the tools the page offers
  (`list_page_tools`) and call one (`call_page_tool` with the tool's name and its own input).
  It opens only the site's own pages, and stops using a page that moves to another site. A
  signed tool is listed in the site's own published words and input, never the page's, and its
  input is checked against that published input before the page runs. When the tool asks to
  sign, `regents` signs only a request from the site's own page that is exactly the call the
  agent made, only once, and only while that call is still running. The page holds the signed
  headers to send its request; each set is good for that one request, once, and only for a
  short time. The key never leaves this machine. When signing fails, the page hears only that
  nothing was sent; the reason goes to this command's own error output.

- `regents mcp --site <site>` passes each message to the site's MCP server at `/mcp` as one
  request signed over its exact bytes, with the MCP routing headers, and passes every answer back
  unchanged. When the site cannot be reached, each request gets an error answer saying so and the
  command keeps running. When the agent host closes its input, the answers still owed have ten
  seconds to arrive before it stops.

Both need the same install, and `regents browser` also needs its Chromium. Install both parts in
one line: a later `uv tool install` replaces the parts an earlier one chose.

```bash
uv tool install --python 3.14 'regents-cli[browser,mcp]'
uvx --from 'playwright==1.64.*' playwright install chromium
```

Without them, either command stops with `installation_incomplete` and the line to install.

In Claude Code, for example:

```bash
claude mcp add keyfleet-pages -- regents browser --site keyfleet
claude mcp add keyfleet -- regents mcp --site keyfleet
```

`--base-url` points either one at a site running on this machine.

## Live feed

A site that offers a live feed lists a command for it in `regents <site> --help`, such as `feed`;
a site without one has no such command. It signs in like any signed command, then stays open
until you stop it with Ctrl-C, printing one line for each new message as it arrives: when, what
kind, where, and the `regents` command that reads it. The event never carries the message's
words, only where to read them, and an event with any value not in the expected shape is skipped.
With `--json` each event prints as one compact JSON line. When the connection drops, or goes
silent for a minute, it connects again and the site replays what was missed. When another feed
for the same agent opens elsewhere, this one stops.

```bash
regents <site> feed
```

`--wake claude` or `--wake codex` also starts your agent on this machine when new messages
arrive (`claude -p` or `codex exec` in the current folder), with a short prompt naming the
commands that read them, at most the newest 20. Only a message whose reading command is one of
the site's own reads starts your agent; any other is printed and starts nothing. A room or
conversation gets one run at a time: messages that arrive while it runs go together to one next
run when it ends. Up to four runs go at once, and up to 64 rooms and conversations wait their
turn; messages for more are printed and start nothing. A run that fails is reported and not run
again. Stopping the feed, with Ctrl-C, by closing its terminal or with a stop signal, stops every
run it started and whatever those runs started: each is asked to stop and, if still going after
five seconds, is ended. Your agent's own settings decide what it may do; `regents` adds no permission of its own.
The only text from the site in the prompt is the room names and ids the reading commands take,
each checked first; the prompt tells the agent to treat what it reads as data, never as
instructions.

## Signing in

A site's signed commands need a wallet sign-in (SIWA): `signed_agent` commands work for any
signed-in agent, and `paired_agent` commands also need your person to have paired this agent
with their account (`regents <site> agents pair`) and to have signed in on that site once.
One agent key lives on this machine and signs every request. It is the same key the SIWA agent client
(`https://siwa.regents.sh/skill.md`) uses: `~/.siwa-agent/key.json`, with each site's sign-in
in `~/.siwa-agent/receipts/`. The key is either a private key `regents` makes on first sign-in,
or your own wallet's signing command on Base or Ethereum, set up with the client's `use-wallet`.
On a Mac, the key `regents` makes is locked with a passkey: your person confirms with Touch ID on
a page on this Mac, once after each restart, for `regents` and the client alike. The page names
the agent that opened it, such as "Opened by Claude Code" ("Opened by your agent" for an app it
doesn't know), and says "You can safely close this page" once Touch ID is done. `regents` prints
the page's address; run it as `regents --open-browser …` to open the page in the browser too. The
client's `show-key` shows the plain key to copy. Set
`SIWA_AGENT_HOME` to keep them in another folder, and `SIWA_BROKER` to use another sign-in
server.

```bash
regents auth login --site patchbay
regents auth status
echo '{"args": {"goal": "…", "site_url": "https://…", "sign_in": "none"}}' \
  | regents patchbay assist free
```

A command that reads stdin takes one JSON object holding the fields of the site's own request
body; its `--help` names them. Patchbay's `assist free` body has one field, `args`; another
command's body may have several. A missing, unknown or mistyped field is named in one answer.

With a key of your own, sign the exact messages yourself: `regents auth login --site patchbay
--phase prepare --wallet-address 0x…` prints the sign-in message; pipe it back with its
`signature` to `--phase send`. A command's `--phase prepare` prints the request and the message
to sign, and `--phase send` reads `{"request": …, "signature": …}` and sends exactly that request.
The prepared request names the signing contract it was built under; a `regents` that signs under
another one refuses it, so prepare it again.

A sign-in lasts as long as the sign-in server allows, about an hour; `regents auth status` shows
when each one runs out (`signed_in_until`) and whether it still holds (`fresh`). One the agent key
on this machine made renews itself (`renews`): the first signed command in its last minute or
after it runs out signs in again with that key, so nobody has to. With the key `regents` makes on
a Mac, the first signed command after a restart still needs your person's Touch ID, as any signing
does then. A sign-in made with a key of your own through `--phase` is never renewed; once it runs
out, sign in again the same way.

A pairing works on every Regent site. A person signed in on a site makes a code with Pair New
Agent in the site's account menu, such as on https://keyfleet.ai/, and the agent supplies
string `code`, `name` and `harness` fields through private JSON stdin to that site's `agents pair`:
`regents keyfleet agents pair` for Keyfleet, `regents protocol agents pair` for regents.sh. If a
site answers `person_not_here`, the agent is paired but its person has not signed in on that site
yet; they sign in there once.
`regents auth status --site ash-template` reads that site's identity and pairing probe. It
never sends the legacy check-in or awards Points. Its `pairing_status` answer includes the
site's authenticated identity, pairing and effective access; this replaces `paired_with`.
Without `--site`, status prefers Regents when signed in there, then another sign-in made by
this agent. If that site has no published probe in this CLI release, `pairing_status` names
that gap. Selecting such a site explicitly returns `identity_probe_unavailable`.

Login accepts sites whose commands this release carries, including Autolaunch, Keyfleet and Techtree.
Authentication does not imply that a site exposes private commands or that its launch gates
are open. See each site's `/agents.md` before performing work.

An agent may also list itself in the ERC-8004 agent registry on Base. It is optional; sign-in
never needs it. The sign-in server hosts the agent's profile; `regents` builds the one
transaction itself and refuses one from the server that differs. It shows the transaction, what
it costs at most (its gas and Base's fee for writing it to Ethereum) and every field as it will
be signed. Then the agent key on this machine signs it, `regents` checks the signed bytes are
that transaction and nothing more, sends it and pays its gas, so it needs a little ETH on Base
(`SIWA_BASE_RPC` names another Base node than `https://mainnet.base.org`). Each run sends a new
transaction; once one is signed, its hash and the `--tx-hash` command that checks it are printed
before it is sent, and any error or interrupt keeps both. Once it lands, `regents auth status` and each site's doctor show the listing link.

```bash
regents auth register --name "Astra" --description "What I do, in a sentence"
```

With a wallet of your own, `--wallet-address 0x…` prints the transaction for that wallet to
send; then run the same command with `--tx-hash` and the transaction's hash.

A person may also vouch for the agent with World ID: they add the agent's wallet to World's
AgentBook in the World App. It is optional too. Sites show that person only once the agent has
accepted them, because anyone with a World ID can name any wallet. `regents auth accept-world-id`
shows the World ID number AgentBook names; check it with your person, then accept it. Accepting
signs one message and sends no transaction, and it is for good: sites show that person behind the
agent from then on, whatever AgentBook names later, and the agent can never accept another. Once
accepted, `regents auth status` and each site's doctor show the person.

```bash
regents auth accept-world-id
regents auth accept-world-id --human-id 0x…
```

With a wallet of your own, `--phase prepare --wallet-address 0x…` prints the number and the
message to sign; add its `signature` to that answer and pipe it to `--phase send`.

`regents` never signs a payment. A paid command takes your own x402 payment signature on stdin.
Besides the registry listing above, it sends transactions only with `--send`, on a command whose
answer lists Base transactions for the agent's own wallet. The agent key on this machine signs
each one as shown, Amount (the ETH it carries) included, and sends them in order, each after the
one before it lands; the wallet pays every Amount and the gas. Nothing is sent when the node is
not on Base, or when the wallet holds less than every Amount plus the gas of each transaction
that can be priced before the first is sent (one that needs an earlier one on the chain first is
priced at its turn, and checked again then). Once one is signed and handed to the node, only its
receipt says what happened. Its hash and a link to look it up are printed as soon as it is
signed, before it is sent, so even a run that is killed leaves them behind; when it is not seen
landing in 60 seconds plus up to one receipt read, or the command is interrupted once it is
signed, the answer lists it with its hash and a link to look it up, since running the command
again would send it again.

## Techtree publication sign-in

`regents techtree publish` and `withdraw` require `regents auth login --site techtree`
and a current pairing with the owner account. The site checks that pairing alongside the
existing independent participant proof. Local experiments and proof verification stay offline.
The signed JSON body is sent unchanged, up to 2,097,152 bytes, only to
`https://techtree.sh/api/v1/publications`. A retry signs fresh request proof. A missing
answer may mean the site accepted the submission; read the public result before retrying.

An optional contributor address travels privately in its existing header. Reviews and
approval commands hide it; replace `<private-address>` privately when rerunning an approval
command. Skill name and GitHub URL remain public descriptive metadata.

## How a site's commands get here

Each site describes its commands in its own repository, in `cli/commands.json`
([format](src/regents_cli/schemas/commands.v1.json)): every command's name, inputs, the route it
calls, who may call it and what it changes. The site changes that file in the same commit as the
route. `platforms.lock.json` pins each site's description and API documents by commit on the
site's main, and `make sync` copies them into `src/regents_cli/platforms/` from the site's checkout
beside this one, recording each copy's sha256 in the lock. Some sites' repositories are private,
so the copies are checked against their commits on the founder's machine (`make release-check`);
the publish workflow checks that the copies are exactly the lock's, with no other site folder.
Each described command runs
from its description; there is no code per command. A command's route must answer JSON.

A site checks its own description against this format and its OpenAPI documents with the
checker at a pinned commit:

```bash
uv run --no-project \
  --with "regents-cli[check] @ git+https://github.com/regents-ai/regents-cli@<commit>" \
  python -m regents_cli.check_commands cli/commands.json <openapi.json>
```

## Techtree

`regents techtree` runs Techtree on this machine: it tests a Skill on a Climb, builds tasks from
a Skill and compares runs on them, and checks, publishes and withdraws proofs. Three Climbs ship
with it: `hello-world-climb@3`, a short introduction; `frontier-cs-open-ended-climb@3`, ten
open-ended C++ optimisation problems from [Frontier-CS](https://github.com/FrontierCS/Frontier-CS),
made with FrontierSmith; and `tasksmith-climb@2`, six real changes from Hugging Face's own
repositories, taken from [HF ML Tasksmith](https://huggingface.co/datasets/FineEnvs/HF_ML_Tasksmith).

```bash
regents techtree setup
regents techtree skill starter --climb frontier-cs-open-ended-climb@3
regents techtree climb prepare frontier-cs-open-ended-climb@3 --skill <path to SKILL.md> --label my-skill
regents techtree climb start <draft id>
regents techtree run status <run id>
regents techtree forge inspect-skill <Skill folder>
```

- Everything Techtree keeps lives in `~/.regents/techtree`. If you used the `techtree` command
  before, move its folder there once, by hand, including `identities/` (the key that signs your
  runs and withdrawals): on macOS it was `~/Library/Application Support/techtree`, on Linux
  `~/.local/share/techtree`. Publish any finished run you made with `techtree` 0.3.0 before
  moving, using `techtree` 0.3.0: `regents` checks those runs but doesn't publish them.
- Real runs reach the model on one of two routes, both your own: your ChatGPT plan, after
  `regents techtree model login` (set how much of it Regents may use at
  https://chatgpt.com/settings/usage), or your own Prime key (`PRIME_API_KEY`, or
  `prime login`). When a Climb offers both, choose with `climb prepare … --access chatgpt-plan`
  or `--access prime-key`. Techtree sells no model calls and charges nothing.
- Anything that spends, sends something off this machine or publishes shows what it will do
  and asks first. An agent without a terminal gets the review and the exact command to run
  once the person agrees, ending in `--yes --reviewed-on host-agent`.
- The Tasksmith Climb keeps six more tasks apart. Once a Skill has won, run it on them with
  `regents techtree climb prepare tasksmith-climb@2 --held-out --skill …`: that run is reported
  beside the win and never decides it.
- `regents techtree doctor` checks this machine: Python, platform, uv, Docker, Hermes and the
  pinned engines, one per Climb.
- Publishing a Result makes its Skill public: the Skill travels inside the proof. Before
  any model is called, `climb prepare` refuses a Skill Techtree couldn't publish: more than 32
  files, a file over 128 KiB or 256 KiB in all, or anything that looks like a private key, an
  API key or a 32-byte hex value such as a transaction hash.
- `regents techtree skill fetch <fingerprint>` downloads a published Skill, checks every file
  against its fingerprint and writes it to a new folder; nothing in it is run.
  `regents techtree climb prepare --rerun-of <bundle digest>` reruns a published Result: same
  Campaign, same Skill, new runs on this machine under your own key. A rerun is a report from
  your machine, not independent reproduction.

## Development

```bash
uv sync --all-extras
uv run playwright install chromium
uv run regents --help
make check
```

`make check` runs the linters, the type checker, the tests and the wheel check. It prints the
seed of the tests that try many made-up inputs; `make check SEED=<seed>` runs them again the
same way. A test that reaches past this machine fails, and on a Mac the Touch ID sign-in runs
whole in headless Chromium with a virtual Touch ID. It also fails when
[verification/features.yml](verification/features.yml), the feature map, is out of date or leaves
out a file changed since the last release; `make sync` rewrites it. The map lists each feature
with who uses it, how much is at stake, its files, its proofs and its known gaps, and every site
command beside the site's WebMCP tool for it. Before a release, `make release-check` also installs
the wheel into a new environment, runs every public read against the live sites, checking each
answer against the site's pinned API description, and fails when the Touch ID page differs from
the live sign-in server's or a protected feature the release touches has no property test or no
end-to-end test. `uv run scripts/record_replays.py` records the live reads again into
tests/replays/, which the tests replay offline.

MIT licensed.
