Unable to prevent Composer from making random unrelated edits

I ask Composer to do something, which it successfully figures out how to do… and then it also applies random other edits.

Here’s my prompt:

When moving a function from a source file to a destination file:

  • Only make the minimal required changes.
  • Analyze which requires and imports the function is using in the source file.
  • Add the required additional requires and imports used by the function to the destination file, if any are missing.
  • Add the function to the destination file.
  • In the source file, delete the function being moved. Be careful NOT to delete any other functions or code. ONLY delete the one funciton.
  • In the source file, add a require for the function to import it from the destination file.
  • Do not make any other changes to either file.

Move send-offsets-to-txn from test_basic_consumer to consumer.

I’m trying really hard to convince the AI to just move the function.

I’ve tried claude-3.5-sonnet, gpt-4o, o1. They all successfully figure out how to move the function and to update the imports. They all also make random, unrelated code changes. When deleting the function from the source file, Claude likes to delete another function as well. So does gpt-4o. o1 manages to only move the function from the source file, but then in the destination file finds an unrelated comment which it doesn’t like and decides to truncate.

1 Like

Its really challenging to make COMPOSER understand Claude and Claude understand COMPOSER. Cleaning for Claude sometimes means wipe or just make the code well organized and without unnecessary things. When COMPOSER has the responsibility to guide Claude into the world of deleting real things, the complexity is somehow impossible to predict. Cursor still “fine tuning” Claude into this new adventure but what already is amazing will be even more, They will understand each other just by looking at the others eyes but until than some misunderstanding is going to happen sometimes. The same goes to any other great LLM. The more it knows… the more it will need to know each other.

In the Chat window, the AI describes the change correctly! It shows the functions added to the destination file, the requires and imports updated, and the moved functions removed from the source file. I look it over, and everything is fine.

I click “Apply”… and Cursor makes random unrelated changes in the editor window! “Oh, I see you’re deleting some functions. Let’s delete some more functions.”

No! Stop! Just. Do. What. You. Said. You. Would. Do.

1 Like