CodeReel: Accelerating Code-to-Video Agents with Exact Frame Reuse and Blocking-Aware Scheduling
Organizations: National University of Singapore Singapore, Singapore
Abstract
Coding agents make videos by writing and refining programs in a build--inspect--edit loop. A finished film costs a median of $2.85 in model calls and 11 minutes, over a third of that time in builds that block the agent. We find that much of this time is avoidable, for two reasons. First, 37.5% of the frames of a session's later films were drawn before, many shifted in time or inside an edited scene. Second, half of the builds stop at a check, where the agent needs only the verdict, but which builds stop is unknown until the checks finish. We present CodeReel, a training-free execution layer behind agents' existing commands. Exact frame reuse keys each frame by its drawing commands, regardless of its position in time, and reuses each frame whose key recurs. Blocking-aware scheduling runs the checks first and starts the render alongside them, at idle priority, unless the session's recent builds make a pass unlikely. Scheduling spends CPU to answer sooner and reuse returns it; exact keys let later versions use frames rendered for a failed one as the agent thinks. We introduce EditLoop, a benchmark of replayable agent sessions whose films are checked against renders from scratch. On it, CodeReel cuts the agent's wait by 36.3% against Rebuild, a warm pipeline with parallel rendering, and by 57.9% against Sequential, today's step-by-step pipeline. On time-shifting edits its reuse renders 43.9%, close to the 43.0% whose pixels are new, while Manim-style caching renders 99.8%. With real agents, the median wait per build is 0.62x Rebuild's in Claude Code, on topics never used in development, and 0.67x in Codex CLI. The gain holds for five models and two frameworks.
Figures & tables
| System | Wait | CPU | Memory | Frames | Exact |
|---|---|---|---|---|---|
| EditLoop’s real track (Canvas 2D, 32 cores; 70 topics) | |||||
| Sequential ( Chen et al., 2026b ; Ku et al., 2025 ) | 23.2 s | 143 s | 4.3 GB | 1,399 | 363/363 |
| Rebuild | 0.66 | 1.17 | 1.83 | 1.00 | 363/363 |
| CodeReel | 0.42 | 0.95 | 1.70 | 0.65 | 363/363 |
| EditLoop’s Remotion track (React, 8 cores; synthetic edits) | |||||
| Remotion renderer ( Remotion, 2026b ) | 11.9 s | 91 s | 2.2 GB | 1,003 | – |
| Setting | Wait | Failed | Film | Frames | CPU |
|---|---|---|---|---|---|
| CodeReel by machine | |||||
| 32 cores | 0.64 | 0.39 | 0.71 | 0.65 | 0.81 |
| 32 cores, think time | 0.59 | 0.41 | 0.65 | 0.49 | 0.92 |
| 8 cores | 0.67 | 0.43 | 0.71 | 0.66 | 0.76 |
| 8 cores, think time | 0.60 | 0.43 | 0.63 | 0.53 | 0.86 |
| 4 cores | 0.75 | 0.46 | 0.79 | 0.63 | 0.72 |
| Adjacent | Time-shifting | ||
|---|---|---|---|
| Method | Exact | versions | edits |
| Scene windows | 90.3% | 100.0% | |
| Read sets | 83.8% | 53.2% | |
| Kamishibai-style, typical ( kamishibai, 2026 ) | 63.5% | 54.0% | |
| Kamishibai-style, careful | 89.0% | 99.8% | |
| Manim-style ( The Manim Community Developers, 2026 ) | 88.0% | 99.8% |
| Agent | Pairs | Wait | Film | Total | Builds | Time | Faults |
|---|---|---|---|---|---|---|---|
| Claude Code, untouched | 14 | 0.62 | 0.76 | 0.69 | 0.93 | 0.83 | 0.29 |
| Claude Code, all | 26 | 0.59 | 0.73 | 0.70 | 1.01 | 0.84 | 0.42 |
| Codex CLI | 12 | 0.67 | 0.58 | 0.68 | 0.98 | 0.83 | 0.58 |
Appendix figures & tables12 assets
Supplementary material from the paper’s appendix.
Appendix
| Check | Reports |
|---|---|
| A frame’s texts and image draws | |
| Overlap | text over a subject, another text or a subtitle, outside the safe area, or cut by the frame edge |
| Reading | text on screen for less time than reading it takes |
| Timing | text shown more than 0.5 s before the narration says it |
| Subtitles | a subtitle over a picture without a box |
| Cuts | a picture still moving at a cut, or filling the frame for under 1 s |
| Real | Models | Synthetic | |
| Sessions | 123 | 20 | 6 |
| Versions | 1,525 | 215 | 150 |
| Tool calls | 2,078 | 289 | 150 |
| Builds | 1,314 | 188 | 150 |
| Calls per session | 16.9 | 14.4 | 25.0 |
| Chinese / English | 69 / 54 | 16 / 4 | 0 / 6 |
| Condition | How it is enforced |
|---|---|
| is never kept; keys are taken after the loads a draw asked for; a kept key carries its read set forward, and every kept key passed both levels (induction over key passes) | |
| Configuration, frame grid | one index per runtime, browser, fonts, page, size, scale and the renderer’s frame rate; a size or background set by a script is read by every frame |
| Same parts, names, order | holds, in and ( frame), the windows of every part a reached script registers; an overlay reached, two parts of one name, or a script added or removed: level 3 |
| Code | reach follows the names a script declares or binds (declarations at any depth, implicit globals, members of the global object under any of its names, string property names); a computed global access reaches every name; a write into shared state or the page: level 3 |
| Values read at load | recorded per script, cues included; a script whose values changed starts the reach |
| Values read while drawing | the timeline, the style, cues, asset entries, sound durations, the film’s length, the registration, size and background are probed per frame, raw reads and property queries included; an opaque value or a write while drawing: no key |
| Cores | |||
|---|---|---|---|
| 4 | 0.02 | 0.14 | 0.14 |
| 8 | 0.10 | 0.36 | 0.25 |
| 16 | 0.21 | 0.61 | 0.28 |
| 32 | 0.22 | 0.85 | 0.21 |
| 64 | 0.13 | 0.88 | 0.13 |
| Frames rendered | Builds | Sessions | Wait |
|---|---|---|---|
| None | 162 | 6 | 0.35 |
| Under 5% | 162 | 6 | 0.46 |
| 5–20% | 78 | 6 | 0.56 |
| 20% or more | 48 | 6 | 0.92 |
| Setting | Topics | Builds | Wait | Failed | Film | Frames |
|---|---|---|---|---|---|---|
| 32 cores | 70 | 702 | 0.64 [0.61, 0.66] | 0.39 [0.36, 0.42] | 0.71 [0.68, 0.74] | 0.65 |
| 32 cores, think time | 70 | 702 | 0.59 [0.58, 0.61] | 0.41 [0.38, 0.44] | 0.65 [0.63, 0.67] | 0.49 |
| 8 cores | 70 | 702 | 0.67 [0.64, 0.69] | 0.43 [0.40, 0.45] | 0.71 [0.68, 0.74] | 0.66 |
| 8 cores, think time | 70 | 702 | 0.60 [0.58, 0.63] | 0.43 [0.40, 0.46] | 0.63 [0.61, 0.66] | 0.53 |
| 4 cores | 20 | 197 | 0.75 [0.70, 0.80] | 0.46 [0.42, 0.50] | 0.79 [0.72, 0.85] | 0.63 |
| 32 cores, Sonnet 5.5 | 10 | 81 | 0.62 [0.55, 0.73] | 0.47 [0.40, 0.57] | 0.66 [0.59, 0.79] | 0.62 |
| Builds | 32 cores | 8 cores | |
|---|---|---|---|
| First of a session (cache empty) | 70 | 0.56 | 0.60 |
| After an edit of | |||
| one scene’s script | 47 | 0.62 | 0.64 |
| narration lines | 171 | 0.66 | 0.66 |
| files added or removed | 277 | 0.62 | 0.66 |
| a shared script | 74 | 0.66 | 0.72 |
| Rebuild with one mechanism | ||||||
| Stage | Rebuild (per build) | Sequential | reuse | verdict first | fast checks | CodeReel |
| Wait | 15.4 s | 1.51 | 0.94 | 0.69 | 0.82 | 0.64 |
| Frames | 1,399 | 1.00 | 0.66 | 1.00 | 1.00 | 0.65 |
| Checks | 10.8 s | 0.78 | 0.89 | 0.59 | 0.38 | 0.26 |
| Keys (of capture) | – | 0 | 0.05 | 0 | 0 | 0.06 |
| Capture | 7.1 s | 1.25 | 0.87 | 1.07 | 1.06 | 0.91 |
| Adjacent versions | Time-shifting edits | |||
| Method | Rendered | Stale | Rendered | Stale |
| Re-render all, input hash | 100.0% | 0 | 100.0% | 0 |
| Scene windows | 90.3% | 22,563 | 100.0% | 0 |
| Read sets | 83.8% | 9,704 | 53.2% | 7,228 |
| Kamishibai-style, typical ( kamishibai, 2026 ) | 63.5% | 131,408 | 54.0% | 6,121 |
| Kamishibai-style, careful | 89.0% | 15,305 | 99.8% | 0 |
| Same time | Nearest | |||
|---|---|---|---|---|
| Threshold | Rendered | Stale | Rendered | Stale |
| Pixels changed | 57.2% | 0 | 47.7% | 0 |
| 0.1 | 51.1% | 4,146 (14) | 39.4% | 15,216 (18) |
| 0.05 | 52.6% | 3,441 (12) | 41.2% | 14,175 (18) |
| 0.01 | 62.9% | 108 (7) | 57.4% | 6,648 (18) |
| 0.001 | 66.7% | 14 (4) | 69.6% | 1,804 (17) |
Coding Agents
Coding agents use language models, tools, and feedback to modify software and complete engineering tasks.
See all 164 papers