Switchboardcompletion-hook reference
Back to the overview
Full source reference

The exit event.

Settings, behavior and supporting evidence in one reading view.

alpha.6 · source previewPublic CLI 0.1.0-alpha.5The hook is not in the public release.

Wiring & settings

The unpublished installer merges these hook groups into .claude/settings.local.json, preserving existing hooks.

{
  "hooks": {
    "PostToolUse": [{
      "matcher": "Bash|Edit|Write",
      "hooks": [{ "type": "command", "command": "sb hook record", "timeout": 10 }]
    }],
    "PostToolUseFailure": [{
      "matcher": "Bash|Edit|Write",
      "hooks": [{ "type": "command", "command": "sb hook record", "timeout": 10 }]
    }],
    "Stop": [{
      "hooks": [{ "type": "command", "command": "sb hook gate", "timeout": 30 }]
    }]
  }
}
hooks
The source installer merges these entries into .claude/settings.local.json and preserves other hooks. --shared targets .claude/settings.json. It requires strict JSON.
Stop
Runs after the main agent responds; user interruptions skip it, and API errors use StopFailure.Source
PostToolUse / PostToolUseFailure
Records successful and failed tool events: command, exit status, file path, and output excerpts of up to 400 leading and 200 trailing characters. This is not a complete transcript or diff capture.
matcher
The recorder listens to Bash, Edit and Write. The Stop gate has no matcher.
"type": "command"
Runs a shell command. Anthropic recommends command hooks for production; its experimental warning concerns agent hooks.Source
command
sb hook record and sb hook gate exist in local alpha.6 source. Public npm latest remains 0.1.0-alpha.5 and does not include them. Registry checked 21 October 2026.Source
timeout
The installer sets 10 seconds for recording and 30 seconds for grading. The gate reads recorded work; it does not rerun commands to check the claim.
Continuation compatibility
Stop additionalContext requests continuation, including when the source switches to it after three block responses. This is not a three-retry stopping guarantee.Source
Host continuation cap
Claude Code defaults to eight consecutive continuations; tool calls reset the counter. CLAUDE_CODE_STOP_HOOK_BLOCK_CAP can raise it.Source
packages/cli/src/hook/templates.tspackages/cli/src/commands/hook.ts

Response contract

Continuation, not a stop guarantee

decision: block prevents completion and requests another agent continuation. Stop-hook additionalContext also continues Claude Code; it does not simply save a note for a later user turn.

The local hook changes to additionalContext after three consecutive block responses. Its receipt retains the actual gate label. This caps explicit block responses, not the number of continuations.

Claude Code documents a default cap of eight consecutive stop-hook continuations. Tool calls reset its counter, and CLAUDE_CODE_STOP_HOOK_BLOCK_CAP can change the cap. This is not an eight-turn bound on the whole session.

Claude Code Stop behavior
packages/cli/src/hook/gate.tspackages/cli/src/hook/session-state.ts

Responses for all six labels

Shapes below describe the alpha.6 source. Ellipses stand for the reason composed from the record; these are not a live run.

accepted

The source exits silently. The receipt keeps its gate label, assessment and stated scope.

exit 0 · no stdout

accepted-with-cautions

The source sends recorded cautions as additionalContext. Current Claude Code continues on that feedback; this is not a silent completion.

{"hookSpecificOutput":{"hookEventName":"Stop","additionalContext":"…"}}

held-for-review

The reason carries the review basis and next objective. It does not enforce human sign-off. After three block responses, the source switches to context feedback and retains the held label.

{"decision":"block","reason":"…"}

blocked-missing-evidence

The reason identifies missing support or a recorded failed check. The source's three-block threshold changes the response format, not the receipt label.

{"decision":"block","reason":"…"}

pending

The projection declines to block an unfinished assessment. This is not an approval of the work.

exit 0 · no stdout

not-checked

The source records a not-checked receipt when claims exist but no session evidence is available. Nothing checked does not mean verified.

exit 0 · no stdout

Compatibility and failure paths

The installer does not enforce a minimum Claude Code version. The earlier v2.1.214 claim concerned a vendor error-handling fix; it was not a tested compatibility floor for this implementation. This hook emits valid JSON with exit code zero.

No recognized claim means no receipt and no response. Claims without recorded session evidence produce a not-checked receipt and no block. Infrastructure errors generally fail open; a persistence failure after a block decision preserves the block where possible.

packages/cli/src/hook/gate.tspackages/cli/src/hook/templates.ts

Implementation status & evidence

Published behavior, source-only additions and design intent are different statuses. The completion hook remains unpublished alpha.6.

Evaluation does not rerun work

shipped

The core runEvaluation function inspects supplied receipt, proof and contract data. It does not execute the agent's task or rerun its commands.

packages/core/src/evaluation-lane.ts

Evaluation function performs no file writes

shipped

The core function returns an evaluation result. The CLI persists that result separately. This describes function behavior, not a sandbox or removal of filesystem permissions.

packages/core/src/evaluation-lane.ts:1

Independent evaluator role

declared

The result declares evaluator_role independent. No runtime check enforces a distinct builder and evaluator identity.

packages/core/src/evaluation-lane.ts:657

Separate invocation for hook receipts

source only

Local alpha.6 adds sb evaluate --receipt and --latest to read hook receipts from disk. That invocation is separate, but it does not create an independent model or sandbox.

packages/cli/src/commands/evaluate.ts:184

Enforced different-model evaluation

designed — not shipped

The default lane runs no model. The optional source-only evaluator configuration names Haiku, but neither invokes it automatically nor guarantees a different model family from the builder.

packages/cli/src/hook/templates.ts:116

Limits & open work

These limits describe the current implementation, including the distinction between the published CLI and the unpublished hook.

  1. The unpublished alpha.6 hook grades recorded session commands and file-edit events through exported core functions. Without a readable, valid project contract it uses a synthesized session contract; the human summary discloses that context. This integration installs command hooks, not a Switchboard MCP server or plugin.

    packages/cli/src/hook/gate.ts:302packages/cli/src/hook/synth.ts:109packages/cli/src/hook/receipts.ts:177
  2. Claim extraction uses lexical rules over the last assistant message, carrying at most five sentences of up to 200 characters. Command classification recognizes test, typecheck, lint and build. The latest decisive command in each class supplies that class's result; this does not inspect all test cases, skipped-test counts or the repository diff.

    packages/cli/src/hook/claims.ts:16packages/cli/src/hook/classes.ts:23packages/cli/src/hook/report-builder.ts:225
  3. No recognized completion claim produces no receipt or response. A claim with no session evidence produces a not-checked receipt and no continuation request. Other infrastructure failures are logged and normally exit silently with code 0. If persistence fails after a block decision, the gate still emits that decision and attempts a fallback receipt.

    packages/cli/src/hook/gate.ts:284packages/cli/src/hook/gate.ts:310packages/cli/src/hook/gate.ts:463packages/cli/src/hook/hook-io.ts:102
  4. The source switches from decision:block to additionalContext after three consecutive block responses, preserving the receipt's gate label. Current Claude Code treats both outputs as continuation. The source's intended yield therefore needs compatibility work; no runtime fix is included in this reference update.

    packages/cli/src/hook/gate.ts:431packages/cli/src/hook/session-state.ts:185
  5. The hook emits JSON with exit code 0 and does not enforce a minimum Claude Code version. Development source records testing against 2.1.89. Its older 2.1.214 note concerned invalid JSON with exit code 2; that is not an established compatibility floor for this configuration.

    packages/cli/src/commands/hook.ts:71packages/cli/src/hook/hook-io.ts:102
  6. The .claude/settings.example.json emitted by @switchboard/projections contains switchboard_projection, note, mission_boundary and return_when. It is explanatory projection data, not the hook settings installed by sb hook install.

    packages/projections/src/claude/index.ts:150packages/cli/src/commands/hook.ts:140
  7. The separate sb ingest workflow checks the active handoff, return handoff ID and loop objective. It also requires met criteria when done_when_met is yes, and verification or evidence for completed returns. An untouched createReturnTemplate passes as a partial return, not completed work. sb run claude creates the dispatch handoff; the Stop hook synthesizes its own grading context without requiring that dispatch workflow.

    packages/core/src/ingest.ts:80packages/core/src/handoff.ts:68packages/cli/src/commands/run.tspackages/cli/src/hook/synth.ts:62
  8. checkBoundaries matches the return's summary and decisions_made against non_goals. It does not inspect changed_files or a diff; an unmentioned non-goal is recorded as preserved. The migration case study supplies a canonical delta containing the tests/ violation. It is not evidence that the hook automatically discovers that violation.

    packages/core/src/canonical-delta.ts:59apps/web/src/lib/fixture-inputs.ts:1526
  9. A successful sb receipt command does not return a failure exit code just because closure_allowed is false. Local alpha.6 sb evaluate, including its new --receipt and --latest paths, exits 1 for block_recommended; hold_recommended still exits 0. The published alpha.5 evaluation command lacks those flags and does not set that failure exit code.

    packages/cli/src/commands/receipt.ts:164packages/cli/src/commands/evaluate.ts:71packages/cli/src/commands/evaluate.ts:184
  10. The legacy sb receipt path passes null mode and scoring-stack snapshots and reports narrative_only. The local hook instead passes mode and stack from a valid repository contract at grading time; a synthesized contract has neither. This is not evidence that all scoring layers are implemented.

    packages/cli/src/commands/receipt.ts:150packages/cli/src/hook/gate.ts:302packages/core/src/canonical-pack.ts:657
  11. FULL_RUN_AVAILABLE remains false. A requested full-run is downgraded to slice-check; that performed scope cannot authorize closure_seal or milestone_review promotion.

    packages/core/src/eval-scope.ts:51packages/core/src/eval-scope.ts:176
  12. The schemas include score_reporting_level complete and receipt verdict disputed. The current derivation functions do not produce those values: deriveScoreReportingLevel returns narrative_only or partial; deriveReceiptVerdict returns verified, partially_verified, inconclusive or not_verified.

    packages/core/src/canonical-pack.ts:657packages/core/src/receipt-v2.ts:209
  13. The default evaluation lane is deterministic code running inside the evaluating CLI process. evaluator_role independent declares a role on the result; it does not enforce a separate identity or sandbox. sb evaluate is a separate invocation from agent execution. Optional sb hook install --evaluator writes a Haiku agent configuration with Read, Grep and Glob tools, but the gate does not automatically invoke it.

    packages/core/src/evaluation-lane.ts:657packages/cli/src/commands/evaluate.ts:184packages/cli/src/commands/hook.ts:177packages/cli/src/hook/templates.ts:116
  14. Receipts are unsigned local assessments with no authenticated issuer identity. Receipt IDs use rcv2- plus eight random bytes. Legacy proof-artifact hashes use 16 hexadecimal characters of SHA-256; hook evidence manifests use the full digest. These hashes do not sign the receipt, and ordinary file writes do not enforce immutable storage.

    packages/core/src/receipt-v2.ts:754packages/cli/src/lib/proof.ts:35packages/cli/src/hook/receipts.ts:72packages/cli/src/store/filesystem-store.ts:200
  15. sb receipt is not idempotent: repeating it over one ingest creates a new receipt ID. The hook also issues a new receipt for each graded stop. Its proof manifest is written under a session-derived dispatch path, so a later graded stop can replace that manifest; it is not an immutable proof snapshot stored separately for every receipt.

    packages/cli/src/commands/receipt.ts:164packages/core/src/receipt-v2.ts:754packages/cli/src/hook/receipts.ts:226packages/cli/src/hook/synth.ts:25

Core wording follow-up

The canonical delta's gap template still renders “Objective only no met.” when objective_met is no. That wording can reach block reasons and receipts. Correcting the core template is separate from this website update.

packages/core/src/canonical-delta.ts:320

What “receipt” means here

A Switchboard receipt is a self-issued, unsigned assessment of claims about performed work. It is not a signed action attestation. Local files can be edited; hashes do not establish issuer identity.

A separate signed action-receipt specification

The bet against this page

The forecast records a bet that native receipts or attestation will land in a major harness. If the native product supplies the record and trust structure, the case for building this separate layer narrows. The concession and its grading date remain on the record.

Read the forecast →
The wider picture

These references describe the cited APIs and product scopes. They are not a list of Switchboard integrations. Each entry includes its documentation check date and sources.

Claude Code

CLI · settings.json hooksChecked 2026-10-21
Completion response
Stop and SubagentStop accept decision:"block" with a reason, or exit code 2 with stderr feedback. additionalContext also continues the conversation, as feedback rather than a hook error.
Continuation limit
The default cap is eight consecutive continuations; tool calls reset the count. CLAUDE_CODE_STOP_HOOK_BLOCK_CAP can raise it. stop_hook_active identifies an existing continuation.
Handler mechanism
Command, HTTP, MCP-tool, prompt and agent handlers are documented. Prompt evaluates once; agent uses tools and remains experimental.
Task completion is a separate event
TaskCompleted exit code 2 prevents task completion. continue:false stops a finishing teammate; TaskUpdate-triggered completion ignores that field.
Record and persistence
The cited hooks reference does not describe a typed claim–evidence receipt. transcript_path and last_assistant_message expose session material. additionalContext is labelled as hook feedback in the transcript.

Primary sources

This describes the cited API and product scope. A handler’s ability to call another model does not establish enforced reviewer independence. Delivery into a continuation does not, by itself, establish a durable receipt.

Codex CLI

Local CLI · hooks.json or config.tomlChecked 2026-10-21
Completion response
Stop decision:"block" creates a continuation prompt using reason; the docs explicitly distinguish this from rejecting the turn. Exit code 2 uses stderr for the same continuation. continue:false takes precedence.
Handler mechanism
command and mcp_tool handlers run; prompt and agent definitions are parsed but skipped. MCP hooks use an existing server connection. This row covers local CLI behavior, not cloud orchestration.
Configuration and repetition
Hooks can be configured in user or trusted project hooks.json and config.toml files. Changed non-managed hooks require trust review. stop_hook_active identifies a continued turn; the cited Stop section specifies no retry cap.
Record and persistence
The cited hooks documentation does not describe a typed claim–evidence receipt. transcript_path may identify a session transcript, but its format is not a stable hook interface. Prompt delivery does not establish a retention policy.

Primary sources

This describes the cited API and product scope. A handler’s ability to call another model does not establish enforced reviewer independence. Delivery into a continuation does not, by itself, establish a durable receipt.

Cursor

Agent hooks · .cursor/hooks.jsonChecked 2026-10-21
Completion response
stop runs after the agent loop ends. A non-empty followup_message submits the next user message. The default is five automatic follow-ups per script; loop_limit can change it or remove the cap with null.
Handler mechanism and scope
The reference documents command and LLM prompt handlers. Cloud agents run command handlers only. Handler availability does not establish independent review.
Failure behavior is event-specific
For permission hooks, invalid JSON blocks the action. Crashes and timeouts normally allow it through unless failClosed is configured. These permission-hook rules are distinct from stop follow-up behavior.
Record and persistence
The cited hooks documentation does not describe a typed claim–evidence receipt. It exposes transcript paths and demonstrates custom file/telemetry recording. Those facilities do not specify a claim-assessment artifact or its retention.

Primary sources

This describes the cited API and product scope. A handler’s ability to call another model does not establish enforced reviewer independence. Delivery into a continuation does not, by itself, establish a durable receipt.

Gemini CLI

CLI · settings.json hooksChecked 2026-10-21
Completion response
AfterAgent decision:"deny" rejects the response and retries with reason as a new prompt. Exit code 2 retries using stderr feedback. continue:false stops the session without retrying.
Handler and retry context
The configuration currently accepts command handlers. AfterAgent receives prompt, prompt_response and stop_hook_active. The cited reference specifies no retry cap; that is not a claim that retries are unlimited.
Record and persistence
The cited hooks reference does not describe a typed claim–evidence receipt. Its base input includes a session transcript JSON path. clearContext can clear model history while retaining the UI display, so feedback delivery and storage are separate questions.

Primary sources

This describes the cited API and product scope. A handler’s ability to call another model does not establish enforced reviewer independence. Delivery into a continuation does not, by itself, establish a durable receipt.

OpenHands

Cloud, CLI and local GUI hooksChecked 21 October 2026
Completion
Stop can prevent finishing. A deny decision overrides the exit code; exit 2 also blocks. Other nonzero exits log an error and allow the operation. Async hooks cannot block. The guide gives no repeated-denial cap.
Handler
Only command handlers are documented, with a 60-second default timeout. Configure .openhands/hooks.json in the working folder; snake_case and compatible PascalCase event names are supported.
Feedback and logs
reason is displayed in the UI; additionalContext enters the agent prompt. Hook execution events appear in the conversation log. That does not establish a separate retained assessment.
Record scope
The hooks guide describes decisions, context and execution logs, but no built-in record pairing claims with evidence. Custom scripts may write their own artifacts.

Primary sources

This describes the cited API and product scope. A handler’s ability to call another model does not establish enforced reviewer independence. Delivery into a continuation does not, by itself, establish a durable receipt.

Amp

Plugin API, agent.endChecked 21 October 2026
Completion
agent.end runs after a turn finishes. Returning action: continue with userMessage starts another turn. Five consecutive plugin continuations are allowed by default; maxContinuations can raise the limit, and a user message resets the count.
Checks inside plugins
Plugins can call thread-scoped AI helpers. The official goal example asks an AI helper whether the latest assistant report satisfies a goal, then continues if needed. This is a programmable check, not a documented isolation guarantee.
Event and delivery
The event includes the turn status and messages. The returned userMessage becomes the follow-up prompt. This mechanism starts a new turn rather than vetoing the completed one.
Record scope
The API provides typed AI results and configurable plugins, but these references do not define a standard claim/evidence completion assessment. A plugin can implement its own record.

Primary sources

This describes the cited API and product scope. A handler’s ability to call another model does not establish enforced reviewer independence. Delivery into a continuation does not, by itself, establish a durable receipt.

GitHub Copilot

CLI and cloud agent; differing limitsChecked 21 October 2026
Completion
agentStop and subagentStop accept block decisions with a nonempty reason, used as the next prompt. The CLI ends after eight consecutive blocks. Cloud retries remain subject to the job timeout.
Handler scope
Command and HTTP handlers can decide completion. Prompt handlers submit text at sessionStart, not an independent stop evaluation. Cloud documentation is inconsistent: its introduction limits entries to bash/command, while the HTTP section describes cloud URL restrictions. Cloud HTTP support was not resolved here.
Configuration
Repository hooks use .github/hooks/*.json. The CLI also loads user, policy, settings and plugin hooks; cloud jobs use the cloned repository and an ephemeral sandbox.
Record scope
The reference describes event payloads and continuation feedback, not a standard claim/evidence assessment or retention contract. Returning a reason does not establish durable storage.

Primary sources

This describes the cited API and product scope. A handler’s ability to call another model does not establish enforced reviewer independence. Delivery into a continuation does not, by itself, establish a durable receipt.

Devin CLI

CLI hooks; not the cloud-agent productChecked 21 October 2026
Completion
Stop fires when the agent wants to finish. Hooks can return approve or block with a reason; exit 2 also blocks. Other nonzero exits are logged without blocking. The lifecycle guide warns about repeated-stop loops and exposes stop_hook_active, without specifying a numeric cap.
Handler
Handlers run shell commands or evaluate LLM prompts, with optional timeouts. Prompt support alone does not establish a separate model, sandbox or evaluator identity.
Configuration
.devin/hooks.v1.json is the recommended project file. User configuration and compatible .claude settings are also supported. This documentation describes Devin CLI, not the separate cloud-agent product.
Feedback and record scope
The overview explicitly says reason is shown to the agent. Payloads have session and turn correlation IDs, but the cited pages do not define a claim/evidence assessment or its retention.

Primary sources

This describes the cited API and product scope. A handler’s ability to call another model does not establish enforced reviewer independence. Delivery into a continuation does not, by itself, establish a durable receipt.

Aider

CLI linting and testing optionsChecked 21 October 2026
Check mechanism
--auto-test runs the configured --test-cmd after edits; it is off by default. /test runs a command on demand, and Aider attempts repairs when it returns a nonzero exit status with error output.
Completion scope
These references describe a test-and-repair loop rather than a Stop event with an allow/block decision. --test runs tests, attempts fixes, then exits. This is not a claim that Aider has no other hooks or integrations.
Logs and record scope
The FAQ documents Markdown conversation logs in .aider.chat.history.md. The cited options and testing guide do not define a separate claim/evidence assessment. Conversation history and check-result delivery are different properties.

Primary sources

This describes the cited API and product scope. A handler’s ability to call another model does not establish enforced reviewer independence. Delivery into a continuation does not, by itself, establish a durable receipt.