← ClaudeAtlas

mycostop-hook-fragilitylisted

Use when prompt/response capture stops working, a Claude Code hook reports a silent non-blocking error, or you're modifying anything in packages/myco/src/hooks/, the global launcher, or the EventBuffer/ reconciliation path. Stop hooks are the most fragile point in Myco's capture chain — covers three distinct, independently-diagnosable failure modes: (1) hook path wiring breaking when ~/.myco/runtime/ is deleted even though the native daemon is active, (2) capture-critical hooks needing an EventBuffer fallback so daemon restarts mid-turn don't permanently drop the assistant response, and (3) the global launcher's catch-all masking real errors as a silent "non-blocking status code, no stderr" failure. Apply this even if the user just says "capture isn't working" or "hook is erroring" without naming a root cause — the procedure here is how you tell the three apart and fix or recover from each.
goondocks-co/myco · ★ 13 · AI & Automation · score 79
Install: claude install-skill goondocks-co/myco
# Stop Hook Fragility: Diagnosis, Idempotency, and Recovery Stop hooks sit at the boundary between Claude Code and Myco's capture pipeline, and they are the most fragile point in that chain: a single broken path, a missing fallback, or a masked exit code silently stops prompt/response capture with no visible symptom in the session itself. Three independent failure modes have been observed, each with a different root cause and a different diagnostic fingerprint. Treat "capture isn't working" as a triage problem — figure out which of the three you're looking at before reaching for a fix. ## Prerequisites Know the shape of the hook chain before diagnosing anything: - Claude Code invokes hooks per the command registered in `~/.claude/settings.json` (e.g. the Stop hook entry). - That command routes through `~/.myco/launcher.cjs`, which spawns the actual hook binary and translates the child's exit/signal into its own process exit. - The hook binaries themselves live in `packages/myco/src/hooks/` (covering, among others, the stop, user-prompt-submit, and post-tool-use entry points). **Every hook in this directory is fail-open** — it always exits 0, writing errors only to stderr. The hook code is never the source of a non-zero exit you see in Claude Code's UI. - Capture-critical hooks POST to the daemon (a `capturePost(...)` call, which is `captureCritical`) and, on failure, should buffer to `<grove>/projects/<pid>/buffer/<sid>.jsonl` for replay via `reconci