Make Bot (basic llm chain) write longform story in segments WHILE REMEMBERING OR READING ALL PREVIOUS SEGMENTS

I need my n8n basic llm chain bots to write a 12000 word story from scratch. There is a bot previously that comes up with the idea, then it passes down to next bot which organizes the story kind of and then I have another bot that is looped to write the story in 12 segments (due to token limitations). So what I want is each segment to come out at 1000 words. So the bot writes segment/chapter 1, then writes it down in a “document”(a code node that I have), then it will write segment 2 and add it to the “document” and so on until it finishes the story. However, I need the story to have a consistent narrative and the only way I can think of doing that is by having the writer bot read whatever it has been written before. But I am told by Google Gemini that this poses a problem of eventually reaching the limit of input tokens.

Basically need a way of making sure the bot is able to read the previous segments of the story in order to keep it consistent, coherent, without errors, without saying for example that a character Bob died in the beginning of the story and then later down says he is still well and alive, or confusing names or repeating lines or “scenes” because it cannot read what was written before.

Can this be done?