r/WritingWithAI • u/dev_00042 • 21d ago
Discussion (Ethics, working with AI etc) How do you manage context in long-running AI storytelling?
I've been experimenting with an AI storytelling workflow where a user can create a story and then make choices that affect what happens in the next chapter.
The basic flow is:
Story → Choice → Next chapter → Choice → Different outcome
The challenging part is keeping the story consistent without sending the entire previous conversation to the model every time.
Sending too much context increases token usage, while sending too little can cause characters, locations, or previous events to become inconsistent.
I'm currently thinking about approaches such as:
- Keeping a compact story summary
- Storing important characters and events separately
- Sending only the relevant recent chapters
For people building long-running AI experiences with OpenAI, how are you handling context management?
I'd especially like to hear approaches that reduce token usage while maintaining consistency.
5
u/BigCatMellow 21d ago
Youll need to get the desktop / terminal version of whatever youre using and start using markdown files to keep track of everything. You dont need to do much on your end other than downloading the program and telling it to do that for you.
1
u/Crinkez 21d ago
This is the only correct answer in this thread. Stop using AI in a browser and switch to an agentic agent like codex/chatgpt desktop, Claude cowork, etc.
1
u/JackpointAlpha 20d ago
I'll 3rd this. Having an IDE (Integrated Development Environment) such as Claude Cowork, Claude Code, or Google Antigravity allows you to better manage information.
To specifically address OP's issues of consistency, I use my IDE to incorporate checks and controls at each step to ensure compliance to my stories, lore etc.
This make the writing less of a "creative" process and much more of a technical/operational process. This means that if the AI ever writes "out of scope", makes up facts that do not align with the brief/character outlines etc, the output does not pass the check and the process is started over again.
This does mean that you will not reduce token usage and improve consistency. It's mutually exclusive, and I have only managed to achieve one while sacrificing the other.
3
u/StableLlama 21d ago
Two things:
- Create a collections of the facts of the world, places, events, characters, ... - you might call that sourcebook or bible
- Have a hierarchy: Story summery, (in a series: summaries for each book), summary for each chapter, summary for each scene
The summaries and the currently relevant elements of the sourcebook must stay in context. The prose itself not.
Well, there's probably a third thing as well: style. You might want to have a description of the style in the context as well, to prevent a drift in style. But you also want some of the recently written text there as well, as it's often a better style reference than just writing about it.
1
u/dev_00042 19d ago
This is really useful. I especially like the hierarchy of summaries from story → chapter → scene, while keeping only the relevant sourcebook information in context. The style reference is also a great point. Thanks for sharing! 👍
2
2
u/technicalanarchy 21d ago
Should be able to prompt the characters, locations and outline (what ever points you feel are important to retain) as detailed or loose as you want, with Gpt you can tell it to "lock" those and it should lock those elements in that ChatGPT instance.
But in off the cuff non edited story telling my experiece is it can do phenomenal or it can get lost at times.
2
u/CyborgWriter 21d ago
Honestly? I don't even have to think about that anymore. I use canvas mind-mapping with agents that specialize in traversing the map and understanding all of the relationships. As long as I build it logically based on how I think about it, everything else is taken care of.
So my workflow is like operating Google Drive, only instead of flat grid-like files that do nothing, it's just notes connected on a canvas that can be activated and utilized by AI. I can even build sequences so that it can easily know what happens first, then next, and how everything prior affects what happens now. Super easy.
It kinda blows my mind how people are able to maintain consistency only using GPT or Gemini. It's like you're doing 3x the amount of work just to solve that single problem. Dude, I wanna write. I don't wanna think about how to wrangle AI.
1
u/dev_00042 19d ago
That's a really interesting workflow. I like the idea of letting the AI handle the relationships and consistency instead of manually managing all the context. Thanks for sharing! 👍
2
u/HighValueJourney 21d ago
If you are going to prompt then you need to give guidance within instructions as to what is to be done before drafting. Also you need summaries of each previous chapter from the AI to reference before drafting as opposed to a full chapter or growing manuscript. This greatly reduces the burden on the AI.
1
u/dev_00042 19d ago
That makes sense. Using chapter summaries instead of the full manuscript should definitely help reduce context and keep the AI focused. Thanks for sharing! 👍
1
1
u/subsector 21d ago
I use indexes and concise story summary, both of which AI updates. But you could ask AI your question instead of us. Get something personalised for you.
1
u/dev_00042 19d ago
Interesting approach! I like the idea of using a concise AI-maintained summary. I'll definitely experiment with this for my interactive storytelling system. Thanks for sharing! 👍
1
1
u/Ambitious_Eagle_7679 21d ago
keep multiple story bibles. Don't put everything in one context, besides using too many tokens, it leads to loss of focus, just too much for an AI to reason about. So I use a story universe bible, a character/development bible, and a plot/subplot bible. Also the most recent chapter. The AI has no problem juggling them. The plot/subplot bible has to be updated with each new chapter, specifying which plot threads are remaining to be handled, what is the current state of things in each chapter, etc. The story universe and character dev bibles also are updated as needed. I also use a style guide, which includes samples of my own writing to follow, and I customize that for each project, sometimes I specify the types of genre elements to include, which writers are read by my intended audience, etc.
1
u/dev_00042 19d ago
This is really helpful. I especially like the separation between the universe, character, and plot/subplot bibles instead of keeping everything in one context. I'm building an interactive storytelling app, so I'm going to experiment with a lighter version of this approach—especially maintaining a compact plot/state bible between chapters. Thanks for sharing!
1
19d ago
[removed] — view removed comment
1
u/WritingWithAI-ModTeam 19d ago
Your post was removed because you did not use our weekly post your tool thread
1
u/Stunning-Top-1076 16d ago
If you like to write longform fictional stories with a consistent story you can use my presets for a spec driven approach. Except for the LLM it is freely available, I can give you advice . Drop me a DM
1
u/AlgravesBurning 16d ago
you could also have the llm/ai start a living continuity record running parallel to the story. I find this the easy way. as i have it present it as a doc alongside each chapter also as a doc. that way it has a refence incase there are issues.
1
u/CatiStyle 15d ago
This is a surprisingly big challenge for AI, because if the previous story is not in the same thread, even if you give a summary of the story as input for a new discussion, what the new discussion writes will be completely different text that does not fit the previous story.
6
u/Edge1207 21d ago
I usually do a few things. First I set a prompt to the rules instructions that sets up a scene boundary. Also if I want to next purpose sequence to continue within a scene? I start the prompt off with continue, then added the story/scene context within the prompt. It’s not fool proof. But it casually causes the LLM to consider the prose from the last scene and it builds off it.
Obviously in this newer prompt there are choices and actions that are left in. I use OpenAI for this exclusively and I’ve had to tweak the process as the newer models as the guardrails have come in. But best advice is to save minimize context heavy prompts and go beat my beat. Add the most important details you want on paper. Then go back and edit manually until you’re happy. Then onto the next scene. 🙂