Adds a Push delivery (watch) section to the root README with exit-code table, cross-process semantics, and the active-vs-idle latency caveat that came out of the empirical Claude Code BashOutput test. Adds a brief reference + cross-link in node/README.md, and notes the SessionStart bootstrap behavior in plugin/README.md alongside the existing hook table. Adds /v1/watch to the REST surface table and the watch verb to the CLI listing. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
63 lines
2.5 KiB
Markdown
63 lines
2.5 KiB
Markdown
# @kuns/claude-mailbox
|
||
|
||
Standalone MCP mail server that lets parallel Claude sessions coordinate with each other.
|
||
|
||
## Install
|
||
|
||
One-time per machine:
|
||
|
||
```sh
|
||
npm config set @kuns:registry=https://git.kuns.dev/api/packages/releases/npm/
|
||
npm install -g @kuns/claude-mailbox
|
||
```
|
||
|
||
Then:
|
||
|
||
```sh
|
||
claude-mailbox install-autostart # registers per-OS autostart, no admin needed by default
|
||
```
|
||
|
||
See the [repository README](https://git.kuns.dev/releases/ClaudeMailbox/src/branch/main/README.md) for the full architecture, MCP tool reference, and `.mcp.json` snippet.
|
||
|
||
## Claude Code hook (auto-check inbox)
|
||
|
||
Register a `UserPromptSubmit` hook so Claude pulls pending mailbox messages before every prompt:
|
||
|
||
```sh
|
||
claude-mailbox install-hook --name alice # patches ~/.claude/settings.json
|
||
claude-mailbox install-hook --name alice --project # patches <cwd>/.claude/settings.json
|
||
claude-mailbox uninstall-hook # remove again
|
||
```
|
||
|
||
The hook is idempotent (running `install-hook` twice does nothing the second time) and only touches the `UserPromptSubmit` block — other hooks and settings are preserved.
|
||
|
||
Under the hood the hook runs `claude-mailbox check --name <mailbox> --hook`, which:
|
||
|
||
- prints unread messages in a Claude-friendly format,
|
||
- silently exits 0 if the inbox is empty or the daemon is unreachable (no context noise),
|
||
- marks the messages delivered so they aren't injected again next prompt.
|
||
|
||
Cost: one local HTTP round-trip plus Node coldstart per prompt (~100ms on Windows).
|
||
|
||
## Push delivery (watch)
|
||
|
||
For long-running autonomous sessions, run the watcher as a background bash task so peer messages surface immediately via `BashOutput`:
|
||
|
||
```sh
|
||
claude-mailbox watch --block --name <mailbox>
|
||
```
|
||
|
||
Exit codes: `0` delivered or renamed, `1` error, `2` daemon unreachable, `3` timeout. See the [repository README](https://git.kuns.dev/releases/ClaudeMailbox/src/branch/main/README.md#push-delivery-watch) for the full contract.
|
||
|
||
## Troubleshooting
|
||
|
||
`npm install` returns `401 Unauthorized`
|
||
: The Gitea registry usually serves the `releases` scope publicly, but if your instance requires auth you'll need a read token:
|
||
|
||
```sh
|
||
npm config set //git.kuns.dev/api/packages/releases/npm/:_authToken=<token>
|
||
```
|
||
|
||
`Cannot find module 'node:sqlite'` or similar
|
||
: claude-mailbox uses Node's built-in `node:sqlite`, stable since Node 24. On Node 22.5–23.x it works only with `--experimental-sqlite`. Upgrade to Node 24 LTS or newer: `nvm install 24 && nvm use 24` (or `winget install OpenJS.NodeJS.LTS` on Windows).
|