Claude Code Plugin Monitors: Background Watchers That Notify Claude

David IyaDavid Iya November 28, 2026 9 min read
An old brass radar scope glowing green beside a small oscilloscope showing a sine wave on a dark oak desk at night under a warm lamp
Original image, Claude Code Club

What a Claude Code plugin monitor is

A Claude Code plugin monitor is a shell command your plugin declares, which Claude Code starts in the background and keeps running for the whole session. Whatever the command prints reaches Claude as notifications. That turns Claude from something you have to ask into something that notices: an error appears in a log, a deploy changes state, a queue fills up, and Claude sees it in the conversation without you pasting anything.

Hooks fire on events inside Claude Code, such as a tool call or a session start. Monitors watch the world outside it. If the thing you care about is a file, a log, a build or an API status, a monitor is the component built for it.

Where monitors live and the field schema

By default Claude Code loads monitors from monitors/monitors.json at the plugin root, a JSON array with one object per monitor. You can instead set experimental.monitors in .claude-plugin/plugin.json, either to a path to a .json file or to the array itself inline. When you set that key, it replaces the default file rather than adding to it.

Monitor entry fields

FieldRequiredWhat it does
nameYesAn identifier unique within the plugin
commandYesThe shell command Claude Code runs as a persistent background process in the session's working directory
descriptionYesA short summary shown in the task panel and in notification summaries
whenNoalways, the default, starts the monitor at session start and on plugin reload. on-skill-invoke:<skill> starts it the first time that skill runs

The smallest useful monitor tails a log. An entry named error-log, with the command tail -F ./logs/error.log and the description Application error log, starts with the session and feeds every new error line to Claude.

Always on, or started by a skill

The when field decides whether a monitor costs anything in sessions that never need it. With always, it starts at session start, starts again on plugin reload, and runs until the session ends. With on-skill-invoke:<skill>, it waits until that skill runs for the first time.

A deploy plugin is the clean example. A monitor named deploy-status, whose command runs a poll-deploy.sh script from the plugin, with when set to on-skill-invoke:deploy, stays idle in every session where nobody deploys. The first time the deploy skill runs, the watcher starts and Claude hears about each status change from then on.

My rule: on-skill-invoke for anything tied to one workflow, always only for something you genuinely want in every session, like your own project's error log. A background process in every session for a job you run once a week is noise, and every line it prints is something Claude has to read.

Path variables: substituted, not exported

This is the detail that breaks most first monitors. Three path variables resolve anywhere in a monitor's command: ${CLAUDE_PLUGIN_ROOT}, ${CLAUDE_PLUGIN_DATA} and ${CLAUDE_PROJECT_DIR}. But for monitors they are substituted inline only. Unlike hooks, the monitor process does not get them as environment variables.

How path variables reach each component

ComponentSubstituted inExported to the process
Hook commandscommand and argsCLAUDE_PLUGIN_ROOT, CLAUDE_PLUGIN_DATA, CLAUDE_PROJECT_DIR and CLAUDE_PLUGIN_OPTION_<KEY>
Monitor commandsAnywhere in commandNot exported
MCP stdio serverscommand, args, envCLAUDE_PLUGIN_ROOT, CLAUDE_PLUGIN_DATA, CLAUDE_PROJECT_DIR
LSP serverscommand, args, env, workspaceFolderCLAUDE_PLUGIN_ROOT, CLAUDE_PLUGIN_DATA, CLAUDE_PROJECT_DIR

So a monitor script that reads $CLAUDE_PLUGIN_DATA from its environment gets nothing. Put the variable in the command and hand it to the script as an argument: the command becomes the quoted plugin root path to scripts/watch.sh, followed by the quoted ${CLAUDE_PLUGIN_DATA}, and the script reads its first argument.

Keep monitor state in CLAUDE_PLUGIN_DATA

Most watchers need memory: the last log offset, the last deploy ID they reported, a cache of a status they already announced. Where you write that matters.

  • ${CLAUDE_PLUGIN_ROOT} is the plugin's install directory. Each version has its own cache directory, so the path changes when the plugin updates. Do not write state there, because the next update leaves it behind.
  • ${CLAUDE_PLUGIN_DATA} is a directory that survives updates, meant for node_modules, virtual environments and caches. It resolves to ~/.claude/plugins/data/<id>/ and is created the first time it is referenced.
  • In that path, <id> is your plugin identifier with every character other than letters, digits, underscore and hyphen replaced by a hyphen, so my-plugin@my-marketplace becomes my-plugin-my-marketplace.
  • By default the data directory is deleted when the plugin is uninstalled from the last place it is installed. claude plugin uninstall has a --keep-data option for when you want it kept.

The same directory solves the configuration problem. Monitors never receive userConfig values: ${user_config.*} in a monitor command stops the monitor from starting, and the process does not get CLAUDE_PLUGIN_OPTION_<KEY> either, because a shell would re-parse a user-typed value as code. If a watcher needs an endpoint or a project name, have a hook or a setup skill write it to a config file in the data directory, and have the monitor script read that file. For how userConfig works everywhere else, see Claude Code plugin userConfig.

Limits and gotchas before you ship

  • Interactive sessions only. Plugin monitors do not start in non-interactive mode with the -p flag, so a scripted or CI run will not have them.
  • Version floor on some setups. On Amazon Bedrock, Claude Platform on AWS, Google Cloud's Agent Platform or Microsoft Foundry, or with DISABLE_TELEMETRY or CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC set, monitors need Claude Code v2.1.310 or later.
  • Disabling a plugin mid-session does not stop monitors that are already running. They stop when the session ends.
  • Monitors run in a shell, in the session's working directory, with your full user permissions and outside the sandbox. Your permission rules do not fence them in.
  • claude plugin validate checks that a monitors path exists and stays inside the plugin root, but that check for monitors needs Claude Code v2.1.283 or later.

Do not confuse plugin monitors with the Monitor tool. When Claude itself starts a watch with the Monitor tool, that watch has a deadline: 5 minutes by default and at most 30. A plugin monitor has no such deadline and runs until the session ends, which is exactly why its output needs to be quiet.

That is my strongest opinion on monitors: print events, not heartbeats. One short line when something changes, nothing when nothing does. A watcher that prints every poll fills Claude's context with noise and buries the one line that matters.

The CCC monitor checklist

  1. Each monitor has a name, a command and a description that tells a human what it watches.
  2. Workflow-specific monitors use when: on-skill-invoke:<skill>, not always.
  3. Every path variable in a command is double-quoted and passed as an argument, never read from the environment.
  4. State and config live in ${CLAUDE_PLUGIN_DATA}, never in ${CLAUDE_PLUGIN_ROOT}.
  5. No ${user_config.*} anywhere in a monitor command.
  6. The script prints one line per real event and stays silent otherwise.
  7. The README says monitors do not run with -p, so nobody expects them in CI.

If you pair a monitor with a hook, for example a SessionStart hook that writes the config file the monitor reads, Claude Code hooks covers the hook side, and Claude Code plugin dependencies covers installing what your scripts need.

Free Claude Code drops, straight to your inbox

Short, practical drops on skills, MCP, agents, prompts, and more. No spam, unsubscribe anytime.

Frequently asked questions

What is a monitor in a Claude Code plugin?

A monitor is a shell command a plugin declares that Claude Code runs in the background for the session. What it prints reaches Claude as notifications, so Claude can react to a log entry or status change without being asked to check.

Where do I put a plugin's monitors?

In monitors/monitors.json at the plugin root, as an array of entries. You can instead set experimental.monitors in plugin.json to a path or an inline array, which replaces the default file. A top-level monitors key still loads but triggers a validate warning.

Why can't my monitor script read CLAUDE_PLUGIN_DATA?

Path variables are substituted inline in a monitor's command but are not exported to the monitor process. Put the quoted variable in the command and pass it to your script as an argument.

Can a plugin monitor use userConfig values?

No. A monitor command that references ${user_config.*} does not start, and monitor processes do not receive CLAUDE_PLUGIN_OPTION_<KEY>. Have the script read its settings from a config file, for example one in the plugin's data directory.

Do plugin monitors run with claude -p?

No. Plugin monitors do not start in non-interactive mode with the -p flag. They run in interactive sessions.

How do I start a monitor only when a skill runs?

Set the entry's when field to on-skill-invoke:<skill>. The monitor starts the first time that skill runs in the session. The default, always, starts it at session start and on plugin reload.

Last reviewed by David Iya on November 28, 2026

David Iya

Written by

David Iya

Forbes 30 Under 30 · Y Combinator

Keep reading

Claude CodePlugins

Claude Code Plugin Output Styles: Ship a Style With Your Plugin

Claude Code plugin output styles let a plugin ship its own response style: a Markdown file in output-styles/ that shows up in /output-style as plugin:name. Here is the file format, the force-for-plugin flag that applies a style automatically, the keep-coding-instructions trap, and the manifest rules that silently drop styles.

David Iya 8 min
Read article
Claude CodePricing

What should my first AI offer be, and how much should I charge?

Your first AI offer should be something you have already built or done for someone, sold to one kind of buyer, named after the result and not the tool. Price it at a fraction of what that result is worth to the buyer, not by the hour. Here is how to pick the offer, draw its edges, set a number, and raise it as customers come in.

Duncan Rogoff 9 min
Read article

Ready to build it yourself?

Join Claude Code Club, the #1 community for learning claude code, for $9/month.

← Back to the blog