Grant an agent
An agent acts for your account: it attests to packages and publishes them under your namespaces. To let it, you grant it, with the account key, on the account holder’s machine.
commons agent grant <agent> --account <account> --out ~/.config/commons/credentials.json<agent> is a name you choose, unique within the account, with the same rule as an account name
(1 to 39 characters: lower-case letters, digits and hyphens, not starting with a hyphen). The
command makes the agent’s key, signs a grant for it with the account key, registers the grant
with the service, and writes the agent’s file to the path --out names. For the agent
agent-a of the account ada it printed:
Registered agent ada/agent-a (sha256:74e5e7bf387f7dae6a293a31fa4f7345891888d2fdcdc094c030f3412ae6f15b) at https://trial.opencodecommons.org, valid until 2026-12-29T15:13:07.379Z.Wrote agent file /home/ada/.config/commons/credentials.json (mode 0600).The agent reads it through COMMONS_CREDENTIALS or --credentials, else from credentials.json in its COMMONS_HOME.A grant names the account, not a namespace: the agent can publish under every namespace the account owns.
The agent’s file
Section titled “The agent’s file”The agent’s file holds the service’s address, the account’s and the agent’s names, the grant, and the agent’s private key. It is a secret: whoever holds it can publish as your agent until the grant ends. The command writes it readable only by you (mode 0600), and the tool warns when an agent’s file can be read by others.
The agent’s commands, and the MCP server, find the file in this order:
- the path
--credentials <file>names, for a command that has the flag; - the path
COMMONS_CREDENTIALSnames; credentials.jsonin the tool’s directory,~/.config/commons/credentials.jsonby default.
Writing it to ~/.config/commons/credentials.json, as above, means the agent needs no setting to
find it. An account can grant several agents, each with its own name and file, and each can be
stopped on its own.
How long a grant lasts
Section titled “How long a grant lasts”A grant lasts 30 days unless you say otherwise:
--days <n>: 1 to 90 days;--hours <n>: 1 to 24 hours, for a grant that covers one working session.
To renew a grant, run the same command again with the same --out file. It keeps the agent’s key
and registers a new grant for it:
Renewed the grant of agent ada/agent-a (sha256:74e5e7bf387f7dae6a293a31fa4f7345891888d2fdcdc094c030f3412ae6f15b) at https://trial.opencodecommons.org, valid until 2026-12-29T15:13:07.922Z.An agent’s name is bound to its key. A grant for an existing name with a different file, and so a different key, is refused:
error: the service refused (HTTP 409) agent_exists: Agent ada/agent-a: the agent is registered with another key.To give an agent a new key, for example after its file was lost, grant a new agent name.
When an account’s key is replaced (commons account enroll --rotate), every grant the old key
signed stops working: grant each agent again.
List the account’s agents
Section titled “List the account’s agents”commons agent list --account <account>Each line gives the agent’s name, its status, its key ID and when its current grant ends:
agent-a active sha256:74e5e7bf387f7dae6a293a31fa4f7345891888d2fdcdc094c030f3412ae6f15b grant until 2026-12-29T15:13:07.922ZStop an agent: the kill switch
Section titled “Stop an agent: the kill switch”There is no command to revoke one grant. An agent signs each attestation with a key that is certified for ten minutes, so stopping an agent means refusing it the next certificate. The kill switch does that, signed with the account key.
To stop one agent:
commons agent suspend <agent> --account <account>Suspended agent ada/agent-a; its status is now suspended.A suspended agent is refused certificates and sessions, so it can neither attest nor publish, and an attestation it signed under a certificate it still holds is refused at publish. To let it act again:
commons agent resume <agent> --account <account>Resumed agent ada/agent-a; its status is now active.To stop every agent of the account at once:
commons account suspend <account>commons account resume <account>Suspended account ada; its status is now suspended.Resumed account ada; its status is now active.A suspended account also cannot claim a namespace; it keeps the ones it has. Each suspension and each resumption is an entry in the commons’ public log. Versions already published stay, and still verify: the switch stops an agent from acting, and says nothing about what it did before.