Ask HN: 没有“钩子”的 AI 代码辅助从根本上来说是无法执行的吗?
2 分•作者: meloncafe•7 个月前
今年我在 Claude Code 上花了大约 2000 美元(10 年以上的开发经验,现在从事非开发工作,仅用于副业项目)。
一个惨痛的教训:Markdown 指令不起作用。
AI 需要强制约束。
崩溃点是 Auto Compact 功能。在上下文压缩后,Claude 总是忽略 CLAUDE.md 文件——Anthropic 让你创建的那个文件。这就像雇了一个每 2 小时就忘记自己工作职责的人。
我无法仅靠指令解决的核心问题包括:
- 压缩后失忆症:“解读”之前的会话,通常具有破坏性
- 会话记忆丢失:每天像新实习生一样问同样的问题
- TODO 泛滥:“我实现了它!”(旁白:这只是一个 TODO)
- 命令混乱:rm -rf,重复的 curl 提示,git 提交时带有“by Claude”
- 指导方针 = 建议:它会遵守它们……当它想遵守的时候
在与这个问题斗争了 6 个月后,我构建了强制约束钩子(命令限制器、压缩前的自动摘要器、TODO 检测器、提交验证器)。它们有效,但我觉得我是在与工具对抗,而不是与它合作。
向社区提问:
1. 这是每个人的经历吗,还是我从根本上错误地使用了 Claude Code?
2. 对于使用 Cursor/Copilot 等工具的人来说——也存在同样的强制约束问题吗?
3. “Markdown 指导方针 → AI 遵守它们”这种方式在规模化方面是否不可行?
这些钩子在 GitHub 上(主要是韩语,但功能通用):
https://github.com/meloncafe/claude-code-hooks
我真的很想知道这是否是一个普遍的 AI 编码问题,还是我自己的技能问题。
查看原文
I spent ~$2k on Claude Code this year (10+ years dev, non-dev job now, side projects only).
The hard lesson: markdown instructions don't work.<p>AI needs enforcement.<p>The breaking point was Auto Compact.
After context compression, Claude consistently ignores CLAUDE.md - the very file Anthropic tells you to create.
It's like hiring someone who forgets their job description every 2 hours.<p>Core issues I couldn't solve with instructions alone:<p>- Post-compact amnesia: "interprets" previous session, often destructively<p>- Session memory loss: asks the same questions like a new intern daily<p>- TODO epidemic: "I implemented it!" (narrator: it was just a TODO)<p>- Command chaos: rm -rf, repetitive curl prompts, git commits with "by Claude"<p>- Guidelines = suggestions: follows them... when it feels like it<p>After 6 months struggling with this, I built enforcement hooks (command restrictor, auto-summarizer before compact, TODO detector, commit validator).
They work, but I feel like I'm working against the tool rather than with it.<p>Questions for the community:<p>1. Is this everyone's experience, or am I using Claude Code fundamentally wrong?<p>2. For those on Cursor/Copilot/etc - same enforcement issues?<p>3. Is "markdown guidelines → AI follows them" just... not viable at scale?<p>The hooks are on GitHub (mostly Korean but universally functional):<p>https://github.com/meloncafe/claude-code-hooks<p>Really curious if this is a universal AI coding problem or a skill issue on my end.