Skip to content

Contracts

A contract is a reference that two parties share word for word, such as a skill that hands work to another agent and the agent that does it. Its version names one exact text. When either party quotes the version, the other knows which text it answered to.

A contract is not an interface. An interface’s version names a shape that several implementations fill, each with its own text. A contract’s version names the text itself, so any change to the text needs a new version.

A contract is named <id>.contract, and its frontmatter carries a contract: block:

---
description: The contract between a skill that delegates work and the agent it delegates to.
contract:
id: delegation
version: 1
parties: [Delegator, Delegatee]
---
## Migrate a `contract:` field you already use
`contract:` is reserved for this block. A reference named `<id>.contract` whose `contract:` is anything but a mapping,
such as `contract: 1`, fails `reference check` with "`contract:` is not a mapping". A reference with any other name is
not checked as a contract, so it keeps passing.
To migrate:
1. Rename the old field to a name of your own, such as `scaffold-contract: 1`, in the reference and in every skill,
recipe, or script that reads it.
2. Add the `contract:` block with an `id` that matches the file name, a `version`, and the `parties`.
3. Run `reference check`.
## Delegator
How to write the brief, and when to reject a report.
## Delegatee
How to treat the brief, and what the report holds.

Each party is a top-level section of the body, in the order the block lists them. The version lives only in the block: the body carries no Version: line of its own.

The line a brief quotes is built from the block: Version: <id>-contract <version>. reference excerpt prints it, then a blank line, then one party’s section word for word, with its subsections:

Terminal window
npx -y cyber-agentkit reference excerpt delegation.contract Delegatee
Version: delegation-contract 1
## Delegatee
How to treat the brief, and what the report holds.

A skill that delegates puts this output into the brief instead of linking to the contract. The agent it hands work to may run where cyber-agentkit is not installed, and this way it reads the text the skill shipped with.

The delegatee’s report opens with three lines, in this order: the exact version line, a Model: line, and Status: done or Status: blocked. reference check-report checks them:

Terminal window
npx -y cyber-agentkit reference check-report delegation.contract report.md
name: delegation.contract
passed: false
failure:
line: 1
expected: "Version: delegation-contract 1"
found: "Model: claude-opus-5-5"

A report that fails is passed: false with the first wrong line, not an error. Give - as the file to read the report from standard input. From the library, checkContractReport(contract, report) gives the same answer.

reference check checks a contract’s block, its name, its parties, and that its body has no version line. Two more rules keep a version from naming two texts:

  • A customized contract gets its own id or version. When a repo, user, managed, or project contribution changes what the contract composes to, the result must carry a different id or version from the copy the plugin ships. check fails it with contract-customized otherwise.

  • The text cannot change without a version bump. reference check --since <ref> compares each contract file in the repository with its copy at that git ref, and fails one whose text changed while its version did not go up, with contract-version. Run it in CI against the branch a pull request merges into:

    Terminal window
    npx -y cyber-agentkit reference check --since origin/main

    A contract that did not exist at the ref passes. A change to the frontmatter alone, or to trailing whitespace, is not a change to the text.