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>
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
---
|
||||
name: session-inbox-monitor
|
||||
version: 0.2.0
|
||||
version: 0.2.1
|
||||
description: >
|
||||
Raises a persistent Monitor (Monitor tool, NOT background Bash) on the
|
||||
project's `.claude-inbox/` at the start of an interactive session, so
|
||||
@@ -104,6 +104,16 @@ for free on session end. Headless sessions skip it and rely on the pull-model
|
||||
- **Monitor auto-stopped** → the harness stops monitors that emit too many
|
||||
events. The injected poll command de-dups by filename (pages once per message,
|
||||
not every 15s) to stay under that bar.
|
||||
- **Mojibake on force-delivery** → the Stop-hook (`stop-dispatcher.ps1`) injects
|
||||
message bodies to stdout; WinPS 5.1 must set `[Console]::OutputEncoding =
|
||||
[System.Text.Encoding]::UTF8` or non-ASCII (Cyrillic) bodies arrive mangled
|
||||
(it emits in the OEM code page under a harness-spawned redirected pipe). Inbox
|
||||
messages must be written as **no-BOM UTF-8, LF** — the Write tool does this;
|
||||
PowerShell writers must use
|
||||
`[IO.File]::WriteAllText($p,$t,[Text.UTF8Encoding]::new($false))`, NOT
|
||||
`Set-Content`/`Out-File -Encoding utf8` (which adds a BOM under 5.1). Same
|
||||
WinPS-5.1 encoding class as the hook-source em-dash gotcha. Fixed + in-situ
|
||||
verified 2026-06-17.
|
||||
|
||||
## Side effects
|
||||
|
||||
|
||||
Reference in New Issue
Block a user