ACP guard

ACP guard reference

Look up what the ACP guard checks, how it judges actions, what the editor sees on a block, plus its settings, commands and gateway routes.

The reference for the ACP guard. Protocol version: ACP schema-v1.21.0.

What is guarded

SurfaceACP methodsProtection
Protocolinitialize, auth, session lifecycle, cancellation, extensionsStrict JSON-RPC 2.0 NDJSON, no batches, 1 MiB frame and 128 pending-ID limits (frame rules)
Promptsession/promptRules, scanners, optional judge, observe or action policy
Outputsession/update and the prompt responseChecked per frame and again over the whole buffered turn. Action mode releases nothing before the final prompt response passes
Approvalsession/request_permission, elicitation/createThe tool call the request asks about is judged as a hook connector would judge it; elicitation/create is checked as content. An unresolved confirmation fails closed in action mode
Filesystemfs/read_text_file, fs/write_text_fileJudged as a Read or Write of the path, with the hook connectors' protected-target rules, plus method policy
Terminalterminal/create and the other terminal/* methodsterminal/create is judged as the shell command it runs, on the editor's platform, with the hook connectors' command rules, effects and protected targets. Other terminal methods get content and method policy
Extensionsfor example cursor/*Judged as tool calls by the same non-shell lane as MCP tools

Frame rules

  • An object that names one key twice, or two keys that differ only in letter case, is invalid (except inside the free-form members rawOutput and _meta).
  • An error response with a null id is checked and forwarded.
  • In action mode any other invalid frame ends the session and names the side that sent it.

Actions are judged like hook tool calls

A frame that makes the editor or agent act (terminal/create, fs/read_text_file, fs/write_text_file, a permission request, a tool call the agent reports in session/update, an extension method) becomes the tool call a hook connector would report. It runs through the same code: the connector's rule packs, protected targets, command and path rules, and the same managed and enterprise policy. An action judged over ACP uses the same rules as the hook connector for the same agent.

VerdictEffect
BlockThe frame is refused; the editor shows the reason
AlertThe frame is allowed and recorded
Unreadable actionA frame that must carry an action but not in the documented shape (a terminal/create with no command, a permission request that shows no action) is refused. It is never treated as clean

How a tool call kind is read

  • Only read reads. Every other kind's locations are judged as writes: edit, delete, move (write of the destination, delete of the source), fetch (its url as a web fetch, its files as download targets), and kinds with no file action of their own (search, other, think).
  • A call with no kind is read by its input: a command is a shell call, text to write is a Write, an input with both is judged as both, and a path alone is a read raised to the unknown tier. Kiro's append, insert and create with a null file_text write their new_str.

Working directory

  • A command runs in the directory the frame names, else in the directory the editor gave the session (session/new, session/load). A relative cwd is joined to it.
  • With no directory known (a session the guard did not see, or one evicted from its table of 1,024), the command or relative file is judged as given and raised to the unknown tier of the active pack: an alert in the default and permissive packs, a block in strict.

Permission requests and tool call state

A permission request is a tool call update. Its kind is optional; the editor applies it onto the tool_call report that gave the kind, and the guard judges the merged call.

  • The guard keeps the kind, title, input and locations of the last 256 tool calls the agent reports, at most 64 KiB each.
  • An input or title over the bound is cut to its start (a command that was seen is still judged) and the call is raised to the unknown tier.
  • At most 64 locations are kept and judged one by one (a block stays a block); more raise the call to the unknown tier. In default and permissive that is an alert, so the editor asks the user; in strict it is a block.
  • A permission that names only the ID of a call whose state was dropped is judged at the unknown tier, not refused.
  • When the gateway judged the agent's report of a call a block, the guard remembers it, so a permission for that call is blocked even after its state was dropped.

Reports of calls that already ran

A tool_call the agent reports in session/update after running it cannot be refused. A block is recorded as an alert that would have blocked, with the finding and severity. The agent's permission request, sent before it ran, is where the action is judged.

Hermes runs its own tools and asks the editor only for the dangerous commands its own approval policy names. Every other tool call is reported after it ran, so the guard cannot refuse a normal Hermes command.

  • Hermes sends a command only as display text ($ <command>), and the guard reads that text as the shell command. What the active pack blocks is recorded as an alert that would have blocked.
  • A Hermes terminal report with no command is judged as an unreadable action, never as clean.
  • defenseclaw acp status, defenseclaw doctor and the Setup form say the guard does not refuse Hermes tool calls. To refuse a command before it runs, run the Hermes hooks in action mode next to the guard (defenseclaw setup hermes --mode action).

Gateway not restarted after an upgrade

A gateway older than the guard refuses the session directory and tool call state the guard sends. The guard then judges the frame again without them and leaves them out of later frames. After the gateway stops answering, it sends them again in case a newer gateway answers.

When a step is blocked or cannot be checked

SituationEditor sees
Blocked prompt (action mode)The turn ends with the reason as an agent message, for example "DefenseClaw policy blocked this action (rule SEC-AWS-KEY: AWS access key). Do not retry it in another form." The next prompt runs
Blocked agent outputThe turn ends and the guard cancels it in the agent. The message says the agent may already have run the step
A check fails after the prompt reached the agentThe agent may already have run tool actions; inspect the results before retrying. A prompt refused before it was forwarded says "not delivered". A specific cause (ACP switched off, a rejected credential, the gateway's own refusal) is named
Observe mode, the gateway refuses the frame in every modeThe guard refuses it too, for example for an account holder the gateway could not confirm. An ordinary finding in observe mode is only recorded
Gateway does not answer (one retry)Only that step is refused: "DefenseClaw could not check this step because the gateway did not answer". The session stays open
Gateway rejects the credential"the gateway did not accept this editor's ACP credential: your administrator may have revoked your access"
ACP checking switched off centrally"your administrator switched ACP checking off"
Observe mode, step cannot be checkedThe session goes on unchecked and the guard says once: "DefenseClaw is not checking this session"
Guard cannot startThe editor shows the reason (Zed: under Failed to Launch)
Agent silent for 60 seconds after a promptThe guard says the agent may be waiting for first-run questions in a terminal
  • A standalone managed guard refuses a frame it could not check by default.
  • A profile's fail_mode: closed makes an observe-mode guard refuse a step it could not check, once the gateway has answered that session. fail_mode: open lets it through.
  • Hook fail modes are separate (gateway outage table).
  • If the central profile mode and the mode the entry was set up for differ, the guard stops the session and names both modes and the setup command to run. Zed keeps one guard per agent, so it keeps answering with that message until you run the command.

Observability

Every guarded decision is a guardrail.evaluation.completed event with these attributes:

AttributeExample
defenseclaw.acp.clientzed
defenseclaw.acp.agentkiro
defenseclaw.acp.methodsession/prompt
defenseclaw.acp.directionclient_to_agent, agent_to_client
defenseclaw.acp.surfaceprompt, output, permission, filesystem, terminal, tool, protocol
defenseclaw.acp.profilekiro-only
defenseclaw.acp.protocol.versionschema-v1.21.0
  • The event also carries defenseclaw.guardrail.raw_action, effective_action and would_block (so an observe-mode pass-through is not mistaken for an action-mode allow), rule_ids, finding_count, reason and defenseclaw.security.severity.
  • A profile-denied method blocks with finding_count 0 and no rule_ids.
  • A decision with findings, and a profile-denied method, also export a trace: an invoke_agent <agent> span with an apply_guardrail child. Both carry the ACP sessionId as session and conversation ID.

Configuration

acp:
  enabled: true
  default_profile: locked
  clients:
    zed: {enabled: true}
  agents:
    kiro:  {enabled: true}
    devin: {enabled: true}
  bindings:
    zed/kiro:  {enabled: true, profile: locked}
    zed/devin: {enabled: true, profile: watch}
  profiles:
    locked:
      mode: action
      fail_mode: closed
      allowed_clients: [zed]
      allowed_agents: [kiro]
      denied_methods: [fs/write_text_file]
    watch:
      mode: observe
      allowed_clients: [zed]
      allowed_agents: [devin]
KeyWhat it does
acp.enabledTurns the guard on
acp.default_profileProfile used when nothing more specific applies
acp.clients.<id>, acp.agents.<id>Enable or pin a profile for an editor or agent. Disabling one disables every pair that uses it
acp.bindings.<client>/<agent>Per-pair switch and profile
acp.profiles.<name>.modeobserve or action
acp.profiles.<name>.fail_modeclosed or open
acp.profiles.<name>.allowed_clients, allowed_agentsThe pairs the profile admits. The resolved profile must admit the pair
acp.profiles.<name>.denied_methodsACP methods always blocked, for example fs/write_text_file
  • A pair's profile is chosen most specific first: binding, agent, editor, then default_profile. defenseclaw acp status --json shows profile_source for each binding.
  • A request that names a profile the configuration does not assign to that pair is refused.
  • The profile name is pinned into the contract lock at setup. If you edit a pair's profile by hand, acp verify and acp status report the drift:
ACP binding verification failed: contract lock profile 'locked' no longer
matches the configured 'watch' for zed/kiro; re-run acp setup

Contract lock

Each binding pins its own lock at <data-dir>/acp/<client>-<agent>.contract-lock.json. It records the guard and agent executable paths and SHA-256 digests, the client configuration path and digest, and the ACP schema version.

  • Agent self-update. When the agent updates itself in place, its digest no longer matches and the editor cannot start the pair. acp status, acp verify, doctor and the editor message name defenseclaw acp refresh --agent <agent>.
  • What is pinned. Only the entries that start the guard with that lock (DefenseClaw · <Agent>, an adopted entry, or a numbered one such as DefenseClaw · <Agent> (2)), not the whole editor file. A theme change, edits outside those entries, and the mode or model Zed stores in them keep the guard starting.
  • Needs setup again: a change to an entry's command, arguments, env or type, or a new entry that starts the guard with the same lock.
  • Older locks. A lock written by an earlier version pins the whole editor file until you run setup for the pair.
  • Agents share one scoped token, a private file named on the guard's command line.
  • Setup uses only the catalog that ships with DefenseClaw and never downloads from the online ACP registry.

Owned entries

Setup and adopt record a SHA-256 digest of each editor entry they write in <data-dir>/acp/owned-entries.json (private to your account). An entry is DefenseClaw's only while it matches that record; the mode or model Zed stores in it does not count as a change.

  • Setup, adopt and remove change only those entries. Any other entry for the pair is left exactly as it is: one you edited, one pointed back at the agent, or a DefenseClaw · <Agent> entry with no record.
  • Setup then writes its own entry next to it (DefenseClaw · <Agent> (2) when the name is taken), and prints the step to take: defenseclaw acp adopt to guard an entry that starts the agent directly, or delete the entry and run setup again.
  • acp verify fails while such an entry is there, and for an entry whose --gateway is not this gateway.

Commands

CommandWhat it does
defenseclaw acp catalogPrints the compiled catalog (protocol, upstream registry, clients and agents) as JSON. Refused on a managed computer (exit 2)
defenseclaw acp setup --client C --agent AWrites the guarded entry, token and contract lock. Flags: --profile, --activate, --guard-binary, --agent-binary, --json. --profile NAME uses that profile, or creates it when config.yaml does not define it; the last line then ends with new profile NAME
defenseclaw acp statusGuard state and each binding's health, profile and mode. --json adds where each profile came from
defenseclaw acp verify [--client C] [--agent A]Checks the contract lock against the configuration. With neither flag, every configured binding is checked. Healthy only when the guard would start the binding: lock version and protocol pins match, and the agent executable is the pinned file, not a link. Fails on a direct entry that starts the pinned agent without the guard
defenseclaw acp detectLists guarded, unguarded and foreign agent entries in each editor
defenseclaw acp adopt (also defenseclaw setup acp)Points existing unguarded entries at the guard. Flags: --client, --profile, --guard-binary, --activate, --yes (also --non-interactive), --json
defenseclaw acp refresh --from-sha256 DIGESTRe-pins a new guard in locks that pinned the old one. The installer runs it on upgrade. --guard-path FILE re-pins only the locks whose guard is that file
defenseclaw acp refresh --agent ARe-pins an agent you updated in place (only when the file is not a link and no account but yours or root, or on Windows SYSTEM, Administrators or TrustedInstaller, can change it or its folder). Refuses a managed enrollment. Each re-pin is an acp-agent-repin audit event. defenseclaw doctor --fix does the same
defenseclaw acp remove --client C --agent ARemoves the entry, reclaims the contract lock and takes out the profiles setup wrote for that pair

Gateway routes

RoutePurpose
POST /api/v1/acp/challengeAuthenticates the loopback gateway before ACP content is encrypted
POST /api/v1/acp/evaluateLoopback-only, mutually authenticated frame evaluation
GET /v1/acp/catalogCompiled client and agent catalog. Gateway token only
GET /v1/acp/profilesEffective profile inventory. Gateway token only

The ACP credential works on the two signed routes only; it gets 401 on the two read routes.