Core content task of the session-inbox-monitor line. Two deliverables:
1. SessionStart hook `skills/session-inbox-monitor/hooks/inbox-monitor.ps1`
(versioned for multi-machine rollout; deployed to ~/.claude/hooks/ and
registered in ~/.claude/settings.json SessionStart):
- sweep: Get-CimInstance | Stop-Process orphaned monitors of THIS inbox,
matched by sentinel CLAUDE_INBOX_MONITOR + inbox path (a /clear leaves
the poll process alive -> re-raise without sweep stacks duplicates);
- inject: hookSpecificOutput.additionalContext with the exact persistent
Monitor command (Monitor tool, not background Bash);
- opt-in gate: fires only on .claude-inbox/ dir or CLAUDE.md trigger line.
ASCII-only (em-dash -> mojibake under WinPS 5.1 without BOM, fixed).
2. SKILL.md body filled (When to use / Inputs / Steps / Deployment /
Failure modes / Side effects / What NOT to do); bump 0.1.0 -> 0.2.0 MINOR.
Headless: no hook-level signal exists (verified via claude-code-guide) ->
agent-side best-effort skip, default errs toward raising (false-skip in
interactive loses the feature; false-raise in headless is a harmless no-op).
Live-verified: inject -> valid JSON; sweep -> killed a planted orphan (PASS);
real Monitor tool spawns a bash process carrying the sentinel (sweep will
find real orphans); settings.json stays valid. Sweep over-match edge and
multi-session-per-project limit documented honestly in Failure modes.
Closes [session-inbox-monitor-sessionstart-hook].
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>