I suspect the solution to keeping a long story coherent is using the model at different levels of abstraction. A human writer doesn’t sit down and write a complete novel in one sitting. They go through a process of planning, character development, world building and so on. When they write a scene, they’re not holding every detail about the rest of the book in their mind, they’re narrowing down to the details that matter for that scene.
So instead of asking the AI to write a novel in one go, why not guide it through a similar process? At each step, pass in information from previous steps as context, focusing on just the details it needs at that step. Have it generate a summary, then a setting, then characters in that setting, then break the plot into chapters, and then scenes, and so on…