With long-running sessions, it helps to tell it to repeat or at least summarize the original prompt every now and then. You can even automate it - in the original prompt, tell it to tack it onto every response.
Same thing goes for any multi-step task that requires memory - make it dump the complete "mental state" after every step.
Oh, I am aware of that but emulating a terminal still proved to be difficult with the current buffer limit. After two or three commands with lots of output, you basically had to start a new session and repeat the prompt (and how far it got in the previous session) all over again.
Same thing goes for any multi-step task that requires memory - make it dump the complete "mental state" after every step.