← BLOG

Keeping AI video clips consistent: a shared ledger, a checker and a cache

How PromptMotion stopped AI video clips contradicting each other with a shared continuity ledger, a checker and caching, and cut LLM cost.

By Yasiru Withanage

4 min read

In part 1 I covered how PromptMotion's engine went from one overloaded prompt to a team of specialist agents that look up film craft from a knowledge base. That version wrote far better shots.

It also exposed a problem I hadn't thought about properly. Each shot was good on its own, but the shots didn't agree with each other. And every fix I added made each run cost a little more. This post is about solving both.

Timeline of six engine versions, each with the problem that led to the next Version 1One bigprompt Version 2Specialistagents Version 3Knowledgeretrieval Version 4Shared ledgerand checker Version 5Cachinglayer TodayTaste looptwo critics Shallow andinconsistent Agents lackedfilm craft Clips driftedapart Cost per runkept rising Reliable butforgettable
This post covers versions 4 and 5.

Throughout the diagrams below, the colours mean the same thing:

Agents doing creative work Shared knowledge and state Checks, critics and problems

V4A shared memory, and someone to check it

This version came straight out of user complaints. Video models generate each clip on its own, with no idea what happened in the one before. So a character's jacket changes colour, an injury disappears, and late-afternoon light turns into night between two shots.

I added a continuity ledger, a record of facts that every clip shares, with one strict rule: agents can add to it but can never change what's already there. Then I added a fifth agent, the Continuity Checker, which reads each new shot against the ledger and sends it back if anything contradicts it.

Version 4: clips append facts to an append-only continuity ledger, which the Continuity Checker reads Clip 1adds facts Clip 2adds facts Clip 3adds facts Continuity ledger add-only, nothing gets rewritten Clip 1Robot is rusted, left arm damaged Clip 1One red flower in a cracked pot Clip 2Late afternoon, dusty gold light Clip 3Robot kneels beside the flower new facts can only be added here reads Continuity Checker tests every new shot against the ledger
The ledger is the one thing every clip agrees on. Facts go in at the bottom and stay there.

The add-only rule turned out to be the important part. In an early version agents could edit the shared state, and a later agent would quietly "fix" a fact to make its own shot easier to write. The story broke and nothing flagged it. Once facts could only be added, the first decision stuck and every agent after it had to work with it.

Here's a real example from the case study run. In shot 1 the robot's left arm is damaged. In shot 4 the Scene Writer has it reach for the flower with that same arm. The checker catches it and sends the shot back.

Shot 4 storyboard: the first draft uses the damaged arm and is rejected; the rewrite uses the good arm and is approved Shot 4, first draft damaged arm Rejected "The robot reaches for the flower with its left arm." Checker:the ledger says the left arm was damaged in clip 1. sent back Shot 4, rewrite hangs limp good arm Approved "It reaches with its right arm. The left one hangs limp at its side." Ledger:right arm holds the flower (added).
The rewrite is a better shot than the first draft. The broken arm becomes part of the story instead of a continuity error.

What surprised me is that the rewrite is better than the original. The robot reaching with its good arm while the broken one hangs says more about the character than the first draft did. That kept happening. The ledger's constraints pushed the writer toward more specific, more emotional choices.

In LangGraph this is just a loop in the graph, with a cap on retries so one stubborn shot can't keep burning calls.

The LangGraph flow: five agents in sequence with a capped retry loop from the Continuity Checker back to the Scene Writer contradiction: retry (capped) Concept Analyst Story Architect Scene Writer ContinuityChecker Output Formatter if consistent
The whole Script Architect as a graph. The only loop is the one that protects continuity.

V5Caching, because the LLM bill is the business

Every new agent meant more LLM calls, and every retry added another. For PromptMotion that matters more than it would for most products. Around 90% of my running cost is LLM usage. I price plans in rupees for Sri Lankan creators and pay for models in dollars, so the cost of a single run decides whether the business makes sense at all.

About 90 percent of PromptMotion's running cost is LLM calls Where PromptMotion's running cost goes LLM calls, about 90% everything else
When the model bill is nearly the whole bill, every extra agent call shows up directly in the margin.

A lot of every run repeats. A style the creator has used before, knowledge base results for common emotions, the formatting rules for each model. The caching layer stores those and hands them back instead of paying for them again.

Caching: an agent step checks the cache; a hit reuses the stored result, a miss calls the LLM and stores the result Agent stepe.g. style block Seen theseinputs? yes, cache hit no, cache miss Reuse stored resultno LLM call Call the LLM Store the result Result
Caching works at the level of one agent's step, which is only possible because the work was already split up.

This was only easy because of version 2. You can't cache part of one giant prompt. You can cache a single agent's step when its inputs haven't changed.

What I took from this stage

When the output has to stay consistent, give agents shared state they can add to but never rewrite. If they're allowed to overwrite facts, sooner or later one of them will. And think about cost from the very first version. A clean agent graph is the only reason caching was easy for me.

You can watch the engine run live or read the full PromptMotion case study. If you're building something like this yourself, here's how I approach multi-agent AI development.

Multi-agent AI
LangGraph
LLM engineering
PromptMotion