Live data from Hacker News

Ask HN: How to Handle Claude's Stubbornness?

news.ycombinator.com

11–20 of 20 posts

Re: Ask HN: How to Handle Claude's Stubbornness?

#11
post #2

Haven't really experienced it besides in long contexts. Usually keep it concise. Something like: We're building feature X. - You might need `a`, `b`, `c`. (any libraries, url documentation etc) - The requirements are: - x - y - z Any negatives (prevent going down a path) would go into requirement. This would be a prompt to sisyphus if small or prometheus if big. (Using opencode + oh-my-openagent). If I believe the ag…

> We're building feature X. - You might need `a`, `b`, `c`. (any libraries, url documentation etc) - The requirements are: - x - y - z So, you are saying we have to start every conversation for an existing project with this context? pointing to the particular feature detail we are targeting?

No this would be something targeted such as:

  We have a bug in our handler for the distributed transaction which updates the payment amount. It allows modifications when it should not.

  The requirements are:
    - We should reject regular changes outside of intent state
    - We should allow upsell when state is accepted and upsell modifications is activate in the config
    - You do NOT have to consider shipping during upsell, it is out of scope and is already required not to change as a result of upsell elsewhere.
We don't use any CLAUDE.md files or similar. Skills for things that it gets wrong and the rest it can handle by reading the repos themselves.

Underlying plugin prompts makes sure it completes the task and adds tests etc.

Re: Ask HN: How to Handle Claude's Stubbornness?

#12

Earlier quoted context omitted.

Looks an interesting approach. So, the tests being written are based on what? on user input or to test the changes it made according to claude's analogy? If it is the latter, it can be the same problem of forcing its analogy. In this case by validating it

> So, the tests being written are based on what? I don't think you understand what I'm saying. If, during a session, Claude makes any change to a source file, the stop hook script FORCES Claude to run the existing tests. There is literally no way Claude can get around running the tests because the prompt will not stop being processed until the stop hook script passes. There is no contradiction. Stop hooks (as well as…

Mate I still didn't understand that.

stop hook forces the claude to run the existing tests. Fine if claude added a new feature but didn't created a test for it. It will wait for it to perform that action. Fine. We can adjust the complexitiy of hook scripts. That's ok.

Tell me if I'm wrong, I am understanding it more like a compiler like if the syntax is ok, just pass. Similarly here, if the test were ran, it will look for a marker file in /tmp, it found it, and pass.

I did not understood the part of tests. Maybe my question is more clear now.

Re: Ask HN: How to Handle Claude's Stubbornness?

#13

Earlier quoted context omitted.

> So, the tests being written are based on what? I don't think you understand what I'm saying. If, during a session, Claude makes any change to a source file, the stop hook script FORCES Claude to run the existing tests. There is literally no way Claude can get around running the tests because the prompt will not stop being processed until the stop hook script passes. There is no contradiction. Stop hooks (as well as…

Mate I still didn't understand that. stop hook forces the claude to run the existing tests. Fine if claude added a new feature but didn't created a test for it. It will wait for it to perform that action. Fine. We can adjust the complexitiy of hook scripts. That's ok. Tell me if I'm wrong, I am understanding it more like a compiler like if the syntax is ok, just pass. Similarly here, if the test were ran, it will loo…

This is one of the simplest and most fundamental ways to manage Claude’s behavior. I genuinely can’t make it clearer. The issue you’re describing seems to center on situations where Claude becomes “stubborn” and doesn’t follow instructions.

When that happens, the solution is straightforward: create a hook script that explicitly enforces the behavior you want. By doing so, you remove ambiguity and leave Claude no option but to comply.

If you can share a specific case where Claude isn’t following your prompts, I can help you craft an appropriate hook to correct it.

Re: Ask HN: How to Handle Claude's Stubbornness?

#14

Earlier quoted context omitted.

> We're building feature X. - You might need `a`, `b`, `c`. (any libraries, url documentation etc) - The requirements are: - x - y - z So, you are saying we have to start every conversation for an existing project with this context? pointing to the particular feature detail we are targeting?

No this would be something targeted such as: We have a bug in our handler for the distributed transaction which updates the payment amount. It allows modifications when it should not. The requirements are: - We should reject regular changes outside of intent state - We should allow upsell when state is accepted and upsell modifications is activate in the config - You do NOT have to consider shipping during upsell, it…

Now it is convincing. But the same approach a week ago frustrated me. The problem was some guy in office wrote the logs, and it was somehow logging success even though it was going in the catch block due to an error. But the claude was convinced that the logs were right and even though i was telling it not to trust the logs and listing the exact thing to fix, it did the opposite and in the end i had to do it manually along with fixing the logger. Nevermind, your approach is reliable and will surely work when the logs are fine. Thanks

Re: Ask HN: How to Handle Claude's Stubbornness?

#15

Earlier quoted context omitted.

No this would be something targeted such as: We have a bug in our handler for the distributed transaction which updates the payment amount. It allows modifications when it should not. The requirements are: - We should reject regular changes outside of intent state - We should allow upsell when state is accepted and upsell modifications is activate in the config - You do NOT have to consider shipping during upsell, it…

Now it is convincing. But the same approach a week ago frustrated me. The problem was some guy in office wrote the logs, and it was somehow logging success even though it was going in the catch block due to an error. But the claude was convinced that the logs were right and even though i was telling it not to trust the logs and listing the exact thing to fix, it did the opposite and in the end i had to do it manually…

[deleted]

Re: Ask HN: How to Handle Claude's Stubbornness?

#16
post #15

Earlier quoted context omitted.

Now it is convincing. But the same approach a week ago frustrated me. The problem was some guy in office wrote the logs, and it was somehow logging success even though it was going in the catch block due to an error. But the claude was convinced that the logs were right and even though i was telling it not to trust the logs and listing the exact thing to fix, it did the opposite and in the end i had to do it manually…

[deleted]

[dead]

Re: Ask HN: How to Handle Claude's Stubbornness?

#19

Earlier quoted context omitted.

Mate I still didn't understand that. stop hook forces the claude to run the existing tests. Fine if claude added a new feature but didn't created a test for it. It will wait for it to perform that action. Fine. We can adjust the complexitiy of hook scripts. That's ok. Tell me if I'm wrong, I am understanding it more like a compiler like if the syntax is ok, just pass. Similarly here, if the test were ran, it will loo…

This is one of the simplest and most fundamental ways to manage Claude’s behavior. I genuinely can’t make it clearer. The issue you’re describing seems to center on situations where Claude becomes “stubborn” and doesn’t follow instructions. When that happens, the solution is straightforward: create a hook script that explicitly enforces the behavior you want. By doing so, you remove ambiguity and leave Claude no opti…

Thanks for the pointer. For now I’ve fixed the issue. Your reply made me go through the hook script solution more carefully, and I’m exploring it now.
Post reply on HN