Help Center/ CodeArts Agent/ FAQs/ Agent/ What Should I Do If the AI Keeps Using Previous Context After a New Chat Is Started?
Updated on 2026-07-29 GMT+08:00

What Should I Do If the AI Keeps Using Previous Context After a New Chat Is Started?

Symptom

If you click Stop during agent execution and immediately send a new instruction, the agent may fail to recognize the termination. As a result, it continues to execute the unfinished task based on the previous logic, causing repeated task execution and logic disorder.

Cause Analysis

  • Context retention mechanism: The design logic of the agent is to retain the complete chat history to understand the context. Clicking Stop only interrupts the current content generation and does not delete the historical instruction from the chat history.
  • Model inference logic: When a new question is sent, the system sends the complete history that includes the terminated task to the model. The model relies on global context analysis. If it does not receive a clear "cancel" or "ignore" instruction, it may assume by default that the task still needs to be completed. In this case, the model will preferentially complete the old task before responding to the new task.
  • Intent understanding deviation: In the absence of clear information indicating task termination, the model tends to interpret a new question as a supplement to an unfinished old task rather than a replacement of the task.

Solution

  • Clear instructions (recommended): When asking a question, directly include an instruction that negates or ignores previous context, for example, "Ignore the previous quicksort generation instruction and directly generate a Snake game."
  • Starting a new chat: To completely clear the context and avoid interference from chat history, click New Chat on the page or run the /clear command to start a new chat.