Makes Command Code (cmd) a first-class agent inside
Herdr, the terminal multiplexer for coding agents.
- Lifecycle state —
idleon start (green checkmark),workingduring processing,blockedwhen asking for input, confirming edits, or approving a shell command,idlewhen finished. Status is reported from inside the livecmdprocess —cmddoes not need to exit for the state to update. - Session restore — reports the Command Code session id so Herdr can resume the agent after a server restart.
- Sidebar detection — seeds an agent-detection override so Herdr recognizes
the
cmdprocess. - Launch panes — new task, resume last session, or resume a named session.
- Notifications — a
notifyaction sends a Herdr toast.
- Herdr >= 0.7.0
cmdon yourPATH(npm i -g command-code)
herdr plugin link /path/to/commandcode-herdr-integration
herdr plugin action invoke commandcode.integration.setupFrom GitHub (after publishing with the herdr-plugin topic):
herdr plugin install <you>/commandcode-herdr
herdr plugin action invoke commandcode.integration.setupThe setup action writes the hook into ~/.commandcode/settings.json,
fingerprints it in ~/.commandcode/trusted-hooks.json, and seeds the
agent-detection override. To remove: node cmd-hooks/install-hooks.mjs --uninstall.
herdr plugin pane open --plugin commandcode.integration --entrypoint task
herdr plugin pane open --plugin commandcode.integration --entrypoint resume-last
herdr plugin pane open --plugin commandcode.integration --entrypoint resume-namedSend a notification:
herdr plugin action invoke commandcode.integration.notify "Build done" "api workspace"Keybinding:
[[keys.command]]
key = "prefix+c"
type = "plugin_pane"
command = "commandcode.integration.task"
description = "Command Code: new task"By default Herdr suppresses toasts for the active tab and has notifications off.
Enable in ~/.config/herdr/config.toml:
[ui.toast]
delivery = "herdr"
delay_seconds = 1
[ui.toast.herdr]
position = "bottom-right"
[ui.sound]
enabled = trueHerdr does not have a built-in cmd sound agent key, so set a shared path:
[ui.sound]
request_path = "sounds/request.mp3"This plugin mirrors Herdr's OpenCode integration: status is reported from
inside the live cmd process via Command Code hooks, not from the launcher.
| Hook event | State | When |
|---|---|---|
SessionStart |
idle |
Agent launches (green checkmark) |
PreToolUse |
blocked |
AskUserQuestion, Question, edit_file, write_file |
PreToolUse |
working |
Any other tool |
| Visible pane prompt | blocked |
Exact shell-command permission signal (below) |
PostToolUse |
working |
After any tool completes |
Stop |
idle |
Turn finished |
For a shell command permission request, the hook watches the current visible pane (not terminal history) for this exact two-line signal:
Execute Shell Command
Command Code needs to execute
It reports blocked once while that signal is visible. After the user approves
or rejects the request, normal PostToolUse or Stop lifecycle events report
the next working or idle state.
Command Code has no Exit hook event. On force-quit, the persistent agent
claim + Herdr's process detection handle the transition.
| File | Role |
|---|---|
herdr-plugin.toml |
Manifest: panes, setup action, notify action |
cmd-hooks/herdr-status.sh |
Lifecycle hook reporting to Herdr socket |
cmd-hooks/install-hooks.mjs |
Installs/removes the hook in Command Code config |
scripts/launch.sh |
Pane entrypoint; runs cmd |
scripts/common.sh |
Shared helpers (agent-detection seeding) |
scripts/notify.sh |
Sends a Herdr notification |
config/agent-detection/cmd.toml |
Agent-detection override for cmd process |
tests/ |
Test suite |
- Launching uses plugin panes (real PTYs); actions run detached without a
TTY and
cmdrequires one. - Windows is supported via Git Bash (scripts are POSIX
sh). - Verify agent-detection schema with
herdr api schema --json; adjustconfig/agent-detection/cmd.tomlif field names differ on your version.