Blog · Comparison · 27 November 2026

Coding Agent Hooks Compared: Claude Code to Devin

Coding agent hooks are commands an agent runs at fixed points in its loop, usually before a tool call, after a tool call, when a prompt is submitted and when a turn ends. Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI and Devin all have them, and they look alike: JSON on stdin, JSON on stdout, exit code 2 to block. The details differ enough to break a script copied from one to another. This comparison puts the six side by side, from each vendor's own documentation read on 27 Nov 2026, and ends with how to run one hook script across all of them.

Why hooks matter for teams of agents

A hook is the only place where you can act inside an agent you did not write. For a single agent it is a convenience: run the formatter after each edit, block rm -rf. For several agents in one repository it is the whole coordination surface:

  • Refuse an edit to a file another agent is changing.
  • Report what the agent changed, so people and other agents can see it.
  • Hand over text: a message from another agent, a correction from a person.
  • Hold the end of a turn until the work merges with a peer's.
  • Answer a permission prompt from somewhere other than the agent's terminal.

Which of these each agent allows decides what a coordination layer can do for it.

The coding agent hooks comparison table

Claude Code Codex Cursor Copilot (CLI and cloud agent) Gemini CLI Devin CLI
Config ~/.claude/settings.json, .claude/settings.json, managed, plugins $CODEX_HOME/hooks.json, .codex/hooks.json (trusted projects), [hooks] in config.toml ~/.cursor/hooks.json, .cursor/hooks.json, enterprise ~/.copilot/hooks/*.json, .github/hooks/*.json, settings files ~/.gemini/settings.json, .gemini/settings.json, system .devin/hooks.v1.json, .devin/config.json, plus Claude Code's files
Before tool PreToolUse PreToolUse preToolUse, beforeShellExecution preToolUse BeforeTool PreToolUse
How to deny permissionDecision: "deny" permissionDecision: "deny" (old decision: "block" accepted) permission: "deny" permissionDecision: "deny" with a reason decision: "deny" with a reason decision: "block"
After tool PostToolUse PostToolUse postToolUse, afterFileEdit postToolUse AfterTool PostToolUse
Inject context additionalContext additionalContext (about 2,500 tokens by default) additional_context additionalContext (capped at 10 KB) additionalContext additionalContext
Turn end Stop, decision: "block" Stop, decision: "block" stop, followup_message agentStop, decision: "block" AfterAgent, decision: "deny" Stop, decision: "block"
Permission request PermissionRequest PermissionRequest None permissionRequest (CLI only) None (observe only) PermissionRequest
Exit 2 Blocks Blocks Blocks Denies on preToolUse Blocks Blocks
Trust step Workspace trust /hooks review, by hash Trusted workspace for project hooks "Workspace admission" Fingerprint, warn on change Not described in the CLI hooks overview

A few notes the table cannot hold:

  • Codex turns hooks on by default; hooks = false under [features] switches them off. "Non-managed hooks must be reviewed and trusted before they run", through /hooks, and trust is tied to each hook's hash, so a changed hook is reviewed again. Edits arrive as tool_name: "apply_patch".
  • Claude Code caps Stop continuations: after eight in a row, it overrides the next block. Copilot CLI does the same after 8 consecutive blocks. Cursor's loop_limit defaults to 5.
  • Gemini CLI timeouts are milliseconds; Cursor, Copilot and Claude Code use seconds.
  • Copilot timeouts always fail open, even on preToolUse; other non-zero exits on preToolUse fail closed.
  • Cursor accepts ask on preToolUse but says it is "not enforced for preToolUse today".

Three agents run Claude Code's hooks too

This is the fact most teams miss. Hooks written for Claude Code are loaded by other agents:

  • Cursor imports .claude/settings.local.json, .claude/settings.json and ~/.claude/settings.json through "Third-Party Imports", on by default, mapping event and tool names.
  • Devin CLI loads hooks from .claude/ paths "when read_config_from.claude is enabled (the default)".
  • Copilot CLI: "Cross-tool .claude/settings.json and .claude/settings.local.json files in the repository are also read." (The cloud agent does not read them.)

Two consequences. First, a script installed for Claude Code may already be running inside Cursor, Devin or Copilot and believe it is Claude Code, recording the wrong source. Second, if you also install the agent's native hooks, one event can run the script twice. A cross-agent hook script has to work out which agent called it before it does anything else.

Copilot's cloud agent is a special case

GitHub's hooks reference says that for the cloud agent "Hook configuration is loaded from .github/hooks/*.json files in the cloned repository", and nothing else. Only the bash field is honoured, the working directory is /workspace, permissionRequest "either does not fire or has no effect" because tools are pre-approved, and ask becomes a deny. The cloud agent's network is also behind GitHub's firewall, so a hook that calls an outside service needs that host allowed.

The gaps

  • Permission requests. Only Claude Code, Codex, Devin and Copilot CLI have a hook that fires when the agent is about to ask a person. Cursor and Gemini CLI do not, so nobody can answer their prompts from elsewhere; you can only allow or deny in the before-tool hook.
  • No hooks at all. Aider has none: its options page offers --notifications-command, --lint-cmd and --test-cmd, but no lifecycle events.
  • Plugins instead of hooks. OpenCode, Amp and Cline extend through plugin systems with their own APIs, and Antigravity CLI uses a separate hooks.json format. These need their own adapter, or a supervisor that works from outside the agent.

One hook script for all of them

If you want the same rules for every agent, write one script with three steps:

  1. Detect the calling agent from fields only it sends.
  2. Normalise its payload into one shape (event, tool, path, command).
  3. Translate your answer into the agent's own fields.

That is how Forkit's hook script works. Its Claude Code and Codex paths have been run with real agents (Claude Code and Codex 0.160.1 in production on 17 Nov 2026, one run, with Codex's trust step bypassed by its flag, so /hooks itself is untested). On 26 Nov 2026 it gained the other four:

  • Detection: Cursor by cursor_version or CURSOR_VERSION; Devin by DEVIN_PROJECT_DIR, or by prompt_id without Claude Code's transcript_path (Claude Code now sends prompt_id too, which an earlier version mistook for Devin); Copilot by its camelCase sessionId; Gemini CLI by GEMINI_* variables.
  • Answers in each agent's words: Cursor permission, additional_context, followup_message; Gemini decision: deny; Copilot permissionDecision, additionalContext and behavior; Devin in both shapes.
  • Native files: forkit init writes ~/.cursor/hooks.json, ~/.gemini/settings.json and ~/.copilot/hooks/forkit.json when it finds those agents; forkit init --sandbox --project --agents cursor,gemini,copilot writes .cursor/hooks.json, .gemini/settings.json and .github/hooks/forkit.json to commit. Devin runs the Claude Code hook file.
  • No double reporting: a call through .claude/settings.json is skipped when the agent's own hook file already has Forkit.

The Cursor, Gemini CLI, Copilot and Devin support has been tested with each agent's documented payloads, not yet run against the real agents. Use it as a preview until it has been.

For agents with no hooks, forkit run -- <agent> supervises the checkout instead: it reports changed files, makes files another agent claimed read-only, and writes messages to a file the agent can read. That is weaker than a hook, as coordinating agents that have no hooks explains.

Which agent's hooks fit which job

Job Best supported by
Answer approvals remotely Claude Code, Codex, Devin, Copilot CLI
Refuse edits to claimed files All six
Deliver a message mid-turn All six (after-tool context)
Hold the end of a turn All six, each with its own loop cap
Committed, team-wide hooks in a cloud agent Copilot cloud agent (.github/hooks/ only)

If you only run Claude Code, its own hooks plus the PermissionRequest hook are all you need, and a cross-agent layer adds little. The layer earns its place once a team mixes vendors. See also Claude Code hooks vs MCP and the Codex hooks guide.

Forkit has a Free plan; Pro is $20 a month and Team $40 per seat a month, billed per person, never per agent. More at forkit-mcp.com.

Sources

Read on 27 Nov 2026: