Posted by aakil 2 hours ago
Comment blocks are <= 7 words, function names <= 4 words. User-facing message strings should be <= 10 words. Use an active voice, no stage performances, and pick the most common word when choosing among alternatives.
Limiting the number of words is the strongest factor in cleaning up the output, IMO.
For older code I've instructed it to delete all the comments, and then I re-comment it using a new session and these guidelines, asking it to rejustify the need for every comment to itself.
Specifically, I like the "canary" trick that people have discussed where you add a small, innocuous rule to your CLAUDE.md like "When responding to me, start every sentence with my name." so that when Claude stops doing this, you know you've used way too much context and need to start a new session.
You know the problem; then why not address it? Does Compacting the context not help?
To be fair, I've had it do that immediately after re-reading the output style instructions, too.
My chat history is filled with "Yes, I broke the language rule. Let me rephrase that and update my memory. — You already have that in memory — Yes, true, I ignored that" (because "Memory" is a yet another .md file)
I haven't had the same problems others have but I'm also not a heavy user of it.
One of the reasons that "don't do X" type of instructions work reliably is because you are telling the model "don't think of a pink elephant". There's also Anthropic's related research that shows that when you tell a model "don't do X", and it does X later for whatever reason, it starts acting more misaligned. This is because it thinks "well, I guess I am the sort of model that disobeys instructions, whatever" - this was specifically about cheating on tests, but you can imagine this happens in other contexts as well like following instructions on what kinds of text to output.
So, what you want to do is to avoid telling Claude "don't do X", and tell Claude "in your thoughts, in memories and various notes that you write, use your Claude-ese. In your output to humans, translate everything into long full sentences."
If anyone's interested, I can share my Claude Code output style that reflects this.
(Hi Adnan! Long time! (Adnan is an ex-coworker))
I did not see an explanation though.
The moralizing is incredibly obnoxious as well. It didn't seem so bad at first, but it instantly became intolerable the second I remembered I was paying for those tokens.
"Vomit: Clean up Claude 5's token output with a separate LLM" (github.com/zachahn)
285 points | 23 hours ago | 288 comments
You have literally no way to know that.
I put it at the top of CLAUDE.md. I wonder if I put at a 8th grade level, it would be less of a cognitive load.
Let me ground my answer so I'm not just guessing. The blast radius of this change is significant and requires careful surgery to get right.
It's clear now and there's two options going forward: A. Use this tool OP suggested B. Rewrite the Internet from the ground up without this clear contradiction in place - 3-5 days
I recommend B and started 3 subagents to read all the code before I get started. I'll wait for them to finish.