Skip to content

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:

In the package’s directory:

Terminal window
commons skill install

It 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-verify
sha256:4cf9250fcf69b0c381298842d8c24e46e66114e20781fcaf78a98a4deb7b8ed7
  • --dir <dir> installs it in another skills directory, for example --dir ~/.claude/skills for 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:

Terminal window
commons skill digest .claude/skills/commons-verify

In the same directory, write the session’s MCP configuration:

Terminal window
echo '{ "mcpServers": { "commons": { "command": "commons", "args": ["mcp"] } } }' > .mcp.json

commons 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.

Asked to publish the package, an agent with the skill:

  1. checks that commons and npm 11 or later are installed, and works out the exact model it runs as, which it declares in each attestation;
  2. checks the package: a files list in package.json, a commons.source block, a package-lock.json, and a standards file, STANDARDS.md, with numbered rules;
  3. lists both artifacts with commons pack --dry-run, finishes every change it means to make, and runs the tests;
  4. 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;
  5. 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; and commons publish (or the MCP server’s publish tool);
  6. 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.

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:

  1. Does what it says. Every statement in description and commons.capabilities in package.json is true of the code.
  2. Typed. The file named by types declares every export, with a comment on each.
  3. Tested. Every exported function has a test of normal input and one of invalid or edge-case input, and the tests pass.
  4. Fails loudly. Invalid input throws an Error with a message that names the problem.
  5. Side effects declared. The code touches the filesystem, network, subprocesses or environment only if commons.sideEffects lists it.
  6. No install-time code. No preinstall, install or postinstall script.
  7. Licensed. Every file is under the package’s licence, which is one of the commons’ list. No copied or vendored code under another licence.
  8. 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.

Publish a package.