4 Commits

Author SHA1 Message Date
8205f5d758 fix(session-inbox-monitor): UTF-8 OutputEncoding forward-guard in SessionStart hook (v0.2.2)
Closes session-inbox-monitor-encoding-guard-followup (finding from -review
structural audit item E, CONCERN).

inbox-monitor.ps1 emitted ConvertTo-Json (incl. the interpolated inbox path)
to a redirected pipe under WinPS 5.1 without setting [Console]::OutputEncoding
— the same context that mojibaked stop-dispatcher. ASCII-safe today, but the
inbox path is user-data, so a non-ASCII path/content would mangle the inject.

- Add [Console]::OutputEncoding + $OutputEncoding = UTF8 after the $ProjectDir
  gate (mirror of stop-dispatcher.ps1). Comment text kept pure ASCII.
- Regression under WinPS 5.1: parse 0 errors; ran hook against a Cyrillic-path
  project, read raw stdout bytes as no-BOM UTF-8 -> JSON valid, Cyrillic path
  round-trips intact.
- Re-deployed to ~/.claude/hooks/inbox-monitor.ps1, SHA256 byte-identical.
- SKILL.md Mojibake failure-mode extended; version 0.2.1 -> 0.2.2 (PATCH).

install/hermes/dist not rebuilt — PATCH needs only reload-plugins; the runtime
hook is deployed.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-17 12:05:15 +03:00
29d5e9ffa8 fix(session-inbox-monitor): force UTF-8 on Stop-hook delivery + writer guide v0.2.1
Closes session-inbox-monitor-stophook-utf8-fix. Cyrillic message bodies arrived
as mojibake when force-delivered via the Stop-hook block reason.

Root cause: ~/.claude/hooks/stop-dispatcher.ps1 reads bodies with -Encoding UTF8
(fine) but did NOT set [Console]::OutputEncoding, so ConvertTo-Json to stdout
under a harness-spawned redirected pipe (WinPS 5.1) emitted in OEM cp866.

Fix applied to the machine-local hook (not in git): set
[Console]::OutputEncoding/$OutputEncoding = UTF8 at the top. In-situ RED->GREEN
verified through the real Stop-hook path: a Cyrillic pangram that previously came
back as mojibake now delivers clean; no-loop holds.

Repo changes: SKILL.md Failure modes documents the encoding contract for inbox
writers (no-BOM UTF-8 LF; WriteAllText, not Set-Content -Encoding utf8 which BOMs
under 5.1); bump 0.2.0 -> 0.2.1 PATCH. stop-dispatcher.ps1 multi-machine
propagation is the workshop setup's concern (notified).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-17 11:06:00 +03:00
c3e1ce7b40 feat(session-inbox-monitor): SessionStart hook + fill SKILL body v0.2.0
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>
2026-06-17 10:48:50 +03:00
cf08fdeea7 feat(skills): add session-inbox-monitor v0.1.0 (promoted from .workshop/.brainstorm/session-inbox-monitor.md) 2026-06-17 10:28:47 +03:00