refactor(session-inbox-monitor): v0.3.0 → v0.4.0 — inbox path .claude-inbox → .agents/inbox

This commit is contained in:
2026-08-12 13:27:59 +03:00
parent f8a6709545
commit 8682cd7e09

View File

@@ -1,9 +1,9 @@
--- ---
name: session-inbox-monitor name: session-inbox-monitor
version: 0.3.0 version: 0.4.0
description: > description: >
Raises a persistent Monitor (Monitor tool, NOT background Bash) on the Raises a persistent Monitor (Monitor tool, NOT background Bash) on the
project's `.claude-inbox/` at the start of an interactive session, so project's `.agents/inbox/` at the start of an interactive session, so
inter-session messages page the session in real time; the monitor dies on inter-session messages page the session in real time; the monitor dies on
session end on its own. A paired SessionStart hook injects the session end on its own. A paired SessionStart hook injects the
raise-instruction and first sweeps orphaned monitors of this inbox (a raise-instruction and first sweeps orphaned monitors of this inbox (a
@@ -20,7 +20,7 @@ description: >
# session-inbox-monitor # session-inbox-monitor
Auto-raises a session-length Monitor on `.claude-inbox/` at interactive-session Auto-raises a session-length Monitor on `.agents/inbox/` at interactive-session
start (via a paired SessionStart hook that injects the instruction and sweeps start (via a paired SessionStart hook that injects the instruction and sweeps
orphans), so inter-session messages page the session in real time. Tears down orphans), so inter-session messages page the session in real time. Tears down
for free on session end. Headless sessions skip it and rely on the pull-model for free on session end. Headless sessions skip it and rely on the pull-model
@@ -42,7 +42,7 @@ for free on session end. Headless sessions skip it and rely on the pull-model
## Inputs ## Inputs
- `<project>/.claude-inbox/` — the watched directory. Direct-child `*.md` files - `<project>/.agents/inbox/` — the watched directory. Direct-child `*.md` files
are inbox messages (the Stop-hook moves them to `.read/` once handled). are inbox messages (the Stop-hook moves them to `.read/` once handled).
- The SessionStart hook supplies the **exact Monitor command** to run, with the - The SessionStart hook supplies the **exact Monitor command** to run, with the
sweep sentinel (`CLAUDE_INBOX_MONITOR`) and the absolute inbox path baked in. sweep sentinel (`CLAUDE_INBOX_MONITOR`) and the absolute inbox path baked in.
@@ -63,7 +63,7 @@ for free on session end. Headless sessions skip it and rely on the pull-model
3. **Do not sweep yourself.** Killing orphans is the hook's job (it runs before 3. **Do not sweep yourself.** Killing orphans is the hook's job (it runs before
you, at SessionStart, when no other session activity is live). you, at SessionStart, when no other session activity is live).
4. **On an event** (`New inter-session message in inbox: <name>`), read 4. **On an event** (`New inter-session message in inbox: <name>`), read
`.claude-inbox/` and handle the message per `inter-session-peer-discipline`. `.agents/inbox/` and handle the message per `inter-session-peer-discipline`.
The Stop-hook also force-delivers any inbox messages at end of turn as a The Stop-hook also force-delivers any inbox messages at end of turn as a
backstop, so nothing is lost if the monitor missed a beat. backstop, so nothing is lost if the monitor missed a beat.
5. **Teardown is automatic.** The Monitor dies at session end. Do **not** add a 5. **Teardown is automatic.** The Monitor dies at session end. Do **not** add a
@@ -82,7 +82,7 @@ for free on session end. Headless sessions skip it and rely on the pull-model
"timeout": 15, "statusMessage": "inbox-monitor" } ] } "timeout": 15, "statusMessage": "inbox-monitor" } ] }
``` ```
- Twin pattern: `poller-interactive-lock-writer` (`interactive-lock.ps1`). - Twin pattern: `poller-interactive-lock-writer` (`interactive-lock.ps1`).
- Opt-in per project: the hook fires only when the project has a `.claude-inbox/` - Opt-in per project: the hook fires only when the project has a `.agents/inbox/`
directory **or** a CLAUDE.md line `inbox monitor: raise on start`. directory **or** a CLAUDE.md line `inbox monitor: raise on start`.
## Failure modes ## Failure modes
@@ -127,12 +127,12 @@ for free on session end. Headless sessions skip it and rely on the pull-model
session; both die at session end. session; both die at session end.
- Force-kills orphaned monitor processes of this inbox at every SessionStart. - Force-kills orphaned monitor processes of this inbox at every SessionStart.
- **No repo writes.** The hook and its `~/.claude/settings.json` registration are - **No repo writes.** The hook and its `~/.claude/settings.json` registration are
machine-local; only this skill (docs) and `.claude-inbox/` activity are in play. machine-local; only this skill (docs) and `.agents/inbox/` activity are in play.
## Pi (pi-coding-agent) support — session-scoped global extension ## Pi (pi-coding-agent) support — session-scoped global extension
Same contract, pi-native, and **session-scoped**: the extension watches ONLY the Same contract, pi-native, and **session-scoped**: the extension watches ONLY the
current session's project inbox (`<ctx.cwd>/.claude-inbox/`) — it never reads current session's project inbox (`<ctx.cwd>/.agents/inbox/`) — it never reads
other projects' inboxes (vitya's rule: an agent may only read its own other projects' inboxes (vitya's rule: an agent may only read its own
directory's inbox). Installed globally so *every* pi session has the directory's inbox). Installed globally so *every* pi session has the
capability, but each session only ever touches its own project's inbox. capability, but each session only ever touches its own project's inbox.
@@ -143,7 +143,7 @@ capability, but each session only ever touches its own project's inbox.
directory), hot-reload with `/reload`. Test: directory), hot-reload with `/reload`. Test:
`node --experimental-strip-types .common/lib/pi-extensions/inbox-monitor.test.mjs` `node --experimental-strip-types .common/lib/pi-extensions/inbox-monitor.test.mjs`
(incl. decoy check — another project's inbox is never touched). (incl. decoy check — another project's inbox is never touched).
- **Opt-in per project** — same as CC: `.claude-inbox/` dir exists OR CLAUDE.md - **Opt-in per project** — same as CC: `.agents/inbox/` dir exists OR CLAUDE.md
line `inbox monitor: raise on start`. line `inbox monitor: raise on start`.
- **PUSH:** 15s poll of the session's own inbox (interactive only). **PULL:** - **PUSH:** 15s poll of the session's own inbox (interactive only). **PULL:**
`agent_settled` sweep — the pi equivalent of the CC Stop-hook pickup. Both `agent_settled` sweep — the pi equivalent of the CC Stop-hook pickup. Both