Files
ClaudeMailbox/plugin/commands/mailbox-update.md
Mika Kuns 462d6561e1 feat(plugin): per-session mailbox identity + mailbox-update command
The hook now derives a unique mailbox name from the session_id supplied
on hook stdin, so two parallel Claude Code sessions in the same project
get distinct mailboxes (e.g. `claude-a8b3c1d2`, `claude-d4e5f6a7`)
instead of colliding on a shared env value. An optional
CLAUDE_MAILBOX_NAME base prefix flavors the names as `<base>-<sid>`.

Adds:
- `claude-mailbox session-announce` subcommand for the new SessionStart
  hook, which prints the current session's mailbox name to context
- `/claude-mailbox:mailbox-update` slash command for `npm update` +
  daemon restart
- stdin parsing helpers (parseHookStdin, deriveSessionName) with unit
  tests; the doctor no longer needs a mandatory name prompt
2026-05-19 11:39:14 +02:00

2.1 KiB

description, allowed-tools
description allowed-tools
Update the Claude-Mailbox daemon to the latest published npm version and restart it. Bash

You are running the Claude-Mailbox update command. Update the @kuns/claude-mailbox npm package and restart the daemon. Never run sudo automatically — if elevation is needed, stop and ask.

Step 1 — current version

Run: claude-mailbox --version

  • Exit 0 → record the version string as CURRENT.
  • Non-zero → tell the user the daemon binary is not installed yet. Suggest /claude-mailbox:mailbox-doctor to do a full setup and stop.

Step 2 — latest published version

Run: npm view @kuns/claude-mailbox version

If the npm registry config is missing, the call may fail with a 404. Fall back to:

npm view --registry=https://git.kuns.dev/api/packages/releases/npm/ @kuns/claude-mailbox version

Record the result as LATEST.

Step 3 — compare

  • If CURRENT === LATEST: print "Already up to date (vX.Y.Z)." and stop. Do not run any further steps.
  • Otherwise: tell the user CURRENTLATEST and ask for confirmation before proceeding.

Step 4 — perform the update

On user confirmation, run these in order. Stop on the first failure and report it:

  1. claude-mailbox stop
  2. npm install -g @kuns/claude-mailbox@latest
    • On Linux/macOS this may fail with EACCES. Do not run sudo automatically. Ask the user how they want to proceed (e.g., sudo npm install -g …, or switch to a user-scoped Node setup with nvm/fnm).
  3. claude-mailbox start
  4. claude-mailbox --version to verify the upgrade landed.
  5. claude-mailbox status to verify the daemon is Running.

Step 5 — summary

Print exactly this block:

Claude-Mailbox update
  previous version: <CURRENT>
  new version:      <whatever --version now reports>
  daemon:           Running | Stopped | NotInstalled
  pending messages survived: <count of messages still in inbox via `claude-mailbox list`, if applicable>

If the new version matches LATEST and daemon is Running, end with: "Update complete." Otherwise, end with the first thing that went wrong.