Documentation

Quickstart

This page gets a coding agent recorded on your own machine. It takes one command. No account is needed.

start installs a hook for each coding agent it finds on the machine: Claude Code, Codex, Gemini CLI, Cursor, Grok CLI, Hermes Agent and OpenClaw. It lists every file before it changes anything. This page follows Claude Code. For the other files, and for agents start does not cover, see Connect an agent.

1. Install and start

There are two ways to get the command-line tool (the CLI).

The install script. The engine serves a script that installs the CLI and then runs countersign start:

curl -fsSL https://app.trycountersign.ai/start.sh | sh

The script supports macOS and Linux on amd64 and arm64. It downloads the CLI to ~/.countersign/bin/countersign, compares the download with its published SHA-256 checksum, and refuses to install if they differ. If ~/.countersign/bin is not on your PATH, the script prints the line to add.

Build from source. This needs Go 1.27.3 or later.

make build
bin/countersign start

2. What start does

start tells you what it is about to do before it creates anything.

Countersign will record what your coding agent does. Everything stays on this machine.
It adds a hook to ~/.claude/settings.json. It records. It does not block anything.
Continue? [Y/n]

If you answer no, nothing is changed. If there is no terminal to ask on, start treats that as a no.

After you confirm, it does six things.

  1. Starts the engine on this machine. The engine is the part that decides and records. It listens on 127.0.0.1:4951 only. Its database, its signing key and its log file (engine.log) are in ~/.countersign/local. It starts when something needs it and exits after 12 hours with no requests. The next use starts it again.
  2. Creates a workspace. The workspace is named after you and the machine, for example ada@laptop. A signing key is made for you. The workspace details and your key are saved in ~/.countersign/config.json, readable only by your user.
  3. Activates a starting policy. The policy is {"default":"allow","rules":[]}. It allows everything the agent's passport grants.
  4. Gives the agent a passport. A passport is a signed statement of what an agent may do. This one is named claude-code, covers every tool (*) and lasts 365 days. The agent's credential is saved in ~/.countersign/agents/claude-code.json. The credential is set to recording only.
  5. Adds a hook to Claude Code. See the next section.
  6. Records one action. start sends one signed request so there is a receipt to look at straight away.

Then it prints a summary. The values below are examples.

Countersign is set up.

  workspace   ada@laptop (on this machine)
  agent       claude-code, recording only: no rule blocks anything, a revoke does
  hook        added to ~/.claude/settings.json
  status line added (a count of what this session did)
  test        receipt #4: a test action sent by this command, signed and in the ledger
  recording   waiting for the first tool call from your agent. Restart it, use it once, then
              `countersign doctor` says when each hook last asked.

Restart Claude Code if it is already open. Then use it as usual. The receipt in the summary is a test action start sent itself. Recording begins when your agent, restarted, makes its first tool call. countersign doctor tells you when each hook last asked.

3. What it changes in ~/.claude/settings.json

start asks before it changes this file.

  • It adds one entry to PreToolUse, one to PostToolUse and one to PostToolUseFailure, so a tool call that fails has an outcome too. Each has the matcher * and runs countersign hook --agent claude-code --fail open, using the full path of the CLI. Each tells Claude Code to wait at most 15 seconds for the hook.
  • It adds one entry to UserPromptSubmit that runs the same command. This is how a key or token pasted into the conversation is noticed. The prompt is read on your machine. Nothing is recorded unless it holds one, and then only the kind of secret is. See Secret exposure alerts.
  • It adds a statusLine entry that runs countersign statusline. It does this only if you have no status line of your own.
  • Before the first change it saves a copy of the file as it was, at ~/.claude/settings.json.before-countersign.
  • If the file is not valid JSON, start stops and changes nothing.
  • Your other hooks and settings are left as they are.

To set up the workspace without touching the settings file, use --no-hook. To skip the status line, use --no-statusline. To skip the question, use --yes. To use a different settings file, use --settings PATH.

4. See what the agent does

The log

countersign log            # the last 30 actions
countersign log -f         # keep printing new actions as they happen
countersign log -n 100     # the last 100
countersign log --all      # also show passports, policy changes and outcome reports

Each line is the receipt number, the time, the verdict and the action.

   12  14:02:07  ok          git status
   13  14:02:31  would block git push --force origin main  ! force push rewrites history other people may have

The verdicts are:

VerdictMeaning
okAllowed.
would blockA rule said no. Recording only, so the action was not stopped.
would askA rule asked for a human. Recording only, so the action was not held.
refusedThe passport was revoked or has run out, and the action did not run.
ran anywayThe passport was revoked or has run out, and a hook that only records let the action run. A revoke stops a recording-only hook from build 2026.11.29.2 on, so after a revoke this is a hook that needs countersign update.
BLOCKEDBlocked. The agent was told why.
NEEDS OKHeld for a human approval.
refusedThe engine refused the request before evaluating it, for example because the passport had expired.

A ! marks an action the guard list flags. See Guard.

The digest

countersign digest               # the last 24 hours
countersign digest --since 72h   # further back

The digest counts actions, sessions and changed files. It lists flagged actions under "Worth a look", newest last, up to 25. It says how many of them the guard would have stopped.

The status line

In Claude Code the status line shows a count for the current session.

● rec 42 · 2 flagged · guard on · #57
  • rec 42: 42 actions recorded in this session. The count reads the latest 400 ledger entries and shows 400+ at that limit.
  • 2 flagged: two of them match the guard list.
  • guard on: shown when an agent credential on this machine is enforcing.
  • #57: the latest receipt number in this session.
  • ○ countersign: not recording: the engine did not answer.
  • ○ countersign: not set up: there is no workspace on this machine.

The ledger in your browser

countersign open

This opens the console for your workspace with a link that works once, for five minutes. The browser can read the ledger. It holds no signing key, so it cannot sign passports, policy or approvals. Make those changes with the CLI.

5. Block destructive commands

countersign guard on

Recording only is the default. guard on switches to enforcing and adds rules that block a short list of destructive commands. See Guard.

6. Stop

countersign stop

stop removes the Countersign hook entries and the Countersign status line from ~/.claude/settings.json. It leaves everything else in the file alone. Your agent is no longer recorded.

The ledger and keys stay in ~/.countersign. Delete that folder to remove them. The engine exits by itself after 12 quiet hours. countersign start turns recording back on.

What is recorded

For each tool call the hook records:

  • the tool name
  • the shell command (first 1,000 characters), or the file path, or the URL
  • the working directory
  • a hash of the full arguments

File contents and command output are not recorded. Text that looks like a credential is replaced with a marker before the entry is signed. See Security and limits.

Keep the ledger on the hosted service instead

countersign start --hosted

This creates the workspace on https://app.trycountersign.ai in place of your machine. Before it creates anything, start lists what is sent for each tool call: the tool name, the shell command (first 1,000 characters), the file path or URL, and the working directory. File contents and command output are not sent.

A machine holds one workspace. To switch between local and hosted, remove ~/.countersign and run start again.

Files on your machine

PathContents
~/.countersign/config.jsonWorkspace id, API key, your signing key, the engine's public key.
~/.countersign/agents/NAME.jsonOne agent credential: its key, its passport id and its mode.
~/.countersign/local/The local engine's database, its key and engine.log.
~/.countersign/hook/The hook's memory of which approval belongs to which action.
~/.countersign/shares.jsonThe receipts you have published from this machine.
~/.countersign/bin/countersignThe CLI, when installed by the script.
~/.countersign/originThe address the CLI was installed from. countersign update fetches the next build from there. See Updating.

Set COUNTERSIGN_HOME to use a different folder.

Next