Live data from Hacker News

Ask HN: How to Handle Claude's Stubbornness?

news.ycombinator.com

1–10 of 20 posts

Ask HN: How to Handle Claude's Stubbornness?

#1
I’ve been running into this issue with Claude (in browser and claude code) where it is being stubborn many times.

It will refrain from obeying what I say or suggest. Instead, it comes up with its own analogy and starts suggesting and implementing that logic. Even when I already know its going in wrong path and I have proposed the direction for the same problem.

Many times I’ve had to explicitly tell it: don’t think, don’t force your analogy, just implement what I am putting in front of you. Still this does not stick with it always.

Has anyone else dealt with this? How are you handling it?

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

#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 agent won't understand what it is supposed to do or if there are multiple solutions of which only some are allowed I add "DO NOT make or edit any business rules before asking me".

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

#3
I use a series of stop hook [0] scripts. For example, I have a script [1] that forces Claude to execute tests whenever code files are changed. The stop hook runs automatically and will force Claude to continue working until the script passes.

I also have a script that forces Claude to generate a summary of work [2] if it hadn't done so on it's own.

[0]: https://code.claude.com/docs/en/hooks

[1]: https://gist.github.com/Looking4OffSwitch/c3d5848935fec5ac3b...

[2]: https://gist.github.com/Looking4OffSwitch/3b13b65e40284be899...

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

#4
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…

[deleted]

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

#5
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…

[deleted]

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

#8

I use a series of stop hook [0] scripts. For example, I have a script [1] that forces Claude to execute tests whenever code files are changed. The stop hook runs automatically and will force Claude to continue working until the script passes. I also have a script that forces Claude to generate a summary of work [2] if it hadn't done so on it's own. [0]: https://code.claude.com/docs/en/hooks [1]: https://gist.github.c…

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

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

#9

I use a series of stop hook [0] scripts. For example, I have a script [1] that forces Claude to execute tests whenever code files are changed. The stop hook runs automatically and will force Claude to continue working until the script passes. I also have a script that forces Claude to generate a summary of work [2] if it hadn't done so on it's own. [0]: https://code.claude.com/docs/en/hooks [1]: https://gist.github.c…

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 all the other hook types) are the only way to force Claude to work deterministically.

Hook scripts can be as simple or as complex as you like: you define the success criteria. For example, if Claude just added a new feature but didn't create a test for it, then a stop hook would prevent Claude from stopping until the test was written.

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

#10
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?

Post reply on HN