Learning resourcesReviewed · Cognition

Devin CLI hooks overview

This is the official documentation page for hooks in Devin CLI, written for developers who want to run scripts or LLM prompts when the coding agent reaches certain lifecycle events; its main catch is that it is an overview only, with per-event payload details left to a separate page. Hooks can block or rewrite tool calls, inject context into the agent, and log actions, and they are configured in JSON files such as .devin/hooks.v1.json.

Researched 13 Nov 2026

In short.

This is the official documentation page for hooks in Devin CLI, written for developers who want to run scripts or LLM prompts when the coding agent reaches certain lifecycle events. Its main catch is that it is an overview only, with per-event payload details on a separate page, and nothing it describes was run for this report. According to the page, hooks are JSON-configured rules that fire on eight events (PreToolUse, PostToolUse, PermissionRequest, UserPromptSubmit, Stop, PostCompaction, SessionStart, SessionEnd). Each hook is either a shell command or an LLM prompt, optionally filtered by a regex on the tool name. A command hook receives event data as JSON on stdin and can answer with exit codes or JSON on stdout to block an action, approve it, add context, or rewrite a tool's input before it runs. Hooks are read from .devin/ files, user-level config and, by default, existing Claude Code style .claude/ files. Important gaps: exit code 2 or an explicit block decision blocks an action. Other non-zero exit codes, timeouts and unreadable output are logged as errors and do not themselves block the action. Whether other hooks or permission checks would still block it in that case is unknown. The page also does not explain prompt hooks in depth, hook ordering, default timeouts, or whether project-supplied hooks need user approval.

Researched and written by an AI model and checked by a second AI model. How it works

This report covers only the one selected documentation page, [https://docs.devin.ai/cli/extensibility/hooks/overview.md], captured in full on 13 November 2026. Pages it links to, including the Lifecycle Hooks and read_config_from configuration pages, are excluded, so their details are treated as unknown. The page carries no licence or copyright notice, so no reuse rights are claimed. Nothing described was installed or run, so all behaviour is as the vendor documents it and has not been tested.

The overview

What this resource is

This is a single documentation page titled Hooks, from the Devin CLI docs, at [https://docs.devin.ai/cli/extensibility/hooks/overview.md]. It sits under the CLI extensibility section and describes how to configure hooks: custom logic that Devin CLI runs in response to events in the agent's lifecycle. The page itself says hooks can enforce policies, add context, log actions, modify permissions, or integrate with external systems.

The page footer says the documentation is built and hosted on Mintlify. The page does not name an author, a publication date, or a Devin CLI version it applies to, so these are unknown.

Overall assessment

As a reference for the hook feature, the page is short and concrete. It gives a minimal configuration that looks ready to use, the full list of events, the input and output JSON shapes, the exit code rules, and every file location that is searched. A developer could write a first blocking hook from this page alone, as long as they can find the tool names (the page leaves those to the Lifecycle Hooks page).

The main weaknesses are scope and depth rather than accuracy. Some details a policy author needs are either on linked pages outside this review or not stated at all: the input fields for each event, the built-in tool names, how several hooks combine, and what the prompt hook type actually does. Nothing here was executed, so every behaviour below is as documented, not as observed.

Who it is for

The page suits people who already use Devin CLI, the command-line coding agent, and want to control or observe what it does. Typical readers would be individual developers who want to block risky shell commands, team leads who want a shared policy committed to a repository, and platform or security engineers who want to log agent actions or send them to external systems.

It assumes you are comfortable with JSON configuration, shell scripts that read stdin, and regular expressions. Beginners can follow the quick example, but writing a safe policy script needs shell and JSON skills the page does not teach. It is not an introduction to Devin CLI itself.

What hooks can do

The page lists four main uses: enforce policies (block dangerous commands, require confirmation, restrict file access), add context (inject instructions when tools are called), run side effects (scripts, notifications, logging), and modify permissions (grant or restrict them depending on the situation).

In practice, the documented output format gives a hook four ways to act. It can return a top-level decision of approve or block, with an optional reason shown to the agent. It can return an additionalContext string inside hookSpecificOutput, which is injected into the agent's context for UserPromptSubmit, SessionStart and PostToolUse. For PreToolUse, it can return an updatedInput object whose fields are merged into the tool's arguments, so a hook can rewrite part of a call, such as only the command field. And because a command hook is a shell command, it can also perform side effects.

Eight events are listed: PreToolUse (before a tool executes), PostToolUse (after it finishes), PermissionRequest (when a permission decision is needed), UserPromptSubmit (when the user submits a message), Stop (when the agent wants to stop), PostCompaction (after context compaction completes successfully), SessionStart (when a session starts or resumes, once the agent and its machine are both up), and SessionEnd (when a session ends; the page says it is not fired in cloud sessions).

Using it

Requirements

The page implies you need Devin CLI and a project or user configuration location that it reads. It does not say which Devin CLI version introduced hooks, how to install the CLI, or whether an account or plan is required. These are unknown from this page.

Command hooks also need whatever your script depends on, such as a shell and tools to parse JSON from stdin. The page does not say which shell is used on each operating system. It does name a Windows path for user config (%APPDATA%\devin\config.json), so Windows appears to be supported, at least for configuration.

How it works

Each hook entry has a type, an optional matcher, and fields specific to its type. The type is command (run a shell command) or prompt (evaluate an LLM prompt). The matcher is a regular expression tested against the hook event's tool_name; an empty or missing matcher matches every tool name. An optional timeout is given in seconds. Hooks are grouped under an event name, and each group holds a matcher and a list of hooks.

For command hooks, Devin CLI passes event data as JSON on stdin. The example payload includes hook_event_name, tool_name, tool_input, session_id and prompt_id. session_id stays the same for a whole session. prompt_id changes with every user prompt and is absent for events that fire before the first prompt, such as SessionStart. The environment variable DEVIN_PROJECT_DIR is set to the project root.

The hook responds through its exit code and, optionally, JSON on stdout. Exit code 0 means success and the agent continues normally. Exit code 2 blocks the action. Any other exit code is logged as an error and does not block, and a timeout or unreadable output is also treated as an error that does not block. Printing a JSON object with decision set to block is another way to deny an action.

According to the page, hook files are discovered in the working directory and its parent directories up to the repository root, the same way skills and rules are loaded.

Setup

The recommended project-level setup is to create .devin/hooks.v1.json. In that file the hooks object is the whole file, with no wrapper key. In every other location the hooks sit under a top-level hooks key in a settings file.

Project-level locations listed: .devin/hooks.v1.json, .devin/config.json, .devin/config.local.json (a local override, described as gitignored), .claude/settings.json and .claude/settings.local.json. User-level locations listed: ~/.config/devin/config.json (or %APPDATA%\devin\config.json on Windows), ~/.claude.json, ~/.claude/settings.json and ~/.claude/settings.local.json. The .claude paths use the Claude Code format. They are loaded when read_config_from.claude is enabled, which is the default. The page says you can turn this off in user config and links to [https://docs.devin.ai/cli/reference/configuration/read-config-from.md].

To check what is loaded, the page says to run the /hooks slash command, which shows all currently loaded hooks and their source files.

Worked example from the page

The page's quick example creates .devin/hooks.v1.json with a PreToolUse entry whose matcher is exec, holding one command hook that runs ./scripts/check-command.sh. The page says this runs the script before every shell command execution. The script receives the event JSON on stdin (for instance, tool_name exec and a tool_input with a command field). It can deny the action by exiting with code 2 or by printing a JSON object such as {"decision": "block", "reason": "Destructive command blocked by policy"}.

The page also shows a rewrite. A PreToolUse hook returns hookSpecificOutput with hookEventName set to PreToolUse and an updatedInput whose command is rtk git status. The page does not explain what rtk is; it is only an example value. The page does not give the contents of check-command.sh, so readers have to write the checking logic themselves. Neither example was run for this report.

Assessment & evidence

Limitations and risks

Error handling. According to the page, an action is blocked when a hook exits with code 2 or returns a decision of block. Other non-zero exit codes, timeouts and unreadable output are logged as errors and do not themselves block the action. The page does not say whether other hooks or permission checks would still block it in that case. Anyone using hooks as a security control should write scripts so that any problem they detect leads to exit code 2 or a block decision, and should not treat hooks as a hard guarantee. The page does not give the default timeout.

Repository-supplied hooks. Project files such as .devin/hooks.v1.json and the .claude/ files are loaded automatically, and command hooks run shell commands. The page does not say whether Devin CLI asks for approval before running hooks that come from a cloned repository, so the trust model is not established here. It is sensible to review hook files in unfamiliar repositories.

The page leaves several things unknown. It does not explain how the prompt hook type works in detail. It does not say what happens when several hooks match the same event (order, parallel execution, which decision wins), or how hooks from .devin and .claude combine or conflict. The full list of tool names is left to the Lifecycle Hooks page at [https://docs.devin.ai/cli/extensibility/hooks/lifecycle-hooks.md]. The exact input fields for each event are not given beyond the one PreToolUse example. SessionEnd does not fire in cloud sessions, so logging at session end will miss those sessions.

Why this assessment

The assessment rests on what the page states directly. The event table, field tables, exit code table and location tables are explicit and consistent with each other and with the quick example. For instance, the statement in the quick example that exit code 2 blocks matches the exit code table, and the description of updatedInput matches its row in the output table.

The cautions about hook errors come straight from the exit code table, which says other non-zero codes, timeouts and unreadable output are logged as errors and do not block. The cautions about project-supplied hooks and prompt hooks come from what the page leaves out: it does not mention approval prompts or explain prompt hooks, so these are flagged as unknown, not as confirmed problems.

Alternatives and related options

The page does not compare hooks with other mechanisms. It does say that existing hooks in .claude/ directories are picked up automatically in Claude Code format. That suggests hooks written for Claude Code may carry over, though the page says nothing about compatibility beyond the file format. It also says hook files are discovered the same way as skills and rules, so those are related Devin CLI extension points.

The selected page does not compare external enforcement mechanisms; their suitability is unknown from this evidence.

Evidence base

Everything in this report comes from one captured file: the full text of the documentation page at [https://docs.devin.ai/cli/extensibility/hooks/overview.md] (evidence_541f0ea6-1482-4143-a855-88f86fd820f6, about 8.4 KB). It contains the quick example, the event table, the hook format and field tables, the input and output descriptions for command hooks, the exit codes, the file locations and the /hooks verification command.

Nothing was executed. No hook was installed, Devin CLI was not run, and none of the claims here have been tested. Behaviour is as the vendor documents it, and actual behaviour could differ.

Access & freshness

Costs

The page states no price for hooks or for Devin CLI. It does not say where command hooks execute or how any hook usage is billed. Command-hook charges are unknown. Prompt hooks evaluate an LLM prompt, but the page does not say which model runs it, so prompt-hook charges are also unknown. Any required plan and any usage quotas are unknown as well.

Rights and reuse

The captured page has no licence statement or reuse terms for the documentation text or the example snippets. Reuse rights are therefore unknown, and you should not assume a copy of the page can be redistributed. The original page is at [https://docs.devin.ai/cli/extensibility/hooks/overview.md].

Freshness

The page was captured on 13 November 2026. It shows no publication or last-updated date and no CLI version, so it is unknown how current it is relative to the latest Devin CLI release. Details could change, including the event names, the .devin/hooks.v1.json file name (the v1 suggests a versioned format) and the default value of read_config_from.claude. Check the live page before relying on them.

Suggested next steps

Before writing matchers, read the Lifecycle Hooks page at [https://docs.devin.ai/cli/extensibility/hooks/lifecycle-hooks.md] for the data each event provides and the built-in tool names. Start with a project-level .devin/hooks.v1.json containing one PreToolUse hook, then use the /hooks command to confirm it is loaded and see which file it came from.

If you rely on a hook to block actions, have the script exit with code 2 for anything it cannot confidently allow, set a timeout, and try it in a safe sandbox project before trusting it. Review any hook files that come with a cloned repository. If you already have Claude Code hooks, decide whether you want Devin CLI to pick them up automatically, and turn this off with the read_config_from setting if you do not.

Evidence for this report

selected-page.txtselected · checked 2026-11-13