A practical guide to Herdr plugins

By

Tagged: AI

Install, inspect, configure, run, and build Herdr plugins, with practical commands and the security checks to make before trusting one.

If you want to extend Herdr, plugins are just small programs paired with a manifest. A plugin can set up a project layout, add a custom action, react to workspace events, pop open a terminal pane, or wire Herdr up to another tool on your machine.

The nice part is there’s no separate plugin SDK to learn. You can write a plugin in Bash, JavaScript, PowerShell, Lua, Rust, or whatever else your machine can run. Herdr takes care of installing it, reading the manifest, wiring up keybindings and events, opening panes, capturing logs, and passing runtime context. When your plugin needs to control the workspace, it calls the normal Herdr CLI or socket API.

If you’re new to how Herdr handles terminals and agents, start with my Herdr deep dive first.

Find a plugin

You can browse community plugins at herdr.dev/plugins. That page pulls public GitHub repositories tagged with herdr-plugin automatically, so treat it as a directory and vet every repo yourself before installing it.

Because Herdr doesn’t sandbox plugins, anything you install runs as your user, inherits your environment, and has full access to the Herdr CLI. Treat a plugin with the same caution you’d give a shell script or an editor extension. Before you install one, run through a quick check:

  1. Open the repository on GitHub.
  2. Read herdr-plugin.toml.
  3. Check the build and runtime commands declared there.
  4. Read the scripts or source code those commands execute.
  5. Make sure you trust the author.

Install a plugin from GitHub

Once you’ve checked a repo, you can install it directly with GitHub shorthand:

herdr plugin install owner/repository

Some repositories bundle several plugins together. When that happens, append the subdirectory path:

herdr plugin install owner/repository/path/to/plugin

Here’s the community example from the Herdr docs so you can see what a real install command looks like:

herdr plugin install \
  ogulcancelik/herdr-plugin-examples/agent-telegram-notify

In an interactive terminal, Herdr prints the source and the commands it plans to run, then waits for you to confirm. Skip the --yes flag on a first install, since it bypasses that prompt. Save it for a repo and revision you’ve already read through. If you want to lock down a specific revision, you can pin a Git ref right in the command:

herdr plugin install \
  owner/repository/path/to/plugin \
  --ref v1.2.0

Under the hood, Herdr clones the repo with Git, runs whatever build commands the manifest declares, keeps the checkout in a managed directory, and registers the plugin. If a build command fails, Herdr stops and won’t register it.

List and inspect installed plugins

To see everything you’ve installed so far, run:

herdr plugin list

If you’re writing a script around the output, ask for structured output instead:

herdr plugin list --json

You can also filter the list down to a single plugin by its ID:

herdr plugin list --plugin examples.agent-telegram-notify

Keep in mind that the plugin ID comes from its manifest, so it doesn’t have to match the GitHub repository name. Also, installed plugins and whether they’re enabled are global for your user account. If you install a plugin inside one named Herdr session, it shows up in all your other sessions right away.

Configure a plugin

Every plugin gets its own stable configuration directory. Print its path with:

herdr plugin config-dir examples.agent-telegram-notify

Whenever a plugin’s docs ask you to add an .env file or other user-editable settings, put them in that directory. Never drop credentials inside the managed plugin checkout itself, because reinstalling a GitHub plugin replaces that checkout.

At runtime, Herdr also gives each plugin a separate state directory where it can store whatever files and data formats it owns.

Run plugin actions

To see which actions a plugin exposes, list them first:

herdr plugin action list \
  --plugin examples.agent-telegram-notify

Once you know the action ID declared in the manifest, invoke it directly:

herdr plugin action invoke \
  examples.agent-telegram-notify.send-test

If two installed plugins declare an action with the same name, use the fully qualified form:

plugin.id.action

Running actions from the CLI is fine when you’re testing, though you’ll probably want shortcuts for the ones you reach for often. You can bind any action in ~/.config/herdr/config.toml:

[[keys.command]]
key = "prefix+l"
type = "plugin_action"
command = "example.layout.apply"
description = "apply layout"

Pick a key that isn’t already taken by the built-in keymap (you can check the defaults in Herdr keyboard shortcuts). After editing the config file, reload it to pick up the new binding:

herdr server reload-config

Open a plugin pane

Plugins can also define terminal pane entrypoints, which are great for interactive tools you want right inside your workspace. List the plugin’s entrypoints or check its docs to grab the ID, then open it like this:

herdr plugin pane open \
  --plugin example.layout \
  --entrypoint board

Herdr gives you five ways to place that pane:

If you don’t like the default placement the manifest picked, override it on the fly:

herdr plugin pane open \
  --plugin example.layout \
  --entrypoint board \
  --placement popup \
  --width 80% \
  --height 20

One detail worth knowing: a popup is meant to be temporary, while split, tab, zoomed, and overlay panes work like normal panes with the usual Herdr pane APIs.

Read plugin logs

When an action fails, check its command log:

herdr plugin log list \
  --plugin example.layout \
  --limit 20

Herdr records which declared command ran and how it exited. Beyond that, you’re debugging a normal Node, Bash, or Rust program the way you always would.

Disable, enable, and remove plugins

If you want to turn a plugin off without removing it, disable it:

herdr plugin disable example.layout

When you want it back, enable it again:

herdr plugin enable example.layout

To remove a GitHub-managed plugin completely, uninstall it by ID:

herdr plugin uninstall example.layout

You can also pass the original source shorthand instead:

herdr plugin uninstall owner/repository/path/to/plugin

Right now, Herdr doesn’t have a separate update command for plugins. To pull a newer version from GitHub, just reinstall it from the same source to refresh its managed checkout.

Build a small local plugin

The best way to see how this fits together is to build a tiny plugin yourself. Let’s make an action that lists your current Herdr workspaces using two files in a directory:

workspace-tools/
  herdr-plugin.toml
  index.js

Start with the manifest:

id = "example.workspace-tools"
name = "Workspace Tools"
version = "0.1.0"
min_herdr_version = "0.7.0"
description = "Small workspace helpers"
platforms = ["linux", "macos", "windows"]

[[actions]]
id = "list-workspaces"
title = "List workspaces"
contexts = ["workspace"]
command = ["node", "index.js"]

Herdr runs declared commands directly as argv arrays instead of passing them through a shell, so shell expansion won’t happen unless your command spawns a shell itself.

Next, write the JavaScript file so it calls the installed Herdr binary:

const { spawnSync } = require('node:child_process')

const herdr = process.env.HERDR_BIN_PATH ?? 'herdr'

const result = spawnSync(
  herdr,
  ['workspace', 'list'],
  {
    encoding: 'utf8',
    stdio: ['ignore', 'pipe', 'pipe'],
  },
)

process.stdout.write(result.stdout)
process.stderr.write(result.stderr)
process.exit(result.status ?? 1)

Use HERDR_BIN_PATH here rather than hardcoding herdr. It points to the binary that owns the running session, and it works across both Unix sockets and Windows named pipes.

While you’re building a plugin locally, you don’t need to push it to GitHub to test it. Link your working directory straight into Herdr:

herdr plugin link /absolute/path/to/workspace-tools

One gotcha to keep in mind: plugin link skips any build commands in your manifest. Since you’re working from a live checkout, you’re expected to build it yourself.

From there, list and run your new action to verify it works:

herdr plugin action list \
  --plugin example.workspace-tools

herdr plugin action invoke \
  example.workspace-tools.list-workspaces

If something breaks, pull up the log:

herdr plugin log list \
  --plugin example.workspace-tools

Once you’re done testing, unlink the directory to remove the registration without touching any of your local files:

herdr plugin unlink example.workspace-tools

What a manifest can declare

Here’s everything you can define in herdr-plugin.toml:

EntryUse
[[build]]Prepare a GitHub-installed plugin
[[startup]]Run one initialization command after server restore
[[actions]]Expose commands that people, keys, or tools can invoke
[[events]]React to known Herdr events
[[panes]]Open a terminal interface managed by the plugin
[[link_handlers]]Route matching terminal links to a plugin action

A couple of limits are worth knowing before you design a bigger plugin. [[startup]] hooks run once to initialize things and exit, so don’t rely on them as background services that Herdr will supervise for you. Also, every action and pane has to be declared upfront in the manifest. In this v1 plugin system, plugins can’t register new actions at runtime, and every plugin UI lives inside a terminal pane rather than a native non-terminal interface.

Runtime context

When Herdr runs one of your plugin’s commands, it starts inside the plugin directory and passes a set of environment variables with the current context:

HERDR_BIN_PATH
HERDR_ENV
HERDR_PLUGIN_ID
HERDR_PLUGIN_ROOT
HERDR_PLUGIN_CONFIG_DIR
HERDR_PLUGIN_STATE_DIR
HERDR_PLUGIN_CONTEXT_JSON
HERDR_WORKSPACE_ID
HERDR_TAB_ID
HERDR_PANE_ID

Don’t assume every workspace, tab, or pane variable will be populated on every run, since it depends on how the command was triggered. When your action needs more than the common IDs (like the focused pane, worktree, agent, selected text, or clicked URL), read HERDR_PLUGIN_CONTEXT_JSON instead.

My recommendation

Start small by installing one community plugin after reading its repo, and get comfortable with these four commands first:

herdr plugin list
herdr plugin action list --plugin ID
herdr plugin action invoke ID.ACTION
herdr plugin log list --plugin ID

After that, write a tiny local action of your own and link it. Herdr wires everything up from the manifest, while the script underneath stays a normal command you can run, inspect, and debug on its own.

For the full manifest reference, head to the official Herdr plugin guide. And if you’d rather have an agent drive the workspace for you, check out how to use the Herdr skill.

Want me to talk about your product? You can sponsor this site.

Related posts about ai: