From 8747d638fb56dd91d029865ada737d225341193c Mon Sep 17 00:00:00 2001 From: Mika Kuns Date: Tue, 19 May 2026 16:06:55 +0200 Subject: [PATCH] feat(plugin): add SubagentStop hook to auto-check inbox after subagent runs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Delivers peer messages that arrive during a long-running subagent into the parent context the moment the Task tool returns, instead of waiting until the next user prompt. Reuses the existing `claude-mailbox check --hook` so the mailbox identity stays consistent with UserPromptSubmit. Plugin 1.2.0 → 1.3.0. Co-Authored-By: Claude Opus 4.7 (1M context) --- plugin/.claude-plugin/plugin.json | 4 ++-- plugin/README.md | 3 ++- plugin/hooks/hooks.json | 10 ++++++++++ 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/plugin/.claude-plugin/plugin.json b/plugin/.claude-plugin/plugin.json index f8e4bed..b25d214 100644 --- a/plugin/.claude-plugin/plugin.json +++ b/plugin/.claude-plugin/plugin.json @@ -1,7 +1,7 @@ { "name": "claude-mailbox", - "version": "1.2.0", - "description": "Auto-checks the local Claude-Mailbox daemon before every prompt and injects pending messages into the conversation context.", + "version": "1.3.0", + "description": "Auto-checks the local Claude-Mailbox daemon before every prompt and after each subagent run, and injects pending messages into the conversation context.", "author": { "name": "Mika Kuns" }, diff --git a/plugin/README.md b/plugin/README.md index 2be19dd..18cd63d 100644 --- a/plugin/README.md +++ b/plugin/README.md @@ -39,8 +39,9 @@ The `SessionStart` hook announces the current session's mailbox name in the conv |---|---|---| | `SessionStart` | `claude-mailbox session-announce` | Registers the session with the daemon, then prints (a) this session's mailbox name, (b) the exact `from` / `name` args to pass to MCP tools, and (c) a list of other mailboxes active in the last hour — so Claude knows who's around without needing to call `list_mailboxes` first. | | `UserPromptSubmit` | `claude-mailbox check --hook` | Pulls unread messages for the session's mailbox and injects them as context. Silent on empty inbox; emits a one-line setup hint when the daemon is unreachable. | +| `SubagentStop` | `claude-mailbox check --hook` | Same as `UserPromptSubmit`, but fires when a subagent finishes (Task tool). Lets the parent see peer messages that arrived during a long-running subagent run, instead of waiting until the next user prompt. | -Cost: one local HTTP round-trip per prompt + Node coldstart (~100ms on Windows). +Cost: one local HTTP round-trip per prompt and per subagent stop + Node coldstart (~100ms on Windows). ## MCP tools diff --git a/plugin/hooks/hooks.json b/plugin/hooks/hooks.json index 45fbcdb..b238873 100644 --- a/plugin/hooks/hooks.json +++ b/plugin/hooks/hooks.json @@ -19,6 +19,16 @@ } ] } + ], + "SubagentStop": [ + { + "hooks": [ + { + "type": "command", + "command": "claude-mailbox check --hook" + } + ] + } ] } }