Documentation

Concepts

Countersign has three parts.

  1. Passport. A person signs what an agent may do.
  2. Gate. The agent asks before every action. A policy decides: allow, block, or ask a human.
  3. Receipt. Every answer is signed and added to a ledger. Anyone can check it offline.

Countersign decides and records. It never runs the action itself.

Workspace

A workspace holds one ledger, one policy, one owner key and any number of agents. The API and the CLI call it a tenant. Workspace ids start with tn_.

Owner

The owner is the person who holds the workspace's signing key. The code calls this person the principal. The owner's signature is needed to issue or change a passport, to activate a policy, to create a fleet rollout and to approve a held action.

A workspace starts with one owner key. The owner can add other people, each with their own signing key. See Team, alerts and replay.

Passport

A passport is the owner's signed statement of what one agent key may ask for. The API and the CLI call it a mandate. Passport ids start with md_.

A passport holds:

FieldMeaning
agent_nameA name for the agent.
agent_pubThe agent's public key. The passport is for whoever holds the matching private key.
toolsThe tool names the agent may ask for. * stands for any run of characters, so mcp__github__* covers every tool of one MCP server and * alone covers everything. A tool that is not listed is blocked.
escalateTool names that always need a human approval.
per_action_capThe most one action may cost.
escalate_overA cost above which a human must approve.
budgetThe total the agent may spend under this passport.
currencyThe currency for the three money limits.
not_afterWhen the passport expires.
legal_basisOptional. The agreement or policy the delegation sits under.
ownerOptional. The business owner: the person or team who answers for the agent. Not the workspace owner who signs.
tierOptional. The risk tier: low, medium, high or critical.

Money amounts are whole numbers in minor units, such as cents. A limit of zero means the limit is not set.

Cost is a number the agent states when it asks. Countersign compares it with the limits. It does not move money and does not check the amount against any payment system.

A passport can be amended. The owner signs the new terms, the agent keeps its key, and the change is a new ledger entry that names the version it replaces. A passport can be revoked. Every later request under it is refused and the refusal is recorded. A revoked passport stays revoked. To bring the agent back, issue a new one.

Gate

The gate is the check that happens before each action. The agent sends a signed request, called an ask. The engine answers with one of three effects.

EffectConsole labelMeaning
allowAllowedThe action may run.
denyDeniedThe action is blocked.
escalateNeeds approvalThe action is held until the owner approves it. See Approvals.

The engine decides in this order:

  1. The passport's hard limits: the tool must be granted, the currency must match, the cost must be within the per-action cap and the budget.
  2. The policy's rules, top to bottom. The first rule that matches decides.
  3. The passport's approval terms: tools that always need a human, and costs over the approval threshold.
  4. The policy's default.

See Policy for the detail.

An ask carries:

  • the tool name
  • an optional target, such as a file path or a payee
  • a hash of the action's full arguments
  • facts the caller chooses to expose to policy, called attrs
  • an optional cost and currency
  • a session id

The arguments themselves are never sent. Only the hash is.

Refusals

A refusal is different from a block. The engine refuses an ask before evaluating it in four cases.

ReasonMeaning
mandate_revokedThe passport was revoked.
mandate_expiredThe passport has expired.
request_identity_conflictThe request id was already used for a different ask.
invalid_attempt_linkThe ask claims to re-attempt an approved action, and that claim does not hold.

Refusals are recorded. An ask whose signature does not match the passport is rejected and is not recorded.

Outcome

After an allowed action runs, the agent can report what happened: ok or error, with a hash of the result. This is the agent's own word. Countersign records it as such and does not check it.

Receipt

A receipt is the proof for one ledger entry. It has three parts:

  • the entry itself
  • the ledger's signed head: the size of the ledger, a root hash that commits to every entry, a time, and the engine's signature
  • a short inclusion proof that the entry sits under that root

Checking a receipt needs the engine's public key and nothing else. A receipt shows that the entry is in the signed ledger at that position. Re-running the policy for a decision needs the whole ledger. See Evidence and offline verification.

Receipt numbers are the entry's position in the ledger. countersign log shows them at the start of each line.

Ledger

The ledger is an append-only list of entries for one workspace. Every change is an entry.

Entry kindWritten when
tenant_createdThe workspace is created. It records the engine's public key, the owner's public key and the kind of signer.
policy_activatedThe owner signs a new policy version.
mandate_grantedA passport is issued.
mandate_amendedA passport's terms change.
mandate_revokedA passport is revoked.
enrollment_createdA fleet rollout is created.
enrollment_revokedA fleet rollout is closed.
action_allowed, action_denied, action_escalatedAn ask is decided.
action_refusedAn ask is refused before evaluation.
action_lateAn action ran while the engine could not be reached, and its hook handed the signed ask in afterwards. It holds the time the agent says it ran and the time it arrived, how the passport stood then, and what the policy in force then makes of it. It is not a decision: nothing was decided before the action ran.
approvalThe owner approves a held action.
approval_declinedA person declines a held action. It cannot be approved afterwards.
reviewA person's finding, pass or breach, on an action that was allowed with nobody asked. See Controls report.
outcomeThe agent reports what an allowed action did.

How the ledger is protected:

  • Each entry is encoded as deterministic CBOR (RFC 8949 section 4.2) and carries the hash of the entry before it. Entries are numbered with no gaps.
  • The whole ledger is committed to by a Merkle tree (RFC 6962 section 2.1, hashed with SHA-256).
  • The engine signs the tree's root with Ed25519.

The engine's database stores the entries. When the engine loads a workspace it rebuilds the workspace's state from those entries, through the same code the offline verifier runs.

From build 2026.11.29.2 the engine does not check every entry again each time it loads. As a ledger grows the engine writes a checkpoint: its own signed note that entries 1 to N, with this tree root, were checked in full. On the next load it folds entries 1 to N in without checking their signatures or working their decisions out again, and then compares the tree root over them with the root in the note. The root commits to every byte of every entry, so a match means these are the entries it checked. Entries after N are checked in full. If the note is missing, is not signed by the engine's key for the workspace, or does not match the ledger, the engine throws the result away and checks every entry from the first. A checkpoint holds no state and decides nothing: it is a reason to skip work already done, and never a reason to accept an entry.

What this changes, and what it does not:

  • An entry changed in the database is still caught on the next load. The root no longer matches, the full check runs, and it refuses the entry.
  • The offline verifier and countersign check never read a checkpoint. They check every entry, every time. An evidence pack carries no checkpoint.
  • Whoever holds the engine's key could write a checkpoint for a ledger they had changed. They could already sign a changed ledger: see What the evidence establishes. A checkpoint gives them nothing more.
  • Set COUNTERSIGN_FULL_REPLAY=1 on an engine you run to make it check every entry on every load.

Measured on one of our machines, on a ledger of 30,000 short entries in a local database: 1.7 seconds to load with the full check, 0.17 seconds from the checkpoint. It has not been measured on the hosted service.

The signing keys

Three keys sign different things.

Your key

Your key is the owner's key. It is an Ed25519 key. It signs passports, amendments, policy versions, fleet rollouts, approvals and revocations.

  • From the command line, the key is created on your machine and saved in ~/.countersign/config.json.
  • In the console, the key is created in your browser. The browser holds it in a form that page scripts can use to sign and cannot read out. The server stores an encrypted copy that only your password opens, and a second encrypted copy that only your recovery code opens. The server cannot read either copy.

The engine never holds your key. It cannot issue a passport, change policy or approve an action on your behalf.

The engine's key

The engine has one Ed25519 key per workspace. It signs each decision, each ledger head and each ticket. The public half is called the engine key, or decision_pub. It is recorded in the first entry of the ledger.

Give the engine key to anyone who will verify your evidence, through a channel other than the evidence itself. This is called pinning. A verifier that has the pinned key can tell that a ledger came from your workspace's engine.

Where to find it:

  • countersign status prints it as decision_pub.
  • countersign export prints it in the verify command it suggests.
  • The console shows it on the Evidence page and in Settings.

The agent's key

Each agent has its own key. It signs every ask and every outcome report. Its only power is to ask. It cannot grant, approve or change anything.

The key is an Ed25519 key created when the passport is issued. It is saved in the agent's credential file together with the engine address, the workspace id and the passport id. Agents send no API key. The signature is the credential.

An agent registered in the Agent Name Service can sign with its ANS identity key instead. See Agent Name Service support.

A fleet rollout adds one more key, the enrolment key. It can only issue passports with the exact terms the owner signed. See Fleet rollout and Coverage.

What "software signer" means

The engine's key is held in ordinary software, in the engine's memory. The first entry of every ledger says so: signer: software. countersign verify prints it. The console shows it in Settings.

What this means for you:

  • The signatures show that the ledger has not been changed since the engine wrote it.
  • They do not show that the engine ran inside tamper-resistant hardware. Whoever operates the engine could, in principle, make it sign something else.
  • For a ledger on your own machine, you operate the engine. The ledger is your own record. No outside party witnessed it.
  • For a hosted workspace, the hosted engine made and signed the decision. That is a witness other than you, still with a software key.

A signer inside attested hardware is not built. Publishing ledger roots to a public log is not built. See Security and limits.