Set up an agent session
An agent publishes with two things the command-line tool carries: the commons-verify skill,
which tells it how to review a package and attest to it, and the commons MCP server, which gives it
the tools search, get and publish. This page sets both up for a Claude Code session, in the
directory of the package the agent will publish.
The agent also needs:
- the
commonscommand on itsPATH, because the skill runscommons attest(install the command-line tool); - an agent’s file it can find, by default at
~/.config/commons/credentials.json(grant an agent).
Install the skill
Section titled “Install the skill”In the package’s directory:
commons skill installIt copies the skill, unchanged, to .claude/skills/commons-verify, Claude Code’s directory for a
project’s skills, and prints the path and the copy’s digest:
installed /home/ada/iso-duration/.claude/skills/commons-verifysha256:4cf9250fcf69b0c381298842d8c24e46e66114e20781fcaf78a98a4deb7b8ed7--dir <dir>installs it in another skills directory, for example--dir ~/.claude/skillsfor every project.- An identical copy already there is left as it is (
already installed, unchanged:). A different one is refused unless you pass--force.
Do not edit the installed copy. The digest is over every byte of the skill, each attestation
records it, and the commons accepts attestations only from a skill whose digest its policy lists.
The trial’s policy is at https://trial.opencodecommons.org/-/commons/v1/policy. To print the
digest of any copy:
commons skill digest .claude/skills/commons-verifyAdd the MCP server
Section titled “Add the MCP server”In the same directory, write the session’s MCP configuration:
echo '{ "mcpServers": { "commons": { "command": "commons", "args": ["mcp"] } } }' > .mcp.jsoncommons mcp runs the MCP server on standard input and output. It reads the agent’s file from
COMMONS_CREDENTIALS, else from credentials.json in the tool’s directory, and the service’s
address from COMMONS_URL, else from the agent’s file. Claude Code asks you to approve the
commons server the first time a session starts in the directory.
A session that only searches and installs needs no agent’s file; give it the service’s address instead:
{ "mcpServers": { "commons": { "command": "commons", "args": ["mcp"], "env": { "COMMONS_URL": "https://trial.opencodecommons.org" } } }}Neither .claude/ nor .mcp.json is packed into what is published. commons pack --dry-run lists
every file that is.
What the skill makes the agent do
Section titled “What the skill makes the agent do”Asked to publish the package, an agent with the skill:
- checks that
commonsand npm 11 or later are installed, and works out the exact model it runs as, which it declares in each attestation; - checks the package: a
fileslist inpackage.json, acommons.sourceblock, apackage-lock.json, and a standards file,STANDARDS.md, with numbered rules; - lists both artifacts with
commons pack --dry-run, finishes every change it means to make, and runs the tests; - reviews every packed file against each numbered rule of
STANDARDS.md, without editing anything, and writes its findings to.commons/review-findings.json: a verdict and a note for each rule, the answer to “was any code in this package copied from a source under another license?”, and the files it read; - runs three commands one straight after the other:
commons attest test-run, which runs the tests itself and signs the result;commons attest code-review, which signs the review; andcommons publish(or the MCP server’spublishtool); - reads any rejection, fixes what the package can fix, and reports what only the account holder can fix, such as a namespace the account does not own.
Each attestation is signed with a key certified for ten minutes, which is why the attest commands and the publish follow each other with nothing in between. Any edit after attesting changes the package’s bytes and means attesting again.
The standards file
Section titled “The standards file”STANDARDS.md holds the rules the review checks, as numbered lines (1. , 2. , …, with none
missing). It is packed into the source bundle, so anyone can read what a package was reviewed
against.
If the package has no STANDARDS.md, the agent creates one from the skill’s template,
STANDARDS.template.md, whose eight rules are, in short:
- Does what it says. Every statement in
descriptionandcommons.capabilitiesinpackage.jsonis true of the code. - Typed. The file named by
typesdeclares every export, with a comment on each. - Tested. Every exported function has a test of normal input and one of invalid or edge-case input, and the tests pass.
- Fails loudly. Invalid input throws an
Errorwith a message that names the problem. - Side effects declared. The code touches the filesystem, network, subprocesses or
environment only if
commons.sideEffectslists it. - No install-time code. No
preinstall,installorpostinstallscript. - Licensed. Every file is under the package’s licence, which is one of the commons’ list. No copied or vendored code under another licence.
- No secrets. No keys, tokens, passwords or personal data in any file.
Write your own STANDARDS.md to hold a package to other rules. A different standards path is
named in package.json, as commons.source.standards.