New Your team’s decisions, in one playbook every coding agent works from. Never answer your agent twice

add_custom_hook

[MAINTENANCE] 273287cb — define a user-creatable Claude Code hook (PreToolUse | PostToolUse | Stop), generalizing past sprint_guard.sh/.ps1 (the only hook Meridian auto-writes today). Written into the repo's .claude/hooks/<slug>.sh / .ps1 on the next generate_handoff — the same auto-inject mechan...

SERVERMeridian SOURCE@meridianmcp/mcp
Medium RISK CLASS
Category Write
Parameters 93 required
Recommended Rate-limitedsee the rule below
Registry record Grade F, identity unverified Pull the record →

This record as markdown: /tools/io-github-ajc3xc-meridian/add-custom-hook.md

What add_custom_hook does on Meridian

AI agents use add_custom_hook to create or update resources in Meridian, usually the action step of a workflow, after the agent has gathered context. Every call changes real data in your Meridian environment.

ParameterTypeRequiredDescription
name string Yes Human-readable hook name; sanitized to a filesystem-safe slug used for the written filename(s). Must not be 'sprint_guard'.
event string Yes Which Claude Code hook event this fires on.
enabled boolean Default true. Disabled hooks are skipped on the next generate_handoff write (their files aren't touched, but also aren't refreshed).
matcher string Optional Claude Code tool-name matcher regex (e.g. "Edit|Write"); ignored for Stop hooks.
blocking boolean Default true. true = real exit-code-blocking semantics (script written verbatim). false = advisory/non-blocking (an exit 2 is downgraded to 1 before writing).
script_sh string Yes POSIX shell script body (required). Receives the same stdin JSON payload Claude Code passes to any hook.
project_id string
script_ps1 string Optional PowerShell script body. Omit to only write the .sh file.
project_name string Project name — an alternative to project_id; resolved to the id internally. project_id wins if both are given.

Parameters from the server's own tool schema.

Why add_custom_hook is rated Medium

This tool writes executable shell/PowerShell scripts into the repository's .claude/hooks/ directory. While it's a Write operation (creating files), the files it creates are executable hook scripts that run during AI coding sessions (PreToolUse, PostToolUse, Stop).

From the tool's definition define a user-creatable Claude Code hook ... Written into the repo's .claude/hooks/<slug>.sh / .ps1 on the next generate_handoff

Questions about add_custom_hook

What does the add_custom_hook tool do? +

[MAINTENANCE] 273287cb — define a user-creatable Claude Code hook (PreToolUse | PostToolUse | Stop), generalizing past sprint_guard.sh/.ps1 (the only hook Meridian auto-writes today). Written into the repo's .claude/hooks/<slug>.sh / .ps1 on the next generate_handoff — the same auto-inject mechanism sprint_guard already uses. script_sh (POSIX shell body) is required; script_ps1 (PowerShell body) is optional — omit it to only ever write the .sh file. matcher is a Claude Code tool-name regex (e.g. "Edit|Write"), ignored for Stop hooks. blocking (default true) controls determinism vs. suggestion power: true writes the script byte-for-byte so its own exit code drives REAL Claude Code exit-code-blocking semantics (exit 2 blocks a PreToolUse call / a Stop / feeds PostToolUse output back to the model); false wraps it so an exit 2 is downgraded to 1 before it's written — the hook still runs and its output still surfaces, but it can never hard-block ('strong suggestion power' without determinism). name must not be 'sprint_guard' (reserved for Meridian's own hook) or collide with an existing hook's derived slug on this project — both raise a clear {error}. Persistent-state disclosure: on hosted Meridian, supplied text and project/session metadata are sent to and stored in Meridian's service; self-hosted deployments keep them in the configured local SQLite/Postgres database. This data is visible in the dashboard/API and later project context or handoffs. Delete individual tasks, notes, or decisions where supported, or delete the project/account using the documented controls. Do not include secrets. It is categorised as a Write tool in the Meridian MCP Server, which means it can create or modify data. Consider rate limits to prevent runaway writes.

What parameters does add_custom_hook accept? +

add_custom_hook accepts 9 parameters: name, event, enabled, matcher, blocking, script_sh, project_id, script_ps1, project_name. Required: name, event, script_sh. The full parameter table on this page comes from the server's own tool schema.

How do I enforce a policy on add_custom_hook? +

Register the Meridian MCP server in PolicyLayer and add a rule for add_custom_hook: allow, deny, rate-limit, or require approval. Point your MCP client at the PolicyLayer proxy URL and the rule is enforced on every call, before it reaches Meridian. Nothing to install.

What risk level is add_custom_hook? +

add_custom_hook is a Write tool with medium risk. Write tools should be rate-limited to prevent accidental bulk modifications.

Can I rate-limit add_custom_hook? +

Yes. Add a rate_limit block to the add_custom_hook rule in your PolicyLayer policy. For example, setting max: 10 and window: 60 limits the tool to 10 calls per minute. Rate limits are tracked per agent session and reset automatically.

How do I block add_custom_hook completely? +

Set action: deny in the PolicyLayer policy for add_custom_hook. The AI agent will receive a policy violation error and cannot call the tool. You can also include a reason field to explain why the tool is blocked.

What MCP server provides add_custom_hook? +

add_custom_hook is provided by the Meridian MCP server (@meridianmcp/mcp). PolicyLayer sits as a proxy in front of this server to enforce policies before tool calls reach the server.

More on Meridian, and thousands of servers like it.

// THE MCP REGISTRY

PolicyLayer tracks 44,603 MCP servers and 515,000+ tools.

Every server has a live record: who publishes it, whether it answers without auth, its risk grade, every tool classified, the recommended policy. This page is one line of Meridian's. Pull the full record:

Teams ship this data inside their own products. See what a licence covers →

// GET IN TOUCH

Have a question or want to learn more? Send us a message.

Message sent.

We'll get back to you soon.