AGI Hunt· lydiahallie·· 1 小时前AI 评分65
Claude Code Stop hook 使用 exit 2 实现检查失败自动重试
Claude Code Stop hook 让检查失败自动重试,关键是要用 exit 2
AI 导读
Lydia Hallie 分享了使用 Claude Code Stop hook 在检查失败时自动重试的技巧,关键是为阻断性退出配置 exit 2。exit 2 会让 Claude 读取 hook 的 stderr 输出并再次修复,exit 1 则可能直接结束;推荐写法为 `[your command] >&2 || { echo failed; exit 2; }`。
来源:AGI Hunt · agihunt.info