This could / should should be a seperate function since you are using it so often. Approach could be that when you are above a certain token size, you get the possibility to roll back with a special button. This function then:
- Creates a summary of the application thus far.
- Rolls back the chat, without touching the code.
- Enters the summary so the agent knows what is the state.
It could even push to GitHub in the same flow, maybe with a checkbox.
This makes live easier for avid users but very much so for people starting with the platform. It also avoids making the mistake of rolling back the code instead of only the chat .